import{_ as N,d as H,m as P,n as y,p as V,a6 as z,r as g,o as c,c as I,h as k,y as r,A as m,i,D as d,H as M,a as f,cZ as O,cW as x,fq as j}from"./index.js";import{useColumns as q}from"./columns.40ddb0.js";import{h as w,a as Q,b as U}from"./index.39f3085f.js";const W={class:"main flex",style:{width:"100%"}},Z=H({__name:"action-table",emits:["edit","create","view"],setup(G,{expose:A,emit:B}){const{logout:_}=P(),{columns:S}=q(),h=y([]),l=y([]),C=y(!0),F=y(),T=B,$=async s=>{const{id:n,status:t}=s,{code:u,message:b}=await w({id:n,status:t+""=="1"?"0":"1"});x({code:u,message:b,logout:_,handler:()=>p()})},D=async s=>{const{id:n}=s,{code:t,message:u}=await Q({id:n});x({code:t,message:u,logout:_,handler:()=>p()})};function E(s){}async function p(){C.value=!0;const{code:s,data:n,message:t}=await U({});x({code:s,message:t,logout:_,handler:()=>{h.value=j(n!=null?n:[])}}),C.value=!1}function v(s,n,t){T(t,s,n,t)}return V(()=>{l.value=z().getMenuActions("menuOperator")}),A({onSearch:p}),(s,n)=>{var R;const t=g("el-button"),u=g("el-popconfirm"),b=g("PureTable");return c(),I("div",W,[k(i(O),{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(()=>n[1]||(n[1]=[M(" \u65B0\u589E ")])),_:1},8,["icon"])):f("v-if",!0)]),default:r(({size:o,checkList:L})=>[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:L,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:E},{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=>$(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=>D(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 Y=N(Z,[["__file","D:/work/jiesuan/settle-vue3/src/views/system/menuOperator/components/action-table.vue"]]);export{Y as default};
