fix(用例管理): 修复自定义字段设置CREATE_USER不回显问题

--bug=1038673 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001038673
This commit is contained in:
guoyuqi 2024-04-08 14:19:47 +08:00 committed by 刘瑞斌
parent 72267841f2
commit 257696d36f
3 changed files with 12 additions and 5 deletions

View File

@ -215,12 +215,14 @@
<!-- 渲染自定义字段开始TODO -->
<template v-for="item in customFieldsColumns" :key="item.slotName" #[item.slotName]="{ record }">
<a-tooltip
:content="getTableFields(record.customFields, item as MsTableColumn)"
:content="getTableFields(record.customFields, item as MsTableColumn, record.createUser)"
position="top"
:mouse-enter-delay="100"
mini
>
<div class="one-line-text max-w-[300px]">{{ getTableFields(record.customFields, item as MsTableColumn) }}</div>
<div class="one-line-text max-w-[300px]">{{
getTableFields(record.customFields, item as MsTableColumn, record.createUser)
}}</div>
</a-tooltip>
</template>
<!-- 渲染自定义字段结束 -->

View File

@ -243,12 +243,12 @@
<!-- 回收站自定义字段 -->
<template v-for="item in customFieldsColumns" :key="item.slotName" #[item.slotName]="{ record }">
<a-tooltip
:content="getTableFields(record.customFields, item as MsTableColumn)"
:content="getTableFields(record.customFields, item as MsTableColumn, record.createUser)"
position="top"
:mouse-enter-delay="100"
mini
>
<div>{{ getTableFields(record.customFields, item as MsTableColumn) }}</div>
<div>{{ getTableFields(record.customFields, item as MsTableColumn, record.createUser) }}</div>
</a-tooltip>
</template>
<template #operation="{ record }">

View File

@ -134,7 +134,7 @@ export function getCaseLevels(customFields: CustomAttributes[]): CaseLevel {
}
// 处理自定义字段
export function getTableFields(customFields: CustomAttributes[], itemDataIndex: MsTableColumnData) {
export function getTableFields(customFields: CustomAttributes[], itemDataIndex: MsTableColumnData, userId: string) {
const multipleExcludes = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER'];
const selectExcludes = ['MEMBER', 'RADIO', 'SELECT'];
@ -147,6 +147,10 @@ export function getTableFields(customFields: CustomAttributes[], itemDataIndex:
// 处理多选项
if (multipleExcludes.includes(currentColumnData.type) && currentColumnData.defaultValue) {
selectValue = JSON.parse(currentColumnData.defaultValue);
if (Array.isArray(selectValue) && selectValue.includes('CREATE_USER')) {
const index = selectValue.indexOf('CREATE_USER');
selectValue.splice(index, 1, userId);
}
return (
(currentColumnData.options || [])
.filter((item: any) => selectValue.includes(item.value))
@ -168,6 +172,7 @@ export function getTableFields(customFields: CustomAttributes[], itemDataIndex:
}
return currentColumnData.defaultValue || '-';
}
return '-';
}
export function initFormCreate(customFields: CustomAttributes[], permission: string[]) {