import{k}from"./index.CN1lNsL-.js";import{createCrudOptions as g}from"./curd.BZYMTVPy.js";import y from"./index.r40HDQRN.js";import{a as E,r as i,q as L,Z as x,aj as c,J as B,o as D,K as S,S as f,H as C,u as M}from"./vue.YrNK8sx4.js";import"./api.Csqs03ZT.js";import"./_plugin-vue_export-helper.DlAUqK2U.js";const O=E({__name:"index",setup(R){const{crudBinding:m,crudRef:w,crudExpose:u}=k({createCrudOptions:g}),o=i(!1),a=i(null),s=i("add");let r=null;function v(){a.value=null,s.value="add",o.value=!0}function p(){o.value=!1,u.doRefresh()}function l(t){const e=t;a.value=e.detail,s.value="view",o.value=!0}function d(t){const e=t;a.value=e.detail,s.value="edit",o.value=!0}return L(()=>{u.doRefresh();function t(){const e=document.querySelector(".workflow-page .fs-actionbar");if(e&&!e.querySelector(".my-create-btn")){const n=document.createElement("button");n.className="el-buttonwf el-button el-button--primary el-button--default my-create-btn",n.innerHTML="新建审批流程",n.onclick=v,e.append(n)}}r=new MutationObserver(()=>{setTimeout(()=>{t()},30)}),r.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("workflow-view",l),window.addEventListener("workflow-edit",d)}),x(()=>{r&&(r.disconnect(),r=null),window.removeEventListener("workflow-view",l),window.removeEventListener("workflow-edit",d)}),(t,e)=>{const n=c("fs-crud"),b=c("fs-page");return D(),B(b,{class:"workflow-page"},{default:S(()=>[f(n,C({ref_key:"crudRef",ref:w},M(m)),null,16),f(y,{visible:o.value,"onUpdate:visible":e[0]||(e[0]=_=>o.value=_),editData:a.value,mode:s.value,onSuccess:p},null,8,["visible","editData","mode"])]),_:1})}}});export{O as default};
