fix(脑图): 脑图性能优化

This commit is contained in:
baiqi 2024-06-18 20:28:06 +08:00 committed by Craftsman
parent 705f89c07e
commit 93ace7f9fd
4 changed files with 31 additions and 20 deletions

View File

@ -67,7 +67,6 @@
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import { FormItem } from '@/components/pure/ms-form-create/types';
import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue'; import MsMinderEditor from '@/components/pure/ms-minder-editor/minderEditor.vue';
import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props'; import type { MinderJson, MinderJsonNode, MinderJsonNodeData } from '@/components/pure/ms-minder-editor/props';
import { setPriorityView } from '@/components/pure/ms-minder-editor/script/tool/utils'; import { setPriorityView } from '@/components/pure/ms-minder-editor/script/tool/utils';
@ -397,58 +396,57 @@
return; return;
} }
// TODO: // TODO:
const waitingRenderNodes: MinderJsonNode[] = [];
res.forEach((e) => { res.forEach((e) => {
// //
const child = window.minder.createNode( const child = window.minder.createNode(
{ {
...e.data, ...e.data,
expandState: 'collapse',
isNew: false, isNew: false,
}, },
node node
); );
child.render(); waitingRenderNodes.push(child);
const grandChildren: MinderJsonNode[] = [];
e.children?.forEach((item) => { e.children?.forEach((item) => {
// // // //
const grandChild = window.minder.createNode( const grandChild = window.minder.createNode(
{ {
...item.data, ...item.data,
expandState: 'collapse',
isNew: false, isNew: false,
}, },
child child
); );
grandChild.render(); grandChildren.push(grandChild);
const greatGrandChildren: MinderJsonNode[] = [];
item.children?.forEach((subItem) => { item.children?.forEach((subItem) => {
// //
const greatGrandChild = window.minder.createNode( const greatGrandChild = window.minder.createNode(
{ {
...subItem.data, ...subItem.data,
expandState: 'collapse',
isNew: false, isNew: false,
}, },
grandChild grandChild
); );
greatGrandChild.render(); greatGrandChildren.push(greatGrandChild);
}); });
window.minder.renderNodeBatch(greatGrandChildren);
}); });
child.expand(); window.minder.renderNodeBatch(grandChildren);
child.renderTree();
}); });
node.expand(); node.expand();
node.renderTree(); // node.renderTree();
window.minder.renderNodeBatch(waitingRenderNodes);
window.minder.layout(); window.minder.layout();
window.minder.execCommand('camera', node, 100); window.minder.execCommand('camera', node, 100);
if (node.data) { if (node.data) {
node.data.isLoaded = true; node.data.isLoaded = true;
} }
// importJson // importJson
const currentFullJson: MinderJson = window.minder.exportJson(); replaceNodeInTree([importJson.value.root], node.data?.id || '', node, 'data', 'id');
const { root } = currentFullJson;
if (root.data?.id === 'NONE') {
//
importJson.value = currentFullJson;
} else {
//
replaceNodeInTree([importJson.value.root], node.data?.id || '', root, 'data', 'id');
}
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);

View File

@ -450,16 +450,20 @@
const currentPriority = ref<RunMode>(RunMode.SERIAL); const currentPriority = ref<RunMode>(RunMode.SERIAL);
// / // /
const priorityTextMap = { const priorityTextMap: Record<number, string> = {
2: t('ms.minders.serial'), 2: t('ms.minders.serial'),
3: t('ms.minders.parallel'), 3: t('ms.minders.parallel'),
}; };
// / // /
const priorityMap = { const priorityMap: Record<RunMode, number> = {
[RunMode.SERIAL]: 2, [RunMode.SERIAL]: 2,
[RunMode.PARALLEL]: 3, [RunMode.PARALLEL]: 3,
}; };
function getExecuteMethod(priority: number) {
return priority === 2 ? RunMode.SERIAL : RunMode.PARALLEL;
}
/** /**
* 处理执行方式切换 * 处理执行方式切换
* @param val 执行方式 * @param val 执行方式
@ -736,11 +740,13 @@
...node.data, ...node.data,
id: undefined, id: undefined,
num: nodeIndex, num: nodeIndex,
executeMethod: getExecuteMethod(node.data.priority),
}); });
} else { } else {
tempMinderParams.value.editList.push({ tempMinderParams.value.editList.push({
...node.data, ...node.data,
num: nodeIndex, num: nodeIndex,
executeMethod: getExecuteMethod(node.data.priority),
}); });
} }
return node.data.level < 2; return node.data.level < 2;

View File

@ -88,7 +88,7 @@
}" }"
> >
<slot :name="item.titleSlotName" :column-config="item"> <slot :name="item.titleSlotName" :column-config="item">
<div v-if="item.title" class="title-name text-[var(--color-text-3)]"> <div v-if="item.title" class="title-name">
{{ t(item.title as string) }} {{ t(item.title as string) }}
</div> </div>
</slot> </slot>
@ -1015,6 +1015,13 @@
} }
} }
} }
:deep(.arco-table-th-title) {
.title-name {
@apply break-keep;
color: var(--color-text-3);
}
}
</style> </style>
<style lang="less"> <style lang="less">

View File

@ -1075,8 +1075,8 @@
await initQuoteCaseDetail(); await initQuoteCaseDetail();
} }
handleActiveDebugProtocolChange(requestVModel.value.protocol); handleActiveDebugProtocolChange(requestVModel.value.protocol);
setDefaultActiveTab();
nextTick(() => { nextTick(() => {
setDefaultActiveTab();
isSwitchingContent.value = false; isSwitchingContent.value = false;
}); });
} }