1
YM
2024-05-11 b576ba3501304bdbd56771dc7299e0c40e047aa4
1
5个文件已修改
515 ■■■■■ 已修改文件
src/pages/TcmSystem/TcmSystem.vue 134 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/character/detail.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/character/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/inherit/index.vue 268 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/inherit/list.vue 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/TcmSystem/TcmSystem.vue
@@ -50,8 +50,8 @@
              style="padding: 0 20rpx; color: #2c2c2c; cursor: pointer"
              @click="handInstitCLick(item, 'a')"
            >
              <view class="">{{ item.dynastyName }}</view>
              <view class="">{{ item.count }}</view>
              <view>{{ item.dynastyName }}</view>
              <view>{{ item.count }}</view>
            </li>
          </ul>
          <view v-if="institution.list.length - 1 > 3" class="flex flex-center">
@@ -85,8 +85,8 @@
              style="padding: 0 20rpx; cursor: pointer"
              @click="handInstitCLick(item, 'b')"
            >
              <view class="">{{ item.dynastyName }}</view>
              <view class="">{{ item.count }}</view>
              <view>{{ item.dynastyName }}</view>
              <view>{{ item.count }}</view>
            </li>
          </ul>
          <view v-if="officials.list.length - 1 > 3" class="flex flex-center">
@@ -125,9 +125,7 @@
        v-loading="pageLoading"
      >
        <view class="flex" style="width: 100%; margin-bottom: 0.3rem">
          <view
            class=""
            style="font-size: 0.14rem; color: #2c2c2c; font-weight: 400"
          <view style="font-size: 0.14rem; color: #2c2c2c; font-weight: 400"
            >共{{ total }}条</view
          >
          <view class="paixu">
@@ -145,8 +143,8 @@
        <view class="flex CommodityList">
          <view
            class="rightList"
            @click="ListClick(item)"
            v-for="item in CommodityList"
            @click="ListClick(item, index)"
            v-for="(item, index) in CommodityList"
            :key="item"
          >
            <el-card class="box-card" style="height: 100%">
@@ -247,7 +245,6 @@
    <el-dialog class="dialog" :visible.sync="dialogVisible" width="40%">
      <!-- 取消键 -->
      <view
        class=""
        style="
          padding: 0.16rem;
          position: absolute;
@@ -292,21 +289,20 @@
            </ul>
          </view>
        </view>
        <view class="" style="width: 80%; height: 100%; position: relative">
        <view style="width: 80%; height: 100%; position: relative">
          <view class="pinji flex">
            <view class=""
            <view
              >品级:<span> {{ ListDetails.grade || "-" }}</span>
            </view>
            <view class=""
            <view
              >别名:<span> {{ ListDetails.alias || "-" }}</span>
            </view>
            <view class=""
            <view
              >来源:<span> {{ ListDetails.source || "-" }}</span>
            </view>
          </view>
          <view class="">
          <view>
            <view
              class=""
              style="
                font-size: 0.14rem;
                color: #2c2c2c;
@@ -320,7 +316,6 @@
              相关描述
            </view>
            <view
              class=""
              style="
                font-size: 0.14rem;
                color: #2c2c2c;
@@ -330,9 +325,8 @@
            >
              {{ ListDetails.desc || "-" }}
            </view>
            <view class="">
            <view>
              <view
                class=""
                style="
                  font-size: 0.14rem;
                  color: #2c2c2c;
@@ -346,7 +340,6 @@
                备注
              </view>
              <span
                class=""
                v-for="item in ListDetails.notesList"
                style="
                  font-size: 0.14rem;
@@ -360,21 +353,60 @@
            </view>
          </view>
        </view>
        <!-- <view class="flex detailsBtn">
          <el-button class="flex btn-prev">
        <view class="flex detailsBtn">
          <el-button
            class="flex btn-prev"
            :disabled="!ListDetails.prev"
            @click="ListClick(ListDetails.prev, ListDetails.prev.index)"
          >
            <view class="flex">
              <view class="" style="margin-right: 40rpx">上一条</view>
              <view class="btn-prev-L">机构: 太医院 </view>
              <view style="width: 0.6rem">上一条</view>
              <view
                class="btn-prev-L"
                style="
                  flex: 1;
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
                "
                :title="ListDetails.prev ? ListDetails.prev.name : '-'"
              >
                {{
                  ListDetails.prev
                    ? ListDetails.prev.typeName + ":" + ListDetails.prev.name
                    : "-"
                }}
              </view>
            </view>
          </el-button>
          <view class=""> 102/329 </view>
          <el-button class="flex btn-next">
          <view class="pageInfo">
            {{ ListDetails.index + 1 }}/{{ total }}
          </view>
          <el-button
            class="flex btn-next"
            :disabled="!ListDetails.next"
            @click="ListClick(ListDetails.next, ListDetails.next.index)"
          >
            <view class="flex">
              <view class="" style="margin-right: 40rpx">机构: 太医院 </view>
              <view class="btn-prev-R">下一条</view>
              <view
                style="
                  flex: 1;
                  overflow: hidden;
                  white-space: nowrap;
                  text-overflow: ellipsis;
                "
                :title="ListDetails.next ? ListDetails.next.name : '-'"
              >
                {{
                  ListDetails.next
                    ? ListDetails.next.typeName + ":" + ListDetails.next.name
                    : "-"
                }}
              </view>
              <view class="btn-prev-R" style="width: 0.6rem">下一条</view>
            </view>
          </el-button>
        </view> -->
        </view>
      </view>
    </el-dialog>
@@ -528,7 +560,7 @@
      getMedicalList(Obj).then((res) => {
        this.CommodityList = res.list.map((item) => {
          return {
            id: item.id,
            requestId: this.searchType == "ALL" ? item.id : item.rowId,
            post:
              item.type === "OFFICIAL"
                ? "职官"
@@ -544,23 +576,44 @@
      });
    },
    // list数组 获取list里面的详情shuju
    ListClick(item) {
      console.log(item,this.searchType);
    ListClick(item, index) {
      console.log(item, "item");
      let Obj = {
        rowId: this.searchType == "ALL" ? item.id : item.rowId,
        rowId: item.requestId,
        medicalSearchType: this.searchType,
        type: this.classifyType, //查询类型 取值:OFFICIAL->职官 INSTITUTION->机构 ALL->职官、机构
        name: this.SearchValue, //搜索框检索
        dynastyId: this.classifyId, //点击朝代查询数据时,带上此参数
        sort: this.rankVal, //排序方式 取值:CREATE创建时间,NAME名称
        sort: this.rankVal //排序方式 取值:CREATE创建时间,NAME名称
      };
      getMedicalDetails(Obj).then((res) => {
        this.ListDetails = {
          index,
          ...item,
          ...res.object.curr
          ...res.object.curr,
          next:
            res.object.next && res.object.next.name
              ? {
                  ...res.object.next,
                  requestId: res.object.next.rowId,
                  index: index + 1,
                  typeName:
                    res.object.next.type === "OFFICIAL" ? "职官" : "机构"
                }
              : null,
          prev:
            res.object.prev && res.object.prev.name
              ? {
                  ...res.object.prev,
                  requestId: res.object.prev.rowId,
                  index: index - 1,
                  typeName:
                    res.object.prev.type === "OFFICIAL" ? "职官" : "机构"
                }
              : null
        };
        this.dialogVisible = true;
      });
      this.dialogVisible = !this.dialogVisible;
    },
    // 左侧的机构统计等等按钮
    handInstitCLick(item, name) {
@@ -755,12 +808,19 @@
  border-radius: 5px;
  /* height: .32rem; */
  line-height: 0.32rem;
  flex: 1;
  overflow: hidden;
}
.detailsBtn .pageInfo {
  width: 1rem;
  text-align: center;
}
.detailsBtn .btn-prev-L,
.detailsBtn .btn-prev-R {
  border-left: 1px solid #9e9e9e;
  padding-left: 0.1rem;
  text-align: center;
}
.detailsBtn > :nth-child(2) {
src/pages/character/detail.vue
@@ -515,7 +515,7 @@
            a: item.time,
            b: item.activityName,
            c: item.activityAddrOld,
            d: "-" // 这里缺少活动描述字段
            d: item.desc // 这里缺少活动描述字段
          };
        });
      });
src/pages/character/index.vue
@@ -468,8 +468,12 @@
    },
    // 高级搜索
    onSubmit(val) {
      getAdvanceSearch(val).then((res) => {
        console.log(res, "接口调用成功");
      getAdvanceSearch({
        ...val,
        page: 1,
        pageSize: 100
      }).then((res) => {
        console.log(res,"res");
      });
    },
    // 点击下面的朝代按钮
src/pages/inherit/index.vue
@@ -10,16 +10,24 @@
    <div class="filterBox font-family">
      <div class="searchBox">
        <input type="text" placeholder="输入姓名/别名/朝代" />
        <button>搜索</button>
        <input type="text" v-model="keyword" placeholder="请输入关键字" />
        <button @click="search">搜索</button>
      </div>
      <div class="dynasty">
        <div style="font-weight: 700; line-height: 0.25rem">筛选朝代</div>
        <div class="filterList">
          <div class="filterItem" v-for="(item, index) in dynasty" :key="index">
            <div class="circleBox" :class="{ bgcColor: item.isColor }"></div>
            <div class="filterText" :class="{ fontColor: item.isColor }">
              {{ item.name + " " + item.number }}
          <div
            class="filterItem"
            v-for="(item, index) in dynasty"
            :key="index"
            @click="changeDynasty(item)"
          >
            <div
              class="circleBox"
              :class="{ active: item.dynastyId === activeId }"
            ></div>
            <div class="filterText">
              {{ item.dynasty + " " + item.count }}
            </div>
          </div>
        </div>
@@ -27,83 +35,76 @@
      <div class="condition">
        <div style="font-weight: 700; line-height: 0.25rem">条件选择</div>
        <div class="filterList">
          <div class="conditionItem">
            <div class="circleBox"></div>
          <div class="conditionItem" @click="changeCondition(3)">
            <div
              class="circleBox"
              :style="{ background: conditionId === 3 ? '#bacd66' : '#9e9e9e' }"
            ></div>
            <div class="filterText">3代传承世医</div>
          </div>
          <div class="conditionItem">
            <div class="circleBox"></div>
          <div class="conditionItem" @click="changeCondition(4)">
            <div
              class="circleBox"
              :style="{ background: conditionId === 4 ? '#6d9346' : '#9e9e9e' }"
            ></div>
            <div class="filterText">4代传承世医</div>
          </div>
          <div class="conditionItem">
            <div class="circleBox"></div>
          <div class="conditionItem" @click="changeCondition(5)">
            <div
              class="circleBox"
              :style="{ background: conditionId === 5 ? '#da7a2b' : '#9e9e9e' }"
            ></div>
            <div class="filterText">5代传承世医</div>
          </div>
          <div class="conditionItem">
            <div class="circleBox"></div>
          <div class="conditionItem" @click="changeCondition(6)">
            <div
              class="circleBox"
              :style="{ background: conditionId === 6 ? '#bc321d' : '#9e9e9e' }"
            ></div>
            <div class="filterText">5代以上传承世医</div>
          </div>
        </div>
      </div>
      <div style="padding-left: 0.5rem; margin-top: 20px">共 1983个世医</div>
      <div style="padding-left: 0.5rem; margin-top: 20px">
        共 {{ this.nodeData.length }}个世医
    </div>
    </div>
    <div class="contentBox">
    <!-- echarts图 -->
    <div class="barChart" ref="barChart"></div>
      <div
        class="toolBox"
        v-if="showTool"
        :style="{ top: toolTop, left: toolLeft }"
      >
        <div class="toolItem" @click="gotoDetail(1)">个人信息</div>
        <div class="toolItem" @click="gotoDetail(2)">世医文化</div>
        <div class="toolItem" @click="gotoDetail(3)">世医传承</div>
      </div>
    </div>
  </view>
</template>
<script>
import * as echarts from "echarts";
import { inheritMedicalList } from "@/api/index.js";
import {
  inheritMedicalSataStatistics,
  inheritMedicalList
} from "@/api/index.js";
export default {
  data() {
    return {
      // 标题顶部栏需要的东西
      keyword: "",
      idIndex: 0,
      activeIndex: 1,
      dynasty: [
        {
          name: "唐",
          number: "4910",
          isColor: false
        },
        {
          name: "五代",
          number: "494",
          isColor: true
        },
        {
          name: "宋",
          number: "51273",
          isColor: false
        },
        {
          name: "北宋",
          number: "15",
          isColor: true
        },
        {
          name: "南宋",
          number: "4910",
          isColor: false
        },
        {
          name: "元",
          number: "299",
          isColor: true
        },
        {
          name: "明",
          number: "1830",
          isColor: false
        },
        {
          name: "清",
          number: "1000",
          isColor: true
        }
      ],
      nodeData: []
      activeId: "",
      conditionId: "",
      searchType: "KEYWORD",
      dynasty: [],
      nodeData: [],
      showTool: false,
      toolTop: 0,
      toolLeft: 0,
      toolInfo: {}
    };
  },
  onLoad(options) {
@@ -111,27 +112,40 @@
    console.log("optionsoptionsoptions", options.id);
  },
  mounted() {
    this.getStatistics();
    this.getData();
  },
  methods: {
    getStatistics() {
      inheritMedicalSataStatistics().then((res) => {
        this.dynasty = res.object;
      });
    },
    getData() {
      this.nodeData = [];
      inheritMedicalList({
        keywords: "",
        dynastyId: "",
        searchType: "KEYWORD",
        path: ""
        keywords: this.keyword,
        dynastyId: this.activeId,
        searchType: this.searchType,
        path: this.conditionId
      }).then((res) => {
        console.log(res);
        this.nodeData = res.object.nodeList.map((item) => {
          return {
            ...item,
        for (let i = 0; i < res.object.nodeList.length; i++) {
          const node = res.object.nodeList[i];
          if (
            this.nodeData.findIndex((citem) => citem.name == node.name) == -1
          ) {
            this.nodeData.push({
              ...node,
            itemStyle: {
              color: "#F8E2D7",
              borderColor: "#F3AA78",
              borderWidth: "3"
            }
          };
        });
          }
        }
        console.log(this.nodeData);
        // 初始化 echarts
        this.initBarChart();
      });
@@ -225,18 +239,84 @@
      //进行渲染
      myChart.setOption(option);
      myChart.on("click", (params) => {
        console.log(params.event.offsetX, params.event.offsetY);
        if (params.componentType === "series") {
          this.showTool = true;
          this.toolTop = params.event.offsetY + "px";
          this.toolLeft = params.event.offsetX + "px";
          this.toolInfo = {
            id: params.data.identifier,
            name: encodeURIComponent(params.data.name)
          };
        }
      });
    },
    gotoDetail(type) {
      switch (type) {
        case 1:
          uni.navigateTo({
            url: "/pages/character/detail?id=" + this.toolInfo.id
          });
          break;
        case 2:
        uni.navigateTo({
          url:
            "/pages/inherit/list?id=" +
            params.data.identifier +
              "/pages/inherit/list?type=" +
              2 +
              "&id=" +
              this.toolInfo.id +
            "&name=" +
            encodeURIComponent(params.data.name)
              this.toolInfo.name
        });
          break;
        case 3:
          uni.navigateTo({
            url:
              "/pages/inherit/list?type=" +
              1 +
              "&id=" +
              this.toolInfo.id +
              "&name=" +
              this.toolInfo.name
      });
          break;
      }
    },
    // 返回按钮
    goBack() {
      this.$router.go(-1);
    },
    search() {
      this.searchType = "KEYWORD";
      this.activeId = "";
      this.conditionId = "";
      this.getData();
    },
    changeDynasty(item) {
      if (item.dynastyId === this.activeId) {
        this.activeId = "";
        if (this.conditionId === "") {
          this.searchType = "KEYWORD";
        }
      } else {
        this.searchType = "DYNASTY";
        this.activeId = item.dynastyId;
        this.keyword = "";
      }
      this.getData();
    },
    changeCondition(index) {
      if (index === this.conditionId) {
        this.conditionId = "";
        if (this.activeId === "") {
          this.searchType = "KEYWORD";
        }
      } else {
        this.searchType = "DYNASTY";
        this.conditionId = index;
        this.keyword = "";
      }
      this.getData();
    }
  }
};
@@ -258,12 +338,32 @@
  font-size: 0.12rem;
  padding: 0;
}
.barChart {
.contentBox {
  width: 100vw;
  height: 80vh;
  position: relative;
}
.barChart {
  width: 100%;
  height: 100%;
}
.toolBox {
  padding: 0.1rem;
  position: absolute;
}
.toolItem {
  padding: 0.04rem 0.2rem;
  border: 1px solid #333;
  border-radius: 1rem;
  margin: 0.06rem;
  font-size: 0.12rem;
  cursor: pointer;
  background-color: #fff;
}
.toolItem:hover {
  background-color: #efefef;
}
.filterBox {
  height: 2.2rem;
  width: 90%;
  border-bottom: 1px solid #ccc;
  padding: 20px;
@@ -309,8 +409,10 @@
  padding: 0.1rem 0.5rem;
}
.filterList {
  flex: 1;
  overflow: hidden;
  margin-left: 0.4rem;
  display: flex;
  overflow: hidden;
}
.filterItem {
  display: flex;
@@ -319,9 +421,12 @@
  justify-content: center;
  width: 1rem;
  height: 0.25rem;
  flex: 1;
  margin-left: 0.2rem;
  border-radius: 0.13rem;
  float: left;
  margin-top: 0.02rem;
  margin-bottom: 0.1rem;
  cursor: pointer;
}
.conditionItem {
  display: flex;
@@ -330,21 +435,26 @@
  justify-content: center;
  width: 1.3rem;
  height: 0.25rem;
  flex: 1;
  float: left;
  margin-left: 0.2rem;
  border-radius: 0.13rem;
  margin-top: 0.02rem;
  margin-bottom: 0.1rem;
  cursor: pointer;
}
.circleBox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #326350;
  background-color: #9e9e9e;
}
.circleBox.active {
  background-color: #da7a2b;
}
.filterText {
  margin-left: 10px;
  font-size: 16px;
  color: #326350;
}
.fontColor {
  color: #827e44 !important;
src/pages/inherit/list.vue
@@ -1,5 +1,5 @@
<template>
  <view class="">
  <view>
    <headNav
      idIndex="2"
      :searchBg="false"
@@ -34,7 +34,7 @@
          世医文化
        </li>
      </ul>
      <view class="" style="width: 1rem"></view>
      <view style="width: 1rem"></view>
    </view>
    <view v-if="showType == 1" class="legendBox">
      <view class="socialMappingBox" @click="showSocialMapping">
@@ -87,7 +87,6 @@
<script>
import * as echarts from "echarts";
import {
  inheritMedicalSataStatistics,
  inheritMedicalCultureList,
  inheritMedicalRelationList
} from "@/api/index.js";
@@ -108,9 +107,12 @@
  onLoad(options) {
    this.idIndex = options.id;
    this.mainName = decodeURIComponent(options.name);
    console.log("optionsoptionsoptions", options.id);
    this.type = options.type;
  },
  mounted() {
    if (this.type) {
      this.changeType(this.type);
    }
    this.getData();
  },
  methods: {
@@ -126,22 +128,48 @@
        for (let i = 0; i < data.edgeList.length; i++) {
          const linkItem = data.edgeList[i];
          const index = data.nodeList.findIndex(
              (item) => item.identifier == linkItem.endId
            (item) =>
              item.identifier ==
              (linkItem.endId == this.idIndex
                ? linkItem.startId
                : linkItem.endId)
            );
          if (linkItem.relationType == "亲属关系") {
            data.nodeList[index].linkType = 1;
            data.nodeList[index].color = "#DCE7EB";
            data.nodeList[index].borderColor = "#5F81A4";
            data.nodeList[index].color = "#F8E2D7";
            data.nodeList[index].borderColor = "#F3AA78";
          }
          if (linkItem.relationType == "社会关系") {
            data.nodeList[index].linkType = 2;
            data.nodeList[index].color = "#E1E1E1";
            data.nodeList[index].borderColor = "#888888";
            data.nodeList[index].color = "#ecf4fe";
            data.nodeList[index].borderColor = "#597aa5";
          }
          this.links.push({
            source: this.mainName,
            target: data.nodeList[index].name,
            relationName: linkItem.relation
            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, // 设置标签的z轴高度,使其比连接线更高
              distance: -10 // 将标签放置在连接线上
            }
          });
        }
        this.dataList = [];
@@ -150,13 +178,22 @@
            ...item,
            itemStyle: {
              color: item.identifier == this.idIndex ? "#F8E2D7" : item.color,
              borderColor: item.identifier == this.idIndex ? "#F3AA78" : item.borderColor,
              borderColor:
                item.identifier == this.idIndex ? "#F3AA78" : item.borderColor,
              borderWidth: "3"
            }
          };
        });
        console.log(this.dataList,this.links);
        this.initBarChart();
        console.log(this.dataList);
        console.log(this.links);
        this.initBarChart(this.dataList, this.links);
      });
      // 世医文化
      inheritMedicalCultureList({
        identifier: this.idIndex
      }).then((res) => {
        console.log(res, "res");
      });
    },
    showSocialMapping() {
@@ -167,9 +204,7 @@
        newDataList = [...this.dataList];
        newLinks = [...this.links];
      } else {
        newDataList = this.dataList.filter(
          (item) => item.itemStyle.borderColor == "#F3AA78"
        );
        newDataList = this.dataList.filter((item) => item.color !== "#ecf4fe");
        newLinks = [...this.links];
      }
      this.initBarChart(newDataList, newLinks);
@@ -183,7 +218,7 @@
        }, 50);
      }
    },
    initBarChart() {
    initBarChart(dataList, links) {
      // WMBg
      //通过 $ref 进行挂载
      var barChart = document.getElementById("barChart");
@@ -233,30 +268,20 @@
              color: "black", // 设置节点文字颜色为黑色
              fontSize: FontSize // 设置文字大小
            },
            edgeSymbol: ["circle"],
            edgeSymbol: ["circle", "arrow"],
            edgeSymbolSize: [4, 10],
            edgeLabel: {
              show: true,
              fontSize: FontSize, //更改两者关系的字体
              position: "middle",
              //这里设置关系文字是否和线段重叠
              //   padding: [0, 0], // 调整内边距以确保标签与线段紧密贴合
              // verticalAlign: 'middle', // 设置文本的垂直对齐方式为居中
              formatter: function (params) {
                // params.data 是边的数据对象,你可以在这里定义关系名
                // 例如,你可以根据 source 和 target 的名称来定义关系名
                return params.data.relationName || "父子"; // 如果定义了 relationName 则显示它,否则显示“父子”
              }
            },
            //各个节点
            data: this.dataList, //关系连接
            links: this.links,
            data: dataList,
            links: links,
            lineStyle: {
              color: "#000000",
              opacity: 0.9,
              width: 2,
              curveness: 0
              curveness: 0.3
            },
            emphasis: {
              focus: "adjacency",
              lineStyle: {
                width: 10
              }
            },
            force: {
              initLayout: null,