From ccb19f88b2583c7dadb18b6b2e9571ec120c6c61 Mon Sep 17 00:00:00 2001
From: YM <479443481@qq.com>
Date: 星期三, 24 四月 2024 22:34:38 +0800
Subject: [PATCH] 1

---
 src/pages/inherit/index.vue |  190 +++++++++++++++-------------------------------
 1 files changed, 63 insertions(+), 127 deletions(-)

diff --git a/src/pages/inherit/index.vue b/src/pages/inherit/index.vue
index 84f4708..4302770 100644
--- a/src/pages/inherit/index.vue
+++ b/src/pages/inherit/index.vue
@@ -54,6 +54,12 @@
 </template>
 <script>
 import * as echarts from "echarts";
+import {
+  inheritMedicalList,
+  inheritMedicalSataStatistics,
+  inheritMedicalCultureList,
+  inheritMedicalRelationList
+} from "@/api/index.js";
 export default {
   data() {
     return {
@@ -64,44 +70,45 @@
         {
           name: "鍞�",
           number: "4910",
-          isColor: false,
+          isColor: false
         },
         {
           name: "浜斾唬",
           number: "494",
-          isColor: true,
+          isColor: true
         },
         {
           name: "瀹�",
           number: "51273",
-          isColor: false,
+          isColor: false
         },
         {
           name: "鍖楀畫",
           number: "15",
-          isColor: true,
+          isColor: true
         },
         {
           name: "鍗楀畫",
           number: "4910",
-          isColor: false,
+          isColor: false
         },
         {
           name: "鍏�",
           number: "299",
-          isColor: true,
+          isColor: true
         },
         {
           name: "鏄�",
           number: "1830",
-          isColor: false,
+          isColor: false
         },
         {
           name: "娓�",
           number: "1000",
-          isColor: true,
-        },
+          isColor: true
+        }
       ],
+      nodeData: []
     };
   },
   onLoad(options) {
@@ -109,10 +116,31 @@
     console.log("optionsoptionsoptions", options.id);
   },
   mounted() {
-    // 鍒濆鍖� echarts
-    this.initBarChart();
+    this.getData();
   },
   methods: {
+    getData() {
+      inheritMedicalList({
+        keywords: "",
+        dynastyId: "",
+        searchType: "KEYWORD",
+        path: ""
+      }).then((res) => {
+        console.log(res);
+        this.nodeData = res.object.nodeList.map((item) => {
+          return {
+            ...item,
+            itemStyle: {
+              color: "#F8E2D7",
+              borderColor: "#F3AA78",
+              borderWidth: "3"
+            }
+          };
+        });
+        // 鍒濆鍖� echarts
+        this.initBarChart();
+      });
+    },
     initBarChart() {
       // WMBg
       //閫氳繃 $ref 杩涜鎸傝浇
@@ -140,16 +168,17 @@
         Distance = 22;
       }
 
+      console.log(this.nodeData, "this.nodeData");
       let option = {
         title: {
-          text: [""],
+          text: [""]
         },
         backgroundColor: {
           type: "image",
           image: "/static/image/WMBg.png",
           repeat: "repeat-x", // 鏄惁骞抽摵锛屽彲浠ユ槸 'repeat-x', 'repeat-y', 'no-repeat'
           size: "100% 100%", // 鑳屾櫙鍥剧墖鐨勫昂瀵革紝鍙互鏄櫨鍒嗘瘮鎴栬�呭儚绱�
-          position: "center center", // 鑳屾櫙鍥剧墖鐨勪綅缃紝鍙互鏄� top, bottom, middle 鎴栬�呯櫨鍒嗘瘮
+          position: "center center" // 鑳屾櫙鍥剧墖鐨勪綅缃紝鍙互鏄� top, bottom, middle 鎴栬�呯櫨鍒嗘瘮
         },
         tooltip: {},
         animationDurationUpdate: 1500,
@@ -157,18 +186,17 @@
         series: [
           {
             type: "graph",
-            layout: "none",
-            symbolSize: SymbolSize + 20,
+            layout: "force",
+            symbolSize: 120,
             //鏄惁鍏佽鐢ㄦ埛鎷栧姩鍥剧墖
-            roam: false,
+            roam: true,
             label: {
               show: true,
               color: "black", // 璁剧疆鑺傜偣鏂囧瓧棰滆壊涓洪粦鑹�
-              fontSize: FontSize, // 璁剧疆鏂囧瓧澶у皬
+              fontSize: FontSize // 璁剧疆鏂囧瓧澶у皬
             },
             edgeSymbol: ["circle", "arrow"],
             edgeSymbolSize: [4, 10],
-
             edgeLabel: {
               show: true,
               fontSize: FontSize, //鏇存敼涓よ�呭叧绯荤殑瀛椾綋
@@ -179,132 +207,40 @@
               formatter: function (params) {
                 // params.data 鏄竟鐨勬暟鎹璞★紝浣犲彲浠ュ湪杩欓噷瀹氫箟鍏崇郴鍚�
                 // 渚嬪锛屼綘鍙互鏍规嵁 source 鍜� target 鐨勫悕绉版潵瀹氫箟鍏崇郴鍚�
-                return params.data.relationName || "鐖跺瓙"; // 濡傛灉瀹氫箟浜� relationName 鍒欐樉绀哄畠锛屽惁鍒欐樉绀衡�滅埗瀛愨��
-              },
+                return params.data.relationName; // 濡傛灉瀹氫箟浜� relationName 鍒欐樉绀哄畠锛屽惁鍒欐樉绀衡�滅埗瀛愨��
+              }
             },
             //鍚勪釜鑺傜偣
-            data: [
-              {
-                name: "钖涢洩",
-                itemStyle: {
-                  color: "#F8E2D7",
-                  borderColor: "#F3AA78",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "閭电櫥鐎�",
-                x: 400,
-                y: 300,
-                itemStyle: {
-                  color: "#F8E2D7",
-                  borderColor: "#F3AA78",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "閭甸瞾鐬�",
-                x: 500,
-                y: 300,
-                itemStyle: {
-                  color: "#F8E2D7",
-                  borderColor: "#F3AA78",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "閭垫槬娉�",
-                x: 600,
-                y: 300,
-                itemStyle: {
-                  color: "#F8E2D7",
-                  borderColor: "#F3AA78",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "寰愰敠",
-                x: 650,
-                y: 400,
-                itemStyle: {
-                  color: "#DCE7EB",
-                  borderColor: "#5F81A4",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "閭典笝鎵�",
-                x: 700,
-                y: 300,
-                itemStyle: {
-                  color: "#F8E2D7",
-                  borderColor: "#F3AA78",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "鍐鑺�",
-                x: 720,
-                y: 400,
-                itemStyle: {
-                  color: "#DCE7EB",
-                  borderColor: "#5F81A4",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "鏉庨缚绔�",
-                x: 740,
-                y: 500,
-                itemStyle: {
-                  color: "#E1E1E1",
-                  borderColor: "#888888",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "閭垫櫙灏�",
-                x: 800,
-                y: 200,
-                itemStyle: {
-                  color: "#F8E2D7",
-                  borderColor: "#F3AA78",
-                  borderWidth: "3",
-                },
-              },
-              {
-                name: "閭垫櫙搴�",
-                x: 800,
-                y: 400,
-                itemStyle: {
-                  color: "#F8E2D7",
-                  borderColor: "#F3AA78",
-                  borderWidth: "3",
-                },
-              },
-            ],
+            data: this.nodeData,
             lineStyle: {
               color: "#000000",
               opacity: 0.9,
               width: 2,
-              curveness: 0,
+              curveness: 0
             },
-          },
-        ],
+            force: {
+              // initLayout: 'circular',
+              // gravity: 0
+              friction: 0.1,
+              repulsion: 500,
+              edgeLength: 6
+            }
+          }
+        ]
       };
       //杩涜娓叉煋
       myChart.setOption(option);
       myChart.on("click", (params) => {
         uni.navigateTo({
-        url: "/pages/inherit/list"
-      });
+          url: "/pages/inherit/list"
+        });
       });
     },
     // 杩斿洖鎸夐挳
     goBack() {
       this.$router.go(-1);
-    },
-  },
+    }
+  }
 };
 </script>
 <style scoped>

--
Gitblit v1.9.1