action-table.b0f6809c.js 3.2 KB

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