import{r as f,B as F,d as s,o as P,l as Q,f as l,p as _,e,m as y,h as n,k as N,z as A,G as E,F as G,H,I as O,v as J}from"./index-TnLvmlMR.js";import{u as M,d as W}from"./role-4U779guX.js";const X={class:"dialog-footer"},Y=O({name:"SelectUser"}),oe=Object.assign(Y,{props:{roleId:{type:[Number,String]}},emits:["ok"],setup(S,{expose:I,emit:k}){const V=S,{proxy:p}=J(),{sys_normal_disable:C}=p.useDict("sys_normal_disable"),h=f([]),i=f(!1),g=f(0),v=f([]),a=F({pageNum:1,pageSize:10,roleId:void 0,userName:void 0,phonenumber:void 0});function x(){a.roleId=V.roleId,b(),i.value=!0}function U(r){p.$refs.refTable.toggleRowSelection(r)}function R(r){v.value=r.map(o=>o.userId)}function b(){M(a).then(r=>{h.value=r.rows,g.value=r.total})}function m(){a.pageNum=1,b()}function T(){p.resetForm("queryRef"),m()}const K=k;function z(){const r=a.roleId,o=v.value.join(",");if(o==""){p.$modal.msgError("请选择要分配的用户");return}W({roleId:r,userIds:o}).then(d=>{p.$modal.msgSuccess(d.msg),d.code===200&&(i.value=!1,K("ok"))})}return I({show:x}),(r,o)=>{const d=s("el-input"),w=s("el-form-item"),c=s("el-button"),B=s("el-form"),u=s("el-table-column"),$=s("dict-tag"),q=s("el-table"),D=s("pagination"),L=s("el-row"),j=s("el-dialog");return P(),Q(j,{title:"选择用户",modelValue:n(i),"onUpdate:modelValue":o[5]||(o[5]=t=>H(i)?i.value=t:null),width:"800px",top:"5vh","append-to-body":""},{footer:l(()=>[y("div",X,[e(c,{type:"primary",onClick:z},{default:l(()=>[_("确 定")]),_:1}),e(c,{onClick:o[4]||(o[4]=t=>i.value=!1)},{default:l(()=>[_("取 消")]),_:1})])]),default:l(()=>[e(B,{model:n(a),ref:"queryRef",inline:!0},{default:l(()=>[e(w,{label:"用户名称",prop:"userName"},{default:l(()=>[e(d,{modelValue:n(a).userName,"onUpdate:modelValue":o[0]||(o[0]=t=>n(a).userName=t),placeholder:"请输入用户名称",clearable:"",style:{width:"200px"},onKeyup:N(m,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),e(w,{label:"手机号码",prop:"phonenumber"},{default:l(()=>[e(d,{modelValue:n(a).phonenumber,"onUpdate:modelValue":o[1]||(o[1]=t=>n(a).phonenumber=t),placeholder:"请输入手机号码",clearable:"",style:{width:"200px"},onKeyup:N(m,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),e(w,null,{default:l(()=>[e(c,{type:"primary",icon:"Search",onClick:m},{default:l(()=>[_("搜索")]),_:1}),e(c,{icon:"Refresh",onClick:T},{default:l(()=>[_("重置")]),_:1})]),_:1})]),_:1},8,["model"]),e(L,null,{default:l(()=>[e(q,{onRowClick:U,ref:"refTable",data:n(h),onSelectionChange:R,height:"260px"},{default:l(()=>[e(u,{type:"selection",width:"55"}),e(u,{label:"用户名称",prop:"userName","show-overflow-tooltip":!0}),e(u,{label:"用户昵称",prop:"nickName","show-overflow-tooltip":!0}),e(u,{label:"邮箱",prop:"email","show-overflow-tooltip":!0}),e(u,{label:"手机",prop:"phonenumber","show-overflow-tooltip":!0}),e(u,{label:"状态",align:"center",prop:"status"},{default:l(t=>[e($,{options:n(C),value:t.row.status},null,8,["options","value"])]),_:1}),e(u,{label:"创建时间",align:"center",prop:"createTime",width:"180"},{default:l(t=>[y("span",null,A(r.parseTime(t.row.createTime)),1)]),_:1})]),_:1},8,["data"]),G(e(D,{total:n(g),page:n(a).pageNum,"onUpdate:page":o[2]||(o[2]=t=>n(a).pageNum=t),limit:n(a).pageSize,"onUpdate:limit":o[3]||(o[3]=t=>n(a).pageSize=t),onPagination:b},null,8,["total","page","limit"]),[[E,n(g)>0]])]),_:1})]),_:1},8,["modelValue"])}}});export{oe as default};
