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