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

View File

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

View File

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

View File

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

View File

@ -184,7 +184,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useMinderStore from '@/store/modules/components/minder-editor/index'; import useMinderStore from '@/store/modules/components/minder-editor/index';
import { MinderNodePosition } from '@/store/modules/components/minder-editor/types'; 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'; import { MinderEventName } from '@/enums/minderEnum';
@ -362,6 +362,23 @@
case 'paste': case 'paste':
minderStore.dispatchEvent(MinderEventName.PASTE_NODE, undefined, undefined, undefined, selectedNodes); minderStore.dispatchEvent(MinderEventName.PASTE_NODE, undefined, undefined, undefined, selectedNodes);
window.minder.execCommand('Paste'); 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; break;
case 'delete': case 'delete':
minderStore.dispatchEvent(MinderEventName.DELETE_NODE, undefined, undefined, undefined, selectedNodes); minderStore.dispatchEvent(MinderEventName.DELETE_NODE, undefined, undefined, undefined, selectedNodes);

View File

@ -97,9 +97,9 @@
(val) => { (val) => {
const node: MinderJsonNode = window.minder.getSelectedNode(); const node: MinderJsonNode = window.minder.getSelectedNode();
if (val && node) { if (val && node) {
nextTick(() => { setTimeout(() => {
window.minder.execCommand('camera', node, 100); 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 type { MinderJsonNode } from '@/components/pure/ms-minder-editor/props';
import { getGenerateId, mapTree } from '@/utils';
import { MinderEventName } from '@/enums/minderEnum'; import { MinderEventName } from '@/enums/minderEnum';
import { MinderNodePosition, MinderState } from './types'; import { MinderNodePosition, MinderState } from './types';
@ -60,7 +62,7 @@ const useMinderStore = defineStore('minder', {
this.mold = val; this.mold = val;
}, },
setClipboard(nodes?: MinderJsonNode[]) { setClipboard(nodes?: MinderJsonNode[]) {
this.clipboard = nodes || []; this.clipboard = mapTree(nodes || [], (node) => ({ ...node, id: getGenerateId(), type: 'ADD' }));
}, },
setMinderUnsaved(val: boolean) { setMinderUnsaved(val: boolean) {
this.minderUnsaved = val; this.minderUnsaved = val;

View File

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