fix(全局): bugFix
This commit is contained in:
parent
efa797f4a9
commit
99b1b4eb48
|
@ -102,6 +102,8 @@ import type { CommonList, ModuleTreeNode, MoveModules, TableQueryParams } from '
|
|||
import { ProjectListItem } from '@/models/setting/project';
|
||||
import { AssociateFunctionalCaseItem } from '@/models/testPlan/testPlan';
|
||||
|
||||
import type { Result } from '#/axios';
|
||||
|
||||
// 获取模块树
|
||||
export function getCaseModuleTree(params: TableQueryParams) {
|
||||
return MSR.get<ModuleTreeNode[]>({ url: `${GetCaseModuleTreeUrl}/${params.projectId}` });
|
||||
|
@ -154,7 +156,7 @@ export function followerCaseRequest(data: { userId: string; functionalCaseId: st
|
|||
}
|
||||
// 创建用例
|
||||
export function createCaseRequest(data: Record<string, any>) {
|
||||
return MSR.uploadFile({ url: CreateCaseUrl }, { request: data.request, fileList: data.fileList }, '', true);
|
||||
return MSR.uploadFile<Result>({ url: CreateCaseUrl }, { request: data.request, fileList: data.fileList }, '', true);
|
||||
}
|
||||
// 编辑用例
|
||||
export function updateCaseRequest(data: Record<string, any>) {
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
import useUserStore from '@/store/modules/user';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import { OptionsFieldId } from '@/models/caseManagement/featureCase';
|
||||
import { customFieldsItem, OptionsField } from '@/models/caseManagement/featureCase';
|
||||
|
||||
import { initFormCreate } from '@/views/case-management/caseManagementFeature/components/utils';
|
||||
import { Api } from '@form-create/arco-design';
|
||||
|
@ -73,6 +73,7 @@
|
|||
const emit = defineEmits<{
|
||||
(e: 'initTemplate', id: string): void;
|
||||
(e: 'cancel'): void;
|
||||
(e: 'saved'): void;
|
||||
}>();
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
@ -103,14 +104,14 @@
|
|||
const result = customFields.map((item: any) => {
|
||||
const memberType = ['MEMBER', 'MULTIPLE_MEMBER'];
|
||||
let initValue = item.defaultValue;
|
||||
const optionsValue: OptionsFieldId[] = item.options;
|
||||
const optionsValue: OptionsField[] = item.options;
|
||||
if (memberType.includes(item.type)) {
|
||||
if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) {
|
||||
initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id];
|
||||
}
|
||||
}
|
||||
if (item.internal && item.type === 'SELECT') {
|
||||
// TODO:过滤用例等级字段,等级字段后续可自定义,需要调整
|
||||
// 这里不需要再展示用例等级字段。TODO:过滤用例等级字段,等级字段后续可自定义,需要调整
|
||||
return false;
|
||||
}
|
||||
return {
|
||||
|
@ -172,7 +173,7 @@
|
|||
});
|
||||
const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
|
||||
if (selectedNode?.data) {
|
||||
selectedNode.data.id = res.id;
|
||||
selectedNode.data.id = res.data.id;
|
||||
}
|
||||
} else {
|
||||
await updateCaseRequest({
|
||||
|
@ -190,11 +191,14 @@
|
|||
...selectedNode.data,
|
||||
text: baseInfoForm.value.name,
|
||||
priority: priorityNumber,
|
||||
isNew: false,
|
||||
};
|
||||
window.minder.execCommand('priority', priorityNumber + 1);
|
||||
setPriorityView(true, 'P');
|
||||
selectedNode.data.changed = false;
|
||||
}
|
||||
Message.success(t('common.saveSuccess'));
|
||||
emit('saved');
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
@ -215,7 +219,18 @@
|
|||
() => {
|
||||
baseInfoForm.value.name = props.activeCase.name;
|
||||
baseInfoForm.value.tags = props.activeCase.tags || [];
|
||||
formRules.value = initFormCreate(props.activeCase.customFields || [], ['FUNCTIONAL_CASE:READ+UPDATE']);
|
||||
if (props.activeCase.customFields) {
|
||||
formRules.value = initFormCreate(
|
||||
(props.activeCase.customFields || []).filter((item: customFieldsItem) => {
|
||||
if (item.internal && item.type === 'SELECT') {
|
||||
// 这里不需要再展示用例等级字段。TODO:过滤用例等级字段,等级字段后续可自定义,需要调整
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
['FUNCTIONAL_CASE:READ+UPDATE']
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
:active-case="activeCase"
|
||||
@init-template="(id) => (templateId = id)"
|
||||
@cancel="handleBaseInfoCancel"
|
||||
@saved="handleBaseInfoSaved"
|
||||
/>
|
||||
<attachment
|
||||
v-else-if="activeExtraKey === 'attachment'"
|
||||
|
@ -327,6 +328,13 @@
|
|||
resetExtractInfo();
|
||||
}
|
||||
|
||||
function handleBaseInfoSaved() {
|
||||
const node: MinderJsonNode = window.minder.getSelectedNode();
|
||||
if (node.data) {
|
||||
initCaseDetail(node.data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换用例详情显示
|
||||
*/
|
||||
|
|
|
@ -12,8 +12,11 @@
|
|||
>
|
||||
<!-- 展开行-->
|
||||
<template #expand-icon="{ expanded, record }">
|
||||
<div class="flex items-center gap-[2px] text-[var(--color-text-4)]">
|
||||
<MsIcon :type="expanded ? 'icon-icon_split_turn-down_arrow' : 'icon-icon_split-turn-down-left'" />
|
||||
<div
|
||||
class="flex items-center gap-[2px] text-[var(--color-text-4)]"
|
||||
:class="expanded ? 'rgb(var(--primary-5))' : ''"
|
||||
>
|
||||
<MsIcon type="icon_split-turn-down-left" />
|
||||
<div v-if="record.children">{{ record.children.length }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -32,7 +32,7 @@ export interface customFieldsItem {
|
|||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface OptionsFieldId {
|
||||
export interface OptionsField {
|
||||
fieldId: string;
|
||||
value: string;
|
||||
text: string;
|
||||
|
@ -46,7 +46,7 @@ export interface CustomAttributes {
|
|||
apiFieldId: null | undefined | 'string'; // 三方API
|
||||
defaultValue: string;
|
||||
type: string;
|
||||
options: OptionsFieldId[];
|
||||
options: OptionsField[];
|
||||
}
|
||||
|
||||
// 功能用例表
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
<div
|
||||
v-if="!condition.enableCommonScript"
|
||||
class="relative flex-1 rounded-[var(--border-radius-small)] bg-[var(--color-text-n9)]"
|
||||
class="relative min-w-[500px] flex-1 rounded-[var(--border-radius-small)] bg-[var(--color-text-n9)]"
|
||||
>
|
||||
<div v-if="isShowEditScriptNameInput" class="absolute left-[12px] top-[12px] z-10 w-[calc(100%-24px)]">
|
||||
<a-input
|
||||
|
|
|
@ -171,6 +171,7 @@
|
|||
'import',
|
||||
'folderNodeSelect',
|
||||
'changeProtocol',
|
||||
'change',
|
||||
]);
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
@ -351,6 +352,7 @@
|
|||
try {
|
||||
await deleteModule(node.id);
|
||||
Message.success(t('apiScenario.deleteSuccess'));
|
||||
emit('change');
|
||||
await initModules();
|
||||
emit('countRecycleScenario');
|
||||
} catch (error) {
|
||||
|
@ -417,6 +419,7 @@
|
|||
dropPosition,
|
||||
});
|
||||
Message.success(t('apiScenario.moveSuccess'));
|
||||
emit('change');
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
|
@ -441,7 +444,6 @@
|
|||
lastModuleCountParam.value = {
|
||||
projectId: appStore.currentProjectId,
|
||||
};
|
||||
|
||||
await initModules();
|
||||
});
|
||||
defineExpose({
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
@folder-node-select="handleNodeSelect"
|
||||
@init="handleModuleInit"
|
||||
@new-scenario="() => newTab()"
|
||||
@change="handleModuleChange"
|
||||
></scenarioModuleTree>
|
||||
</div>
|
||||
<a-divider margin="0" />
|
||||
|
@ -522,8 +523,13 @@
|
|||
|
||||
const createRef = ref<InstanceType<typeof create>>();
|
||||
const detailRef = ref<InstanceType<typeof detail>>();
|
||||
const apiTableRef = ref<InstanceType<typeof ScenarioTable>>();
|
||||
const saveLoading = ref(false);
|
||||
|
||||
function handleModuleChange() {
|
||||
apiTableRef.value?.loadScenarioList();
|
||||
}
|
||||
|
||||
async function realSaveScenario() {
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
|
|
|
@ -295,7 +295,7 @@
|
|||
CreateOrUpdateCase,
|
||||
CustomAttributes,
|
||||
DetailCase,
|
||||
OptionsFieldId,
|
||||
OptionsField,
|
||||
StepList,
|
||||
} from '@/models/caseManagement/featureCase';
|
||||
import type { ModuleTreeNode, TableQueryParams } from '@/models/common';
|
||||
|
@ -404,7 +404,7 @@
|
|||
const result = customFields.map((item: any) => {
|
||||
const memberType = ['MEMBER', 'MULTIPLE_MEMBER'];
|
||||
let initValue = item.defaultValue;
|
||||
const optionsValue: OptionsFieldId[] = item.options;
|
||||
const optionsValue: OptionsField[] = item.options;
|
||||
if (memberType.includes(item.type)) {
|
||||
if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) {
|
||||
initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id];
|
||||
|
|
|
@ -165,7 +165,7 @@
|
|||
import useFeatureCaseStore from '@/store/modules/case/featureCase';
|
||||
import { mapTree } from '@/utils';
|
||||
|
||||
import type { CaseManagementTable, CaseModuleQueryParams, OptionsFieldId } from '@/models/caseManagement/featureCase';
|
||||
import type { CaseManagementTable, CaseModuleQueryParams, OptionsField } from '@/models/caseManagement/featureCase';
|
||||
import type { ModuleTreeNode, TableQueryParams } from '@/models/common';
|
||||
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
|
||||
|
||||
|
@ -384,7 +384,7 @@
|
|||
// 用例等级表头检索
|
||||
const caseLevelFields = ref<Record<string, any>>({});
|
||||
const caseFilterVisible = ref(false);
|
||||
const caseLevelList = ref<OptionsFieldId[]>([]);
|
||||
const caseLevelList = ref<OptionsField[]>([]);
|
||||
const caseFilters = ref<string[]>([]);
|
||||
|
||||
// 获取用例参数
|
||||
|
|
Loading…
Reference in New Issue