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,cv as O}from"./index.56c69f5a.js";import{useColumns as U}from"./columns.3ea7778e.js";import{h as j,a as w,b as G}from"./index.5c303e77.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:n,status:t}=s,{code:u,message:b}=await j({id:n,status:t+""=="1"?"0":"1"});x({code:u,message:b,logout:_,handler:()=>f()})},A=async s=>{const{id:n}=s,{code:t,message:u}=await w({id:n});x({code:t,message:u,logout:_,handler:()=>f()})};function E(s){}async function f(){C.value=!0;const{code:s,data:n,message:t}=await G({});x({code:s,message:t,logout:_,handler:()=>{h.value=O(n!=null?n:[])}}),C.value=!1}function v(s,n,t){S(t,s,n,t)}return P(()=>{l.value=V().getMenuActions("menuOperator")}),B({onSearch:f}),(s,n)=>{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:n[0]||(n[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:a})=>[l.value.some(e=>e=="007")?(c(),m(t,{key:0,class:"reset-margin",link:"",type:"primary",size:o,onClick:e=>v(a,a.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(a,a.id,"edit"),icon:i(d)("edits")},null,8,["size","onClick","icon"])):p("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=>$(a)},{reference:r(()=>[y(t,{class:"reset-margin",link:"",type:"primary",size:o,icon:i(d)(a.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(a)},{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),a.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,a.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};
