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