import{useColumns as N}from"./columns.120f9d5d.js";import{q as P,A as D,B as k,C as H,aQ as V,r as g,o as c,n as I,t as y,H as u,K as m,v as i,P as d,S as M,bp as Q}from"./index.d8ce26ef.js";import{h as q,a as z,b as K}from"./index.51e1177f.js";import{T as O}from"./index.4ed99b91.js";import{u as p}from"./hooks.3def80f5.js";import{r as F}from"./responseHandle.f073653a.js";const U={class:"main flex",style:{width:"100%"}},j=M(" \u65B0\u589E "),ee=P({__name:"action-table",emits:["edit","create","view"],setup(G,{expose:R,emit:S}){const{logout:h}=D(),{columns:T}=N(),_=k([]),l=k([]),C=k(!0),x=k(),$=async o=>{const{id:n,status:t}=o,{code:r,message:b}=await q({id:n,status:t+""=="1"?"0":"1"});F({code:r,message:b,logout:h,handler:()=>f()})},A=async o=>{const{id:n}=o,{code:t,message:r}=await z({id:n});F({code:t,message:r,logout:h,handler:()=>f()})};function E(o){}async function f(){C.value=!0;const{code:o,data:n,message:t}=await K({});F({code:o,message:t,logout:h,handler:()=>{_.value=Q(n!=null?n:[])}}),C.value=!1}function v(o,n,t){S(t,o,n,t)}return H(()=>{l.value=V().getMenuActions("menuOperator")}),R({onSearch:f}),(o,n)=>{var B;const t=g("el-button"),r=g("el-popconfirm"),b=g("PureTable");return c(),I("div",U,[y(i(O),{title:"\u83DC\u5355\u5217\u8868",loading:C.value,tableRef:(B=x.value)==null?void 0:B.getTableRef(),dataList:_.value,onRefresh:f},{buttons:u(()=>[l.value.some(s=>s=="002")?(c(),m(t,{key:0,type:"primary",icon:i(p)("add"),onClick:n[0]||(n[0]=s=>v(null,"","create"))},{default:u(()=>[j]),_:1},8,["icon"])):d("",!0)]),default:u(({size:s,checkList:L})=>[y(b,{ref_key:"tableRef",ref:x,border:"",align:"left","row-key":"id","table-layout":"auto","default-expand-all":"",size:s,data:_.value,columns:i(T),checkList:L,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:E},{operation:u(({row:a})=>[l.value.some(e=>e=="007")?(c(),m(t,{key:0,class:"reset-margin",link:"",type:"primary",size:s,onClick:e=>v(a,a.id,"view"),icon:i(p)("eye-view")},null,8,["size","onClick","icon"])):d("",!0),l.value.some(e=>e=="005")?(c(),m(t,{key:1,class:"reset-margin",link:"",type:"primary",size:s,onClick:e=>v(a,a.id,"edit"),icon:i(p)("edits")},null,8,["size","onClick","icon"])):d("",!0),l.value.some(e=>e=="004")&&a.status+""=="1"||l.value.some(e=>e=="003")&&a.status+""=="0"?(c(),m(r,{key:2,title:a.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:e=>$(a)},{reference:u(()=>[y(t,{class:"reset-margin",link:"",type:"primary",size:s,icon:i(p)(a.status==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["size","icon"])]),_:2},1032,["title","onConfirm"])):d("",!0),l.value.some(e=>e=="006")?(c(),m(r,{key:3,title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onConfirm:e=>A(a)},{reference:u(()=>[y(t,{class:"reset-margin",link:"",type:"primary",size:s,icon:i(p)("delete")},null,8,["size","icon"])]),_:2},1032,["onConfirm"])):d("",!0),a.menu_type+""=="1"&&l.value.some(e=>e=="002")?(c(),m(t,{key:4,class:"reset-margin",link:"",type:"primary",size:s,onClick:e=>v(null,a.id,"create"),icon:i(p)("add")},null,8,["size","onClick","icon"])):d("",!0)]),_:2},1032,["size","data","columns","checkList"])]),_:1},8,["loading","tableRef","dataList"])])}}});export{ee as default};
