1
YM
2024-06-12 e7c088a46085ca75f64f32555296dd774b95461f
src/pages/academicGenres/chart.vue
@@ -65,8 +65,17 @@
        </li>
      </ul>
    </view>
    <view class="contentBox">
      <view id="main" style="width: 100%; height: 100%"></view>
    <view class="contentBox" style="position: relative;">
      <div
          v-if="nodeData.length == 0"
          style="color: #666; text-align: center; font-size: 16px; position: absolute;top: 1rem;left: 0;right: 0;"
        >
          暂无数据
        </div>
      <view id="main" style="width: 100%; height: 100%">
      </view>
    </view>
  </view>
</template>
@@ -134,11 +143,15 @@
                return {
                  content: item.content,
                  source:
                    "出处:《" +
                    res.object.bookList &&
                    res.object.bookList.find((citem) => citem.id == item.bookId)
                      .name +
                    "》 P" +
                    item.pageNo
                      ? "出处:《" +
                        res.object.bookList.find(
                          (citem) => citem.id == item.bookId
                        ).name +
                        "》 P" +
                        item.pageNo
                      : ""
                };
              })
            : [],
@@ -147,11 +160,15 @@
                return {
                  content: item.content,
                  source:
                    "出处:《" +
                    res.object.bookList &&
                    res.object.bookList.find((citem) => citem.id == item.bookId)
                      .name +
                    "》 P" +
                    item.pageNo
                      ? "出处:《" +
                        res.object.bookList.find(
                          (citem) => citem.id == item.bookId
                        ).name +
                        "》 P" +
                        item.pageNo
                      : ""
                };
              })
            : [],
@@ -160,11 +177,15 @@
                return {
                  content: item.content,
                  source:
                    "出处:《" +
                    res.object.bookList &&
                    res.object.bookList.find((citem) => citem.id == item.bookId)
                      .name +
                    "》 P" +
                    item.pageNo
                      ? "出处:《" +
                        res.object.bookList.find(
                          (citem) => citem.id == item.bookId
                        ).name +
                        "》 P" +
                        item.pageNo
                      : ""
                };
              })
            : [],
@@ -173,11 +194,15 @@
                return {
                  content: item.content,
                  source:
                    "出处:《" +
                    res.object.bookList &&
                    res.object.bookList.find((citem) => citem.id == item.bookId)
                      .name +
                    "》 P" +
                    item.pageNo
                      ? "出处:《" +
                        res.object.bookList.find(
                          (citem) => citem.id == item.bookId
                        ).name +
                        "》 P" +
                        item.pageNo
                      : ""
                };
              })
            : []
@@ -207,30 +232,32 @@
        searchSchoolPerson({
          keyword: item
        }).then((res) => {
          for (let i = 0; i < res.list.length; i++) {
            const citem = res.list[i];
            // 节点
            this.nodeData.push({
              name: citem.name2,
              x: Math.random() * 1000,
              y: Math.random() * 600,
              itemStyle: {
                color: citem.relationType == "人物著作" ? "#eee" : "#FDEFE4",
                borderWidth: 4,
                borderColor:
                  citem.relationType == "人物著作" ? "#9e9e9e" : "#DA7A2B",
                borderRadius: 30
              },
              symbolSize: 100
            });
            // 关系
            this.links.push({
              source: item,
              target: citem.name2,
              label: {
                show: false
              }
            });
          if (res.list) {
            for (let i = 0; i < res.list.length; i++) {
              const citem = res.list[i];
              // 节点
              this.nodeData.push({
                name: citem.name2,
                x: Math.random() * 1000,
                y: Math.random() * 600,
                itemStyle: {
                  color: citem.relationType == "人物著作" ? "#eee" : "#FDEFE4",
                  borderWidth: 4,
                  borderColor:
                    citem.relationType == "人物著作" ? "#9e9e9e" : "#DA7A2B",
                  borderRadius: 30
                },
                symbolSize: 100
              });
              // 关系
              this.links.push({
                source: item,
                target: citem.name2,
                label: {
                  show: false
                }
              });
            }
          }
          this.init();
        });