import{_ as P,d as w,m as k,l as H,n as I,R as V,r as b,o as u,c as O,h as f,x as d,A as v,u as c,D as m,H as U,a as p,cQ as j,cN as A}from"./index.e80c366d.js";import{h as q,a as Q,b as G}from"./index.31c623b4.js";import{useColumns as J}from"./columns.5906b9fd.js";const K={class:"main flex",style:{width:"100%"}},W=w({__name:"action-table",emits:["edit","create","view"],setup(X,{expose:B,emit:L}){const{columns:$}=J(),h=k(!0),C=k([]),r=k([]),{logout:x}=H(),F=k(),R=new Map,D=async t=>{const{id:n,status:e}=t,{code:s,message:i}=await q({id:n,status:e+""=="1"?"0":"1"});A({code:s,message:i,logout:x,handler:()=>g(t.pid)})},E=async t=>{const{id:n}=t,{code:e,message:s}=await Q({id:n});A({code:e,message:s,logout:x,handler:()=>Number(t.pid)===0?y():g(t.pid)})};function M(t){}async function S(t){return h.value=!0,new Promise(n=>{G({...t,size:100}).then(e=>{h.value=!1;const{code:s,data:i}=e;s===1&&i.list.length!==0?n(i.list):n([])}).catch(()=>{h.value=!1,n([])})})}async function y(){const t=await S({});C.value=t.map(n=>({...n,hasChildren:!0}))}function g(t){const n=t?parseInt(t):0,{row:e,treeNode:s,resolve:i}=R.get(n)||{};e?N(e,s,i):y()}async function N(t,n,e){const{id:s}=t;R.set(s,{row:t,treeNode:n,resolve:e});const i=await S({pid:s});e(i)}function _(t,n,e){L(e,t,n,e)}return I(()=>{r.value=V().getMenuActions("menuOperator")}),B({onSearch:y,reloadTree:g}),(t,n)=>{var T;const e=b("el-button"),s=b("el-popconfirm"),i=b("PureTable");return u(),O("div",K,[f(c(j),{title:"\u83DC\u5355\u5217\u8868",loading:h.value,tableRef:(T=F.value)==null?void 0:T.getTableRef(),dataList:C.value,onRefresh:y},{buttons:d(()=>[r.value.some(l=>l=="2")?(u(),v(e,{key:0,type:"primary",size:"small",icon:c(m)("add"),onClick:n[0]||(n[0]=l=>_(null,"","create"))},{default:d(()=>[U(" \u65B0\u589E ")]),_:1},8,["icon"])):p("v-if",!0)]),default:d(({size:l,checkList:z})=>[f(i,{ref_key:"tableRef",ref:F,border:"",align:"left","row-key":"id","table-layout":"auto",size:l,lazy:!0,data:C.value,columns:c($),checkList:z,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:M,load:N},{operation:d(({row:o})=>[r.value.some(a=>a=="5")?(u(),v(e,{key:0,class:"reset-margin",link:"",type:"primary",size:l,onClick:a=>_(o,o.id,"view"),icon:c(m)("eye-view")},null,8,["size","onClick","icon"])):p("v-if",!0),r.value.some(a=>a=="4")?(u(),v(e,{key:1,class:"reset-margin",link:"",type:"primary",size:l,onClick:a=>_(o,o.id,"edit"),icon:c(m)("edits")},null,8,["size","onClick","icon"])):p("v-if",!0),r.value.some(a=>a=="7")&&o.status+""=="1"||r.value.some(a=>a=="6")&&o.status+""=="0"?(u(),v(s,{key:2,title:String(o.status)==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:a=>D(o)},{reference:d(()=>[f(e,{class:"reset-margin",link:"",type:"primary",size:l,icon:c(m)(String(o.status)==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["size","icon"])]),_:2},1032,["title","onConfirm"])):p("v-if",!0),r.value.some(a=>a=="8")?(u(),v(s,{key:3,title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onConfirm:a=>E(o)},{reference:d(()=>[f(e,{class:"reset-margin",link:"",type:"primary",size:l,icon:c(m)("delete")},null,8,["size","icon"])]),_:2},1032,["onConfirm"])):p("v-if",!0),p(`            v-if="row.menu_type + '' === '1' && powers.some(i => i == '002')"`),f(e,{class:"reset-margin",link:"",type:"primary",size:l,onClick:a=>_(null,o.id,"create"),icon:c(m)("add")},null,8,["size","onClick","icon"])]),_:2},1032,["size","data","columns","checkList"])]),_:1},8,["loading","tableRef","dataList"])])}}});var te=P(W,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/system/menuOperator/components/action-table.vue"]]);export{te as default};
