import{_ as z,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,cP as j,cM as B}from"./index.d0c68291.js";import{h as q,a as G,b as J}from"./index.1550896a.js";import{useColumns as K}from"./columns.cf3edfc2.js";const Q={class:"main flex",style:{width:"100%"}},W=w({__name:"action-table",emits:["edit","create","view"],setup(X,{expose:L,emit:M}){const{columns:N}=K(),h=k(!0),C=k([]),r=k([]),{logout:x}=H(),F=k(),R=new Map,$=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)})},D=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 E(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}=R.get(n)||{};e?T(e,s,i):y()}async function T(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){M(e,t,n,e)}return I(()=>{r.value=V().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(),O("div",Q,[f(c(j),{title:"\u83DC\u5355\u5217\u8868",loading:h.value,tableRef:(A=F.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(()=>[U(" \u65B0\u589E ")]),_:1},8,["icon"])):p("v-if",!0)]),default:d(({size:l,checkList:P})=>[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(N),checkList:P,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:E,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=>$(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=>D(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=z(W,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/system/menuOperator/components/action-table.vue"]]);export{te as default};
