fix(测试计划): 修复测试计划执行历史时间展示和标签展示问题&项目误报规则bug

This commit is contained in:
xinxin.wu 2024-08-20 10:52:41 +08:00 committed by Craftsman
parent b5be3393eb
commit 89ef45c7dd
5 changed files with 60 additions and 48 deletions

View File

@ -552,10 +552,27 @@
return totalWidth + tablePadding; return totalWidth + tablePadding;
}; };
const getAllTagsFromData = (rows: TableData[], dataIndex: string): any[] => {
const allTags: Record<string, any>[] = [];
const collectTags = (nodes: TableData[]) => {
nodes.forEach((node) => {
if (node[dataIndex]) {
allTags.push(node[dataIndex]);
}
if (node.children && node.children.length > 0) {
collectTags(node.children);
}
});
};
collectTags(rows);
return allTags;
};
// TODO // TODO
const getMaxRowTagWidth = (rows: TableData[], dataIndex: string) => { const getMaxRowTagWidth = (rows: TableData[], dataIndex: string) => {
const allTags = ((rows as TableData) || []).map((row: TableData) => row[dataIndex] || []); const allTags = getAllTagsFromData(rows, dataIndex);
const rowWidths = (allTags || []).map((tags: any) => { const rowWidths = (allTags || []).map((tags: any) => {
return getRowTagTotalWidth(tags); return getRowTagTotalWidth(tags);
}); });

View File

@ -172,6 +172,7 @@
slotName: 'userRoles', slotName: 'userRoles',
dataIndex: 'userRoles', dataIndex: 'userRoles',
showDrag: true, showDrag: true,
isTag: true,
width: 300, width: 300,
}, },
{ {

View File

@ -24,44 +24,14 @@
:action-config="tableBatchActions" :action-config="tableBatchActions"
v-on="propsEvent" v-on="propsEvent"
@batch-action="handleTableBatch" @batch-action="handleTableBatch"
@enable-change="enableChange"
> >
<template #operation="{ record }"> <template #operation="{ record }">
<template v-if="!record.enable">
<div class="flex flex-row">
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row">
<MsButton class="!mr-0" @click="handleEnableOrDisableProject(record.id)">
{{ t('common.enable') }}
</MsButton>
<a-divider direction="vertical" />
</span>
<span>
<MsButton
v-permission="['PROJECT_APPLICATION_API:DELETE']"
class="!mr-0"
@click="handleDelete(record.id)"
>{{ t('common.delete') }}</MsButton
>
</span>
</div>
</template>
<template v-else>
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row items-center"> <span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row items-center">
<MsButton class="!mr-0" @click="showAddRule(record)">{{ t('common.edit') }}</MsButton> <MsButton class="!mr-0" @click="showAddRule(record)">{{ t('common.edit') }}</MsButton>
<a-divider class="h-[16px]" direction="vertical" /> <a-divider class="h-[16px]" direction="vertical" />
</span> </span>
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row items-center"> <MsTableMoreAction class="!mr-0" :list="tableActions" @select="handleMoreAction($event, record)" />
<MsButton class="!mr-0" @click="handleEnableOrDisableProject(record.id, false)">
{{ t('common.disable') }}
</MsButton>
<a-divider class="h-[16px]" direction="vertical" />
</span>
<MsTableMoreAction
v-permission="['PROJECT_APPLICATION_API:UPDATE']"
class="!mr-0"
:list="tableActions"
@select="handleMoreAction($event, record)"
></MsTableMoreAction>
</template>
</template> </template>
</MsBaseTable> </MsBaseTable>
</MsCard> </MsCard>
@ -231,6 +201,7 @@
title: 'project.menu.rule.enable', title: 'project.menu.rule.enable',
dataIndex: 'enable', dataIndex: 'enable',
width: 143, width: 143,
permission: ['PROJECT_APPLICATION_API:UPDATE'],
}, },
{ {
title: 'project.menu.rule.label', title: 'project.menu.rule.label',
@ -340,6 +311,7 @@
label: 'system.user.delete', label: 'system.user.delete',
eventTag: 'delete', eventTag: 'delete',
danger: true, danger: true,
permission: ['PROJECT_APPLICATION_API:DELETE'],
}, },
]; ];
@ -472,6 +444,12 @@
} }
} }
function enableChange(record: FakeTableListItem, newValue: string | number | boolean) {
if (record.id) {
handleEnableOrDisableProject(record.id, newValue as boolean);
}
}
onMounted(() => { onMounted(() => {
setLoadListParams({ projectId: currentProjectId.value }); setLoadListParams({ projectId: currentProjectId.value });
fetchData(); fetchData();

View File

@ -132,12 +132,21 @@
return !props.shareId ? getReportDetailPage : getReportDetailSharePage; return !props.shareId ? getReportDetailPage : getReportDetailSharePage;
}; };
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(reportDetailList(), { const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
reportDetailList(),
{
scroll: { x: '100%' }, scroll: { x: '100%' },
columns, columns,
heightUsed: 20, heightUsed: 20,
showSelectorAll: false, showSelectorAll: false,
}); },
(item) => {
return {
...item,
caseTotal: item.caseTotal || 0,
};
}
);
function loadReportDetailList() { function loadReportDetailList() {
setLoadListParams({ reportId: props.reportId, shareId: props.shareId ?? undefined }); setLoadListParams({ reportId: props.reportId, shareId: props.shareId ?? undefined });

View File

@ -11,10 +11,11 @@
<ExecutionStatus v-if="record.execResult" :status="record.execResult" :module-type="ReportEnum.API_REPORT" /> <ExecutionStatus v-if="record.execResult" :status="record.execResult" :module-type="ReportEnum.API_REPORT" />
</template> </template>
<template #executionStartAndEndTime="{ record }"> <template #executionStartAndEndTime="{ record }">
<div> <a-tooltip :content="getStartAndEndTime(record)" :mouse-enter-delay="300">
{{ dayjs(record.startTime).format('YYYY-MM-DD HH:mm:ss') }} <div class="one-line-text">
{{ record.endTime ? dayjs(record.endTime).format('YYYY-MM-DD HH:mm:ss') : '-' }} {{ getStartAndEndTime(record) }}
</div> </div>
</a-tooltip>
</template> </template>
<template #operation="{ record }"> <template #operation="{ record }">
<a-tooltip :content="t('project.executionHistory.cleared')" :disabled="!record.deleted"> <a-tooltip :content="t('project.executionHistory.cleared')" :disabled="!record.deleted">
@ -148,6 +149,12 @@
}); });
} }
function getStartAndEndTime(record: PlanDetailExecuteHistoryItem) {
return `${dayjs(record.startTime).format('YYYY-MM-DD HH:mm:ss')}${t('common.to')}${
record.endTime ? dayjs(record.endTime).format('YYYY-MM-DD HH:mm:ss') : '-'
}`;
}
onBeforeMount(() => { onBeforeMount(() => {
loadExecuteList(); loadExecuteList();
}); });