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;
};
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
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) => {
return getRowTagTotalWidth(tags);
});

View File

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

View File

@ -24,44 +24,14 @@
:action-config="tableBatchActions"
v-on="propsEvent"
@batch-action="handleTableBatch"
@enable-change="enableChange"
>
<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">
<MsButton class="!mr-0" @click="showAddRule(record)">{{ t('common.edit') }}</MsButton>
<a-divider class="h-[16px]" direction="vertical" />
</span>
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row items-center">
<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>
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row items-center">
<MsButton class="!mr-0" @click="showAddRule(record)">{{ t('common.edit') }}</MsButton>
<a-divider class="h-[16px]" direction="vertical" />
</span>
<MsTableMoreAction class="!mr-0" :list="tableActions" @select="handleMoreAction($event, record)" />
</template>
</MsBaseTable>
</MsCard>
@ -231,6 +201,7 @@
title: 'project.menu.rule.enable',
dataIndex: 'enable',
width: 143,
permission: ['PROJECT_APPLICATION_API:UPDATE'],
},
{
title: 'project.menu.rule.label',
@ -340,6 +311,7 @@
label: 'system.user.delete',
eventTag: 'delete',
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(() => {
setLoadListParams({ projectId: currentProjectId.value });
fetchData();

View File

@ -132,12 +132,21 @@
return !props.shareId ? getReportDetailPage : getReportDetailSharePage;
};
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(reportDetailList(), {
scroll: { x: '100%' },
columns,
heightUsed: 20,
showSelectorAll: false,
});
const { propsRes, propsEvent, loadList, setLoadListParams } = useTable(
reportDetailList(),
{
scroll: { x: '100%' },
columns,
heightUsed: 20,
showSelectorAll: false,
},
(item) => {
return {
...item,
caseTotal: item.caseTotal || 0,
};
}
);
function loadReportDetailList() {
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" />
</template>
<template #executionStartAndEndTime="{ record }">
<div>
{{ dayjs(record.startTime).format('YYYY-MM-DD HH:mm:ss') }}
{{ record.endTime ? dayjs(record.endTime).format('YYYY-MM-DD HH:mm:ss') : '-' }}
</div>
<a-tooltip :content="getStartAndEndTime(record)" :mouse-enter-delay="300">
<div class="one-line-text">
{{ getStartAndEndTime(record) }}
</div>
</a-tooltip>
</template>
<template #operation="{ record }">
<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(() => {
loadExecuteList();
});