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 k}from"./BasicForm-dL_oCSPM.js";import{e as F,f as y}from"./modalSchemas-DN-MflMO.js";import{d as I,V as q,r as i,c as D,o as O,l,w as V,j as A,ac as C,cZ as G}from"./index-9PRMimni.js";import{u as P}from"./useModal-CO65vga3.js";import{u as j}from"./useForm-CKmgcynv.js";const H=I({__name:"ResetModal",emits:["success","clearData"],setup(L,{expose:m,emit:u}){const o=u,{t:s}=q(),a=G(),{resetSchemas:d}=F(),[p,{openModal:f,closeModal:h,setProps:_,setSubLoading:c}]=P({title:s("counter.resetText"),subBtuText:s("common.okText"),cancelText:s("common.cancelText"),displayDirective:"if",width:650}),[g,{getFieldsValue:w,resetFields:x,validate:B}]=j({gridProps:{cols:"1",xGap:"15"},labelWidth:80,schemas:d,showAdvancedButton:!1}),t=i(0),n=i("");async function M(e,r){n.value=r,f(),C(()=>{x(),t&&(t.value=e.equipmentId)})}async function v(){try{await B();const e=w();await y({equipmentId:t.value.toString(),...e}),a.success(s("counter.resetSuccess")),c(!1),a.success(s("common.saveSuccessText")),o("success",n.value),h()}catch{c(!1)}}function R(e){o("clearData",e)}return m({showModal:M,setProps:_}),(e,r)=>{const S=k,T=b;return O(),D(T,{ref:"modalRef",onRegister:l(p),class:"basicModal basicFormModal",onOnOk:v,"on-update:show":R},{default:V(()=>[A(S,{onRegister:l(g),showActionButtonGroup:!1,showSubmitButton:!1,showResetButton:!1},null,8,["onRegister"])]),_:1},8,["onRegister"])}}});export{H as _};
