import{B as V}from"./BasicForm-dL_oCSPM.js";import{L as R,an as j}from"./template-rpthWlT9.js";import{cO as y,cq as b,fm as C,d as G,r as x,V as N,f as S,u as T,aw as k,h as z,o as $,j as c,w as f,M as A,ao as M,l as u,U as W}from"./index-9PRMimni.js";import{u as q}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 K(p){return{schemas:[{field:"deficiency",label:"",component:"ImageUpload",componentProps:m=>({disabled:p?.readOnly,action:`${b().urlPrefix}/files`,maxNumber:3,headers:{timestamp:new Date().getTime(),authorization:`${y.get(C)}`},onUploadChange:n=>{console.log("file",n)}})}],schemas2:[{field:"correct",label:"",component:"ImageUpload",componentProps:m=>({disabled:p?.readOnly,action:`${b().urlPrefix}/files`,maxNumber:3,headers:{timestamp:new Date().getTime(),authorization:`${y.get(C)}`},onUploadChange:n=>{console.log("file",n)}})}]}}const he=G({__name:"index",props:{btnsDisabled:{type:Object,default:()=>({hasCaptainReject:"0",hasOfficerCommit:"0",hasCaptainPass:"0",hasDeficiencyCommit:"0",hasBasicInfoEdit:"0"})}},emits:["saveCallBack"],setup(p,{expose:h,emit:_}){const m=x([]),n=x([]),g=p,{t:d}=N(),s=S(),P=T(),B=_,[D,{setFieldsValue:I,getFieldsValue:w}]=q({schemas:m,labelWidth:"auto",layout:"horizontal",collapsed:!0,gridProps:{cols:1,xGap:15},showActionButtonGroup:!1}),[E,{setFieldsValue:F,getFieldsValue:U}]=q({schemas:n,labelWidth:"auto",layout:"horizontal",collapsed:!0,gridProps:{cols:1,xGap:15},showActionButtonGroup:!1});async function v(){if(console.log(s.query.id),s.query.id){const t=await R(Number(s.query.id));let a=[];t?.deficiency&&t?.deficiency.forEach(o=>{a.push(o?.photoUrl)});let i=[];t?.correct&&t?.correct.forEach(o=>{i.push(o?.photoUrl)}),I({deficiency:a||[]}),F({correct:i||[]})}let l=!1;l=!s.query.isEdit||g.btnsDisabled.hasCaptainPass==1&&g.btnsDisabled.hasOfficerCommit==0;const r=K({readOnly:l});m.value=r.schemas,n.value=r.schemas2}async function O(){let l=w(),r=[];l.deficiency.forEach(o=>{let e={};e.photoUrl=o,e.photoType="deficiency",e.reportId=s.query.reportId,e.deficiencyId=s.query.id,r.push(e)});let t=U(),a=[];t.correct.forEach(o=>{let e={};e.photoUrl=o,e.photoType="correct",e.reportId=s.query.reportId,e.deficiencyId=s.query.id,a.push(e)});const i=[...r,...a];console.log(i),await j(i),P.success(d("hsqe.deficiency.operationSuccessful")),B("saveCallBack")}return k(()=>{v()}),h({submit:O}),(l,r)=>{const t=M,a=V,i=A,o=W;return $(),z("div",null,[c(o,{cols:"1 s:1 m:1 l:2 xl:2 2xl:2",responsive:"screen","x-gap":12},{default:f(()=>[c(i,{span:"1",class:"mb-4"},{default:f(()=>[c(t,{title:u(d)("hsqe.deficiency.deficiencyPhotos")},null,8,["title"]),c(a,{onRegister:u(D),"label-placement":"top"},null,8,["onRegister"])]),_:1}),c(i,{span:"1",class:"mb-4"},{default:f(()=>[c(t,{title:u(d)("hsqe.deficiency.correctivePhotos")},null,8,["title"]),c(a,{onRegister:u(E),"label-placement":"top"},null,8,["onRegister"])]),_:1})]),_:1})])}}});export{he as default};
