diff --git a/src/views/system/role/authUser.vue b/src/views/system/role/authUser.vue index ea88e9d..df475f1 100644 --- a/src/views/system/role/authUser.vue +++ b/src/views/system/role/authUser.vue @@ -146,12 +146,61 @@ export default { /** 查询授权用户列表 */ getList() { this.loading = true; - allocatedUserList(this.queryParams).then(response => { - this.userList = response.data.rows; - this.total = response.data.total; - this.loading = false; + let response = { + "code": 200, + "msg": "查询成功", + "data": { + "total": 1, + "rows": [ + { + "createBy": null, + "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": null, + "avatar": null, + "password": null, + "status": "0", + "delFlag": null, + "loginIp": null, + "loginDate": null, + "dept": { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "deptId": 105, + "parentId": null, + "ancestors": null, + "deptName": null, + "orderNum": null, + "leader": null, + "phone": null, + "email": null, + "status": null, + "delFlag": null, + "parentName": null, + "children": [] + }, + "roles": [], + "roleIds": null, + "postIds": null, + "roleId": null, + "remark": null, + "admin": false + } + ] } - ); + } + this.userList = response.data.rows; + this.total = response.data.total; + this.loading = false; }, // 返回按钮 handleClose() { @@ -179,25 +228,14 @@ export default { }, /** 取消授权按钮操作 */ cancelAuthUser(row) { - const roleId = this.queryParams.roleId; - this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function () { - return authUserCancel({userId: row.userId, roleId: roleId}); - }).then(() => { - this.getList(); + this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(() => { this.$modal.msgSuccess("取消授权成功"); - }).catch(() => { }); }, /** 批量取消授权按钮操作 */ cancelAuthUserAll(row) { - const roleId = this.queryParams.roleId; - const userIds = this.userIds.join(","); - this.$modal.confirm('是否取消选中用户授权数据项?').then(function () { - return authUserCancelAll({roleId: roleId, userIds: userIds}); - }).then(() => { - this.getList(); + this.$modal.confirm('是否取消选中用户授权数据项?').then(() => { this.$modal.msgSuccess("取消授权成功"); - }).catch(() => { }); } } diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index a5e5ea6..02516be 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -371,18 +371,440 @@ export default { /** 查询角色列表 */ getList() { this.loading = true; - listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => { - this.roleList = response.data.rows; - this.total = response.data.total; - this.loading = false; + let response = { + "code": 200, + "msg": "查询成功", + "data": { + "total": 2, + "rows": [ + { + "createBy": null, + "createTime": "2023-09-29 11:47:27", + "updateBy": null, + "updateTime": null, + "roleId": 1, + "roleName": "超级管理员", + "roleKey": "admin", + "roleSort": 1, + "dataScope": "1", + "menuCheckStrictly": true, + "deptCheckStrictly": true, + "status": "0", + "delFlag": "0", + "flag": false, + "menuIds": null, + "deptIds": null, + "permissions": null, + "remark": "超级管理员", + "admin": true + }, + { + "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 + } + ] } - ); + } + this.roleList = response.data.rows; + this.total = response.data.total; + this.loading = false; }, /** 查询菜单树结构 */ getMenuTreeselect() { - menuTreeselect().then(response => { - this.menuOptions = response.data; - }); + let response = { + "code": 200, + "msg": "操作成功", + "data": [ + { + "id": 1, + "label": "系统管理", + "children": [ + { + "id": 100, + "label": "用户管理", + "children": [ + { + "id": 1000, + "label": "用户查询" + }, + { + "id": 1001, + "label": "用户新增" + }, + { + "id": 1002, + "label": "用户修改" + }, + { + "id": 1003, + "label": "用户删除" + }, + { + "id": 1004, + "label": "用户导出" + }, + { + "id": 1005, + "label": "用户导入" + }, + { + "id": 1006, + "label": "重置密码" + } + ] + }, + { + "id": 101, + "label": "角色管理", + "children": [ + { + "id": 1007, + "label": "角色查询" + }, + { + "id": 1008, + "label": "角色新增" + }, + { + "id": 1009, + "label": "角色修改" + }, + { + "id": 1010, + "label": "角色删除" + }, + { + "id": 1011, + "label": "角色导出" + } + ] + }, + { + "id": 102, + "label": "菜单管理", + "children": [ + { + "id": 1012, + "label": "菜单查询" + }, + { + "id": 1013, + "label": "菜单新增" + }, + { + "id": 1014, + "label": "菜单修改" + }, + { + "id": 1015, + "label": "菜单删除" + } + ] + }, + { + "id": 103, + "label": "部门管理", + "children": [ + { + "id": 1016, + "label": "部门查询" + }, + { + "id": 1017, + "label": "部门新增" + }, + { + "id": 1018, + "label": "部门修改" + }, + { + "id": 1019, + "label": "部门删除" + } + ] + }, + { + "id": 104, + "label": "岗位管理", + "children": [ + { + "id": 1020, + "label": "岗位查询" + }, + { + "id": 1021, + "label": "岗位新增" + }, + { + "id": 1022, + "label": "岗位修改" + }, + { + "id": 1023, + "label": "岗位删除" + }, + { + "id": 1024, + "label": "岗位导出" + } + ] + }, + { + "id": 105, + "label": "字典管理", + "children": [ + { + "id": 1025, + "label": "字典查询" + }, + { + "id": 1026, + "label": "字典新增" + }, + { + "id": 1027, + "label": "字典修改" + }, + { + "id": 1028, + "label": "字典删除" + }, + { + "id": 1029, + "label": "字典导出" + } + ] + }, + { + "id": 106, + "label": "参数设置", + "children": [ + { + "id": 1030, + "label": "参数查询" + }, + { + "id": 1031, + "label": "参数新增" + }, + { + "id": 1032, + "label": "参数修改" + }, + { + "id": 1033, + "label": "参数删除" + }, + { + "id": 1034, + "label": "参数导出" + } + ] + }, + { + "id": 107, + "label": "通知公告", + "children": [ + { + "id": 1035, + "label": "公告查询" + }, + { + "id": 1036, + "label": "公告新增" + }, + { + "id": 1037, + "label": "公告修改" + }, + { + "id": 1038, + "label": "公告删除" + } + ] + }, + { + "id": 108, + "label": "日志管理", + "children": [ + { + "id": 500, + "label": "操作日志", + "children": [ + { + "id": 1039, + "label": "操作查询" + }, + { + "id": 1040, + "label": "操作删除" + }, + { + "id": 1041, + "label": "日志导出" + } + ] + }, + { + "id": 501, + "label": "登录日志", + "children": [ + { + "id": 1042, + "label": "登录查询" + }, + { + "id": 1043, + "label": "登录删除" + }, + { + "id": 1044, + "label": "日志导出" + }, + { + "id": 1045, + "label": "账户解锁" + } + ] + } + ] + } + ] + }, + { + "id": 2, + "label": "系统监控", + "children": [ + { + "id": 109, + "label": "在线用户", + "children": [ + { + "id": 1046, + "label": "在线查询" + }, + { + "id": 1047, + "label": "批量强退" + }, + { + "id": 1048, + "label": "单条强退" + } + ] + }, + { + "id": 110, + "label": "定时任务", + "children": [ + { + "id": 1049, + "label": "任务查询" + }, + { + "id": 1050, + "label": "任务新增" + }, + { + "id": 1051, + "label": "任务修改" + }, + { + "id": 1052, + "label": "任务删除" + }, + { + "id": 1053, + "label": "状态修改" + }, + { + "id": 1054, + "label": "任务导出" + } + ] + }, + { + "id": 111, + "label": "数据监控" + }, + { + "id": 112, + "label": "服务监控" + }, + { + "id": 113, + "label": "缓存监控" + }, + { + "id": 114, + "label": "缓存列表" + } + ] + }, + { + "id": 3, + "label": "系统工具", + "children": [ + { + "id": 115, + "label": "表单构建" + }, + { + "id": 116, + "label": "代码生成", + "children": [ + { + "id": 1055, + "label": "生成查询" + }, + { + "id": 1056, + "label": "生成修改" + }, + { + "id": 1057, + "label": "生成删除" + }, + { + "id": 1058, + "label": "导入代码" + }, + { + "id": 1059, + "label": "预览代码" + }, + { + "id": 1060, + "label": "生成代码" + } + ] + }, + { + "id": 117, + "label": "系统接口" + } + ] + } + ] + } + this.menuOptions = response.data; }, // 所有菜单节点数据 getMenuAllCheckedKeys() { @@ -404,28 +826,523 @@ export default { }, /** 根据角色ID查询菜单树结构 */ getRoleMenuTreeselect(roleId) { - return roleMenuTreeselect(roleId).then(response => { - this.menuOptions = response.data.menus; - return response; - }); + let response = { + "code": 200, + "msg": "操作成功", + "data": { + "checkedKeys": [ + 111, + 112, + 113, + 114, + 115, + 117, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + 1008, + 1009, + 1010, + 1011, + 1012, + 1013, + 1014, + 1015, + 1016, + 1017, + 1018, + 1019, + 1020, + 1021, + 1022, + 1023, + 1024, + 1025, + 1026, + 1027, + 1028, + 1029, + 1030, + 1031, + 1032, + 1033, + 1034, + 1035, + 1036, + 1037, + 1038, + 1046, + 1047, + 1048, + 1049, + 1050, + 1051, + 1052, + 1053, + 1054, + 1055, + 1056, + 1057, + 1058, + 1059, + 1060, + 1039, + 1040, + 1041, + 1042, + 1043, + 1044, + 1045 + ], + "menus": [ + { + "id": 1, + "label": "系统管理", + "children": [ + { + "id": 100, + "label": "用户管理", + "children": [ + { + "id": 1000, + "label": "用户查询" + }, + { + "id": 1001, + "label": "用户新增" + }, + { + "id": 1002, + "label": "用户修改" + }, + { + "id": 1003, + "label": "用户删除" + }, + { + "id": 1004, + "label": "用户导出" + }, + { + "id": 1005, + "label": "用户导入" + }, + { + "id": 1006, + "label": "重置密码" + } + ] + }, + { + "id": 101, + "label": "角色管理", + "children": [ + { + "id": 1007, + "label": "角色查询" + }, + { + "id": 1008, + "label": "角色新增" + }, + { + "id": 1009, + "label": "角色修改" + }, + { + "id": 1010, + "label": "角色删除" + }, + { + "id": 1011, + "label": "角色导出" + } + ] + }, + { + "id": 102, + "label": "菜单管理", + "children": [ + { + "id": 1012, + "label": "菜单查询" + }, + { + "id": 1013, + "label": "菜单新增" + }, + { + "id": 1014, + "label": "菜单修改" + }, + { + "id": 1015, + "label": "菜单删除" + } + ] + }, + { + "id": 103, + "label": "部门管理", + "children": [ + { + "id": 1016, + "label": "部门查询" + }, + { + "id": 1017, + "label": "部门新增" + }, + { + "id": 1018, + "label": "部门修改" + }, + { + "id": 1019, + "label": "部门删除" + } + ] + }, + { + "id": 104, + "label": "岗位管理", + "children": [ + { + "id": 1020, + "label": "岗位查询" + }, + { + "id": 1021, + "label": "岗位新增" + }, + { + "id": 1022, + "label": "岗位修改" + }, + { + "id": 1023, + "label": "岗位删除" + }, + { + "id": 1024, + "label": "岗位导出" + } + ] + }, + { + "id": 105, + "label": "字典管理", + "children": [ + { + "id": 1025, + "label": "字典查询" + }, + { + "id": 1026, + "label": "字典新增" + }, + { + "id": 1027, + "label": "字典修改" + }, + { + "id": 1028, + "label": "字典删除" + }, + { + "id": 1029, + "label": "字典导出" + } + ] + }, + { + "id": 106, + "label": "参数设置", + "children": [ + { + "id": 1030, + "label": "参数查询" + }, + { + "id": 1031, + "label": "参数新增" + }, + { + "id": 1032, + "label": "参数修改" + }, + { + "id": 1033, + "label": "参数删除" + }, + { + "id": 1034, + "label": "参数导出" + } + ] + }, + { + "id": 107, + "label": "通知公告", + "children": [ + { + "id": 1035, + "label": "公告查询" + }, + { + "id": 1036, + "label": "公告新增" + }, + { + "id": 1037, + "label": "公告修改" + }, + { + "id": 1038, + "label": "公告删除" + } + ] + }, + { + "id": 108, + "label": "日志管理", + "children": [ + { + "id": 500, + "label": "操作日志", + "children": [ + { + "id": 1039, + "label": "操作查询" + }, + { + "id": 1040, + "label": "操作删除" + }, + { + "id": 1041, + "label": "日志导出" + } + ] + }, + { + "id": 501, + "label": "登录日志", + "children": [ + { + "id": 1042, + "label": "登录查询" + }, + { + "id": 1043, + "label": "登录删除" + }, + { + "id": 1044, + "label": "日志导出" + }, + { + "id": 1045, + "label": "账户解锁" + } + ] + } + ] + } + ] + }, + { + "id": 2, + "label": "系统监控", + "children": [ + { + "id": 109, + "label": "在线用户", + "children": [ + { + "id": 1046, + "label": "在线查询" + }, + { + "id": 1047, + "label": "批量强退" + }, + { + "id": 1048, + "label": "单条强退" + } + ] + }, + { + "id": 110, + "label": "定时任务", + "children": [ + { + "id": 1049, + "label": "任务查询" + }, + { + "id": 1050, + "label": "任务新增" + }, + { + "id": 1051, + "label": "任务修改" + }, + { + "id": 1052, + "label": "任务删除" + }, + { + "id": 1053, + "label": "状态修改" + }, + { + "id": 1054, + "label": "任务导出" + } + ] + }, + { + "id": 111, + "label": "数据监控" + }, + { + "id": 112, + "label": "服务监控" + }, + { + "id": 113, + "label": "缓存监控" + }, + { + "id": 114, + "label": "缓存列表" + } + ] + }, + { + "id": 3, + "label": "系统工具", + "children": [ + { + "id": 115, + "label": "表单构建" + }, + { + "id": 116, + "label": "代码生成", + "children": [ + { + "id": 1055, + "label": "生成查询" + }, + { + "id": 1056, + "label": "生成修改" + }, + { + "id": 1057, + "label": "生成删除" + }, + { + "id": 1058, + "label": "导入代码" + }, + { + "id": 1059, + "label": "预览代码" + }, + { + "id": 1060, + "label": "生成代码" + } + ] + }, + { + "id": 117, + "label": "系统接口" + } + ] + } + ] + } + } + this.deptOptions = response.data.depts; + this.menuOptions = response.data.menus + return response; }, /** 根据角色ID查询部门树结构 */ getDeptTree(roleId) { - return deptTreeSelect(roleId).then(response => { - this.deptOptions = response.data.depts; - return response; - }); + let response = { + "code": 200, + "msg": "操作成功", + "data": { + "checkedKeys": [ + 105 + ], + "depts": [ + { + "id": 100, + "label": "牧鱼科技", + "children": [ + { + "id": 101, + "label": "深圳总公司", + "children": [ + { + "id": 103, + "label": "研发部门" + }, + { + "id": 104, + "label": "市场部门" + }, + { + "id": 105, + "label": "测试部门" + }, + { + "id": 106, + "label": "财务部门" + }, + { + "id": 107, + "label": "运维部门" + } + ] + }, + { + "id": 102, + "label": "长沙分公司", + "children": [ + { + "id": 108, + "label": "市场部门" + }, + { + "id": 109, + "label": "财务部门" + } + ] + } + ] + } + ] + } + } + this.deptOptions = response.data.depts; + return response; }, // 角色状态修改 handleStatusChange(row) { let text = row.status === "0" ? "启用" : "停用"; - this.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function () { - return changeRoleStatus(row.roleId, row.status); - }).then(() => { - this.$modal.msgSuccess(text + "成功"); - }).catch(function () { - row.status = row.status === "0" ? "1" : "0"; - }); + this.$modal.msgSuccess(text + "成功"); }, // 取消按钮 cancel() { @@ -532,21 +1449,42 @@ export default { this.reset(); const roleId = row.roleId || this.ids const roleMenu = this.getRoleMenuTreeselect(roleId); - getRole(roleId).then(response => { - this.form = response.data; - this.open = true; - this.$nextTick(() => { - roleMenu.then(res => { - let checkedKeys = res.data.checkedKeys - checkedKeys.forEach((v) => { - this.$nextTick(() => { - this.$refs.menu.setChecked(v, true, false); - }) - }) - }); - }); - this.title = "修改角色"; + let response = { + "code": 200, + "msg": "操作成功", + "data": { + "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 + } + } + this.form = response.data; + this.open = true; + this.$nextTick(() => { + let checkedKeys = roleMenu.data.checkedKeys + checkedKeys.forEach((v) => { + this.$nextTick(() => { + this.$refs.menu.setChecked(v, true, false); + }) + }) }); + this.title = "修改角色"; }, /** 选择角色权限范围触发 */ dataScopeSelectChange(value) { @@ -558,16 +1496,37 @@ export default { handleDataScope(row) { this.reset(); const deptTreeSelect = this.getDeptTree(row.roleId); - getRole(row.roleId).then(response => { - this.form = response.data; - this.openDataScope = true; - this.$nextTick(() => { - deptTreeSelect.then(res => { - this.$refs.dept.setCheckedKeys(res.data.checkedKeys); - }); - }); - this.title = "分配数据权限"; + let response = { + "code": 200, + "msg": "操作成功", + "data": { + "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 + } + } + this.form = response.data; + this.openDataScope = true; + this.$nextTick(() => { + this.$refs.dept.setCheckedKeys(deptTreeSelect.data.checkedKeys) }); + this.title = "分配数据权限"; }, /** 分配用户操作 */ handleAuthUser: function (row) { @@ -579,19 +1538,11 @@ export default { this.$refs["form"].validate(valid => { if (valid) { if (this.form.roleId != undefined) { - this.form.menuIds = this.getMenuAllCheckedKeys(); - updateRole(this.form).then(response => { - this.$modal.msgSuccess("修改成功"); - this.open = false; - this.getList(); - }); + this.$modal.msgSuccess("修改成功"); + this.open = false; } else { - this.form.menuIds = this.getMenuAllCheckedKeys(); - addRole(this.form).then(response => { - this.$modal.msgSuccess("新增成功"); - this.open = false; - this.getList(); - }); + this.$modal.msgSuccess("新增成功"); + this.open = false; } } }); @@ -600,29 +1551,20 @@ export default { submitDataScope: function () { if (this.form.roleId != undefined) { this.form.deptIds = this.getDeptAllCheckedKeys(); - dataScope(this.form).then(response => { - this.$modal.msgSuccess("修改成功"); - this.openDataScope = false; - this.getList(); - }); + this.$modal.msgSuccess("修改成功"); + this.openDataScope = false; } }, /** 删除按钮操作 */ handleDelete(row) { const roleIds = row.roleId || this.ids; - this.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(function () { - return delRole(roleIds); - }).then(() => { - this.getList(); + this.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(() => { this.$modal.msgSuccess("删除成功"); - }).catch(() => { }); }, /** 导出按钮操作 */ handleExport() { - this.download('system/role/export', { - ...this.queryParams - }, `role_${new Date().getTime()}.xlsx`) + this.$modal.msgSuccess("导出成功"); } } }; diff --git a/src/views/system/role/selectUser.vue b/src/views/system/role/selectUser.vue index 5043667..64ac8e3 100644 --- a/src/views/system/role/selectUser.vue +++ b/src/views/system/role/selectUser.vue @@ -104,10 +104,60 @@ export default { }, // 查询表数据 getList() { - unallocatedUserList(this.queryParams).then(res => { - this.userList = res.data.rows; - this.total = res.data.total; - }); + let response = { + "code": 200, + "msg": "查询成功", + "data": { + "total": 1, + "rows": [ + { + "createBy": null, + "createTime": "2023-09-29 11:47:27", + "updateBy": null, + "updateTime": null, + "userId": 1, + "deptId": 103, + "userName": "admin", + "nickName": "锐腾", + "email": "muyu@163.com", + "phonenumber": "15888888888", + "sex": null, + "avatar": null, + "password": null, + "status": "0", + "delFlag": null, + "loginIp": null, + "loginDate": null, + "dept": { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "deptId": 103, + "parentId": null, + "ancestors": null, + "deptName": null, + "orderNum": null, + "leader": null, + "phone": null, + "email": null, + "status": null, + "delFlag": null, + "parentName": null, + "children": [] + }, + "roles": [], + "roleIds": null, + "postIds": null, + "roleId": null, + "remark": null, + "admin": true + } + ] + } + } + this.userList = response.data.rows; + this.total = response.data.total; }, /** 搜索按钮操作 */ handleQuery() { @@ -127,13 +177,9 @@ export default { this.$modal.msgError("请选择要分配的用户"); return; } - authUserSelectAll({roleId: roleId, userIds: userIds}).then(res => { - this.$modal.msgSuccess(res.data.msg); - if (res.data.code === 200) { - this.visible = false; - this.$emit("ok"); - } - }); + this.$modal.msgSuccess("分配用户成功") + this.visible = false; + this.$emit("ok"); } } }; diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 7bfc950..48b0d5f 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -930,7 +930,7 @@ export default { "ancestors": "0,100,101", "deptName": "测试部门", "orderNum": 3, - "leader": "锐腾", + "leader": "牧鱼", "phone": null, "email": null, "status": "0", @@ -1019,7 +1019,7 @@ export default { /** 删除按钮操作 */ handleDelete(row) { const userIds = row.userId || this.ids; - this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () { + this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(() => { this.$modal.msgSuccess("删除成功"); }) },