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

View File

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

View File

@ -88,7 +88,7 @@
}"
>
<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) }}
</div>
</slot>
@ -1015,6 +1015,13 @@
}
}
}
:deep(.arco-table-th-title) {
.title-name {
@apply break-keep;
color: var(--color-text-3);
}
}
</style>
<style lang="less">

View File

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