import{_ as T}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 j}from"./BasicForm-dL_oCSPM.js";import{n as y}from"./jobPlanDetails-5wu16ZE_.js";import{V as i,bk as P,d as D,c as B,o as M,l as a,w as k,j as R,cZ as F,ac as N}from"./index-9PRMimni.js";import{u as O}from"./useForm-CKmgcynv.js";import{u as S}from"./useModal-CO65vga3.js";P();const{t:n}=i();function V(){return[{field:"shipId",hidden:!0},{field:"serialNumber",hidden:!0},{field:"productCode",hidden:!0},{field:"model",hidden:!0},{field:"jobCode",hidden:!0},{field:"sparePartNumber",hidden:!0},{field:"plannedQuantity",component:"NInputNumber",label:n("jobPlan.viewDetails.jobDetailsTab.plannedQuantity"),componentProps:{placeholder:n("jobPlan.viewDetails.jobDetailsTab.plannedQuantity"),min:0,precision:0},rules:[{required:!0,message:n("jobPlan.viewDetails.jobDetailsTab.plannedQuantityRequired")}]}]}function v(o){return o?{...o}:{}}const G=D({__name:"index",emits:["refresh"],setup(o,{expose:r,emit:l}){const{t}=i(),c=F(),u=l,[d,{submit:m,setFieldsValue:p}]=O({schemas:V(),layout:"horizontal",gridProps:{cols:1}}),[f,{openModal:b,closeModal:h,setSubLoading:s}]=S({title:t("jobPlan.viewDetails.jobDetailsTab.sparePartsModalTitle"),subBtuText:t("common.confirmText"),cancelText:t("common.cancelText"),width:300});async function _(){try{const e=await m();if(!e){s(!1);return}await y({...e}),c.success(t("common.optionsEditSuccessText")),u("refresh"),h()}catch(e){console.error(e)}finally{s(!1)}}async function w({record:e}){b(),await N(),p(v(e))}return r({handleOpenModal:w}),(e,C)=>{const g=j,x=T;return M(),B(x,{onRegister:a(f),"show-icon":"",type:"warning",onOnOk:_},{default:k(()=>[R(g,{onRegister:a(d),showActionButtonGroup:!1},null,8,["onRegister"])]),_:1},8,["onRegister"])}}});export{G as _};
