import{_ as L,d as N,w as M,x as y,y as P,ad as V,r as g,o as c,c as z,l as k,D as r,G as m,m as i,J as d,M as H,a as f,bA as I,bx as x,dZ as O}from"./index.js";import{useColumns as U}from"./columns.40ddb0.js";import{h as j,a as w,b as G}from"./index.b8b33c0d.js";const J={class:"main flex",style:{width:"100%"}},Q=N({__name:"action-table",emits:["edit","create","view"],setup(Z,{expose:A,emit:B}){const{logout:_}=M(),{columns:S}=U(),h=y([]),l=y([]),C=y(!0),F=y(),T=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:()=>p()})},$=async s=>{const{id:n}=s,{code:t,message:u}=await w({id:n});x({code:t,message:u,logout:_,handler:()=>p()})};function D(s){}async function p(){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){B(t,s,n,t)}return P(()=>{l.value=V().getMenuActions("menuOperator")}),A({onSearch:p}),(s,n)=>{var R;const t=g("el-button"),u=g("el-popconfirm"),b=g("PureTable");return c(),z("div",J,[k(i(I),{title:"\u83DC\u5355\u5217\u8868",loading:C.value,tableRef:(R=F.value)==null?void 0:R.getTableRef(),dataList:h.value,onRefresh:p},{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"])):f("v-if",!0)]),default:r(({size:o,checkList:E})=>[k(b,{ref_key:"tableRef",ref:F,border:"",align:"left","row-key":"id","table-layout":"auto",size:o,data:h.value,columns:i(S),checkList:E,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:D},{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"])):f("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"])):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:o,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:o,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:o,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 X=L(Q,[["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/system/menuOperator/components/action-table.vue"]]);export{X as default};
