2 lines
20 KiB
JavaScript
2 lines
20 KiB
JavaScript
webpackJsonp([15],{FTz3:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l=a("mvHQ"),o=a.n(l),r={data:function(){return{roleOptions:[],departmentOptions:[],labelOptions:[],roleForm:{},editForm:{},detailForm:{},editPasswordForm:{},queryInfo:{authorityId:JSON.parse(localStorage.getItem("userInfo")).authorityId,username:"",nick:"",phone:"",pageNum:1,pageSize:10},currUserAuthorityId:JSON.parse(localStorage.getItem("userInfo")).authorityId,currpage:1,userList:[],total:0,addDialogVisible:!1,editDialogVisible:!1,detailDialogVisible:!1,editPasswordDialogVisible:!1,addForm:{username:"",password:"",nick:"",phone:"",email:"",authorityId:"",department:"",label:"",comments:""},addFormRules:{username:[{required:!0,message:"请输入用户名",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:6,max:16,message:"长度在 6 到 16 个字符",trigger:"blur"}],nick:[{required:!0,message:"请输入姓名",trigger:"blur"},{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],authorityId:[{required:!0,message:"请选择角色",trigger:"blur"}],department:[{required:!0,message:"请选择部门",trigger:"blur"}],label:[{required:!0,message:"请选择标签",trigger:"blur"}],phone:[{required:!0,message:"请输入手机号",trigger:"blur"},{validator:function(e,t,a){if(/^1(3|4|5|6|7|8|9)\d{9}$/.test(t))return a();a(new Error("请输入合法的手机号"))},trigger:"blur",max:11}],email:[{required:!0,message:"请输入电子邮箱",trigger:"blur"},{validator:function(e,t,a){if(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t))return a();a(new Error("请输入合法的邮箱"))},trigger:"blur",max:100}],comments:[{required:!1,message:"请输入备注",trigger:"blur"},{min:0,max:255,message:"长度在 0 到 255 个字符",trigger:"blur"}]},editPasswordFormRules:{password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:6,max:16,message:"长度在 6 到 16 个字符",trigger:"blur"}],confirmPassword:[{required:!0,message:"请输入确认密码",trigger:"blur"},{min:6,max:16,message:"长度在 6 到 16 个字符",trigger:"blur"}]}}},mounted:function(){this.getRoleNameList()},created:function(){this.getUsersList(),this.getDepartmentAndLabelList()},methods:{getDepartmentAndLabelList:function(){var e=this;this.$api.dict.queryAllDataDict().then(function(t){e.departmentOptions=t.data.data.userDepartment,e.labelOptions=t.data.data.userLabel}).catch(function(){})},editPasswordDialogClose:function(){this.$refs.editPasswordFormRef.resetFields(),this.editPasswordDialogVisible=!1},showEditPasswordDialog:function(e){this.editPasswordDialogVisible=!0,this.editPasswordForm.id=e},setEditPasswordFormInputStyle:function(){document.querySelectorAll(".edit-password-input").forEach(function(e){e.style.border="1px solid red",e.style.borderRadius="5px"})},editPassword:function(){var e=this;this.$refs.editPasswordFormRef.validate(function(t){t&&(e.editPasswordForm.password==e.editPasswordForm.confirmPassword?e.$api.user.editPassword2(o()(e.editPasswordForm)).then(function(t){e.$notify({type:"success",message:t.data.msg}),e.editPasswordDialogVisible=!1,e.$refs.editPasswordFormRef.resetFields()}).catch(function(){}):e.$notify({type:"warning",message:"两次输入的密码不一致"}))})},editPasswordCancel:function(){this.$refs.editPasswordFormRef.resetFields(),this.editPasswordDialogVisible=!1},detailDialogClose:function(){this.detailDialogVisible=!1},showDetailDialog:function(e){var t=this;this.detailDialogVisible=!0,this.$api.user.queryUserById(e).then(function(e){t.detailForm=e.data.data}).catch(function(){})},getRoleName:function(e){return e.forEach(function(e){roleOptions.forEach(function(t){e.authorityId==t.roleId&&(e.authorityId=t.roleName)})}),e},getRoleNameList:function(){var e=this;this.$api.role.queryAllRole().then(function(t){var a=t.data.data;a.forEach(function(e,t,a){e.roleId<JSON.parse(localStorage.getItem("userInfo")).authorityId&&a.splice(t,1)}),e.roleOptions=a}).catch(function(){})},selectUsersList:function(){this.queryInfo.pageNum=1,this.total=0,this.getUsersList()},getUsersList:function(){var e=this;this.$api.user.queryAllUser(o()(this.queryInfo)).then(function(t){e.loading=!1,e.userList=t.data.data,e.total=t.data.count,e.queryInfo.pageNum=1}).catch(function(){})},handleSizeChange:function(e){this.queryInfo.pageSize=e,this.getUsersList()},handleCurrentChange:function(e){this.queryInfo.pageNum=e,this.getUsersList()},addDialogClose:function(){this.$refs.addFormRef.resetFields()},addUser:function(){var e=this;this.$refs.addFormRef.validate(function(t){t&&e.$api.user.addUser(o()(e.addForm)).then(function(t){e.$notify({type:"success",message:t.data.msg}),e.addDialogVisible=!1,e.selectUsersList()}).catch(function(){})})},editDialogClose:function(){this.$refs.editFormRef.resetFields()},showEditDialog:function(e){var t=this;this.editDialogVisible=!0,this.$api.user.queryUserById(e).then(function(e){t.editForm=e.data.data}).catch(function(){})},editUser:function(){var e=this;this.$refs.editFormRef.validate(function(t){t&&e.$api.user.editUser(o()(e.editForm)).then(function(t){e.$notify({type:"success",message:t.data.msg}),e.editDialogVisible=!1,e.selectUsersList()}).catch(function(){})})},delUser:function(e){var t=this;this.$confirm("确定删除该用户吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){t.$api.user.delUserById(e).then(function(e){t.$notify({type:"success",message:e.data.msg}),t.selectUsersList()}).catch(function(){})}).catch(function(){})}}},i={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"user-box"},[a("el-form",{staticClass:"user-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:"用户名"}},[a("el-input",{attrs:{placeholder:"请输入用户名关键字",clearable:""},model:{value:e.queryInfo.username,callback:function(t){e.$set(e.queryInfo,"username",t)},expression:"queryInfo.username"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"姓名"}},[a("el-input",{attrs:{placeholder:"请输入姓名关键字",clearable:""},model:{value:e.queryInfo.nick,callback:function(t){e.$set(e.queryInfo,"nick",t)},expression:"queryInfo.nick"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"手机号"}},[a("el-input",{attrs:{placeholder:"请输入手机号码",clearable:""},model:{value:e.queryInfo.phone,callback:function(t){e.$set(e.queryInfo,"phone",t)},expression:"queryInfo.phone"}})],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:e.selectUsersList}},[e._v("查询")])],1),e._v(" "),a("el-row",[a("el-col",{attrs:{span:2}},[a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.addDialogVisible=!0}}},[e._v("添加")])],1)],1)],1)],1),e._v(" "),a("el-table",{attrs:{data:e.userList.slice((e.currpage-1)*e.queryInfo.pageSize,e.currpage*e.queryInfo.pageSize),border:"",fit:!0}},[a("el-table-column",{attrs:{label:"序号",type:"index",align:"center",width:"80"}}),e._v(" "),a("el-table-column",{attrs:{label:"用户名",prop:"username",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{label:"姓名",prop:"nick",width:"100"}}),e._v(" "),a("el-table-column",{attrs:{label:"角色",prop:"authorityId",width:"120"}}),e._v(" "),a("el-table-column",{attrs:{label:"手机号",prop:"phone",width:"120"}}),e._v(" "),a("el-table-column",{attrs:{label:"邮箱",prop:"email",width:"200","show-overflow-tooltip":""}}),e._v(" "),a("el-table-column",{attrs:{label:"部门",prop:"department",width:"130","show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(t){return e._l(e.departmentOptions,function(l){return a("div",{key:l.id,attrs:{label:l.dictValue}},[t.row.department==l.dictCode?a("el-input",{model:{value:l.dictValue,callback:function(t){e.$set(l,"dictValue",t)},expression:"item.dictValue"}}):e._e()],1)})}}])}),e._v(" "),a("el-table-column",{attrs:{label:"标签",prop:"label",width:"130","show-overflow-tooltip":""},scopedSlots:e._u([{key:"default",fn:function(t){return e._l(e.labelOptions,function(l){return a("div",{key:l.id,attrs:{label:l.dictValue}},[t.row.label==l.dictCode?a("el-input",{model:{value:l.dictValue,callback:function(t){e.$set(l,"dictValue",t)},expression:"item.dictValue"}}):e._e()],1)})}}])}),e._v(" "),a("el-table-column",{attrs:{label:"创建时间",prop:"createTime",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{label:"更新时间",prop:"updateTime",width:"160"}}),e._v(" "),a("el-table-column",{attrs:{label:"备注",prop:"comments","show-overflow-tooltip":""}}),e._v(" "),a("el-table-column",{attrs:{label:"操作",fixed:"right",width:"250px",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-tooltip",{attrs:{content:"查看",placement:"top",enterable:!1}},[a("el-button",{attrs:{type:"text",size:"small",disabled:t.row.authorityId<e.currUserAuthorityId},on:{click:function(a){return e.showDetailDialog(t.row.id)}}},[e._v("查看")])],1),e._v(" "),a("el-tooltip",{attrs:{content:"编辑",placement:"top",enterable:!1}},[a("el-button",{attrs:{type:"text",size:"small",disabled:t.row.authorityId<e.currUserAuthorityId},on:{click:function(a){return e.showEditDialog(t.row.id)}}},[e._v("编辑")])],1),e._v(" "),a("el-tooltip",{attrs:{content:"修改密码",placement:"top",enterable:!1}},[a("el-button",{attrs:{type:"text",size:"small",disabled:t.row.authorityId<e.currUserAuthorityId},on:{click:function(a){return e.showEditPasswordDialog(t.row.id)}}},[e._v("修改密码")])],1),e._v(" "),a("el-tooltip",{attrs:{content:"删除",placement:"top",enterable:!1}},[a("el-button",{attrs:{type:"text",size:"small",disabled:t.row.authorityId<e.currUserAuthorityId},on:{click:function(a){return e.delUser(t.row.id)}}},[e._v("删除")])],1)]}}])})],1),e._v(" "),a("el-pagination",{attrs:{"current-page":e.currpage,"page-sizes":[5,10,20,30],"page-size":e.queryInfo.pageSize,layout:"prev, pager, next, sizes, total, jumper",total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),e._v(" "),a("el-dialog",{attrs:{title:"添加用户",visible:e.addDialogVisible,"close-on-click-modal":!1,width:"40%"},on:{"update:visible":function(t){e.addDialogVisible=t},close:e.addDialogClose}},[a("el-form",{ref:"addFormRef",attrs:{model:e.addForm,rules:e.addFormRules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"用户名",prop:"username"}},[a("el-input",{attrs:{placeholder:"请输入用户名"},model:{value:e.addForm.username,callback:function(t){e.$set(e.addForm,"username",t)},expression:"addForm.username"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"密码",prop:"password"}},[a("el-input",{attrs:{placeholder:"请输入密码"},model:{value:e.addForm.password,callback:function(t){e.$set(e.addForm,"password",t)},expression:"addForm.password"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"姓名",prop:"nick"}},[a("el-input",{attrs:{placeholder:"请输入姓名"},model:{value:e.addForm.nick,callback:function(t){e.$set(e.addForm,"nick",t)},expression:"addForm.nick"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"角色",prop:"authorityId"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.addForm.authorityId,callback:function(t){e.$set(e.addForm,"authorityId",t)},expression:"addForm.authorityId"}},e._l(e.roleOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.roleName,value:e.roleId}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"部门",prop:"department"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.addForm.department,callback:function(t){e.$set(e.addForm,"department",t)},expression:"addForm.department"}},e._l(e.departmentOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.dictValue,value:e.dictCode}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"标签",prop:"label"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.addForm.label,callback:function(t){e.$set(e.addForm,"label",t)},expression:"addForm.label"}},e._l(e.labelOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.dictValue,value:e.dictCode}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"手机号",prop:"phone"}},[a("el-input",{attrs:{placeholder:"请输入手机号号码"},model:{value:e.addForm.phone,callback:function(t){e.$set(e.addForm,"phone",t)},expression:"addForm.phone"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"邮箱",prop:"email"}},[a("el-input",{attrs:{placeholder:"请输入邮箱地址"},model:{value:e.addForm.email,callback:function(t){e.$set(e.addForm,"email",t)},expression:"addForm.email"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"备注",prop:"comments"}},[a("el-input",{attrs:{type:"textarea",placeholder:"请输入备注信息"},model:{value:e.addForm.comments,callback:function(t){e.$set(e.addForm,"comments",t)},expression:"addForm.comments"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.addDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.addUser}},[e._v("确 定")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"修改用户",visible:e.editDialogVisible,"close-on-click-modal":!1,width:"40%"},on:{"update:visible":function(t){e.editDialogVisible=t},close:e.editDialogClose}},[a("el-form",{ref:"editFormRef",attrs:{model:e.editForm,rules:e.addFormRules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"用户名",prop:"username"}},[a("el-input",{attrs:{disabled:""},model:{value:e.editForm.username,callback:function(t){e.$set(e.editForm,"username",t)},expression:"editForm.username"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"姓名",prop:"nick"}},[a("el-input",{attrs:{placeholder:"请输入姓名"},model:{value:e.editForm.nick,callback:function(t){e.$set(e.editForm,"nick",t)},expression:"editForm.nick"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"角色",prop:"authorityId"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.editForm.authorityId,callback:function(t){e.$set(e.editForm,"authorityId",t)},expression:"editForm.authorityId"}},e._l(e.roleOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.roleName,value:e.roleId+""}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"部门",prop:"department"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.editForm.department,callback:function(t){e.$set(e.editForm,"department",t)},expression:"editForm.department"}},e._l(e.departmentOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.dictValue,value:e.dictCode}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"标签",prop:"label"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.editForm.label,callback:function(t){e.$set(e.editForm,"label",t)},expression:"editForm.label"}},e._l(e.labelOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.dictValue,value:e.dictCode}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"手机号",prop:"phone"}},[a("el-input",{attrs:{placeholder:"请输入手机号号码"},model:{value:e.editForm.phone,callback:function(t){e.$set(e.editForm,"phone",t)},expression:"editForm.phone"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"邮箱",prop:"email"}},[a("el-input",{attrs:{placeholder:"请输入邮箱地址"},model:{value:e.editForm.email,callback:function(t){e.$set(e.editForm,"email",t)},expression:"editForm.email"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"备注",prop:"comments"}},[a("el-input",{attrs:{type:"textarea",placeholder:"请输入备注信息"},model:{value:e.editForm.comments,callback:function(t){e.$set(e.editForm,"comments",t)},expression:"editForm.comments"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.editDialogVisible=!1}}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.editUser}},[e._v("确 定")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"查看用户",visible:e.detailDialogVisible,"close-on-click-modal":!1,width:"40%"},on:{"update:visible":function(t){e.detailDialogVisible=t},close:e.detailDialogClose}},[a("el-form",{ref:"detailFormRef",attrs:{model:e.detailForm,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"用户名",prop:"username"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.username,callback:function(t){e.$set(e.detailForm,"username",t)},expression:"detailForm.username"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"姓名",prop:"nick"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.nick,callback:function(t){e.$set(e.detailForm,"nick",t)},expression:"detailForm.nick"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"角色",prop:"authorityId"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择",disabled:""},model:{value:e.detailForm.authorityId,callback:function(t){e.$set(e.detailForm,"authorityId",t)},expression:"detailForm.authorityId"}},e._l(e.roleOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.roleName,value:e.roleId+""}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"部门",prop:"department"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择",disabled:""},model:{value:e.detailForm.department,callback:function(t){e.$set(e.detailForm,"department",t)},expression:"detailForm.department"}},e._l(e.departmentOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.dictValue,value:e.dictCode}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"标签",prop:"label"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择",disabled:""},model:{value:e.detailForm.label,callback:function(t){e.$set(e.detailForm,"label",t)},expression:"detailForm.label"}},e._l(e.labelOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.dictValue,value:e.dictCode}})}),1)],1),e._v(" "),a("el-form-item",{attrs:{label:"手机号",prop:"phone"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.phone,callback:function(t){e.$set(e.detailForm,"phone",t)},expression:"detailForm.phone"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"邮箱",prop:"email"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.email,callback:function(t){e.$set(e.detailForm,"email",t)},expression:"detailForm.email"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"备注",prop:"comments"}},[a("el-input",{attrs:{type:"textarea",disabled:""},model:{value:e.detailForm.comments,callback:function(t){e.$set(e.detailForm,"comments",t)},expression:"detailForm.comments"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.detailDialogVisible=!1}}},[e._v("取 消")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"修改密码",visible:e.editPasswordDialogVisible,"close-on-click-modal":!1,width:"30%"},on:{"update:visible":function(t){e.editPasswordDialogVisible=t},close:e.editPasswordDialogClose}},[a("el-form",{ref:"editPasswordFormRef",attrs:{model:e.editPasswordForm,rules:e.editPasswordFormRules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"密码",prop:"password"}},[a("el-input",{staticClass:"edit-password-input",model:{value:e.editPasswordForm.password,callback:function(t){e.$set(e.editPasswordForm,"password",t)},expression:"editPasswordForm.password"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"确认密码",prop:"confirmPassword"}},[a("el-input",{staticClass:"edit-password-input",model:{value:e.editPasswordForm.confirmPassword,callback:function(t){e.$set(e.editPasswordForm,"confirmPassword",t)},expression:"editPasswordForm.confirmPassword"}})],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.editPasswordCancel}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.editPassword}},[e._v("确 定")])],1)],1)],1)},staticRenderFns:[]};var s=a("VU/8")(r,i,!1,function(e){a("scMR")},"data-v-a8a0ac7a",null);t.default=s.exports},scMR:function(e,t){}});
|
|
//# sourceMappingURL=15.889f7b2bb5d5d0f90428.js.map
|