修复智能气阀归属互斥选择
选择任一新归属时自动清空其他归属,保留提交防御校验和审计接口,并补充专项检查、中文操作日志及项目文档。
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
这是高风险操作,可能改变业务状态且无法直接撤销。请确认目标记录和填写内容准确。
|
||||
</a-alert>
|
||||
<a-alert v-if="isOwnershipAction" class="action-alert" type="warning" show-icon>
|
||||
智能气阀只能有一个当前归属。选择新归属前请清空原归属,操作会写入审计记录。
|
||||
智能气阀只能有一个当前归属。选择新归属后会自动清空其他归属,操作会写入审计记录。
|
||||
</a-alert>
|
||||
<a-form :model="form" layout="vertical">
|
||||
<ResourceFieldForm
|
||||
@@ -25,6 +25,7 @@
|
||||
:required-keys="requiredKeys"
|
||||
:relation-options="relations.options"
|
||||
:relation-loading="relations.loading"
|
||||
@change-relation="changeRelation"
|
||||
@search-relation="searchRelation"
|
||||
/>
|
||||
</a-form>
|
||||
@@ -75,6 +76,21 @@ function searchRelation(field: ResourceField, keyword: string) {
|
||||
relations.searchField(field, keyword);
|
||||
}
|
||||
|
||||
/** 选择智能气阀的新归属时清空其余互斥归属,避免提交非法多重归属。 */
|
||||
function changeRelation(field: ResourceField, value: unknown) {
|
||||
if (
|
||||
!isOwnershipAction.value ||
|
||||
!ownershipKeys.includes(field.key) ||
|
||||
value == null ||
|
||||
String(value).trim() === ''
|
||||
) {
|
||||
return;
|
||||
}
|
||||
for (const key of ownershipKeys) {
|
||||
if (key !== field.key) form[key] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.visible, props.action?.name] as const,
|
||||
async ([visible]) => {
|
||||
|
||||
Reference in New Issue
Block a user