feat(system): 角色管理表格行增加编辑入口

角色标识参与审批流程等后端判断,前次改动整体隐藏了角色编辑入口;
本次恢复编辑入口,但编辑时角色标识锁定不可改,仅允许修改角色名称与备注,
且更新请求只提交 roleId、roleName、comments,避免误改审批流相关字段。
This commit is contained in:
dshsa-lanbg
2026-11-01 14:56:19 +08:00
parent e30dd04ac8
commit 2233b2c0e3
2 changed files with 23 additions and 10 deletions
+18 -3
View File
@@ -4,7 +4,7 @@
:width="460" :width="460"
:visible="visible" :visible="visible"
:confirm-loading="loading" :confirm-loading="loading"
:title="isUpdate ? '修改角色' : '添加角色'" :title="isUpdate ? '编辑角色' : '添加角色'"
:body-style="{ paddingBottom: '8px' }" :body-style="{ paddingBottom: '8px' }"
@update:visible="updateVisible" @update:visible="updateVisible"
@ok="save" @ok="save"
@@ -26,10 +26,17 @@
v-model:value="form.roleName" v-model:value="form.roleName"
/> />
</a-form-item> </a-form-item>
<a-form-item label="角色标识" name="roleCode"> <a-form-item
label="角色标识"
name="roleCode"
:extra="
isUpdate ? '角色标识参与审批流程判断,创建后不可修改' : undefined
"
>
<a-input <a-input
allow-clear allow-clear
:maxlength="180" :maxlength="180"
:disabled="isUpdate"
placeholder="请输入角色标识" placeholder="请输入角色标识"
v-model:value="form.roleCode" v-model:value="form.roleCode"
/> />
@@ -119,7 +126,15 @@
.then(() => { .then(() => {
loading.value = true; loading.value = true;
const saveOrUpdate = isUpdate.value ? updateRole : addRole; const saveOrUpdate = isUpdate.value ? updateRole : addRole;
saveOrUpdate(form) // 角色标识参与审批流程判断,修改时只提交可编辑的字段
const data: Role = isUpdate.value
? {
roleId: form.roleId,
roleName: form.roleName,
comments: form.comments
}
: { ...form };
saveOrUpdate(data)
.then((msg) => { .then((msg) => {
loading.value = false; loading.value = false;
message.success(msg); message.success(msg);
+5 -7
View File
@@ -37,13 +37,11 @@
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space> <a-space>
<template v-if="canEdit(record)"> <a @click="openEdit(record)">编辑</a>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
</template>
<a @click="openAuth(record)">分配权限</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<template v-if="canEdit(record)"> <a @click="openAuth(record)">分配权限</a>
<template v-if="canRemove(record)">
<a-divider type="vertical" />
<a-popconfirm <a-popconfirm
placement="topRight" placement="topRight"
title="确定要删除此角色吗?" title="确定要删除此角色吗?"
@@ -132,7 +130,7 @@ const columns = ref<ColumnItem[]>([
} }
]); ]);
const canEdit = (record: Role) => { const canRemove = (record: Role) => {
// return ['student'].includes(record?.roleCode) // return ['student'].includes(record?.roleCode)
return false return false
} }