Commit 215d16b3 by yuwei

项目初始化

parent c602c70f
......@@ -134,6 +134,9 @@ export default {
},
handleList (arr, idx, color, category) {
arr.forEach((item, index) => {
if (item.label === null) {
return false
}
// 设置节点大小
let symbolSize = 10
switch (idx) {
......@@ -218,7 +221,7 @@ export default {
}
}
let itemStyle = null
if (item.list && item.list.length !== 0) {
if (item.children && item.children.length !== 0) {
// 非子节点
itemStyle = {
borderColor: color.c2,
......@@ -246,10 +249,10 @@ export default {
})
if (idx === 1) {
category = item.name
category = item.label
}
let obj = {
name: item.name,
name: item.label,
symbolSize: symbolSize,
category: category,
label,
......@@ -263,28 +266,28 @@ export default {
root: true
})
}
if (item.list && item.list.length === 0) {
if (item.children && item.children.length === 0) {
obj = Object.assign(obj, {
isEnd: true
})
}
this.chartList.push(obj)
if (item.list && item.list.length > 0) {
this.handleList(item.list, idx + 1, color, category)
if (item.children && item.children.length > 0) {
this.handleList(item.children, idx + 1, color, category)
}
})
},
handleLink (arr, idx, color) {
arr.forEach(item => {
if (item.list) {
item.list.forEach((item2, eq) => {
if (item.children) {
item.children.forEach((item2, eq) => {
if (idx === 0) {
color = this.colors.find((itemm, eq2) => eq2 === eq % 10)
}
let lineStyle = null
switch (idx) {
case 0:
if (item2.list.length > 0) {
if (item2.children.length > 0) {
lineStyle = {
normal: {
color: 'target'
......@@ -307,13 +310,13 @@ export default {
break
}
let obj = {
source: item.label,
target: item2.label,
source: item.id,
target: item2.id,
lineStyle
}
this.chartLinks.push(obj)
if (item2.list && item.list.length > 0) {
this.handleLink(item.list, idx + 1)
if (item2.children && item.children.length > 0) {
this.handleLink(item.children, idx + 1)
}
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment