Commit 215d16b3 by yuwei

项目初始化

parent c602c70f
...@@ -134,6 +134,9 @@ export default { ...@@ -134,6 +134,9 @@ export default {
}, },
handleList (arr, idx, color, category) { handleList (arr, idx, color, category) {
arr.forEach((item, index) => { arr.forEach((item, index) => {
if (item.label === null) {
return false
}
// 设置节点大小 // 设置节点大小
let symbolSize = 10 let symbolSize = 10
switch (idx) { switch (idx) {
...@@ -218,7 +221,7 @@ export default { ...@@ -218,7 +221,7 @@ export default {
} }
} }
let itemStyle = null let itemStyle = null
if (item.list && item.list.length !== 0) { if (item.children && item.children.length !== 0) {
// 非子节点 // 非子节点
itemStyle = { itemStyle = {
borderColor: color.c2, borderColor: color.c2,
...@@ -246,10 +249,10 @@ export default { ...@@ -246,10 +249,10 @@ export default {
}) })
if (idx === 1) { if (idx === 1) {
category = item.name category = item.label
} }
let obj = { let obj = {
name: item.name, name: item.label,
symbolSize: symbolSize, symbolSize: symbolSize,
category: category, category: category,
label, label,
...@@ -263,28 +266,28 @@ export default { ...@@ -263,28 +266,28 @@ export default {
root: true root: true
}) })
} }
if (item.list && item.list.length === 0) { if (item.children && item.children.length === 0) {
obj = Object.assign(obj, { obj = Object.assign(obj, {
isEnd: true isEnd: true
}) })
} }
this.chartList.push(obj) this.chartList.push(obj)
if (item.list && item.list.length > 0) { if (item.children && item.children.length > 0) {
this.handleList(item.list, idx + 1, color, category) this.handleList(item.children, idx + 1, color, category)
} }
}) })
}, },
handleLink (arr, idx, color) { handleLink (arr, idx, color) {
arr.forEach(item => { arr.forEach(item => {
if (item.list) { if (item.children) {
item.list.forEach((item2, eq) => { item.children.forEach((item2, eq) => {
if (idx === 0) { if (idx === 0) {
color = this.colors.find((itemm, eq2) => eq2 === eq % 10) color = this.colors.find((itemm, eq2) => eq2 === eq % 10)
} }
let lineStyle = null let lineStyle = null
switch (idx) { switch (idx) {
case 0: case 0:
if (item2.list.length > 0) { if (item2.children.length > 0) {
lineStyle = { lineStyle = {
normal: { normal: {
color: 'target' color: 'target'
...@@ -307,13 +310,13 @@ export default { ...@@ -307,13 +310,13 @@ export default {
break break
} }
let obj = { let obj = {
source: item.label, source: item.id,
target: item2.label, target: item2.id,
lineStyle lineStyle
} }
this.chartLinks.push(obj) this.chartLinks.push(obj)
if (item2.list && item.list.length > 0) { if (item2.children && item.children.length > 0) {
this.handleLink(item.list, idx + 1) 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