import{k as B,ad as y,C as T,F as D,a7 as u,E}from"./index.CL7yl-Wb.js";import{B as S,c as M}from"./crud.uOtil7zh.js";import{a as O,r as N,f as P,aj as o,J as V,o as $,H as j,u as c,K as t,S as a,P as z,Q as A}from"./vue.D1BjjNmv.js";const q=O({__name:"index",setup(F,{expose:_}){let i=N({name:null});const{crudRef:m,crudBinding:g,crudExpose:s,context:H,selectedRows:l}=B({createCrudOptions:M,context:{selectOptions:i}}),{doRefresh:h,setTableData:b}=s,r=P(()=>l.value.length),v=async()=>{await D.confirm(`确定要批量删除这${l.value.length}条记录吗`,"确认",{distinguishCancelAndClose:!0,confirmButtonText:"确定",cancelButtonText:"取消",closeOnClickModal:!1}),await S(u.pluck(l.value,"id")),E.info("删除成功"),l.value=[],await s.doRefresh()},x=e=>{const p=s.getBaseTableRef(),n=s.getTableData();u.pluck(n,"id").includes(e.id)?p.toggleRowSelection(e,!1):l.value=u.remove(l.value,d=>d.id!==e.id)};return _({selectOptions:i,handleRefreshTable:e=>{!e.is_catalog&&e.id?(i.value=e,h()):b([])}}),(e,p)=>{const n=o("el-button"),d=o("el-tooltip"),f=o("el-table-column"),k=o("el-table"),C=o("el-popover"),R=o("fs-crud");return $(),V(R,j({ref_key:"crudRef",ref:m},c(g)),{"pagination-left":t(()=>[a(d,{content:"批量删除"},{default:t(()=>[a(n,{text:"",type:"danger",disabled:r.value===0,icon:c(T),circle:"",onClick:v},null,8,["disabled","icon"])]),_:1})]),"pagination-right":t(()=>[a(C,{placement:"top",width:400,trigger:"click"},{reference:t(()=>[a(n,{text:"",type:r.value>0?"primary":""},{default:t(()=>[z("已选中"+A(r.value)+"条数据",1)]),_:1},8,["type"])]),default:t(()=>[a(k,{data:c(l),size:"small"},{default:t(()=>[a(f,{width:"150",property:"id",label:"id"}),a(f,{fixed:"right",label:"操作","min-width":"60"},{default:t(w=>[a(n,{text:"",type:"info",icon:c(y),onClick:K=>x(w.row),circle:""},null,8,["icon","onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},16)}}});export{q as _};
