import{a as N,c as T,X as f,R as U}from"./index.lP_uh0LI.js";import{a as E,c as X}from"./crud.Zcvpp6Ix.js";import{d as q,a as z,c as A,b as s,h as O,f as P,w as e,s as h,g as t,n as $,u as m,l as _,A as j}from"./vue.BxlDVA1H.js";const G={style:{height:"500px"}},L=q({__name:"index",props:{refreshCallback:{type:Function,required:!0}},setup(b,{expose:C}){const k=b,r=z(!1),i=k.refreshCallback,d=()=>{r.value=!1,a.value=[]},x=async()=>{a.value.length!==0&&(await E(g.value.getSearchFormData().role_id,f.pluck(a.value,"id")).then(l=>{U(l.msg)}),i&&i(),d())},{crudBinding:y,crudRef:g,crudExpose:u,selectedRows:a}=N({createCrudOptions:X,context:{}}),{setSearchFormData:R,doRefresh:w}=u,v=A(()=>a.value.length),D=l=>{const o=u.getBaseTableRef(),n=u.getTableData();f.pluck(n,"id").includes(l.id)?o.toggleRowSelection(l,!1):a.value=f.remove(a.value,c=>c.id!==l.id)};return C({dialog:r,setSearchFormData:R,doRefresh:w,parentRefreshCallbackFunc:i}),(l,o)=>{const n=s("el-button"),c=s("el-table-column"),V=s("el-table"),B=s("el-popover"),S=s("fs-crud"),F=s("el-dialog");return P(),O(F,{modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=p=>r.value=p),title:"添加授权用户",direction:"rtl","destroy-on-close":"","before-close":d},{footer:e(()=>[h("div",null,[t(n,{type:"primary",onClick:x},{default:e(()=>o[1]||(o[1]=[_(" 确定")])),_:1,__:[1]}),t(n,{onClick:d},{default:e(()=>o[2]||(o[2]=[_(" 取消")])),_:1,__:[2]})])]),default:e(()=>[h("div",G,[t(S,$({ref_key:"crudRef",ref:g},m(y)),{"pagination-right":e(()=>[t(B,{placement:"top",width:200,trigger:"click"},{reference:e(()=>[t(n,{text:"",type:v.value>0?"primary":""},{default:e(()=>[_("已选中"+j(v.value)+"条数据",1)]),_:1},8,["type"])]),default:e(()=>[t(V,{data:m(a),size:"small","max-height":500},{default:e(()=>[t(c,{width:"100",property:"name",label:"用户名"}),t(c,{fixed:"right",label:"操作","min-width":"50"},{default:e(p=>[t(n,{text:"",type:"info",icon:m(T),onClick:H=>D(p.row),circle:""},null,8,["icon","onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},16)])]),_:1},8,["modelValue"])}}});export{L as default};