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

View File

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

View File

@ -126,7 +126,7 @@
class="no-content relative border-b" class="no-content relative border-b"
/> />
</div> </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"> <a-spin :loading="detailLoading" class="w-full">
<div class="tab-pane-container"> <div class="tab-pane-container">
<BugDetailTab <BugDetailTab
@ -179,6 +179,13 @@
/> />
</template> </template>
</MsDetailDrawer> </MsDetailDrawer>
<DeleteModal
:id="props.detailId"
v-model:visible="deleteVisible"
:name="detailInfo.title"
:remote-func="deleteSingleBug"
@submit="handleSingleDelete"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -221,6 +228,8 @@
import { BugEditCustomField, BugEditFormObject } from '@/models/bug-management'; import { BugEditCustomField, BugEditFormObject } from '@/models/bug-management';
import { BugManagementRouteEnum, RouteEnum } from '@/enums/routeEnum'; import { BugManagementRouteEnum, RouteEnum } from '@/enums/routeEnum';
const DeleteModal = defineAsyncComponent(() => import('@/views/bug-management/components/deleteModal.vue'));
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const detailDrawerRef = ref<InstanceType<typeof MsDetailDrawer>>(); const detailDrawerRef = ref<InstanceType<typeof MsDetailDrawer>>();
@ -498,35 +507,21 @@
followLoading.value = false; followLoading.value = false;
} }
} }
const deleteVisible = ref(false);
// //
function deleteHandler() { function deleteHandler() {
const { id, name } = detailInfo.value; deleteVisible.value = true;
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);
}
},
});
} }
const handleSingleDelete = () => {
emit('submit');
if (!props.pagination && !props.tableData) {
showDrawerVisible.value = false;
} else {
detailDrawerRef.value?.openNextDetail();
}
};
// bug // bug
function handleCopy() { function handleCopy() {
router.push({ router.push({

View File

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

View File

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

View File

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