import{B as v}from"./BasicForm-dL_oCSPM.js";import{L as w,an as O}from"./template-rpthWlT9.js";import{cO as _,cq as g,fm as y,d as F,r as b,V,f as j,u as N,aw as S,h as T,o as k,j as l,w as C,M as R,ao as $,l as x,U as z}from"./index-9PRMimni.js";import{u as G}from"./useForm-CKmgcynv.js";import"./Render.vue_vue_type_script_lang-DKUYY0Zw.js";import"./SingleImageUpload-CNx4b9eC.js";import"./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";import"./componentSetting-DVhNDBTO.js";import"./ImageUpload-DUsnro3W.js";import"./vuedraggable.umd-Co2xEC3p.js";import"./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";import"./tabsView-BXskTdVh.js";import"./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";import"./propTypes-CebMRUpe.js";import"./BasicSelect-C_uwzMkE.js";import"./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";import"./dictionary-BRse4lkf.js";import"./index-DkvzUEqh.js";import"./index-kKnqLkWM.js";import"./AutoComplete-Dv1Bqed4.js";import"./TreeSelect-BZh2DeCh.js";import"./usePageCache-DluHn7Yy.js";function M(i){return{schemas:[{field:"deficiency",label:"",component:"ImageUpload",componentProps:p=>({disabled:i?.readOnly,action:`${g().urlPrefix}/files`,maxNumber:3,headers:{timestamp:new Date().getTime(),authorization:`${_.get(y)}`},onUploadChange:r=>{console.log("file",r)}})}],schemas2:[{field:"correct",label:"",component:"ImageUpload",componentProps:p=>({disabled:i?.readOnly,action:`${g().urlPrefix}/files`,maxNumber:3,headers:{timestamp:new Date().getTime(),authorization:`${_.get(y)}`},onUploadChange:r=>{console.log("file",r)}})}]}}const ue=F({__name:"index",props:{btnsDisabled:{type:Object,default:()=>({hasCaptainReject:"0",hasOfficerCommit:"0",hasCaptainPass:"0",hasDeficiencyCommit:"0",hasBasicInfoEdit:"0"})}},emits:["saveCallBack"],setup(i,{expose:m,emit:u}){const p=b([]),r=b([]),{t:d}=V(),a=j(),q=N(),D=u,f=i,[I,{setFieldsValue:P,getFieldsValue:h}]=G({schemas:r,labelWidth:"auto",layout:"horizontal",collapsed:!0,gridProps:{cols:1,xGap:15},showActionButtonGroup:!1});async function B(){if(console.log(a.query.id),a.query.id){const o=await w(Number(a.query.id));let c=[];o?.deficiency&&o?.deficiency.forEach(n=>{c.push(n?.photoUrl)});let e=[];o?.correct&&o?.correct.forEach(n=>{e.push(n?.photoUrl)}),P({correct:e||[]})}let t=!1;t=!a.query.isEdit||f.btnsDisabled.hasCaptainPass==1&&f.btnsDisabled.hasOfficerCommit==0;const s=M({readOnly:t});p.value=s.schemas,r.value=s.schemas2}async function E(){let t=h(),s=[];t.correct.forEach(c=>{let e={};e.photoUrl=c,e.photoType="correct",e.reportId=a.query.reportId,e.deficiencyId=a.query.id,s.push(e)});const o=[...s];console.log(o),await O(o),q.success(d("hsqe.deficiency.operationSuccessful")),D("saveCallBack")}function U(){let t=h(),s=[];t.correct&&t.correct.length>0&&t.correct.forEach(c=>{let e={};e.photoUrl=c,e.photoType="correct",e.reportId=a.query.reportId,e.deficiencyId=a.query.id,s.push(e)});const o=[...s];return console.log(o),o}return S(()=>{B()}),m({submit:E,getData:U}),(t,s)=>{const o=$,c=v,e=R,n=z;return k(),T("div",null,[l(n,{cols:"1 s:1 m:1 l:2 xl:2 2xl:2",responsive:"screen","x-gap":12},{default:C(()=>[l(e,{span:"1",class:"mb-4"},{default:C(()=>[l(o,{title:x(d)("hsqe.deficiency.correctivePhotos")},null,8,["title"]),l(c,{onRegister:x(I),"label-placement":"top"},null,8,["onRegister"])]),_:1})]),_:1})])}}});export{ue as default};
