diff --git a/src/views/system/user/authRole.vue b/src/views/system/user/authRole.vue index e849c05..f4229b9 100644 --- a/src/views/system/user/authRole.vue +++ b/src/views/system/user/authRole.vue @@ -71,19 +71,111 @@ export default { const userId = this.$route.params && this.$route.params.userId; if (userId) { this.loading = true; - getAuthRole(userId).then((response) => { - this.form = response.data.user; - this.roles = response.data.roles; - this.total = this.roles.length; - this.$nextTick(() => { - this.roles.forEach((row) => { - if (row.flag) { - this.$refs.table.toggleRowSelection(row); + 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.roles = response.data.roles; + this.total = this.roles.length; + this.$nextTick(() => { + this.roles.forEach((row) => { + if (row.flag) { + this.$refs.table.toggleRowSelection(row); + } }); - this.loading = false; }); + this.loading = false; } }, methods: { @@ -101,12 +193,8 @@ export default { }, /** 提交按钮 */ submitForm() { - const userId = this.form.userId; - const roleIds = this.roleIds.join(","); - updateAuthRole({userId: userId, roleIds: roleIds}).then((response) => { - this.$modal.msgSuccess("授权成功"); - this.close(); - }); + this.$modal.msgSuccess("授权成功"); + this.close(); }, /** 关闭按钮 */ close() { diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 36dc797..7bfc950 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -726,28 +726,264 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - getUser().then(response => { - this.postOptions = response.data.posts; - this.roleOptions = response.data.roles; - this.open = true; - this.title = "添加用户"; - this.form.password = this.initPassword; - }); + 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.roleOptions = response.data.roles; + this.open = true; + this.title = "添加用户"; + this.form.password = this.initPassword; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); - const userId = row.userId || this.ids; - getUser(userId).then(response => { - this.form = response.data.sysUser; - this.postOptions = response.data.posts; - this.roleOptions = response.data.roles; - this.$set(this.form, "postIds", response.data.postIds); - this.$set(this.form, "roleIds", response.data.roleIds); - this.open = true; - this.title = "修改用户"; - this.form.password = ""; - }); + 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": { + "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.postOptions = response.data.posts; + this.roleOptions = response.data.roles; + this.$set(this.form, "postIds", response.data.postIds); + this.$set(this.form, "roleIds", response.data.roleIds); + this.open = true; + this.title = "修改用户"; + this.form.password = ""; }, /** 重置密码按钮操作 */ handleResetPwd(row) { @@ -772,18 +1008,11 @@ export default { this.$refs["form"].validate(valid => { if (valid) { if (this.form.userId != undefined) { - updateUser(this.form).then(response => { - this.$modal.msgSuccess("修改成功"); - this.open = false; - this.getList(); - }); + this.$modal.msgSuccess("修改成功"); } else { - addUser(this.form).then(response => { - this.$modal.msgSuccess("新增成功"); - this.open = false; - this.getList(); - }); + this.$modal.msgSuccess("新增成功"); } + this.open = false; } }); }, @@ -791,18 +1020,12 @@ export default { handleDelete(row) { const userIds = row.userId || this.ids; this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () { - return delUser(userIds); - }).then(() => { - this.getList(); this.$modal.msgSuccess("删除成功"); - }).catch(() => { - }); + }) }, /** 导出按钮操作 */ handleExport() { - this.download('system/user/export', { - ...this.queryParams - }, `user_${new Date().getTime()}.xlsx`) + this.$modal.msgSuccess("导入成功"); }, /** 导入按钮操作 */ handleImport() { @@ -811,7 +1034,7 @@ export default { }, /** 下载模板操作 */ importTemplate() { - this.download('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`) + this.$modal.msgSuccess("下载成功"); }, // 文件上传中处理 handleFileUploadProgress(event, file, fileList) { @@ -819,15 +1042,12 @@ export default { }, // 文件上传成功处理 handleFileSuccess(response, file, fileList) { - this.upload.open = false; - this.upload.isUploading = false; - this.$refs.upload.clearFiles(); - this.$alert("
" + response.data.msg + "
", "导入结果", {dangerouslyUseHTMLString: true}); - this.getList(); + this.$alert("
导入成功
", "导入结果", {dangerouslyUseHTMLString: true}); }, // 提交上传文件 submitFileForm() { - this.$refs.upload.submit(); + this.upload.open = false; + this.$modal.msgSuccess("导入成功"); } } }; diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue index 6638d48..e43d708 100644 --- a/src/views/system/user/profile/index.vue +++ b/src/views/system/user/profile/index.vue @@ -86,11 +86,91 @@ export default { }, methods: { getUser() { - getUserProfile().then(response => { - this.user = response.data.sysUser; - this.roleGroup = response.data.roleGroup; - this.postGroup = response.data.postGroup; - }); + 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.roleGroup = response.data.roleGroup; + this.postGroup = response.data.postGroup; } } }; diff --git a/src/views/system/user/profile/resetPwd.vue b/src/views/system/user/profile/resetPwd.vue index 7b13b3c..c8a1f86 100644 --- a/src/views/system/user/profile/resetPwd.vue +++ b/src/views/system/user/profile/resetPwd.vue @@ -54,9 +54,7 @@ export default { submit() { this.$refs["form"].validate(valid => { if (valid) { - updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => { - this.$modal.msgSuccess("修改成功"); - }); + this.$modal.msgSuccess("修改成功"); } }); }, diff --git a/src/views/system/user/profile/userAvatar.vue b/src/views/system/user/profile/userAvatar.vue index ac546de..a9465e7 100644 --- a/src/views/system/user/profile/userAvatar.vue +++ b/src/views/system/user/profile/userAvatar.vue @@ -133,15 +133,9 @@ export default { // 上传图片 uploadImg() { 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.visible = false; - }); + this.$modal.msgSuccess("修改成功"); + this.visible = false; + this.open = false; }); }, // 实时预览 diff --git a/src/views/system/user/profile/userInfo.vue b/src/views/system/user/profile/userInfo.vue index e64d897..0c8b037 100644 --- a/src/views/system/user/profile/userInfo.vue +++ b/src/views/system/user/profile/userInfo.vue @@ -60,11 +60,7 @@ export default { methods: { submit() { this.$refs["form"].validate(valid => { - if (valid) { - updateUserProfile(this.user).then(response => { - this.$modal.msgSuccess("修改成功"); - }); - } + this.$modal.msgSuccess("修改成功"); }); }, close() {