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