import{_ as w}from"./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";import"./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";import{B}from"./BasicForm-dL_oCSPM.js";import{u as y}from"./useForm-CKmgcynv.js";import{V as c,d as A,r as F,c as O,o as S,l as r,w as T,j as k,gR as P,cZ as j}from"./index-9PRMimni.js";import{u as V}from"./useModal-CO65vga3.js";const{t:C}=c(),I=()=>({approvalSchemas:[{field:"reason",component:"NInput",label:C("jobOrder.comment"),componentProps:{type:"textarea"}}]}),Z=A({__name:"ApprovalModal",emits:["success"],setup(l,{expose:m,emit:i}){const p=i,{t:o}=c(),u=j(),{approvalSchemas:d}=I(),[f,{validate:v,getFieldsValue:_}]=y({gridProps:{cols:1},layout:"horizontal",showActionButtonGroup:!1,schemas:d,labelWidth:"100"}),[h,{openModal:g,closeModal:b,setProps:x,setSubLoading:a}]=V({title:o("jobOrder.approve"),subBtuText:o("common.saveText"),cancelText:o("common.cancelText"),width:650}),s=F();async function M(e){g(),e&&(s.value=e)}async function R(){try{if(!await v()){a(!1);return}if(!s.value)return;const n=_(),t={...s.value,comment:n.reason};await P(t),u.success(o("common.submitApproveText")),a(!1),p("success"),b()}catch{a(!1)}}return m({showModal:M,setProps:x}),(e,n)=>{const t=w;return S(),O(t,{ref:"modalRef",onRegister:r(h),class:"basicModal basicFormModal",onOnOk:R},{default:T(()=>[k(r(B),{ref:"contentFromRef",onRegister:r(f)},null,8,["onRegister"])]),_:1},8,["onRegister"])}}});export{Z as _};
