import{useColumns as D}from"./columns.87209d53.js";import{q as E,A as L,B as y,r as C,o as g,n as A,t as o,H as c,v as l,K as N,P,S as V,be as H}from"./index.7a111e62.js";import{h as I,a as q,b as z}from"./index.fd029790.js";import{T as K}from"./index.3ac3c8f0.js";import{u as r}from"./hooks.f4063c52.js";import{r as k}from"./responseHandle.6edfaed2.js";const Q={class:"main flex",style:{width:"100%"}},j=V(" \u65B0\u589E "),X=E({__name:"action-table",emits:["edit","create","view"],setup(w,{expose:F,emit:x}){const{logout:p}=L(),{columns:B}=D(),f=y([]),h=y(!0),v=y(),R=async a=>{const{id:t,status:e}=a,{code:i,message:_}=await I({id:t,status:e+""=="1"?"0":"1"});k({code:i,message:_,logout:p,handler:()=>u()})},S=async a=>{const{id:t}=a,{code:e,message:i}=await q({id:t});k({code:e,message:i,logout:p,handler:()=>u()})};function T(a){}async function u(){h.value=!0;const{code:a,data:t,message:e}=await z({});k({code:a,message:e,logout:p,handler:()=>{f.value=H(t!=null?t:[])}}),h.value=!1}function d(a,t,e){x(e,a,t,e)}return F({onSearch:u}),(a,t)=>{var b;const e=C("el-button"),i=C("el-popconfirm"),_=C("PureTable");return g(),A("div",Q,[o(l(K),{title:"\u8D44\u91D1\u516C\u6D77\u6C60",loading:h.value,tableRef:(b=v.value)==null?void 0:b.getTableRef(),dataList:f.value,onRefresh:u},{buttons:c(()=>[o(e,{type:"primary",icon:l(r)("add"),onClick:t[0]||(t[0]=s=>d(null,"","create"))},{default:c(()=>[j]),_:1},8,["icon"])]),default:c(({size:s,checkList:$})=>[o(_,{ref_key:"tableRef",ref:v,border:"",align:"left","row-key":"id","table-layout":"auto","default-expand-all":"",size:s,data:f.value,columns:l(B),checkList:$,"tree-props":{hasChildren:"hasChildren",children:"child"},"header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:T},{operation:c(({row:n})=>[o(e,{class:"reset-margin",link:"",type:"primary",size:s,onClick:m=>d(n,n.id,"view"),icon:l(r)("eye-view")},null,8,["size","onClick","icon"]),o(e,{class:"reset-margin",link:"",type:"primary",size:s,onClick:m=>d(n,n.id,"edit"),icon:l(r)("edits")},null,8,["size","onClick","icon"]),o(i,{title:n.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:m=>R(n)},{reference:c(()=>[o(e,{class:"reset-margin",link:"",type:"primary",size:s,icon:l(r)(n.status==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["size","icon"])]),_:2},1032,["title","onConfirm"]),o(i,{title:"\u662F\u5426\u786E\u8BA4\u5220\u9664?",onConfirm:m=>S(n)},{reference:c(()=>[o(e,{class:"reset-margin",link:"",type:"primary",size:s,icon:l(r)("delete")},null,8,["size","icon"])]),_:2},1032,["onConfirm"]),n.menu_type+""=="1"?(g(),N(e,{key:0,class:"reset-margin",link:"",type:"primary",size:s,onClick:m=>d(null,n.id,"create"),icon:l(r)("add")},null,8,["size","onClick","icon"])):P("",!0)]),_:2},1032,["size","data","columns","checkList"])]),_:1},8,["loading","tableRef","dataList"])])}}});export{X as default};
