用户/个人

master
DongZeLiang 2024-04-12 14:40:30 +08:00
parent dade4f045e
commit 043b0fc50f
6 changed files with 457 additions and 81 deletions

View File

@ -71,7 +71,100 @@ export default {
const userId = this.$route.params && this.$route.params.userId; const userId = this.$route.params && this.$route.params.userId;
if (userId) { if (userId) {
this.loading = true; this.loading = true;
getAuthRole(userId).then((response) => { let response = {
"code": 200,
"msg": "操作成功",
"data": {
"user": {
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"userId": 2,
"deptId": 105,
"userName": "muyu",
"nickName": "牧雨",
"email": "muyu@qq.com",
"phonenumber": "15666666666",
"sex": "0",
"avatar": "",
"password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
"status": "0",
"delFlag": "0",
"loginIp": "127.0.0.1",
"loginDate": "2023-09-29T11:47:27.000+08:00",
"dept": {
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"deptId": 105,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "测试部门",
"orderNum": 3,
"leader": "muyu",
"phone": null,
"email": null,
"status": "0",
"delFlag": null,
"parentName": null,
"children": []
},
"roles": [
{
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"roleId": 2,
"roleName": "普通角色",
"roleKey": "common",
"roleSort": 2,
"dataScope": "2",
"menuCheckStrictly": false,
"deptCheckStrictly": false,
"status": "0",
"delFlag": null,
"flag": false,
"menuIds": null,
"deptIds": null,
"permissions": null,
"remark": null,
"admin": false
}
],
"roleIds": null,
"postIds": null,
"roleId": null,
"remark": "测试员",
"admin": false
},
"roles": [
{
"createBy": null,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"roleId": 2,
"roleName": "普通角色",
"roleKey": "common",
"roleSort": 2,
"dataScope": "2",
"menuCheckStrictly": true,
"deptCheckStrictly": true,
"status": "0",
"delFlag": "0",
"flag": true,
"menuIds": null,
"deptIds": null,
"permissions": null,
"remark": "普通角色",
"admin": false
}
]
}
}
this.form = response.data.user; this.form = response.data.user;
this.roles = response.data.roles; this.roles = response.data.roles;
this.total = this.roles.length; this.total = this.roles.length;
@ -83,7 +176,6 @@ export default {
}); });
}); });
this.loading = false; this.loading = false;
});
} }
}, },
methods: { methods: {
@ -101,12 +193,8 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
const userId = this.form.userId;
const roleIds = this.roleIds.join(",");
updateAuthRole({userId: userId, roleIds: roleIds}).then((response) => {
this.$modal.msgSuccess("授权成功"); this.$modal.msgSuccess("授权成功");
this.close(); this.close();
});
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close() { close() {

View File

@ -726,19 +726,256 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
getUser().then(response => { let response = {
"code": 200,
"msg": "操作成功",
"data": {
"roles": [
{
"createBy": null,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"roleId": 2,
"roleName": "普通角色",
"roleKey": "common",
"roleSort": 2,
"dataScope": "2",
"menuCheckStrictly": true,
"deptCheckStrictly": true,
"status": "0",
"delFlag": "0",
"flag": false,
"menuIds": null,
"deptIds": null,
"permissions": null,
"remark": "普通角色",
"admin": false
}
],
"posts": [
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 1,
"postCode": "ceo",
"postName": "董事长",
"postSort": 1,
"status": "0",
"flag": false,
"remark": ""
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 2,
"postCode": "se",
"postName": "项目经理",
"postSort": 2,
"status": "0",
"flag": false,
"remark": ""
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 3,
"postCode": "hr",
"postName": "人力资源",
"postSort": 3,
"status": "0",
"flag": false,
"remark": ""
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 4,
"postCode": "user",
"postName": "普通员工",
"postSort": 4,
"status": "0",
"flag": false,
"remark": ""
}
],
"sysUser": null,
"postIds": null,
"roleIds": null
}
};
this.postOptions = response.data.posts; this.postOptions = response.data.posts;
this.roleOptions = response.data.roles; this.roleOptions = response.data.roles;
this.open = true; this.open = true;
this.title = "添加用户"; this.title = "添加用户";
this.form.password = this.initPassword; this.form.password = this.initPassword;
});
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const userId = row.userId || this.ids; let response = {
getUser(userId).then(response => { "code": 200,
"msg": "操作成功",
"data": {
"roles": [
{
"createBy": null,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"roleId": 2,
"roleName": "普通角色",
"roleKey": "common",
"roleSort": 2,
"dataScope": "2",
"menuCheckStrictly": true,
"deptCheckStrictly": true,
"status": "0",
"delFlag": "0",
"flag": false,
"menuIds": null,
"deptIds": null,
"permissions": null,
"remark": "普通角色",
"admin": false
}
],
"posts": [
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 1,
"postCode": "ceo",
"postName": "董事长",
"postSort": 1,
"status": "0",
"flag": false,
"remark": ""
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 2,
"postCode": "se",
"postName": "项目经理",
"postSort": 2,
"status": "0",
"flag": false,
"remark": ""
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 3,
"postCode": "hr",
"postName": "人力资源",
"postSort": 3,
"status": "0",
"flag": false,
"remark": ""
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"postId": 4,
"postCode": "user",
"postName": "普通员工",
"postSort": 4,
"status": "0",
"flag": false,
"remark": ""
}
],
"sysUser": {
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"userId": 2,
"deptId": 105,
"userName": "muyu",
"nickName": "muyu",
"email": "muyu@qq.com",
"phonenumber": "15666666666",
"sex": "0",
"avatar": "",
"password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
"status": "0",
"delFlag": "0",
"loginIp": "127.0.0.1",
"loginDate": "2023-09-29T11:47:27.000+08:00",
"dept": {
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"deptId": 105,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "测试部门",
"orderNum": 3,
"leader": "锐腾",
"phone": null,
"email": null,
"status": "0",
"delFlag": null,
"parentName": null,
"children": []
},
"roles": [
{
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"roleId": 2,
"roleName": "普通角色",
"roleKey": "common",
"roleSort": 2,
"dataScope": "2",
"menuCheckStrictly": false,
"deptCheckStrictly": false,
"status": "0",
"delFlag": null,
"flag": false,
"menuIds": null,
"deptIds": null,
"permissions": null,
"remark": null,
"admin": false
}
],
"roleIds": null,
"postIds": null,
"roleId": null,
"remark": "测试员",
"admin": false
},
"postIds": [
2,
3
],
"roleIds": [
2
]
}
}
this.form = response.data.sysUser; this.form = response.data.sysUser;
this.postOptions = response.data.posts; this.postOptions = response.data.posts;
this.roleOptions = response.data.roles; this.roleOptions = response.data.roles;
@ -747,7 +984,6 @@ export default {
this.open = true; this.open = true;
this.title = "修改用户"; this.title = "修改用户";
this.form.password = ""; this.form.password = "";
});
}, },
/** 重置密码按钮操作 */ /** 重置密码按钮操作 */
handleResetPwd(row) { handleResetPwd(row) {
@ -772,18 +1008,11 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId != undefined) {
updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else { } else {
addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
} }
this.open = false;
} }
}); });
}, },
@ -791,18 +1020,12 @@ export default {
handleDelete(row) { handleDelete(row) {
const userIds = row.userId || this.ids; const userIds = row.userId || this.ids;
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () { this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () {
return delUser(userIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { })
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/user/export', { this.$modal.msgSuccess("导入成功");
...this.queryParams
}, `user_${new Date().getTime()}.xlsx`)
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
@ -811,7 +1034,7 @@ export default {
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate() { importTemplate() {
this.download('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`) this.$modal.msgSuccess("下载成功");
}, },
// //
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
@ -819,15 +1042,12 @@ export default {
}, },
// //
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
this.upload.open = false; this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>导入成功</div>", "导入结果", {dangerouslyUseHTMLString: true});
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.data.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
this.getList();
}, },
// //
submitFileForm() { submitFileForm() {
this.$refs.upload.submit(); this.upload.open = false;
this.$modal.msgSuccess("导入成功");
} }
} }
}; };

View File

@ -86,11 +86,91 @@ export default {
}, },
methods: { methods: {
getUser() { getUser() {
getUserProfile().then(response => { let response = {
"code": 200,
"msg": "操作成功",
"data": {
"sysUser": {
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"params": {
"@type": "java.util.HashMap"
},
"userId": 1,
"deptId": 103,
"userName": "admin",
"nickName": "牧鱼",
"email": "muyu@163.com",
"phonenumber": "15888888888",
"sex": "1",
"avatar": "",
"password": "$2a$10$JLwI8tUw7QMF1PbVlwWXbu86vvVEFz0ntbrSXxZXuA71dHlnSSeJi",
"status": "0",
"delFlag": "0",
"loginIp": "114.95.174.13",
"loginDate": "2024-04-11T18:35:00.000+08:00",
"dept": {
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"params": {
"@type": "java.util.HashMap"
},
"deptId": 103,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "研发部门",
"orderNum": 1,
"leader": "牧鱼",
"phone": null,
"email": null,
"status": "0",
"delFlag": null,
"parentName": null,
"children": []
},
"roles": [
{
"createBy": null,
"createTime": null,
"updateBy": null,
"updateTime": null,
"params": {
"@type": "java.util.HashMap"
},
"roleId": 1,
"roleName": "超级管理员",
"roleKey": "admin",
"roleSort": 1,
"dataScope": "1",
"menuCheckStrictly": false,
"deptCheckStrictly": false,
"status": "0",
"delFlag": null,
"flag": false,
"menuIds": null,
"deptIds": null,
"permissions": null,
"remark": null,
"admin": true
}
],
"roleIds": null,
"postIds": null,
"roleId": null,
"remark": "管理员",
"admin": true
},
"roleGroup": "超级管理员",
"postGroup": "董事长"
}
}
this.user = response.data.sysUser; this.user = response.data.sysUser;
this.roleGroup = response.data.roleGroup; this.roleGroup = response.data.roleGroup;
this.postGroup = response.data.postGroup; this.postGroup = response.data.postGroup;
});
} }
} }
}; };

View File

@ -54,9 +54,7 @@ export default {
submit() { submit() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
});
} }
}); });
}, },

View File

@ -133,15 +133,9 @@ export default {
// //
uploadImg() { uploadImg() {
this.$refs.cropper.getCropBlob(data => { this.$refs.cropper.getCropBlob(data => {
let formData = new FormData();
formData.append("avatarfile", data);
uploadAvatar(formData).then(response => {
this.open = false;
this.options.img = process.env.VUE_APP_BASE_API + response.data.imgUrl;
store.commit('SET_AVATAR', this.options.img);
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.visible = false; this.visible = false;
}); this.open = false;
}); });
}, },
// //

View File

@ -60,12 +60,8 @@ export default {
methods: { methods: {
submit() { submit() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) {
updateUserProfile(this.user).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
}); });
}
});
}, },
close() { close() {
this.$tab.closePage(); this.$tab.closePage();