fix(测试计划): 部分 bug 修复
This commit is contained in:
parent
a7657635ab
commit
6980ca0b53
|
@ -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);
|
||||||
|
|
|
@ -99,9 +99,15 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
watch(
|
||||||
initNumberAndType();
|
() => modelValue.value,
|
||||||
});
|
() => {
|
||||||
|
initNumberAndType();
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
// 这里控制项目模块选择,如果是顶层则验证 appStore 里的 currentMenuConfig
|
|
||||||
// 项目管理 和 系统设置 不受此控制
|
|
||||||
export const firstLevelMenu = [
|
|
||||||
'workstation',
|
|
||||||
'testPlan',
|
|
||||||
'bugManagement',
|
|
||||||
'caseManagement',
|
|
||||||
'apiTest',
|
|
||||||
'uiTest',
|
|
||||||
'loadTest',
|
|
||||||
];
|
|
||||||
export default {};
|
|
|
@ -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 {
|
||||||
/**
|
/**
|
||||||
* 是否为允许访问的路由
|
* 是否为允许访问的路由
|
||||||
|
|
|
@ -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 没有 order,a 排前面
|
||||||
|
if (a.meta.order !== undefined && b.meta.order === undefined) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// 如果 a 没有 order 但是 b 有 order,b 排前面
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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'));
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<!-- eslint-disable prettier/prettier -->
|
|
||||||
<template>
|
<template>
|
||||||
<MsAdvanceFilter
|
<MsAdvanceFilter
|
||||||
v-model:keyword="keyword"
|
v-model:keyword="keyword"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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="{
|
||||||
|
|
|
@ -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"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue