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 { ProjectListItem } from '@/models/setting/project';
import { AssociateFunctionalCaseItem } from '@/models/testPlan/testPlan'; import { AssociateFunctionalCaseItem } from '@/models/testPlan/testPlan';
import type { Result } from '#/axios';
// 获取模块树 // 获取模块树
export function getCaseModuleTree(params: TableQueryParams) { export function getCaseModuleTree(params: TableQueryParams) {
return MSR.get<ModuleTreeNode[]>({ url: `${GetCaseModuleTreeUrl}/${params.projectId}` }); 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>) { 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>) { export function updateCaseRequest(data: Record<string, any>) {

View File

@ -61,7 +61,7 @@
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { hasAnyPermission } from '@/utils/permission'; 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 { initFormCreate } from '@/views/case-management/caseManagementFeature/components/utils';
import { Api } from '@form-create/arco-design'; import { Api } from '@form-create/arco-design';
@ -73,6 +73,7 @@
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'initTemplate', id: string): void; (e: 'initTemplate', id: string): void;
(e: 'cancel'): void; (e: 'cancel'): void;
(e: 'saved'): void;
}>(); }>();
const appStore = useAppStore(); const appStore = useAppStore();
@ -103,14 +104,14 @@
const result = customFields.map((item: any) => { const result = customFields.map((item: any) => {
const memberType = ['MEMBER', 'MULTIPLE_MEMBER']; const memberType = ['MEMBER', 'MULTIPLE_MEMBER'];
let initValue = item.defaultValue; let initValue = item.defaultValue;
const optionsValue: OptionsFieldId[] = item.options; const optionsValue: OptionsField[] = item.options;
if (memberType.includes(item.type)) { if (memberType.includes(item.type)) {
if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) { if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) {
initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id]; initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id];
} }
} }
if (item.internal && item.type === 'SELECT') { if (item.internal && item.type === 'SELECT') {
// TODO: // TODO:
return false; return false;
} }
return { return {
@ -172,7 +173,7 @@
}); });
const selectedNode: MinderJsonNode = window.minder.getSelectedNode(); const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
if (selectedNode?.data) { if (selectedNode?.data) {
selectedNode.data.id = res.id; selectedNode.data.id = res.data.id;
} }
} else { } else {
await updateCaseRequest({ await updateCaseRequest({
@ -190,11 +191,14 @@
...selectedNode.data, ...selectedNode.data,
text: baseInfoForm.value.name, text: baseInfoForm.value.name,
priority: priorityNumber, priority: priorityNumber,
isNew: false,
}; };
window.minder.execCommand('priority', priorityNumber + 1); window.minder.execCommand('priority', priorityNumber + 1);
setPriorityView(true, 'P'); setPriorityView(true, 'P');
selectedNode.data.changed = false;
} }
Message.success(t('common.saveSuccess')); Message.success(t('common.saveSuccess'));
emit('saved');
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
@ -215,7 +219,18 @@
() => { () => {
baseInfoForm.value.name = props.activeCase.name; baseInfoForm.value.name = props.activeCase.name;
baseInfoForm.value.tags = props.activeCase.tags || []; 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, immediate: true,

View File

@ -49,6 +49,7 @@
:active-case="activeCase" :active-case="activeCase"
@init-template="(id) => (templateId = id)" @init-template="(id) => (templateId = id)"
@cancel="handleBaseInfoCancel" @cancel="handleBaseInfoCancel"
@saved="handleBaseInfoSaved"
/> />
<attachment <attachment
v-else-if="activeExtraKey === 'attachment'" v-else-if="activeExtraKey === 'attachment'"
@ -327,6 +328,13 @@
resetExtractInfo(); 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 }"> <template #expand-icon="{ expanded, record }">
<div class="flex items-center gap-[2px] text-[var(--color-text-4)]"> <div
<MsIcon :type="expanded ? 'icon-icon_split_turn-down_arrow' : 'icon-icon_split-turn-down-left'" /> 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 v-if="record.children">{{ record.children.length }}</div>
</div> </div>
</template> </template>

View File

@ -32,7 +32,7 @@ export interface customFieldsItem {
[key: string]: any; [key: string]: any;
} }
export interface OptionsFieldId { export interface OptionsField {
fieldId: string; fieldId: string;
value: string; value: string;
text: string; text: string;
@ -46,7 +46,7 @@ export interface CustomAttributes {
apiFieldId: null | undefined | 'string'; // 三方API apiFieldId: null | undefined | 'string'; // 三方API
defaultValue: string; defaultValue: string;
type: string; type: string;
options: OptionsFieldId[]; options: OptionsField[];
} }
// 功能用例表 // 功能用例表

View File

@ -77,7 +77,7 @@
<div <div
v-if="!condition.enableCommonScript" 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)]"> <div v-if="isShowEditScriptNameInput" class="absolute left-[12px] top-[12px] z-10 w-[calc(100%-24px)]">
<a-input <a-input

View File

@ -171,6 +171,7 @@
'import', 'import',
'folderNodeSelect', 'folderNodeSelect',
'changeProtocol', 'changeProtocol',
'change',
]); ]);
const appStore = useAppStore(); const appStore = useAppStore();
@ -351,6 +352,7 @@
try { try {
await deleteModule(node.id); await deleteModule(node.id);
Message.success(t('apiScenario.deleteSuccess')); Message.success(t('apiScenario.deleteSuccess'));
emit('change');
await initModules(); await initModules();
emit('countRecycleScenario'); emit('countRecycleScenario');
} catch (error) { } catch (error) {
@ -417,6 +419,7 @@
dropPosition, dropPosition,
}); });
Message.success(t('apiScenario.moveSuccess')); Message.success(t('apiScenario.moveSuccess'));
emit('change');
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
@ -441,7 +444,6 @@
lastModuleCountParam.value = { lastModuleCountParam.value = {
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
}; };
await initModules(); await initModules();
}); });
defineExpose({ defineExpose({

View File

@ -11,6 +11,7 @@
@folder-node-select="handleNodeSelect" @folder-node-select="handleNodeSelect"
@init="handleModuleInit" @init="handleModuleInit"
@new-scenario="() => newTab()" @new-scenario="() => newTab()"
@change="handleModuleChange"
></scenarioModuleTree> ></scenarioModuleTree>
</div> </div>
<a-divider margin="0" /> <a-divider margin="0" />
@ -522,8 +523,13 @@
const createRef = ref<InstanceType<typeof create>>(); const createRef = ref<InstanceType<typeof create>>();
const detailRef = ref<InstanceType<typeof detail>>(); const detailRef = ref<InstanceType<typeof detail>>();
const apiTableRef = ref<InstanceType<typeof ScenarioTable>>();
const saveLoading = ref(false); const saveLoading = ref(false);
function handleModuleChange() {
apiTableRef.value?.loadScenarioList();
}
async function realSaveScenario() { async function realSaveScenario() {
try { try {
saveLoading.value = true; saveLoading.value = true;

View File

@ -295,7 +295,7 @@
CreateOrUpdateCase, CreateOrUpdateCase,
CustomAttributes, CustomAttributes,
DetailCase, DetailCase,
OptionsFieldId, OptionsField,
StepList, StepList,
} from '@/models/caseManagement/featureCase'; } from '@/models/caseManagement/featureCase';
import type { ModuleTreeNode, TableQueryParams } from '@/models/common'; import type { ModuleTreeNode, TableQueryParams } from '@/models/common';
@ -404,7 +404,7 @@
const result = customFields.map((item: any) => { const result = customFields.map((item: any) => {
const memberType = ['MEMBER', 'MULTIPLE_MEMBER']; const memberType = ['MEMBER', 'MULTIPLE_MEMBER'];
let initValue = item.defaultValue; let initValue = item.defaultValue;
const optionsValue: OptionsFieldId[] = item.options; const optionsValue: OptionsField[] = item.options;
if (memberType.includes(item.type)) { if (memberType.includes(item.type)) {
if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) { if (item.defaultValue === 'CREATE_USER' || item.defaultValue.includes('CREATE_USER')) {
initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id]; initValue = item.type === 'MEMBER' ? userStore.id : [userStore.id];

View File

@ -165,7 +165,7 @@
import useFeatureCaseStore from '@/store/modules/case/featureCase'; import useFeatureCaseStore from '@/store/modules/case/featureCase';
import { mapTree } from '@/utils'; 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 type { ModuleTreeNode, TableQueryParams } from '@/models/common';
import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { CaseManagementRouteEnum } from '@/enums/routeEnum';
@ -384,7 +384,7 @@
// //
const caseLevelFields = ref<Record<string, any>>({}); const caseLevelFields = ref<Record<string, any>>({});
const caseFilterVisible = ref(false); const caseFilterVisible = ref(false);
const caseLevelList = ref<OptionsFieldId[]>([]); const caseLevelList = ref<OptionsField[]>([]);
const caseFilters = ref<string[]>([]); const caseFilters = ref<string[]>([]);
// //