fix(脑图): 脑图紧急 bug 修复

This commit is contained in:
baiqi 2024-06-18 18:01:18 +08:00 committed by Craftsman
parent 2d7d462c57
commit 081776445f
8 changed files with 66 additions and 30 deletions

View File

@ -62,6 +62,7 @@
import { OptionsFieldId } from '@/models/caseManagement/featureCase';
import { initFormCreate } from '@/views/case-management/caseManagementFeature/components/utils';
import { Api } from '@form-create/arco-design';
const props = defineProps<{
@ -200,6 +201,8 @@
() => props.activeCase.id,
() => {
baseInfoForm.value.name = props.activeCase.name;
baseInfoForm.value.tags = props.activeCase.tags || [];
formRules.value = initFormCreate(props.activeCase.customFields || [], ['FUNCTIONAL_CASE:READ+UPDATE']);
},
{
immediate: true,

View File

@ -28,7 +28,6 @@
@action="handleAction"
@before-exec-command="handleBeforeExecCommand"
@save="handleMinderSave"
@float-menu-close="handleBaseInfoCancel"
>
<template #extractMenu>
<a-tooltip v-if="showDetailMenu" :content="t('common.detail')">
@ -102,7 +101,7 @@
import { MinderEventName } from '@/enums/minderEnum';
import useMinderBaseApi from './useMinderBaseApi';
import { convertToFile, initFormCreate } from '@/views/case-management/caseManagementFeature/components/utils';
import { convertToFile } from '@/views/case-management/caseManagementFeature/components/utils';
const props = defineProps<{
moduleId: string;
@ -159,13 +158,18 @@
/**
* 初始化用例模块树
*/
async function initCaseTree() {
async function initCaseTree(notRemote = false) {
try {
loading.value = true;
const res = await getCaseMinderTree({
projectId: appStore.currentProjectId,
moduleId: '', //
});
let res: MinderJsonNode[];
if (notRemote) {
res = caseTree.value;
} else {
res = await getCaseMinderTree({
projectId: appStore.currentProjectId,
moduleId: '', //
});
}
caseTree.value = mapTree<MinderJsonNode>(res, (e) => ({
...e,
data: {
@ -227,8 +231,6 @@
const baseInfoRef = ref<InstanceType<typeof baseInfo>>();
const baseInfoLoading = ref(false);
const formRules = ref<FormItem[]>([]);
const extraVisible = ref<boolean>(false);
const activeCase = ref<Record<string, any>>({});
const extractContentTabList = computed(() => {
@ -304,7 +306,6 @@
return convertToFile(fileInfo);
});
}
formRules.value = initFormCreate(res.customFields, ['FUNCTIONAL_CASE:READ+UPDATE']);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
@ -588,6 +589,7 @@
textDescription: textStep?.data?.text || '',
expectedResult: textStep?.children?.[0]?.data?.text || '',
description: remarkNode?.data?.text || '',
priority: node.data?.priority,
};
}
@ -630,7 +632,11 @@
} else if (node.data.resource?.includes(caseTag)) {
//
const caseNodeInfo = getCaseNodeInfo(node as MinderJsonNode);
const caseBaseInfo = baseInfoRef.value?.makeParams();
let caseBaseInfo;
if (activeCase.value.id === node.data.id) {
//
caseBaseInfo = baseInfoRef.value?.makeParams();
}
tempMinderParams.value.updateCaseList.push({
id: node.data.id,
moduleId: parent?.data.id || '',
@ -694,7 +700,7 @@
watch(
() => featureCaseStore.modulesCount,
() => {
initCaseTree();
initCaseTree(true);
},
{
deep: true,

View File

@ -35,14 +35,15 @@ export default function useMinderBaseApi({ hasEditPermission }: { hasEditPermiss
function canShowFloatMenu() {
if (window.minder) {
const node: MinderJsonNode = window.minder.getSelectedNode();
if (node.data?.resource?.includes(caseTag)) {
return true;
}
if (!hasEditPermission) {
if (node?.data?.resource?.includes(caseTag)) {
// 没有编辑权限情况下,用例节点可展示浮动菜单(需要展示详情按钮)
return true;
}
return false;
}
}
return false;
return true;
}
const insertSiblingMenus = ref<InsertMenuItem[]>([]);

View File

@ -18,13 +18,13 @@
</slot>
<div class="flex flex-row gap-[12px]">
<a-input-search
v-model:modelValue="innerKeyword"
v-model:modelValue="keyword"
size="small"
:placeholder="props.searchPlaceholder"
class="w-[240px]"
allow-clear
@press-enter="emit('keywordSearch', innerKeyword, filterResult)"
@search="emit('keywordSearch', innerKeyword, filterResult)"
@press-enter="emit('keywordSearch', keyword, filterResult)"
@search="emit('keywordSearch', keyword, filterResult)"
@clear="handleClear"
></a-input-search>
<!-- <MsTag
@ -78,8 +78,6 @@
import MsTag from '../ms-tag/ms-tag.vue';
import FilterForm from './FilterForm.vue';
import { useI18n } from '@/hooks/useI18n';
import { FilterFormItem, FilterResult } from './type';
const props = defineProps<{
@ -92,14 +90,13 @@
}>();
const emit = defineEmits<{
(e: 'keywordSearch', value: string | undefined, combine: FilterResult): void; // innerKeyword TODO: v-model:keyword
(e: 'keywordSearch', value: string | undefined, combine: FilterResult): void; // keyword TODO: v-model:keyword
(e: 'advSearch', value: FilterResult): void; //
(e: 'dataIndexChange', value: string): void; //
(e: 'refresh', value: FilterResult): void;
}>();
const { t } = useI18n();
const innerKeyword = defineModel<string>('keyword', { default: '' });
const keyword = defineModel<string>('keyword', { default: '' });
const visible = ref(false);
const filterCount = ref(0);
const defaultFilterResult: FilterResult = { accordBelow: 'AND', combine: {} };
@ -124,7 +121,7 @@
};
const handleClear = () => {
innerKeyword.value = '';
keyword.value = '';
emit('keywordSearch', '', filterResult.value);
};

View File

@ -184,7 +184,7 @@
import { useI18n } from '@/hooks/useI18n';
import useMinderStore from '@/store/modules/components/minder-editor/index';
import { MinderNodePosition } from '@/store/modules/components/minder-editor/types';
import { getGenerateId, sleep } from '@/utils';
import { getGenerateId, sleep, traverseTree } from '@/utils';
import { MinderEventName } from '@/enums/minderEnum';
@ -362,6 +362,23 @@
case 'paste':
minderStore.dispatchEvent(MinderEventName.PASTE_NODE, undefined, undefined, undefined, selectedNodes);
window.minder.execCommand('Paste');
const pastedNode: MinderJsonNode = window.minder.getSelectedNode();
if (pastedNode) {
pastedNode.data = {
...pastedNode.data,
text: pastedNode.data?.text || '',
isNew: true,
id: getGenerateId(),
};
traverseTree(pastedNode.children || [], (node) => {
node.data = {
...node.data,
text: node.data?.text || '',
isNew: true,
id: getGenerateId(),
};
});
}
break;
case 'delete':
minderStore.dispatchEvent(MinderEventName.DELETE_NODE, undefined, undefined, undefined, selectedNodes);

View File

@ -97,9 +97,9 @@
(val) => {
const node: MinderJsonNode = window.minder.getSelectedNode();
if (val && node) {
nextTick(() => {
setTimeout(() => {
window.minder.execCommand('camera', node, 100);
});
}, 0);
}
}
);

View File

@ -2,6 +2,8 @@ import { defineStore } from 'pinia';
import type { MinderJsonNode } from '@/components/pure/ms-minder-editor/props';
import { getGenerateId, mapTree } from '@/utils';
import { MinderEventName } from '@/enums/minderEnum';
import { MinderNodePosition, MinderState } from './types';
@ -60,7 +62,7 @@ const useMinderStore = defineStore('minder', {
this.mold = val;
},
setClipboard(nodes?: MinderJsonNode[]) {
this.clipboard = nodes || [];
this.clipboard = mapTree(nodes || [], (node) => ({ ...node, id: getGenerateId(), type: 'ADD' }));
},
setMinderUnsaved(val: boolean) {
this.minderUnsaved = val;

View File

@ -16,7 +16,13 @@
@refresh="fetchData()"
>
<template #right>
<a-radio-group v-model:model-value="showType" type="button" size="small" class="list-show-type">
<a-radio-group
v-model:model-value="showType"
type="button"
size="small"
class="list-show-type"
@change="handleShowTypeChange"
>
<a-radio value="list" class="show-type-icon !m-[2px]">
<MsIcon :size="14" type="icon-icon_view-list_outlined" />
</a-radio>
@ -413,6 +419,10 @@
},
hideCancel: false,
});
} else if (val === 'minder') {
keyword.value = '';
//
emit('init', { moduleIds: [props.activeFolder], projectId: appStore.currentProjectId, pageSize: 10, current: 1 });
}
}