import{B as P}from"./BasicForm-dL_oCSPM.js";import{L as q}from"./template-rpthWlT9.js";import{cO as p,cq as m,fm as h,d as w,r as b,V as U,f as E,c as F,o as I,W as O,w as V,i as N,j as v,A as S,l as g}from"./index-9PRMimni.js";import{u as j}from"./useForm-CKmgcynv.js";function k(d){return{schemas:[{field:"deficiency",label:"",component:"ImageUpload",componentProps:r=>({disabled:d?.readOnly,action:`${m().urlPrefix}/files`,maxNumber:3,headers:{timestamp:new Date().getTime(),authorization:`${p.get(h)}`},onUploadChange:c=>{console.log("file",c)}})}],schemas2:[{field:"correct_url",label:"",component:"ImageCodeUpload",componentProps:({model:r})=>({disabled:d?.readOnly,action:`${m().urlPrefix}/files`,maxNumber:3,headers:{timestamp:new Date().getTime(),authorization:`${p.get(h)}`},onUploadChange:c=>{r.correct=c}})},{field:"correct",hidden:!0}]}}const R={class:"font-medium text-lg text-[#42495c] text-left relative pl-3 before:content-[''] before:absolute before:top-1/2 before:left-0 before:-translate-y-1/2 before:block before:w-[3px] before:h-3 before:bg-[#0ec06a]"},G=w({__name:"index",props:{btnsDisabled:{type:Object,default:()=>({hasCaptainReject:"0",hasOfficerCommit:"0",hasCaptainPass:"0",hasDeficiencyCommit:"0",hasBasicInfoEdit:"0"})}},emits:["saveCallBack"],setup(d,{expose:f}){const u=b([]),r=b([]),{t:c}=U(),a=E(),_=d,[y,{setFieldsValue:C,getFieldsValue:x}]=j({schemas:r,layout:"horizontal",gridProps:{cols:1},showActionButtonGroup:!1});async function D(){if(a.query.id){const e=await q(Number(a.query.id));let s=[];e?.deficiency&&e?.deficiency.forEach(l=>{s.push(l?.photoUrl)});let i=[],t=[];e?.correct&&e?.correct.forEach(l=>{l.photoUrl&&i.push({url:l?.photoUrl,code:l?.photoCode})}),C({correct_url:i.length>0?i:[],correct:t.length>0?t:[]})}let n=!1;n=!a.query.isEdit||_.btnsDisabled.hasCaptainPass==1||a.query.status==="new";const o=k({readOnly:n});u.value=o.schemas,r.value=o.schemas2}function B(n){let o=x(),e=[];o.correct&&o.correct.length>0&&o.correct.forEach(i=>{let t={};t.photoUrl=i.code,t.photoType="correct",t.reportId=a.query.reportId||n,t.deficiencyId=a.query.id,e.push(t)});const s=[...e];return console.log(s),s}return f({getData:B,initData:D}),(n,o)=>{const e=P,s=O;return I(),F(s,{bordered:!1,class:"proCard mt-3","content-class":"pt-0"},{default:V(()=>[N("h2",R,S(g(c)("hsqe.deficiency.correctivePhotos")),1),v(e,{onRegister:g(y),"label-placement":"top"},null,8,["onRegister"])]),_:1})}}});export{G as _};
