fix(工作台): 修复工作台接口数量卡片切换无权限项目资源错误

This commit is contained in:
xinxin.wu 2024-11-21 16:01:30 +08:00 committed by Craftsman
parent e744f1ed38
commit 3fc583ecfe
4 changed files with 14 additions and 13 deletions

View File

@ -296,10 +296,12 @@
} }
function changeProject() { function changeProject() {
nextTick(() => { nextTick(async () => {
initApiOrScenarioCount(); await initApiOrScenarioCount();
emit('change'); emit('change');
initApiCountRate(); if (hasPermission.value) {
initApiCountRate();
}
}); });
} }

View File

@ -146,6 +146,8 @@
coverOptions.value = { ...covOptions }; coverOptions.value = { ...covOptions };
} }
async function initApiCountRate() { async function initApiCountRate() {
console.log(hasPermission.value);
try { try {
loading.value = true; loading.value = true;
const detail = await workApiCountCoverRage(projectId.value); const detail = await workApiCountCoverRage(projectId.value);
@ -191,10 +193,12 @@
} }
function changeProject() { function changeProject() {
nextTick(() => { nextTick(async () => {
initApiCount(); await initApiCount();
emit('change'); emit('change');
initApiCountRate(); if (hasPermission.value) {
initApiCountRate();
}
}); });
} }

View File

@ -150,7 +150,7 @@
</div> </div>
</div> </div>
<NoData <NoData
v-if="showNoData || !defaultWorkList.length" v-if="!defaultWorkList.length"
:no-res-permission="!appStore.projectList.length" :no-res-permission="!appStore.projectList.length"
:all-screen="!defaultWorkList.length" :all-screen="!defaultWorkList.length"
height="h-[calc(100vh-110px)]" height="h-[calc(100vh-110px)]"
@ -249,8 +249,6 @@
const defaultWorkList = ref<SelectedCardItem[]>([]); const defaultWorkList = ref<SelectedCardItem[]>([]);
const showNoData = ref(false);
// key ID // key ID
const requestResults = ref<Record<string, ApiCoverageData>>({}); const requestResults = ref<Record<string, ApiCoverageData>>({});
// //
@ -301,9 +299,6 @@
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
} finally { } finally {
if (!defaultWorkList.value.length) {
showNoData.value = true;
}
appStore.hideLoading(); appStore.hideLoading();
} }
} }

View File

@ -66,7 +66,7 @@ export const colorMapConfig: Record<string, string[]> = {
[WorkCardEnum.ASSOCIATE_CASE_COUNT]: ['#00C261', '#3370FF'], [WorkCardEnum.ASSOCIATE_CASE_COUNT]: ['#00C261', '#3370FF'],
[WorkCardEnum.REVIEW_CASE_COUNT]: ['#D4D4D8', '#3370FF', '#00C261', '#ED0303', '#FFA200'], [WorkCardEnum.REVIEW_CASE_COUNT]: ['#D4D4D8', '#3370FF', '#00C261', '#ED0303', '#FFA200'],
[WorkCardEnum.TEST_PLAN_COUNT]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], [WorkCardEnum.TEST_PLAN_COUNT]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'],
[WorkCardEnum.PLAN_LEGACY_BUG]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], [WorkCardEnum.PLAN_LEGACY_BUG]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8', ...getColorScheme(12)],
[WorkCardEnum.BUG_COUNT]: ['#FFA200', '#3370FF', '#D4D4D8', '#00C261', ...getColorScheme(13)], [WorkCardEnum.BUG_COUNT]: ['#FFA200', '#3370FF', '#D4D4D8', '#00C261', ...getColorScheme(13)],
[WorkCardEnum.HANDLE_BUG_BY_ME]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], [WorkCardEnum.HANDLE_BUG_BY_ME]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'],
[WorkCardEnum.CREATE_BY_ME]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'], [WorkCardEnum.CREATE_BY_ME]: ['#9441B1', '#3370FF', '#00C261', '#D4D4D8'],