fix(缺陷管理): 修复缺陷管理三方平台自定义字段列表展示&缺陷详情bugs

This commit is contained in:
xinxin.wu 2024-09-25 15:34:25 +08:00 committed by 刘瑞斌
parent c20886624f
commit 9cc056beca
6 changed files with 35 additions and 34 deletions

View File

@ -48,6 +48,7 @@
:file-save-as-api="transferFileRequest"
:file-module-options-api="getTransferFileTree"
source-id-key="caseId"
@finish="emit('uploadSuccess')"
>
<span :id="item.uid"></span>
</SaveAsFilePopover>

View File

@ -903,7 +903,7 @@ export function getCustomFieldIndex(field: CustomFieldItem) {
// 表格自定义字段转column
export function customFieldToColumns(customFields: CustomFieldItem[]) {
return customFields.map((field) => {
const { fieldName, fieldKey, fieldId, options, platformOptionJson } = field;
const { fieldName, fieldKey, fieldId, options, platformOptionJson, type } = field;
const column: MsTableColumnData = {
title: fieldName,
dataIndex: ['handleUser', 'status'].includes(fieldId) ? fieldKey : getCustomFieldIndex(field),
@ -912,6 +912,7 @@ export function customFieldToColumns(customFields: CustomFieldItem[]) {
showInTable: true,
width: 200,
options: options || JSON.parse(platformOptionJson),
type,
};
return column;
});

View File

@ -126,7 +126,7 @@
class="no-content relative border-b"
/>
</div>
<div class="leftWrapper h-full">
<div :class="`leftWrapper ${!commentInputIsActive ? 'h-[calc(100vh-178px)]' : 'h-[calc(100vh-382px)]'}`">
<a-spin :loading="detailLoading" class="w-full">
<div class="tab-pane-container">
<BugDetailTab
@ -179,6 +179,13 @@
/>
</template>
</MsDetailDrawer>
<DeleteModal
:id="props.detailId"
v-model:visible="deleteVisible"
:name="detailInfo.title"
:remote-func="deleteSingleBug"
@submit="handleSingleDelete"
/>
</template>
<script setup lang="ts">
@ -221,6 +228,8 @@
import { BugEditCustomField, BugEditFormObject } from '@/models/bug-management';
import { BugManagementRouteEnum, RouteEnum } from '@/enums/routeEnum';
const DeleteModal = defineAsyncComponent(() => import('@/views/bug-management/components/deleteModal.vue'));
const router = useRouter();
const route = useRoute();
const detailDrawerRef = ref<InstanceType<typeof MsDetailDrawer>>();
@ -498,35 +507,21 @@
followLoading.value = false;
}
}
const deleteVisible = ref(false);
//
function deleteHandler() {
const { id, name } = detailInfo.value;
openDeleteModal({
title: t('bugManagement.detail.deleteTitle', { name: characterLimit(name) }),
content: t('bugManagement.detail.deleteContent'),
onBeforeOk: async () => {
try {
const params = {
id,
deleteAll: false,
projectId: currentProjectId.value,
};
await deleteSingleBug(params);
Message.success(t('common.deleteSuccess'));
emit('submit');
if (!props.pagination && !props.tableData) {
showDrawerVisible.value = false;
} else {
detailDrawerRef.value?.openNextDetail();
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
});
deleteVisible.value = true;
}
const handleSingleDelete = () => {
emit('submit');
if (!props.pagination && !props.tableData) {
showDrawerVisible.value = false;
} else {
detailDrawerRef.value?.openNextDetail();
}
};
// bug
function handleCopy() {
router.push({

View File

@ -57,7 +57,7 @@
const { t } = useI18n();
const props = defineProps<{
visible: boolean;
name: string;
name?: string;
id: string;
remoteFunc(params: Record<string, any>): Promise<any>; // Promise
}>();

View File

@ -79,8 +79,8 @@
</a-tooltip>
</div>
</template>
<template #description="{ record }">
<BugNamePopover :name="record.title" :content="record.description" />
<template v-for="item in richPreviewColumns" :key="item.slotName" #[item.slotName]="{ record }">
<BugNamePopover :content="record[item.dataIndex] || ''" />
</template>
</MsBaseTable>
</div>
@ -769,8 +769,8 @@
} else {
item.showInTable = false;
}
if (item.title === '内容') {
item.slotName = 'description';
if (item.type === 'RICH_TEXT') {
item.slotName = item.dataIndex;
item.showTooltip = false;
}
});
@ -780,6 +780,10 @@
}
}
const richPreviewColumns = computed<Record<string, any>[]>(() => {
return customColumns.filter((item) => item.type === 'RICH_TEXT');
});
await getColumnHeaders();
await initFilterOptions();
await tableStore.initColumn(TableKeyEnum.BUG_MANAGEMENT, columns.concat(customColumns), 'drawer');

View File

@ -1,5 +1,5 @@
<template>
<a-tooltip :content="props.name">
<a-tooltip :content="props.name" :disabled="!props.name">
<div class="one-line-text max-w-[calc(100%-32px)]"> {{ props.name }}</div>
</a-tooltip>
<a-popover class="bug-content-popover" title="" position="right" style="width: 480px">
@ -16,7 +16,7 @@
const { t } = useI18n();
const props = defineProps<{
name: string;
name?: string;
content: string;
}>();
</script>