| | |
| | | addRoleForm: { |
| | | state: 1 |
| | | }, |
| | | |
| | | // 修改的角色对象 |
| | | editRoleForm: {}, |
| | | // 添加角色的验证规则 |
| | | addRoleRules: { |
| | | name: [ |
| | | {required: true, message: '请输入名称', trigger: 'blur'}, |
| | | {required: true, message: '请输入名称', trigger: 'blur'}, |
| | | {min: 2, max: 15, message: '长度在 2 到 15 个字符', trigger: 'blur'} |
| | | ], |
| | | state: [ |
| | |
| | | }, |
| | | stateChange(info) { |
| | | saveOrUpdate(info).then(() => { |
| | | this.$message.success("更新状态成功") |
| | | const 更新状态成功 = this.$t('更新状态成功'); |
| | | this.$message.success(更新状态成功) |
| | | |
| | | }); |
| | | }, |
| | |
| | | this.getRoleList(); |
| | | // 隐藏添加角色对话框 |
| | | this.addDialogVisible = false; |
| | | this.$message.success("添加角色成功"); |
| | | const 添加角色成功 = this.$t('添加角色成功'); |
| | | this.$message.success(添加角色成功); |
| | | }); |
| | | }) |
| | | }, |
| | |
| | | this.getRoleList(); |
| | | // 隐藏添加角色对话框 |
| | | this.editDialogVisible = false; |
| | | this.$message.success("修改角色成功"); |
| | | const 修改角色成功 = this.$t('修改角色成功'); |
| | | this.$message.success(修改角色成功); |
| | | }); |
| | | }) |
| | | }, |
| | | // 根据id删除角色信息 |
| | | removeById(role) { |
| | | // 弹框询问用户是否删除角色 |
| | | this.$confirm('此操作将永久删除该角色, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | const 此操作将永久删除该角色是否继续 = this.$t('此操作将永久删除该角色, 是否继续?'); |
| | | const 提示 = this.$t('提示'); |
| | | const 确定 = this.$t('确定'); |
| | | const 取消 = this.$t('取消'); |
| | | this.$confirm(此操作将永久删除该角色是否继续, 提示, { |
| | | confirmButtonText: 确定, |
| | | cancelButtonText: 取消, |
| | | type: 'warning' |
| | | }).then(() => { |
| | | // 删除角色 |
| | | removeById({id: role.id}).then(() => { |
| | | // 重新获取角色列表 |
| | | this.getRoleList(); |
| | | this.$message.success("删除角色成功"); |
| | | const 删除角色成功 = this.$t('删除角色成功'); |
| | | this.$message.success(删除角色成功); |
| | | }); |
| | | }).catch(() => { |
| | | this.$message('已取消删除'); |
| | | const 已取消删除 = this.$t('已取消删除'); |
| | | this.$message(已取消删除); |
| | | }); |
| | | } |
| | | } |