fix(脑图): 脑图性能优化
This commit is contained in:
parent
705f89c07e
commit
93ace7f9fd
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue