Agriculture-front-end/dist/assets/selectUser.78af3543.js

2 lines
3.3 KiB
JavaScript
Raw Normal View History

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