import{k as y,E as c}from"./index.BKEMpsLA.js";import{createCrudOptions as B}from"./curd.CtXNVyqT.js";import{_ as C}from"./index.vue_vue_type_script_setup_true_lang.CJjppyWR.js";import{a as w,r,q as x,Z as E,aj as f,J as v,o as _,K as j,S,M as V,H as F,u as M,t as O,C as n}from"./vue.YrNK8sx4.js";import"./api.2N1tLYgs.js";import"./index.vue_vue_type_script_setup_true_lang.DKSsFgU2.js";import"./api.BT1AK3Px.js";import"./api.Dv806c7F.js";import"./index.vue_vue_type_script_setup_true_name_RefuseNotification_lang.wY20UHLo.js";import"./api.DPMoyOcC.js";import"./api.DBbkK7jc.js";const I=w({name:"approval"}),A=w({...I,setup(L){const u=r(!1),l=r(""),d=r(null),t=r(!1),p=r({}),{crudBinding:h,crudRef:s,crudExpose:a,crudOptions:N}=y({createCrudOptions:e=>B({...e,showRejectDialog:u,rejectReason:l,currentFormId:d})});n("showRejectDialog",u),n("rejectReason",l),n("currentFormId",d),n("crudExpose",a);function R(e,o,i){O(()=>{p.value={...i||{},borrow_type:e,mode:o}}),e!=1&&(t.value=!0)}async function m(e){const o=e.detail;R(o.borrow_type,"view",o)}async function b(e){try{e.mode==="edit"?c.success("编辑成功"):c.success("添加成功"),s.value&&s.value.doRefresh&&s.value.doRefresh(),a.doRefresh()}catch(o){console.error(e.mode==="edit"?"编辑失败":"提交失败",o),c.error(e.mode==="edit"?"编辑失败":"提交失败")}}return r(null),x(()=>{a.doRefresh(),window.addEventListener("approve-view",m)}),E(()=>{window.removeEventListener("approve-view",m)}),(e,o)=>{const i=f("fs-crud"),g=f("fs-page");return _(),v(g,null,{default:j(()=>[S(i,F({ref_key:"crudRef",ref:s},M(h)),null,16),t.value?(_(),v(C,{key:0,visible:t.value,"onUpdate:visible":o[0]||(o[0]=k=>t.value=k),modelValue:p.value,onSubmit:b},null,8,["visible","modelValue"])):V("",!0)]),_:1})}}});export{A as default};
