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 j,j as h,C as u,G as m,l as i,J as d,M as z,a as p,aW as H,aX as x,ch as I}from"./index.js";import{useColumns as O}from"./columns.6b8776.js";import{h as U,a as w,b as G}from"./index.f6de32cf.js";const J={class:"main flex",style:{width:"100%"}},Q=N({__name:"action-table",emits:["edit","create","view"],setup(W,{expose:A,emit:B}){const{logout:y}=M(),{columns:S}=O(),_=k([]),l=k([]),C=k(!0),F=k(),T=async s=>{const{id:a,status:t}=s,{code:r,message:b}=await U({id:a,status:t+""=="1"?"0":"1"});x({code:r,message:b,logout:y,handler:()=>f()})},$=async s=>{const{id:a}=s,{code:t,message:r}=await w({id:a});x({code:t,message:r,logout:y,handler:()=>f()})};function E(s){}async function f(){C.value=!0;const{code:s,data:a,message:t}=await G({});x({code:s,message:t,logout:y,handler:()=>{_.value=I(a!=null?a:[])}}),C.value=!1}function v(s,a,t){B(t,s,a,t)}return P(()=>{l.value=V().getMenuActions("menuOperator")}),A({onSearch:f}),(s,a)=>{var R;const t=g("el-button"),r=g("el-popconfirm"),b=g("PureTable");return c(),j("div",J,[h(i(H),{title:"\u83DC\u5355\u5217\u8868",loading:C.value,tableRef:(R=F.value)==null?void 0:R.getTableRef(),dataList:_.value,onRefresh:f},{buttons:u(()=>[l.value.some(o=>o=="002")?(c(),m(t,{key:0,type:"primary",size:"small",icon:i(d)("add"),onClick:a[0]||(a[0]=o=>v(null,"","create"))},{default:u(()=>[z(" \u65B0\u589E ")]),_:1},8,["icon"])):p("v-if",!0)]),default:u(({size:o,checkList:L})=>[h(b,{ref_key:"tableRef",ref:F,border:"",align:"left","row-key":"id","table-layout":"auto",size:o,data:_.value,columns:i(S),checkList:L,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:E},{operation:u(({row:n})=>[l.value.some(e=>e=="007")?(c(),m(t,{key:0,class:"reset-margin",link:"",type:"primary",size:o,onClick:e=>v(n,n.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(n,n.id,"edit"),icon:i(d)("edits")},null,8,["size","onClick","icon"])):p("v-if",!0),l.value.some(e=>e=="004")&&n.status+""=="1"||l.value.some(e=>e=="003")&&n.status+""=="0"?(c(),m(r,{key:2,title:n.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:e=>T(n)},{reference:u(()=>[h(t,{class:"reset-margin",link:"",type:"primary",size:o,icon:i(d)(n.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(r,{key:3,title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onConfirm:e=>$(n)},{reference:u(()=>[h(t,{class:"reset-margin",link:"",type:"primary",size:o,icon:i(d)("delete")},null,8,["size","icon"])]),_:2},1032,["onConfirm"])):p("v-if",!0),n.pid+""=="0"&&l.value.some(e=>e=="002")?(c(),m(t,{key:4,class:"reset-margin",link:"",type:"primary",size:o,onClick:e=>v(null,n.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/Administrator/Desktop/projects/purchase-vue3/src/views/system/menuOperator/components/action-table.vue"]]);export{Y as default};
