fix(脑图): 脑图性能优化
This commit is contained in:
parent
705f89c07e
commit
93ace7f9fd
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -1075,8 +1075,8 @@
|
|||
await initQuoteCaseDetail();
|
||||
}
|
||||
handleActiveDebugProtocolChange(requestVModel.value.protocol);
|
||||
setDefaultActiveTab();
|
||||
nextTick(() => {
|
||||
setDefaultActiveTab();
|
||||
isSwitchingContent.value = false;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue