fix(全局): bugFix

This commit is contained in:
baiqi 2024-06-25 15:29:35 +08:00 committed by 刘瑞斌
parent efa797f4a9
commit 99b1b4eb48
10 changed files with 52 additions and 16 deletions

View File

@ -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>) {

View File

@ -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,

View File

@ -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);
}
}
/**
* 切换用例详情显示
*/

View File

@ -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>

View File

@ -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[];
}
// 功能用例表

View File

@ -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

View File

@ -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({

View File

@ -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;

View File

@ -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];

View File

@ -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[]>([]);
//