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

View File

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

View File

@ -15,4 +15,4 @@
const { t } = useI18n(); const { t } = useI18n();
const props = withDefaults(defineProps<{ name?: string; isAdmin?: boolean }>(), { isAdmin: false }); const props = withDefaults(defineProps<{ name?: string; isAdmin?: boolean }>(), { isAdmin: false });
</script> </script>

View File

@ -167,6 +167,7 @@
import useLocale from '@/locale/useLocale'; import useLocale from '@/locale/useLocale';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { getFirstRouteNameByPermission } from '@/utils/permission';
import { IconInfoCircle, IconQuestionCircle } from '@arco-design/web-vue/es/icon'; import { IconInfoCircle, IconQuestionCircle } from '@arco-design/web-vue/es/icon';
@ -230,9 +231,8 @@
await userStore.checkIsLogin(); await userStore.checkIsLogin();
appStore.hideLoading(); appStore.hideLoading();
router.replace({ router.replace({
path: route.path, name: getFirstRouteNameByPermission(router.getRoutes()),
query: { query: {
...route.query,
orgId: appStore.currentOrgId, orgId: appStore.currentOrgId,
pId: value as string, 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 { RouteLocationNormalized, RouteRecordRaw } from 'vue-router';
import { firstLevelMenu } from '@/config/permission';
import { useUserStore } from '@/store'; import { useUserStore } from '@/store';
import { hasAnyPermission, topLevelMenuHasPermission } from '@/utils/permission'; import { hasAnyPermission, topLevelMenuHasPermission } from '@/utils/permission';
@ -9,6 +8,8 @@ import { hasAnyPermission, topLevelMenuHasPermission } from '@/utils/permission'
* @returns * @returns
*/ */
export default function usePermission() { export default function usePermission() {
const firstLevelMenu = ['testPlan', 'bugManagement', 'caseManagement', 'apiTest'];
return { return {
/** /**
* 访 * 访

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,3 @@
<!-- eslint-disable prettier/prettier -->
<template> <template>
<MsAdvanceFilter <MsAdvanceFilter
v-model:keyword="keyword" 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 || '')" :all-names="(nodeData.parent? nodeData.parent.children || [] : testPlanTree).filter((e: ModuleTreeNode) => e.id !== nodeData.id).map((e: ModuleTreeNode) => e.name || '')"
:is-delete="false" :is-delete="false"
:ok-text="t('common.confirm')" :ok-text="t('common.confirm')"
:field-config="{ field: renameCaseName }" :field-config="{ field: renameCaseName, nameExistTipText: t('project.fileManagement.nameExist') }"
:loading="confirmLoading" :loading="confirmLoading"
@confirm="updateNameModule" @confirm="updateNameModule"
@cancel="resetFocusNodeKey" @cancel="resetFocusNodeKey"

View File

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

View File

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