fix(测试计划): 修复测试计划报告表头筛选问题

This commit is contained in:
wxg0103 2024-05-22 18:49:00 +08:00 committed by 刘瑞斌
parent 218f8052c7
commit 6787bbc9d4
2 changed files with 19 additions and 8 deletions

View File

@ -74,8 +74,8 @@
class="!mr-0" class="!mr-0"
@click="handleCopyMock(record)" @click="handleCopyMock(record)"
> >
{{ t('common.copy') }} </MsButton {{ t('common.copy') }}
>x </MsButton>
<a-divider direction="vertical" :margin="8"></a-divider> <a-divider direction="vertical" :margin="8"></a-divider>
<MsTableMoreAction :list="tableMoreActionList" @select="handleTableMoreActionSelect($event, record)" /> <MsTableMoreAction :list="tableMoreActionList" @select="handleTableMoreActionSelect($event, record)" />
</template> </template>

View File

@ -16,7 +16,7 @@
@press-enter="searchList" @press-enter="searchList"
@clear="searchList" @clear="searchList"
/> />
<a-button type="outline" class="arco-btn-outline--secondary !p-[8px]" @click="initData"> <a-button type="outline" class="arco-btn-outline--secondary !p-[8px]" @click="initData()">
<template #icon> <template #icon>
<icon-refresh class="text-[var(--color-text-4)]" /> <icon-refresh class="text-[var(--color-text-4)]" />
</template> </template>
@ -30,6 +30,7 @@
:action-config="tableBatchActions" :action-config="tableBatchActions"
v-on="propsEvent" v-on="propsEvent"
@batch-action="handleTableBatch" @batch-action="handleTableBatch"
@filter-change="filterChange"
> >
<template #name="{ record, rowIndex }"> <template #name="{ record, rowIndex }">
<div <div
@ -209,7 +210,6 @@
title: 'report.result', title: 'report.result',
dataIndex: 'resultStatus', dataIndex: 'resultStatus',
slotName: 'resultStatus', slotName: 'resultStatus',
titleSlotName: 'statusFilter',
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
sorter: true, sorter: true,
@ -280,7 +280,7 @@
return false; return false;
} }
}; };
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable( const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, resetFilterParams } = useTable(
reportList, reportList,
{ {
tableKey: TableKeyEnum.TEST_PLAN_REPORT_TABLE, tableKey: TableKeyEnum.TEST_PLAN_REPORT_TABLE,
@ -300,11 +300,17 @@
rename rename
); );
function initData() { function initData(dataIndex?: string, value?: string[] | (string | number | boolean)[] | undefined) {
const filterParams = {
...propsRes.value.filter,
};
if (dataIndex && value) {
filterParams[dataIndex] = value;
}
setLoadListParams({ setLoadListParams({
keyword: keyword.value, keyword: keyword.value,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
filter: { ...propsRes.value.filter, integrated: integratedFilters.value }, filter: { ...filterParams, integrated: integratedFilters.value },
}); });
loadList(); loadList();
} }
@ -368,6 +374,7 @@
resetSelector(); resetSelector();
initData(); initData();
} }
const handleDelete = async (id: string, currentName: string) => { const handleDelete = async (id: string, currentName: string) => {
openModal({ openModal({
type: 'error', type: 'error',
@ -398,14 +405,18 @@
function changeShowType(val: string | number | boolean) { function changeShowType(val: string | number | boolean) {
showType.value = val as ReportShowType; showType.value = val as ReportShowType;
resetFilterParams();
resetSelector(); resetSelector();
console.log(propsRes.value);
propsRes.value.filter = { propsRes.value.filter = {
integrated: integratedFilters.value, integrated: integratedFilters.value,
}; };
initData(); initData();
} }
function filterChange(dataIndex: string, value: string[] | (string | number | boolean)[] | undefined) {
initData(dataIndex, value);
}
/** /**
* 报告详情 showReportDetail * 报告详情 showReportDetail
*/ */