import{B as v}from"./BasicForm-dL_oCSPM.js";import{cO as w,cq as q,fm as D,d as S,r as B,V as P,f as T,aw as U,h as k,o as A,j as i,w as u,M as E,S as F,p as N,A as O,l as d,U as V,c_ as j}from"./index-9PRMimni.js";import{u as R}from"./useForm-CKmgcynv.js";function G(p){return{schemas:[{field:"correct_url",label:"",component:"ImageCodeUpload",componentProps:({model:c})=>({disabled:p?.readOnly,action:`${q().urlPrefix}/files`,maxNumber:3,headers:{timestamp:new Date().getTime(),authorization:`${w.get(D)}`},onUploadChange:o=>{c.correct=o}})},{field:"correct"}]}}const I={class:"pl-0"},K=S({__name:"index",props:{btnsDisabled:{type:Object,default:()=>({export:!1,formApproval:!1,formReject:!1,formSave:!1,formSubmit:!0,submit:!1})}},emits:["saveCallBack","getComData"],setup(p,{expose:m}){const c=B([]),{t:o}=P(),f=T(),h=j(),g=p,[x,{setFieldsValue:b,getFieldsValue:y}]=R({schemas:c,labelWidth:"auto",layout:"horizontal",collapsed:!0,gridProps:{cols:1,xGap:15},showActionButtonGroup:!1});async function _(s){if(s&&s.length>0){let t=[],e=[];e=s,s.forEach(n=>{t.push({url:n?.photoCode,code:n?.photoUrl})}),b({correct_url:t.length>0?t:[],correct:e.length>0?e:[]})}const r=G({readOnly:!!(f.query.type==="view"||g.btnsDisabled.formApproval)});c.value=r.schemas}async function C(s){let r=y(),t=[];r.correct&&r.correct.length>0&&r.correct.forEach(a=>{let l={};l.photoUrl=a.code||a.photoUrl,l.photoType="correct",l.deficiencyId=f.query.id,t.push(l)});let e=!0;const n=[...t];if(s){if(n.length>0)e=!0;else if(e=await new Promise(a=>{h.warning({title:o("hsqe.nc.tip"),content:o("hsqe.nc.noPhotoContent"),positiveText:o("hsqe.nc.yes"),negativeText:o("hsqe.nc.no"),draggable:!0,onPositiveClick:async()=>{a(!0)},onNegativeClick:async()=>{a(!1)}})}),!e)return!1}return{params:n,res:e}}return U(()=>{_()}),m({getData:C,initData:_}),(s,r)=>{const t=F,e=v,n=E,a=V;return A(),k("div",I,[i(a,{cols:"1 s:1 m:1 l:2 xl:2 2xl:2",responsive:"screen","x-gap":12},{default:u(()=>[i(n,{span:"1",class:"mb-4"},{default:u(()=>[i(t,{class:"text-[#1f2225] text-[16px] font-medium"},{default:u(()=>[N(O(d(o)("hsqe.deficiency.correctivePhotos")),1)]),_:1}),i(e,{onRegister:d(x),"label-placement":"top"},null,8,["onRegister"])]),_:1})]),_:1})])}}});export{K as _};
