import{r as c,m as i,v as b,X as r}from"./index.lP_uh0LI.js";import{a as g,J as y}from"./vue.BxlDVA1H.js";function v(a){return a.authorized=0,c({url:`${i.system}role/get_role_users/`,method:"get",params:a})}function x(a,u){return c({url:`${i.system}role/${a}/add_role_users/`,method:"post",data:{users_id:u}})}const R=function({crudExpose:a,context:u}){const d=async e=>await v(e),f=async({form:e,row:o})=>{},m=async({row:e})=>{},h=async({form:e})=>{},s=g([]),p=e=>{const n=a.getTableData().filter(t=>!e.includes(t));r.arrayEach(e,t=>{r.pluck(s.value,"id").includes(t.id)||(s.value=r.union(s.value,[t]))}),r.arrayEach(n,t=>{s.value=r.remove(s.value,l=>l.id!==t.id)})},w=()=>{const e=a.getBaseTableRef(),o=a.getTableData(),n=r.filter(o,t=>r.pluck(s.value,"id").includes(t.id));y(()=>{r.arrayEach(n,t=>{e.toggleRowSelection(t,!0)})})};return{selectedRows:s,crudOptions:{request:{pageRequest:d,addRequest:h,editRequest:f,delRequest:m},actionbar:{show:!1,buttons:{add:{show:!1}}},rowHandle:{show:!1,fixed:"left",width:150,buttons:{view:{show:!1},edit:{show:!1},remove:{show:!1}}},table:{rowKey:"id",onSelectionChange:p,onRefreshed:()=>w()},columns:{$checked:{title:"选择",form:{show:!1},column:{show:!0,type:"selection",align:"center",width:"55px",columnSetDisabled:!0}},_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:e=>{let o=e.index??1,n=a.crudBinding.value.pagination;return((n.currentPage??1)-1)*n.pageSize+o+1}}},name:{title:"用户名",search:{show:!0,component:{props:{clearable:!0}}},type:"text",form:{show:!1}},dept:{title:"部门",show:!0,type:"dict-tree",column:{name:"text",formatter({value:e,row:o,index:n}){return o.dept__name}},search:{show:!0,disabled:!0,col:{span:6},component:{multiple:!1,props:{checkStrictly:!0,clearable:!0,filterable:!0}}},form:{show:!1},dict:b({isTree:!0,url:`${i.system}dept/all_dept/`,value:"id",label:"name"})}}}}},D=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:R},Symbol.toStringTag,{value:"Module"}));export{x as a,D as b,R as c};
