import{a as B,c as y,b as T,E as D,X as u,e as E}from"./index.lP_uh0LI.js";import{B as M,c as O}from"./crud.CMhx-STq.js";import{d as S,a as A,c as N,b as o,h as V,f as X,n as $,u as c,w as t,g as a,l as z,A as P}from"./vue.BxlDVA1H.js";const J=S({__name:"index",setup(U,{expose:_}){let i=A({name:null});const{crudRef:m,crudBinding:g,crudExpose:s,context:j,selectedRows:l}=B({createCrudOptions:O,context:{selectOptions:i}}),{doRefresh:h,setTableData:b}=s,r=N(()=>l.value.length),v=async()=>{await D.confirm(`确定要批量删除这${l.value.length}条记录吗`,"确认",{distinguishCancelAndClose:!0,confirmButtonText:"确定",cancelButtonText:"取消",closeOnClickModal:!1}),await M(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"),R=o("el-table"),w=o("el-popover"),C=o("fs-crud");return X(),V(C,$({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(w,{placement:"top",width:400,trigger:"click"},{reference:t(()=>[a(n,{text:"",type:r.value>0?"primary":""},{default:t(()=>[z("已选中"+P(r.value)+"条数据",1)]),_:1},8,["type"])]),default:t(()=>[a(R,{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(k=>[a(n,{text:"",type:"info",icon:c(y),onClick:F=>x(k.row),circle:""},null,8,["icon","onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},16)}}});export{J as _};
