import{_ as B}from"./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";import"./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";import{B as C}from"./BasicForm-dL_oCSPM.js";import{i as M,j as N}from"./jobPlanDetails-5wu16ZE_.js";import{V as m,bk as S,d as V,r as O,c as F,o as I,l as s,w as r,j as p,n as q,p as z,A,ac as J}from"./index-9PRMimni.js";import{u as L}from"./useForm-CKmgcynv.js";import{u as U}from"./useModal-CO65vga3.js";import{p as G}from"./pick-Cg3anC-c.js";S();const{t:n}=m();function W(){return[{field:"id",hidden:!0},{field:"procedureDetail",component:"NInput",label:n("jobPlan.viewDetails.jobDetailsTab.procedureDetails"),giProps:{span:1},componentProps:{placeholder:n("jobPlan.viewDetails.jobDetailsTab.procedureDetails"),type:"textarea",showCount:!0,maxlength:100,autosize:{minRows:3,maxRows:3}},rules:[{required:!0,message:n("jobPlan.viewDetails.jobDetailsTab.procedureDetailsRequired")}]},{field:"mandatory",defaultValue:!1,slot:"mandatorySlot",giProps:{span:1},componentProps:{}}]}const ee=V({__name:"index",props:{data:{}},emits:["refresh"],setup(u,{expose:f,emit:b}){const{t:a}=m(),h=u,_=b,i=O("add"),[w,{submit:D,setFieldsValue:x}]=L({schemas:W(),layout:"horizontal",gridProps:{cols:1}}),[y,{openModal:g,closeModal:P,setSubLoading:c}]=U({title:a("jobPlan.viewDetails.jobDetailsTab.procedureModalTitle"),subBtuText:a("common.confirmText"),cancelText:a("common.cancelText"),width:600});async function j(){try{const e=await D();if(!e){c(!1);return}const o={...G(h.data,["shipId","serialNumber","productCode","model","jobCode"]),...e},t={add:N,edit:M}[i.value];await t(o),_("refresh"),P()}catch(e){console.error(e)}finally{c(!1)}}async function k({type:e,record:o}={type:"add",record:{}}){i.value=e??"add",g(),await J(),x({id:o?.id??null,procedureDetail:o?.procedureDetail??"",mandatory:o?.mandatory??!1})}return f({handleOpenModal:k}),(e,o)=>{const t=q,T=C,R=B;return I(),F(R,{onRegister:s(y),"show-icon":"",type:"warning",onOnOk:j},{default:r(()=>[p(T,{onRegister:s(w),showActionButtonGroup:!1},{mandatorySlot:r(({model:l,field:d})=>[p(t,{checked:l[d],"onUpdate:checked":v=>l[d]=v},{default:r(()=>[z(A(s(a)("jobPlan.viewDetails.jobDetailsTab.mandatory")),1)]),_:2},1032,["checked","onUpdate:checked"])]),_:1},8,["onRegister"])]),_:1},8,["onRegister"])}}});export{ee as _};
