fix(测试计划): 部分 bug 修复

This commit is contained in:
baiqi 2024-05-24 11:53:54 +08:00 committed by 刘瑞斌
parent a7657635ab
commit 6980ca0b53
16 changed files with 53 additions and 52 deletions

View File

@ -376,7 +376,10 @@
fileList.value = [{ ...file, fileId: file.uid || '', fileName: file.name || '' }];
inputFileName.value = file.name || '';
}
nextTick(() => {
// fileList nextTick
emit('change', fileList.value);
});
}
const inputFilesPopoverVisible = ref(false);

View File

@ -99,9 +99,15 @@
});
}
onBeforeMount(() => {
watch(
() => modelValue.value,
() => {
initNumberAndType();
});
},
{
immediate: true,
}
);
</script>
<style lang="less" scoped>

View File

@ -167,6 +167,7 @@
import useLocale from '@/locale/useLocale';
import useAppStore from '@/store/modules/app';
import useUserStore from '@/store/modules/user';
import { getFirstRouteNameByPermission } from '@/utils/permission';
import { IconInfoCircle, IconQuestionCircle } from '@arco-design/web-vue/es/icon';
@ -230,9 +231,8 @@
await userStore.checkIsLogin();
appStore.hideLoading();
router.replace({
path: route.path,
name: getFirstRouteNameByPermission(router.getRoutes()),
query: {
...route.query,
orgId: appStore.currentOrgId,
pId: value as string,
},

View File

@ -1,12 +0,0 @@
// 这里控制项目模块选择,如果是顶层则验证 appStore 里的 currentMenuConfig
// 项目管理 和 系统设置 不受此控制
export const firstLevelMenu = [
'workstation',
'testPlan',
'bugManagement',
'caseManagement',
'apiTest',
'uiTest',
'loadTest',
];
export default {};

View File

@ -1,6 +1,5 @@
import { RouteLocationNormalized, RouteRecordRaw } from 'vue-router';
import { firstLevelMenu } from '@/config/permission';
import { useUserStore } from '@/store';
import { hasAnyPermission, topLevelMenuHasPermission } from '@/utils/permission';
@ -9,6 +8,8 @@ import { hasAnyPermission, topLevelMenuHasPermission } from '@/utils/permission'
* @returns
*/
export default function usePermission() {
const firstLevelMenu = ['testPlan', 'bugManagement', 'caseManagement', 'apiTest'];
return {
/**
* 访

View File

@ -1,7 +1,5 @@
import { RouteLocationNormalized, RouteRecordNormalized, RouteRecordRaw } from 'vue-router';
import { includes } from 'lodash-es';
import { firstLevelMenu } from '@/config/permission';
import { INDEX_ROUTE } from '@/router/routes/base';
import appRoutes from '@/router/routes/index';
import { useAppStore, useUserStore } from '@/store';
@ -106,11 +104,23 @@ export function topLevelMenuHasPermission(route: RouteLocationNormalized | Route
// 有权限的第一个路由名如果没有找到则返回IndexRoute
export function getFirstRouteNameByPermission(routerList: RouteRecordNormalized[]) {
const currentRoute = routerList
.filter((item) => includes(firstLevelMenu, item.name))
.filter((item) => hasAnyPermission(item.meta.roles || [])) // 排除没有权限的路由
.sort((a, b) => {
return (a.meta.order || 0) - (b.meta.order || 0);
})
.find((item) => hasAnyPermission(item.meta.roles || []));
// 如果 a 和 b 都有 order按照 order 的值进行升序排序
if (a.meta.order !== undefined && b.meta.order !== undefined) {
return a.meta.order - b.meta.order;
}
// 如果 a 有 order 但是 b 没有 ordera 排前面
if (a.meta.order !== undefined && b.meta.order === undefined) {
return -1;
}
// 如果 a 没有 order 但是 b 有 orderb 排前面
if (a.meta.order === undefined && b.meta.order !== undefined) {
return 1;
}
// 如果 a 和 b 都没有 order它们的位置不变
return 0;
})[0];
return currentRoute?.name || INDEX_ROUTE.name;
}

View File

@ -175,10 +175,10 @@
} else {
//
innerParams.value.binaryBody.file = {
...fileList.value[0],
fileId: fileList.value[0]?.uid,
fileName: fileList.value[0]?.originalName || '',
fileAlias: fileList.value[0]?.name || '',
...files[0],
fileId: files[0]?.uid,
fileName: files[0]?.originalName || '',
fileAlias: files[0]?.name || '',
local: false,
};
}

View File

@ -608,10 +608,10 @@
} else {
//
mockDetail.value.mockMatchRule.body.binaryBody.file = {
...file,
fileId: file?.uid || '',
fileName: file?.originalName || '',
fileAlias: file?.name || '',
...files[0],
fileId: files[0]?.uid || files[0]?.id || '',
fileName: files[0]?.originalName || '',
fileAlias: files[0]?.name || '',
local: false,
};
}

View File

@ -446,12 +446,12 @@
local: true,
};
loading.value = false;
} else if (fileList.value[0]) {
} else if (files[0]) {
mockResponse.value.body.binaryBody.file = {
...fileList.value[0],
fileId: fileList.value[0].uid,
fileName: fileList.value[0]?.originalName || '',
fileAlias: fileList.value[0]?.name || '',
...files[0],
fileId: files[0].uid,
fileName: files[0]?.originalName || '',
fileAlias: files[0]?.name || '',
local: false,
};
} else {

View File

@ -2,19 +2,12 @@
<a-popover
v-model:popup-visible="popoverVisible"
position="bl"
:disabled="!props.step.csvIds || props.step.csvIds.length === 0"
:disabled="!props.step.csvIds || props.step.csvIds.length === 0 || props.step.isRefScenarioStep"
content-class="csv-popover"
arrow-class="hidden"
:popup-offset="0"
>
<div
v-if="
!props.step.isRefScenarioStep &&
props.step.stepType === ScenarioStepType.LOOP_CONTROLLER &&
props.step.csvIds?.length
"
class="csv-tag"
>
<div v-if="props.step.stepType === ScenarioStepType.LOOP_CONTROLLER && props.step.csvIds?.length" class="csv-tag">
{{ `CSV ${props.step.csvIds?.length}` }}
</div>
<template #content>

View File

@ -821,7 +821,7 @@
suffix
);
if (type.includes('REPORT')) {
if (type.includes('REPORT') && !type.includes('CLEAN')) {
Message.success(t('project.application.report.tips'));
} else {
Message.success(t('common.operationSuccess'));

View File

@ -1,4 +1,3 @@
<!-- eslint-disable prettier/prettier -->
<template>
<MsAdvanceFilter
v-model:keyword="keyword"

View File

@ -57,7 +57,7 @@
:all-names="(nodeData.parent? nodeData.parent.children || [] : testPlanTree).filter((e: ModuleTreeNode) => e.id !== nodeData.id).map((e: ModuleTreeNode) => e.name || '')"
:is-delete="false"
:ok-text="t('common.confirm')"
:field-config="{ field: renameCaseName }"
:field-config="{ field: renameCaseName, nameExistTipText: t('project.fileManagement.nameExist') }"
:loading="confirmLoading"
@confirm="updateNameModule"
@cancel="resetFocusNodeKey"

View File

@ -29,7 +29,7 @@
:keyword="moduleKeyword"
:default-expand-all="isExpandAll"
:expand-all="isExpandAll"
:empty-text="t('caseManagement.caseReview.noCases')"
:empty-text="t('common.noMatchData')"
:draggable="false"
:virtual-list-props="virtualListProps"
:field-names="{

View File

@ -46,6 +46,7 @@
:ok-text="t('common.confirm')"
:field-config="{
placeholder: t('testPlan.testPlanIndex.addGroupTip'),
nameExistTipText: t('project.fileManagement.nameExist'),
}"
@confirm="confirmHandler"
>