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;
};
const filterData = computed(() => {
return { ...(attrs.filter || {}) } as Record<string, any>;
});
const handleFilterConfirm = (
value: string[] | (string | number | boolean)[] | undefined,
dataIndex: string,
@ -906,6 +902,10 @@
return disableKey ? record[disableKey] : false;
}
const filterData = computed(() => {
return { ...(attrs.filter || {}) } as Record<string, any>;
});
function hasSelectedFilter(item: MsTableColumnData) {
if (item.filterConfig && item.dataIndex) {
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 () => {
await initColumn();
updateAllTagVisibility();
batchLeft.value = getBatchLeft();
initDefaultFilter();
});
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(() => {
filterListOptions.value = originFilterList.value.filter((item: SelectOptionData) =>
item.label?.includes(filterKeyword.value)

View File

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

View File

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

View File

@ -977,11 +977,6 @@
async function loadScenarioList(refreshTreeCount?: boolean) {
const moduleIds = await getModuleIds();
if (route.query.home) {
propsRes.value.filter = {
...NAV_NAVIGATION[route.query.home as WorkNavValueEnum],
};
}
const params = {
keyword: keyword.value,
projectId: appStore.currentProjectId,
@ -1650,6 +1645,11 @@
setAdvanceFilter({ conditions: [], searchMode: 'AND' }, 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) {
loadScenarioList();
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 {
moduleIds,
projectId: currentProjectId.value,
@ -1823,6 +1819,9 @@
}
async function mountedLoad() {
if (route.query.home) {
propsRes.value.filter = { ...NAV_NAVIGATION[route.query.home as WorkNavValueEnum] };
}
await initFilter();
await initData();
getCaseExportData();

View File

@ -899,15 +899,6 @@
if (isSetDefaultKey) {
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 {
type: showType.value,
moduleIds,
@ -1730,6 +1721,13 @@
setAdvanceFilter({ conditions: [], searchMode: 'AND' }, 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();
}
});

View File

@ -2,7 +2,7 @@
<a-trigger position="bottom" trigger="hover" align-point>
<div class="progress-container">
<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 class="threshold-line" :style="{ left: `${props.threshold === 100 ? 99 : props.threshold}%` }"></div>
</div>