提交 94a16cce authored 作者: 张烨's avatar 张烨

style:政令修改思维导图显示样式

上级 5df76eea
......@@ -51,7 +51,7 @@ const onInitGraph = () => {
rankdir: 'LR', // 布局从左向右
controlPoints: true, // 节点间连线的控制点
nodesep: 10, // 同一层节点之间的距离
ranksep: 50, // 不同层节点之间的距离
ranksep: 100, // 不同层节点之间的距离
},
modes: {
default: [
......
......@@ -123,7 +123,7 @@
</div>
</div>
<el-dialog v-model="isTreeDialog" width="1540px" top="8vh" class="viewpoint-dialog" destroy-on-close>
<el-dialog v-model="isTreeDialog" width="1400px" top="8vh" class="viewpoint-dialog" destroy-on-close>
<template #header>
<div class="viewpoint-header">
<div class="viewpoint-title">政令举措思维导图</div>
......@@ -318,20 +318,23 @@ const onDecreeMindMap = async () => {
if (res.code === 200) {
let nodes = []
let edges = []
Object.keys(res.data||{}).forEach((label, count) => {
nodes.push({ id:`node-${count}`, label })
})
Object.values(res.data||{}).forEach((list, count) => {
list.forEach((item, index) => {
if (item.execAgent?.length) {
nodes.push({ id:`node-${count}-${index}`, label:item.textZh, maxWidth:600, labelCfg })
item.execAgent.forEach((label, num) => {
nodes.push({ id:`node-${count}-${index}-${num}`, label })
edges.push({ id:`edge1-${count}-${index}-${num}`, source:`node-${count}-${index}-${num}`, target:`node-${count}-${index}` })
edges.push({ id:`edge2-${count}-${index}-${num}`, source:`node-${count}`, target:`node-${count}-${index}-${num}` })
})
}
})
let obj = {}
let list = onUniqueArray(Object.values(res.data||{}).flat(1), 'sectionId')
list.forEach((item, index) => {
nodes.push({ id:`node-${item.orderNum}-${item.sectionId}`, label:item.textZh, maxWidth:600, labelCfg })
if (item.execAgent?.length) {
item.execAgent.forEach((label, num) => {
if (!obj[label]) {
obj[label] = `${index}-${num}`
nodes.push({ id:`node-${obj[label]}`, label })
}
edges.push({ id:`edge-${index}-${num}`, source:`node-${obj[label]}`, target:`node-${item.orderNum}-${item.sectionId}` })
})
} else {
edges.push({ id:`edge-${index}`, source:`root-virtual`, target:`node-${item.orderNum}-${item.sectionId}` })
}
nodes.push({ id: 'root-virtual', label: '暂无部门' })
})
setTimeout(() => { refMindGraph.value.onMindGraphData(nodes, edges) }, 100)
......@@ -341,6 +344,18 @@ const onDecreeMindMap = async () => {
}
}
// 对象数组去重
const onUniqueArray = (list, key = 'id') => {
const obj = {};
return list.reduce((total, item) => {
if (!obj[String(item[key])]) {
obj[String(item[key])] = true;
total.push(item);
}
return total;
}, []);
}
// 相关实体
const entityList = ref([]);
const onRelatedEntityData = async () => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论