From a971d0c13ab9cd5107152f6eba5e1e724a37fa0b Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期五, 07 六月 2024 17:20:31 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TCM_CharacterLibrary --- src/pages/inherit/list.vue | 143 +++++++++++++++++++++++------------------------ 1 files changed, 69 insertions(+), 74 deletions(-) diff --git a/src/pages/inherit/list.vue b/src/pages/inherit/list.vue index 59f24e5..21130a8 100644 --- a/src/pages/inherit/list.vue +++ b/src/pages/inherit/list.vue @@ -132,69 +132,71 @@ identifier: this.idIndex, socialFlag: true }).then((res) => { - let data = res.object; + this.dataList = res.object; // 澶勭悊鑺傜偣棰滆壊 - this.links = []; - for (let i = 0; i < data.edgeList.length; i++) { - const linkItem = data.edgeList[i]; - const index = data.nodeList.findIndex( - (item) => - item.identifier == - (linkItem.endId == this.idIndex - ? linkItem.startId - : linkItem.endId) - ); - if (linkItem.relationType == "浜插睘鍏崇郴") { - data.nodeList[index].linkType = 1; - data.nodeList[index].color = "#F8E2D7"; - data.nodeList[index].borderColor = "#F3AA78"; - } - if (linkItem.relationType == "绀句細鍏崇郴") { - data.nodeList[index].linkType = 2; - data.nodeList[index].color = "#ecf4fe"; - data.nodeList[index].borderColor = "#597aa5"; - } - this.links.push({ - source: data.nodeList.find( - (item) => item.identifier == linkItem.startId - ).name, - target: data.nodeList.find( - (item) => item.identifier == linkItem.endId - ).name, - relationType: linkItem.relationType, - label: { - show: true, - formatter: function (params) { - // 浣跨敤鍑芥暟鍔ㄦ�佺敓鎴愭爣绛惧唴瀹� - // return relationships.find(rel => rel.source === nodes[params.data - // .source] && rel.target === nodes[params.data.target]) - // .relation; - return linkItem.relation; - }, // 璁剧疆鍏崇郴鏍囩鍐呭涓�"Child-Parent" - color: "#2C2C2C", - fontSize: 16, - backgroundColor: "rgba(255, 255, 255, 1)", - padding: [3, 8], - borderRadius: 30, - position: "middle", // 璁剧疆鏍囩鏂囨湰鍦ㄧ嚎鐨勪腑闂翠綅缃笂灞呬腑鏄剧ず - // z: -1, // 璁剧疆鏍囩鐨剒杞撮珮搴︼紝浣垮叾姣旇繛鎺ョ嚎鏇撮珮 - distance: -10 // 灏嗘爣绛炬斁缃湪杩炴帴绾夸笂 - } - }); - } - this.dataList = []; - this.dataList = data.nodeList.map((item) => { - return { - ...item, - itemStyle: { - color: item.identifier == this.idIndex ? "#F8E2D7" : item.color, - borderColor: - item.identifier == this.idIndex ? "#F3AA78" : item.borderColor, - borderWidth: "3" - } - }; - }); - this.initBarChart(this.dataList, this.links); + // this.links = []; + // for (let i = 0; i < data.edgeList.length; i++) { + // const linkItem = data.edgeList[i]; + // const index = data.nodeList.findIndex( + // (item) => + // item.identifier == + // (linkItem.endId == this.idIndex + // ? linkItem.startId + // : linkItem.endId) + // ); + // if (linkItem.relationType == "浜插睘鍏崇郴") { + // data.nodeList[index].linkType = 1; + // data.nodeList[index].color = "#F8E2D7"; + // data.nodeList[index].borderColor = "#F3AA78"; + // } + // if (linkItem.relationType == "绀句細鍏崇郴") { + // data.nodeList[index].linkType = 2; + // data.nodeList[index].color = "#ecf4fe"; + // data.nodeList[index].borderColor = "#597aa5"; + // } + // this.links.push({ + // source: data.nodeList.find( + // (item) => item.identifier == linkItem.startId + // ).name, + // target: data.nodeList.find( + // (item) => item.identifier == linkItem.endId + // ).name, + // relationType: linkItem.relationType, + // label: { + // show: true, + // formatter: function (params) { + // // 浣跨敤鍑芥暟鍔ㄦ�佺敓鎴愭爣绛惧唴瀹� + // // return relationships.find(rel => rel.source === nodes[params.data + // // .source] && rel.target === nodes[params.data.target]) + // // .relation; + // return linkItem.relation; + // }, // 璁剧疆鍏崇郴鏍囩鍐呭涓�"Child-Parent" + // color: "#2C2C2C", + // fontSize: 16, + // backgroundColor: "rgba(255, 255, 255, 1)", + // padding: [3, 8], + // borderRadius: 30, + // position: "middle", // 璁剧疆鏍囩鏂囨湰鍦ㄧ嚎鐨勪腑闂翠綅缃笂灞呬腑鏄剧ず + // // z: -1, // 璁剧疆鏍囩鐨剒杞撮珮搴︼紝浣垮叾姣旇繛鎺ョ嚎鏇撮珮 + // distance: -10 // 灏嗘爣绛炬斁缃湪杩炴帴绾夸笂 + // } + // }); + // } + // this.dataList = data.nodeList.map((item) => { + // return { + // ...item, + // itemStyle: { + // color: item.identifier == this.idIndex ? "#F8E2D7" : item.color, + // borderColor: + // item.identifier == this.idIndex ? "#F3AA78" : item.borderColor, + // borderWidth: "3" + // } + // }; + // }); + setTimeout(() => { + this.initBarChart(); + }, 50); + }); // 涓栧尰鏂囧寲 @@ -228,7 +230,7 @@ }, 50); } }, - initBarChart(dataList, links) { + initBarChart() { // WMBg //閫氳繃 $ref 杩涜鎸傝浇 var barChart = document.getElementById("barChart"); @@ -268,8 +270,7 @@ animationEasingUpdate: "quinticInOut", series: [ { - type: "graph", - layout: "force", + type: "tree", symbolSize: SymbolSize + 20, //鏄惁鍏佽鐢ㄦ埛鎷栧姩鍥剧墖 roam: true, @@ -280,25 +281,19 @@ }, edgeSymbol: ["circle", "arrow"], edgeSymbolSize: [4, 10], - data: dataList, - links: links, + data: [this.dataList], lineStyle: { opacity: 0.9, width: 2, curveness: 0.3 - }, - emphasis: { - focus: "adjacency", - lineStyle: { - width: 10 - } }, force: { initLayout: null, // gravity: 0 repulsion: 600, edgeLength: 400 - } + }, + expandAndCollapse: false, } ] }; -- Gitblit v1.9.1