import{a as j,E as Z}from"./el-form-item-BvJauXBe.js";import{d as I,h as G,a$ as H,o as S,a0 as V,p as t,m as o,b2 as J,aZ as M,e as l,t as O,x as C,A as W,y as c,q as E,z as X,$ as Y,r as p,ai as ee}from"./index-XuO881sr.js";import{E as oe}from"./el-row-eghH2z0a.js";import{E as te,a as le}from"./el-table-column-5BM1zXQ-.js";/* empty css                  */import{_ as ae}from"./index-CcdWvSxw.js";import"./el-checkbox-Cxc7yQYm.js";import{_ as ne}from"./index-DFHXdJnc.js";/* empty css               */import{u as se,d as re}from"./index-B3ES7G31.js";const ue={class:"dialog-footer"},pe=I({name:"SelectUser"}),we=I({...pe,props:{roleId:{type:[Number,String],required:!0}},emits:["ok"],setup(h,{expose:R,emit:x}){const U=h,{proxy:i}=G(),{sys_normal_disable:T}=H(i?.useDict("sys_normal_disable")),b=p([]),u=p(!1),_=p(0),y=p([]),n=ee({pageNum:1,pageSize:10,roleId:void 0,userName:void 0,phonenumber:void 0}),v=p(),w=p(),q=()=>{n.roleId=U.roleId,m(),u.value=!0},F=s=>{v.value?.toggleRowSelection(s,!1)},$=s=>{y.value=s.map(e=>e.userId)},m=async()=>{const s=await se(n);b.value=s.rows,_.value=s.total},f=()=>{n.pageNum=1,m()},z=()=>{w.value?.resetFields(),m()},B=x,D=async()=>{const s=n.roleId,e=y.value.join(",");if(e==""){i?.$modal.msgError("请选择要分配的用户");return}await re({roleId:s,userIds:e}),i?.$modal.msgSuccess("分配成功"),B("ok"),u.value=!1};return R({show:q}),(s,e)=>{const N=O,g=Z,d=W,K=j,r=le,L=ne,A=te,P=ae,k=oe,Q=J;return S(),V(k,null,{default:t(()=>[o(Q,{modelValue:l(u),"onUpdate:modelValue":e[5]||(e[5]=a=>M(u)?u.value=a:null),title:"选择用户",width:"800px",top:"5vh","append-to-body":""},{footer:t(()=>[E("div",ue,[o(d,{type:"primary",onClick:D},{default:t(()=>[...e[8]||(e[8]=[c("确 定",-1)])]),_:1}),o(d,{onClick:e[4]||(e[4]=a=>u.value=!1)},{default:t(()=>[...e[9]||(e[9]=[c("取 消",-1)])]),_:1})])]),default:t(()=>[o(K,{ref_key:"queryFormRef",ref:w,model:l(n),inline:!0},{default:t(()=>[o(g,{label:"用户名称",prop:"userName"},{default:t(()=>[o(N,{modelValue:l(n).userName,"onUpdate:modelValue":e[0]||(e[0]=a=>l(n).userName=a),placeholder:"请输入用户名称",clearable:"",onKeyup:C(f,["enter"])},null,8,["modelValue"])]),_:1}),o(g,{label:"手机号码",prop:"phonenumber"},{default:t(()=>[o(N,{modelValue:l(n).phonenumber,"onUpdate:modelValue":e[1]||(e[1]=a=>l(n).phonenumber=a),placeholder:"请输入手机号码",clearable:"",onKeyup:C(f,["enter"])},null,8,["modelValue"])]),_:1}),o(g,null,{default:t(()=>[o(d,{type:"primary",icon:"Search",onClick:f},{default:t(()=>[...e[6]||(e[6]=[c("搜索",-1)])]),_:1}),o(d,{icon:"Refresh",onClick:z},{default:t(()=>[...e[7]||(e[7]=[c("重置",-1)])]),_:1})]),_:1})]),_:1},8,["model"]),o(k,null,{default:t(()=>[o(A,{ref_key:"tableRef",ref:v,border:"",data:l(b),height:"260px",onRowClick:F,onSelectionChange:$},{default:t(()=>[o(r,{type:"selection",width:"55"}),o(r,{label:"用户名称",prop:"userName","show-overflow-tooltip":!0}),o(r,{label:"用户昵称",prop:"nickName","show-overflow-tooltip":!0}),o(r,{label:"邮箱",prop:"email","show-overflow-tooltip":!0}),o(r,{label:"手机",prop:"phonenumber","show-overflow-tooltip":!0}),o(r,{label:"状态",align:"center",prop:"status"},{default:t(a=>[o(L,{options:l(T),value:a.row.status},null,8,["options","value"])]),_:1}),o(r,{label:"创建时间",align:"center",prop:"createTime",width:"180"},{default:t(a=>[E("span",null,X(l(i).parseTime(a.row.createTime)),1)]),_:1})]),_:1},8,["data"]),l(_)>0?(S(),V(P,{key:0,page:l(n).pageNum,"onUpdate:page":e[2]||(e[2]=a=>l(n).pageNum=a),limit:l(n).pageSize,"onUpdate:limit":e[3]||(e[3]=a=>l(n).pageSize=a),total:l(_),onPagination:m},null,8,["page","limit","total"])):Y("",!0)]),_:1})]),_:1},8,["modelValue"])]),_:1})}}});export{we as _};
