2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
|
import{G as e,u as l,r as a,I as t,ak as u,U as o,a2 as d,d as s,T as n,o as r,c as i,e as p,w as m,l as c,f,J as v,K as b,j as h,V as y,W as g,k as _,n as k,M as V,m as w,A as x,v as I}from"./index.e5c8b0d6.js";import{e as U,l as N,f as C,h as S,r as $,i as R,j as T,k as D}from"./user.cbff96c4.js";const q={class:"app-container"},K={class:"head-container"},P={class:"head-container"},M={class:"dialog-footer"},j=c("div",{class:"el-upload__text"},[k("将文件拖到此处,或"),c("em",null,"点击上传")],-1),z={class:"el-upload__tip text-center"},Y={class:"el-upload__tip"},B=c("span",null,"仅允许导入xls、xlsx格式文件。",-1),E={class:"dialog-footer"},O=e({name:"User"}),A=Object.assign(O,{setup(e){const O=l(),{proxy:A}=I(),{sys_normal_disable:F,sys_user_sex:G}=A.useDict("sys_normal_disable","sys_user_sex"),H=a([]),J=a(!1),L=a(!0),Q=a(!0),W=a([]),X=a(!0),Z=a(!0),ee=a(0),le=a(""),ae=a([]),te=a(""),ue=a(void 0),oe=a(void 0),de=a([]),se=a([]),ne=t({open:!1,title:"",isUploading:!1,updateSupport:0,headers:{Authorization:"Bearer "+u()},url:"http://36.134.44.75:6901/system/user/importData"}),re=a([{key:0,label:"用户编号",visible:!0},{key:1,label:"用户名称",visible:!0},{key:2,label:"用户昵称",visible:!0},{key:3,label:"部门",visible:!0},{key:4,label:"手机号码",visible:!0},{key:5,label:"状态",visible:!0},{key:6,label:"创建时间",visible:!0}]),ie=t({form:{},queryParams:{pageNum:1,pageSize:10,userName:void 0,phonenumber:void 0,status:void 0,deptId:void 0},rules:{userName:[{required:!0,message:"用户名称不能为空",trigger:"blur"},{min:2,max:20,message:"用户名称长度必须介于 2 和 20 之间",trigger:"blur"}],nickName:[{required:!0,message:"用户昵称不能为空",trigger:"blur"}],password:[{required:!0,message:"用户密码不能为空",trigger:"blur"},{min:5,max:20,message:"用户密码长度必须介于 5 和 20 之间",trigger:"blur"}],email:[{type:"email",message:"请输入正确的邮箱地址",trigger:["blur","change"]}],phonenumber:[{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]}}),{queryParams:pe,form:me,rules:ce}=o(ie),fe=(e,l)=>!e||-1!==l.label.indexOf(e);function ve(){L.value=!0,N(A.addDateRange(pe.value,ae.value)).then((e=>{L.value=!1,H.value=e.rows,ee.value=e.total}))}function be(e){pe.value.deptId=e.id,he()}function he(){pe.value.pageNum=1,ve()}function ye(){ae.value=[],A.resetForm("queryRef"),pe.value.deptId=void 0,A.$refs.tree.setCurrentKey(null),he()}function ge(e){const l=e.userId||W.value;A.$modal.confirm('是否确认删除用户编号为"'+l+'"的数据项?').then((function(){return C(l)})).then((()=>{ve(),A.$modal.msgSuccess("删除成功")})).catch((()=>{}))}function _e(){A.download("system/user/export",{...pe.value},`user_${(new Date).getTime()}.xlsx`)}function ke(e){W.value=e.map((e=>e.userId)),X.value=1!=e.length,Z.value=!e.length}function Ve(){ne.title="用户导入",ne.open=!0}function we(){A.download("system/user/importTemplate",{},`user_template_${(new Date).getTime()}.xlsx`)}d(te,(e=>{A.$refs.deptTreeRef.filter(e)}));const xe=(e,l,a)=>{ne.isUploading=!0},Ie=(e,l,a)=>{ne.open=!1,ne.isUploading=!1,A.$refs.uploadRef.handleRemove(l),A.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>"+e.msg+"</div>","导入结果",{dangerouslyUseHTMLString:!0}),ve()};function Ue(){A.$refs.uploadRef.submit()}function Ne(){me.value={userId:void 0,deptId:void 0,userName:void 0,nickName:void 0,password:void 0,phonenumber:void 0,email:void 0,sex:void 0,status:"0",remark:void 0,postIds:[],roleIds:[]},A.resetForm("userRef")}function Ce(){J.value=!1,Ne()}function Se(){Ne(),R().then((e=>{de.value=e.posts,se.value=e.roles,J.value=!0,le.value="添加用户",me.value.password=oe.value}))}function $e(e){Ne();const l=e.userId||W.value;R(l).then((e=>{me.value=e.data,de.value=e.posts,se.value=e.roles,me.value.postIds=e.postIds,me.value.roleIds=e.roleIds,J.value=!0,le.value="修改用户",me.password=""}))}function Re(){A.$refs.userRef.validate((e=>{e&&(null!=me.value.userId?T(me.value).then((e=>
|