111
杨磊
2024-05-17 115287b451d6cb2ef3d215c1113d5e52e2f5422b
src/pages/inherit/index.vue
@@ -71,7 +71,10 @@
    </div>
    <div class="contentBox">
      <!-- echarts图 -->
      <div class="barChart" ref="barChart"></div>
      <div v-if="nodeData.length > 0" class="barChart" ref="barChart"></div>
      <div v-else>
        <el-empty description="暂无数据"></el-empty>
      </div>
      <div
        class="toolBox"
        v-if="showTool"
@@ -88,7 +91,7 @@
import * as echarts from "echarts";
import {
  inheritMedicalSataStatistics,
  inheritMedicalList
  inheritMedicalList,
} from "@/api/index.js";
export default {
  data() {
@@ -96,7 +99,7 @@
      // 标题顶部栏需要的东西
      keyword: "",
      idIndex: 0,
      activeId: "",
      activeId: 28,
      conditionId: "",
      searchType: "KEYWORD",
      dynasty: [],
@@ -104,33 +107,36 @@
      showTool: false,
      toolTop: 0,
      toolLeft: 0,
      toolInfo: {}
      toolInfo: {},
    };
  },
  onLoad(options) {
    this.idIndex = options.id;
    console.log("optionsoptionsoptions", options.id);
    getDynasty()
    // getDynasty();
  },
  mounted() {
    this.getStatistics();
    this.getData();
    this.getDynasty()
    // this.getDynasty();
  },
  methods: {
    getStatistics() {
      inheritMedicalSataStatistics().then((res) => {
        this.dynasty = res.object;
        const defaultDynasty = this.dynasty.find((f) => f.dynasty == "宋");
        this.activeId = defaultDynasty.dynastyId;
        this.searchType = "DYNASTY";
        this.getData();
      });
    },
    getData() {
      this.nodeData = [];
      inheritMedicalList({
        keywords: this.keyword,
        dynastyId: this.activeId,
        searchType: this.searchType,
        path: this.conditionId
        path: this.conditionId,
      }).then((res) => {
        console.log(res);
        for (let i = 0; i < res.object.nodeList.length; i++) {
@@ -143,12 +149,12 @@
              itemStyle: {
                color: "#F8E2D7",
                borderColor: "#F3AA78",
                borderWidth: "3"
              }
                borderWidth: "3",
              },
            });
          }
        }
        console.log(this.nodeData);
        console.log(this.nodeData, "nodeData");
        // 初始化 echarts
        this.initBarChart();
      });
@@ -249,7 +255,7 @@
          this.toolLeft = params.event.offsetX + "px";
          this.toolInfo = {
            id: params.data.identifier,
            name: encodeURIComponent(params.data.name)
            name: encodeURIComponent(params.data.name),
          };
        }
      });
@@ -258,7 +264,7 @@
      switch (type) {
        case 1:
          uni.navigateTo({
            url: "/pages/character/detail?id=" + this.toolInfo.id
            url: "/pages/character/detail?id=" + this.toolInfo.id,
          });
          break;
        case 2:
@@ -269,7 +275,7 @@
              "&id=" +
              this.toolInfo.id +
              "&name=" +
              this.toolInfo.name
              this.toolInfo.name,
          });
          break;
        case 3:
@@ -280,7 +286,7 @@
              "&id=" +
              this.toolInfo.id +
              "&name=" +
              this.toolInfo.name
              this.toolInfo.name,
          });
          break;
      }
@@ -320,8 +326,8 @@
        this.keyword = "";
      }
      this.getData();
    }
  }
    },
  },
};
</script>
<style scoped>