import{_ as P,d as w,m as k,l as H,n as I,R as U,r as b,o as u,c as V,h as f,x as d,A as v,u as c,D as m,H as O,a as p,cU as j,cR as B}from"./index.56449854.js";import{h as q,a as G,b as J}from"./index.77a8b055.js";import{useColumns as K}from"./columns.ce0f089e.js";const Q={class:"main flex",style:{width:"100%"}},W=w({__name:"action-table",emits:["edit","create","view"],setup(X,{expose:L,emit:N}){const{columns:$}=K(),h=k(!0),C=k([]),r=k([]),{logout:x}=H(),R=k(),F=new Map,D=async t=>{const{id:n,status:e}=t,{code:s,message:i}=await q({id:n,status:e+""=="1"?"0":"1"});B({code:s,message:i,logout:x,handler:()=>g(t.pid)})},E=async t=>{const{id:n}=t,{code:e,message:s}=await G({id:n});B({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=>{J({...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}=F.get(n)||{};e?T(e,s,i):y()}async function T(t,n,e){const{id:s}=t;F.set(s,{row:t,treeNode:n,resolve:e});const i=await S({pid:s});e(i)}function _(t,n,e){N(e,t,n,e)}return I(()=>{r.value=U().getMenuActions("menuOperator")}),L({onSearch:y,reloadTree:g}),(t,n)=>{var A;const e=b("el-button"),s=b("el-popconfirm"),i=b("PureTable");return u(),V("div",Q,[f(c(j),{title:"\u83DC\u5355\u5217\u8868",loading:h.value,tableRef:(A=R.value)==null?void 0:A.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(()=>[O(" \u65B0\u589E ")]),_:1},8,["icon"])):p("v-if",!0)]),default:d(({size:l,checkList:z})=>[f(i,{ref_key:"tableRef",ref:R,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:T},{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/89793/Desktop/projects/report-v3/src/views/system/menuOperator/components/action-table.vue"]]);export{te as default};