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