import{_ as L,d as N,D as P,E as _,F as V,ag as H,x as g,o as c,c as I,y as k,K as r,N as m,u as i,R as d,a as f,bk as M,W as O,bi as F,c4 as w}from"./index.743f0c80.js";import{useColumns as z}from"./columns.6ba62faf.js";import{h as K,a as Q,b as U}from"./index.264c5d36.js";const W={class:"main flex",style:{width:"100%"}},j=O(" \u65B0\u589E "),q=N({__name:"action-table",emits:["edit","create","view"],setup(G,{expose:B,emit:E}){const{logout:y}=P(),{columns:S}=z(),h=_([]),l=_([]),b=_(!0),x=_(),T=async o=>{const{id:n,status:t}=o,{code:u,message:C}=await K({id:n,status:t+""=="1"?"0":"1"});F({code:u,message:C,logout:y,handler:()=>p()})},$=async o=>{const{id:n}=o,{code:t,message:u}=await Q({id:n});F({code:t,message:u,logout:y,handler:()=>p()})};function A(o){}async function p(){b.value=!0;const{code:o,data:n,message:t}=await U({});F({code:o,message:t,logout:y,handler:()=>{h.value=w(n!=null?n:[])}}),b.value=!1}function v(o,n,t){E(t,o,n,t)}return V(()=>{l.value=H().getMenuActions("menuOperator")}),B({onSearch:p}),(o,n)=>{var R;const t=g("el-button"),u=g("el-popconfirm"),C=g("PureTable");return c(),I("div",W,[k(i(M),{title:"\u83DC\u5355\u5217\u8868",loading:b.value,tableRef:(R=x.value)==null?void 0:R.getTableRef(),dataList:h.value,onRefresh:p},{buttons:r(()=>[l.value.some(s=>s=="002")?(c(),m(t,{key:0,type:"primary",icon:i(d)("add"),onClick:n[0]||(n[0]=s=>v(null,"","create"))},{default:r(()=>[j]),_:1},8,["icon"])):f("v-if",!0)]),default:r(({size:s,checkList:D})=>[k(C,{ref_key:"tableRef",ref:x,border:"",align:"left","row-key":"id","table-layout":"auto",size:s,data:h.value,columns:i(S),checkList:D,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:A},{operation:r(({row:a})=>[l.value.some(e=>e=="007")?(c(),m(t,{key:0,class:"reset-margin",link:"",type:"primary",size:s,onClick:e=>v(a,a.id,"view"),icon:i(d)("eye-view")},null,8,["size","onClick","icon"])):f("v-if",!0),l.value.some(e=>e=="005")?(c(),m(t,{key:1,class:"reset-margin",link:"",type:"primary",size:s,onClick:e=>v(a,a.id,"edit"),icon:i(d)("edits")},null,8,["size","onClick","icon"])):f("v-if",!0),l.value.some(e=>e=="004")&&a.status+""=="1"||l.value.some(e=>e=="003")&&a.status+""=="0"?(c(),m(u,{key:2,title:a.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:e=>T(a)},{reference:r(()=>[k(t,{class:"reset-margin",link:"",type:"primary",size:s,icon:i(d)(a.status==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["size","icon"])]),_:2},1032,["title","onConfirm"])):f("v-if",!0),l.value.some(e=>e=="006")?(c(),m(u,{key:3,title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onConfirm:e=>$(a)},{reference:r(()=>[k(t,{class:"reset-margin",link:"",type:"primary",size:s,icon:i(d)("delete")},null,8,["size","icon"])]),_:2},1032,["onConfirm"])):f("v-if",!0),a.menu_type+""=="1"&&l.value.some(e=>e=="002")?(c(),m(t,{key:4,class:"reset-margin",link:"",type:"primary",size:s,onClick:e=>v(null,a.id,"create"),icon:i(d)("add")},null,8,["size","onClick","icon"])):f("v-if",!0)]),_:2},1032,["size","data","columns","checkList"])]),_:1},8,["loading","tableRef","dataList"])])}}});var Z=L(q,[["__file","D:/work/accout-vue3-ui/src/views/system/menuOperator/components/action-table.vue"]]);export{Z as default};