From 2df27fd1fa604fc6b2e5876b1b5e073f9a7f39ab Mon Sep 17 00:00:00 2001
From: 杨磊 <505174330@qq.com>
Date: 星期六, 11 五月 2024 19:24:08 +0800
Subject: [PATCH] 登录注册

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

diff --git a/src/pages/inherit/index.vue b/src/pages/inherit/index.vue
index 9dc0569..610ec9c 100644
--- a/src/pages/inherit/index.vue
+++ b/src/pages/inherit/index.vue
@@ -1,7 +1,7 @@
 <template>
   <view class="">
     <headNav
-      :idIndex="idIndex"
+      idIndex="2"
       :searchBg="false"
       text="涓尰涓栧尰浼犳壙鏁版嵁搴�"
       bg="/static/image/topBg1.png"
@@ -10,8 +10,12 @@
 
     <div class="filterBox font-family">
       <div class="searchBox">
-        <input type="text" placeholder="杈撳叆濮撳悕/鍒悕/鏈濅唬" />
-        <button>鎼滅储</button>
+        <input
+          v-model="keywords"
+          type="text"
+          placeholder="杈撳叆濮撳悕/鍒悕/鏈濅唬"
+        />
+        <button @click="getData">鎼滅储</button>
       </div>
       <div class="dynasty">
         <div style="font-weight: 700; line-height: 0.25rem">绛涢�夋湞浠�</div>
@@ -54,6 +58,7 @@
 </template>
 <script>
 import * as echarts from "echarts";
+import { inheritMedicalList, getDynastyAll } from "@/api/index.js";
 export default {
   data() {
     return {
@@ -102,17 +107,48 @@
           isColor: true,
         },
       ],
+      nodeData: [],
+      keywords: "",
     };
   },
   onLoad(options) {
     this.idIndex = options.id;
     console.log("optionsoptionsoptions", options.id);
+    getDynasty()
   },
   mounted() {
-    // 鍒濆鍖� echarts
-    this.initBarChart();
+    this.getData();
+    this.getDynasty()
+
   },
   methods: {
+    getDynasty() {
+      getDynastyAll().then((res) => {
+        console.log(res, "getDynastyAll");
+      });
+    },
+    getData() {
+      inheritMedicalList({
+        keywords: this.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 杩涜鎸傝浇
@@ -157,10 +193,10 @@
         series: [
           {
             type: "graph",
-            layout: "none",
-            symbolSize: SymbolSize + 20,
+            layout: "force",
+            symbolSize: 120,
             //鏄惁鍏佽鐢ㄦ埛鎷栧姩鍥剧墖
-            roam: false,
+            roam: true,
             label: {
               show: true,
               color: "black", // 璁剧疆鑺傜偣鏂囧瓧棰滆壊涓洪粦鑹�
@@ -168,7 +204,6 @@
             },
             edgeSymbol: ["circle", "arrow"],
             edgeSymbolSize: [4, 10],
-
             edgeLabel: {
               show: true,
               fontSize: FontSize, //鏇存敼涓よ�呭叧绯荤殑瀛椾綋
@@ -179,128 +214,42 @@
               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,
             },
+            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?id=" +
+            params.data.identifier +
+            "&name=" +
+            encodeURIComponent(params.data.name),
+        });
+      });
     },
     // 杩斿洖鎸夐挳
     goBack() {
-      // uuni.redirectTo();
-      uni.redirectTo({
-        url: "/pages/index/index",
-      });
+      this.$router.go(-1);
     },
   },
 };

--
Gitblit v1.9.1