fix(工作台): 修复工作台首页跳转查询缺陷&进度条进度展示错误

This commit is contained in:
xinxin.wu 2024-12-16 11:39:36 +08:00 committed by Craftsman
parent b402c165e0
commit 95c2531315
8 changed files with 52 additions and 42 deletions

View File

@ -847,10 +847,6 @@
columnSelectorVisible.value = true; columnSelectorVisible.value = true;
}; };
const filterData = computed(() => {
return { ...(attrs.filter || {}) } as Record<string, any>;
});
const handleFilterConfirm = ( const handleFilterConfirm = (
value: string[] | (string | number | boolean)[] | undefined, value: string[] | (string | number | boolean)[] | undefined,
dataIndex: string, dataIndex: string,
@ -906,6 +902,10 @@
return disableKey ? record[disableKey] : false; return disableKey ? record[disableKey] : false;
} }
const filterData = computed(() => {
return { ...(attrs.filter || {}) } as Record<string, any>;
});
function hasSelectedFilter(item: MsTableColumnData) { function hasSelectedFilter(item: MsTableColumnData) {
if (item.filterConfig && item.dataIndex) { if (item.filterConfig && item.dataIndex) {
return (filterData.value[item.dataIndex] || []).length > 0; return (filterData.value[item.dataIndex] || []).length > 0;
@ -958,10 +958,21 @@
}); });
}; };
function initDefaultFilter() {
currentColumns.value.forEach((e) => {
const dataIndexKey = e.dataIndex as string;
// filterConfig
if (e.filterConfig?.options && filterData.value[dataIndexKey] && filterData.value[dataIndexKey].length) {
e.filterCheckedList = filterData.value[dataIndexKey];
}
});
}
onMounted(async () => { onMounted(async () => {
await initColumn(); await initColumn();
updateAllTagVisibility(); updateAllTagVisibility();
batchLeft.value = getBatchLeft(); batchLeft.value = getBatchLeft();
initDefaultFilter();
}); });
const updateColumnWidth = throttle(async (dataIndex: string, width: number) => { const updateColumnWidth = throttle(async (dataIndex: string, width: number) => {

View File

@ -221,18 +221,6 @@
} }
); );
watch(
() => props.filter,
(val) => {
if (!val[props.dataIndex as string] || val[props.dataIndex as string]?.length === 0) {
checkedList.value = []; //
} else {
// checkedList
checkedList.value = val[props.dataIndex as string];
}
}
);
const searchItem = debounce(() => { const searchItem = debounce(() => {
filterListOptions.value = originFilterList.value.filter((item: SelectOptionData) => filterListOptions.value = originFilterList.value.filter((item: SelectOptionData) =>
item.label?.includes(filterKeyword.value) item.label?.includes(filterKeyword.value)

View File

@ -32,6 +32,7 @@
@selected-change="handleTableSelect" @selected-change="handleTableSelect"
@batch-action="handleTableBatch" @batch-action="handleTableBatch"
@drag-change="handleTableDragSort" @drag-change="handleTableDragSort"
@filter-change="filterChange"
> >
<template #[FilterSlotNameEnum.API_TEST_API_REQUEST_METHODS]="{ filterContent }"> <template #[FilterSlotNameEnum.API_TEST_API_REQUEST_METHODS]="{ filterContent }">
<apiMethodName :method="filterContent.value" /> <apiMethodName :method="filterContent.value" />
@ -627,9 +628,6 @@
async function loadApiList(hasRefreshTree: boolean) { async function loadApiList(hasRefreshTree: boolean) {
const moduleIds = await getModuleIds(); const moduleIds = await getModuleIds();
if (route.query.home) {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
const params = { const params = {
keyword: keyword.value, keyword: keyword.value,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
@ -792,6 +790,10 @@
} }
function onMountedLoad() { function onMountedLoad() {
if (route.query.home) {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
if (props.selectedProtocols.length > 0) { if (props.selectedProtocols.length > 0) {
loadApiList(true); loadApiList(true);
} }
@ -1129,6 +1131,18 @@
shareButtonRef.value?.initShareList(); shareButtonRef.value?.initShareList();
} }
function filterChange() {
if (typeof refreshModuleTreeCount === 'function' && !isAdvancedSearchMode.value) {
refreshModuleTreeCount({
keyword: keyword.value,
filter: propsRes.value.filter,
moduleIds: [],
protocols: props.selectedProtocols,
projectId: appStore.currentProjectId,
});
}
}
watch( watch(
() => requestMethodsOptions.value, () => requestMethodsOptions.value,
() => { () => {

View File

@ -672,10 +672,6 @@
async function loadCaseList() { async function loadCaseList() {
const selectModules = await getModuleIds(); const selectModules = await getModuleIds();
if (route.query.home) {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
const params = { const params = {
apiDefinitionId: props.apiDetail?.id, apiDefinitionId: props.apiDetail?.id,
keyword: keyword.value, keyword: keyword.value,
@ -1212,6 +1208,10 @@
setAdvanceFilter({ conditions: [], searchMode: 'AND' }, route.query.view as string); setAdvanceFilter({ conditions: [], searchMode: 'AND' }, route.query.view as string);
viewName.value = route.query.view as string; viewName.value = route.query.view as string;
} }
if (route.query.home) {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
}); });
defineExpose({ defineExpose({

View File

@ -977,11 +977,6 @@
async function loadScenarioList(refreshTreeCount?: boolean) { async function loadScenarioList(refreshTreeCount?: boolean) {
const moduleIds = await getModuleIds(); const moduleIds = await getModuleIds();
if (route.query.home) {
propsRes.value.filter = {
...NAV_NAVIGATION[route.query.home as WorkNavValueEnum],
};
}
const params = { const params = {
keyword: keyword.value, keyword: keyword.value,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
@ -1650,6 +1645,11 @@
setAdvanceFilter({ conditions: [], searchMode: 'AND' }, route.query.view as string); setAdvanceFilter({ conditions: [], searchMode: 'AND' }, route.query.view as string);
viewName.value = route.query.view as string; viewName.value = route.query.view as string;
} }
if (route.query.home) {
propsRes.value.filter = {
...NAV_NAVIGATION[route.query.home as WorkNavValueEnum],
};
}
if (!isActivated.value) { if (!isActivated.value) {
loadScenarioList(); loadScenarioList();
cacheStore.setCache(CacheTabTypeEnum.API_SCENARIO_TABLE); cacheStore.setCache(CacheTabTypeEnum.API_SCENARIO_TABLE);

View File

@ -1028,10 +1028,6 @@
} }
} }
if (route.query.home) {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
return { return {
moduleIds, moduleIds,
projectId: currentProjectId.value, projectId: currentProjectId.value,
@ -1823,6 +1819,9 @@
} }
async function mountedLoad() { async function mountedLoad() {
if (route.query.home) {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
await initFilter(); await initFilter();
await initData(); await initData();
getCaseExportData(); getCaseExportData();

View File

@ -899,15 +899,6 @@
if (isSetDefaultKey) { if (isSetDefaultKey) {
moduleIds = []; moduleIds = [];
} }
if (route.query.home) {
if (route.query.home === WorkNavValueEnum.TEST_PLAN_ARCHIVED) {
viewId.value = 'archived';
} else {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
}
return { return {
type: showType.value, type: showType.value,
moduleIds, moduleIds,
@ -1730,6 +1721,13 @@
setAdvanceFilter({ conditions: [], searchMode: 'AND' }, route.query.view as string); setAdvanceFilter({ conditions: [], searchMode: 'AND' }, route.query.view as string);
viewName.value = route.query.view as string; viewName.value = route.query.view as string;
} }
if (route.query.home) {
if (route.query.home === WorkNavValueEnum.TEST_PLAN_ARCHIVED) {
viewId.value = 'archived';
} else {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
}
fetchData(); fetchData();
} }
}); });

View File

@ -2,7 +2,7 @@
<a-trigger position="bottom" trigger="hover" align-point> <a-trigger position="bottom" trigger="hover" align-point>
<div class="progress-container"> <div class="progress-container">
<div class="progress-bar-background"> <div class="progress-bar-background">
<div :class="`progress-bar w-[${props.progress}%] bg-[${props.progressColor}]`"></div> <div class="progress-bar" :style="{ width: `${props.progress}%`, background: `${props.progressColor}` }"></div>
</div> </div>
<div class="threshold-line" :style="{ left: `${props.threshold === 100 ? 99 : props.threshold}%` }"></div> <div class="threshold-line" :style="{ left: `${props.threshold === 100 ? 99 : props.threshold}%` }"></div>
</div> </div>