refactor(AppRoleRightsManager):优化角色标记选择和编辑功能- 在编辑角色时添加 type 参数,确保角色类型正确保存

- 在新增角色页面将角色标记设置为必选项,提高数据完整性- 优化角色保存逻辑,移除冗余的 if 语句
- 重构 back 方法,增加可选参数以提高灵活性
This commit is contained in:
aixianling
2025-01-07 09:20:48 +08:00
parent 532ceeb5e7
commit 385447d3b4
2 changed files with 15 additions and 16 deletions

View File

@@ -319,6 +319,7 @@ export default {
params: { params: {
roleName: this.editName, roleName: this.editName,
appId: this.row.appId, appId: this.row.appId,
type: this.row.type
}, },
}) })
.then((res) => { .then((res) => {

View File

@@ -9,7 +9,7 @@
<el-form-item label="应用角色名称" prop="roleName"> <el-form-item label="应用角色名称" prop="roleName">
<el-input v-model="form.roleName" placeholder="请输入应用角色名称" clearable/> <el-input v-model="form.roleName" placeholder="请输入应用角色名称" clearable/>
</el-form-item> </el-form-item>
<el-form-item label="角色标记" prop="type"> <el-form-item label="角色标记" prop="type" :rules="{required:true,message:'请选择角色标记'}">
<ai-select v-model="form.type" dict="roleType" placeholder="请选择角色标记" clearable/> <ai-select v-model="form.type" dict="roleType" placeholder="请选择角色标记" clearable/>
</el-form-item> </el-form-item>
</div> </div>
@@ -132,8 +132,7 @@ export default {
}, },
//保存提交 //保存提交
confirm() { confirm() {
this.$refs.rightsForm.validate(v => { this.$refs.rightsForm.validate().then(() => {
if (v) {
let menus = [this.$refs.roleTree?.getHalfCheckedKeys(), this.$refs.roleTree?.getCheckedKeys()]?.flat()?.toString() let menus = [this.$refs.roleTree?.getHalfCheckedKeys(), this.$refs.roleTree?.getCheckedKeys()]?.flat()?.toString()
this.instance.post(this.top.actions.modify, null, { this.instance.post(this.top.actions.modify, null, {
params: {...this.form, menus} params: {...this.form, menus}
@@ -144,12 +143,11 @@ export default {
this.top.searchList() this.top.searchList()
} }
}) })
}
}) })
}, },
//取消 返回 //取消 返回
back() { back(params = {}) {
this.$router.push({}) this.$router.push(params)
} }
}, },
} }