1
YM
2024-07-26 c423765d8a5ff0c58d23bb0a31af7df6c1fad95c
src/pages/knowledgeBase/knowledgeBase.vue
@@ -1,13 +1,13 @@
<template>
  <view>
    <!-- 顶部 -->
    <headNav idIndex="0" text="中国医学人物知识库" />
    <headNav idIndex="0" text="中国历代医学人物知识库" />
    <!-- 搜索 -->
    <view class="flex flex-center Search">
      <!-- <luanqing-search class="search_bar" @onSearch="onSearch"></luanqing-search> -->
      <advancedSearch
        @onSearch="onSearch"
        placehold="输入姓名/别名/朝代/传主职业搜索"
        placehold="输入姓名/别名/时期/传主职业搜索"
        :isAvancedTrue="false"
        :keyword="keywords"
      />
@@ -26,11 +26,11 @@
      热门搜索:
      <ul class="flex" style="margin-right: 10rpx">
        <li
          v-for="item in hot"
          @click="hotSearchClick(item)"
          v-for="(item, index) in hot"
          @click="hotSearchClick(item, index)"
          :key="item.id"
          class="cursor"
          style="color: #5879a4"
          :class="{ cursor: true, active: hotAciveIndex === index }"
          style="color: #244a7b"
        >
          {{ item.name }}
        </li>
@@ -47,7 +47,16 @@
        class="advancedSeaTrue1"
      >
        <h3>高级搜索</h3>
        <MyForm @submit="onSubmit" @reset="resetForm" :from="from" />
        <MyForm
          @submit="
            (data) => {
              CurrentPage = 1;
              onSubmit(data);
            }
          "
          @reset="resetForm"
          :from="from"
        />
      </view>
    </view>
    <uni-row
@@ -194,7 +203,11 @@
          <el-table-column prop="id" label="序号" width="110"></el-table-column>
          <el-table-column prop="personName" label="姓名">
            <template slot-scope="scope">
              <a style="cursor: pointer;color: #027EDC;" @click="gotoDetail(scope.row.id)">{{ scope.row.personName }}</a>
              <a
                style="cursor: pointer; color: #027edc"
                @click="gotoDetail(scope.row.id)"
                >{{ scope.row.personName }}</a
              >
            </template>
          </el-table-column>
          <el-table-column prop="personAlias" label="别名"></el-table-column>
@@ -203,7 +216,7 @@
            label="性别"
            width="70"
          ></el-table-column>
          <el-table-column prop="period" label="时代"></el-table-column>
          <el-table-column prop="period" label="时期"></el-table-column>
          <el-table-column
            prop="birthYear"
            label="生年"
@@ -255,7 +268,8 @@
  getPDownload,
  getPList,
  getHotSearch,
  getPersonList
  getPersonList,
  getInstitutionList
} from "@/api/index.js";
export default {
  components: {
@@ -264,6 +278,7 @@
  },
  data() {
    return {
      hotAciveIndex: "",
      // 高级搜索显示
      isAdvancedSearch: false,
      // 高级搜索
@@ -303,12 +318,12 @@
              }
            ]
          },
          {
            type: "input",
            label: "职官",
            name: "official",
            value: ""
          },
          // {
          //   type: "input",
          //   label: "职官",
          //   name: "official",
          //   value: ""
          // },
          {
            type: "select",
            label: "性别",
@@ -331,16 +346,16 @@
          },
          {
            type: "input",
            label: "时间",
            label: "时期",
            name: "dynasty",
            value: ""
          },
          {
            type: "input",
            label: "机构",
            name: "institution",
            value: ""
          }
          // {
          //   type: "select",
          //   label: "机构",
          //   name: "institution",
          //   options: []
          // }
        ]
      },
@@ -359,7 +374,7 @@
      activeBox: null,
      // 时期
      dynasty: {
        title: "时代",
        title: "时期",
        id: "",
        index: "",
        list: []
@@ -376,7 +391,7 @@
      // 表格的数组
      tableData: [],
      // 分页的总数
      total: 100,
      total: 0,
      // 当前页
      CurrentPage: 1,
      // 一页显示多少条数据
@@ -391,16 +406,58 @@
        tagId: "",
        official: "",
        genderType: ""
      }
      },
      aSearchData: ""
    };
  },
  onLoad(options) {
    this.onSearch({ text: options.keyword });
    if (options.isAdvancedSearch && options.isAdvancedSearch == "1") {
      this.isAdvancedSearch = true;
    }
    if (options.official) {
      if (options.official) {
        this.from.from[
          this.from.from.findIndex((item) => item.name == "official")
        ].value = options.official;
      }
      const result = this.from.from.reduce((obj, item) => {
        obj[item.name] = item.value;
        return obj;
      }, {});
      // 提交逻辑
      this.onSubmit(result);
    } else {
      if (options.dynasty) {
        this.dynasty.index = Number(options.dynasty);
        this.dynasty.id = Number(options.dynasty);
      }
      this.onSearch({ text: options.keyword });
    }
  },
  mounted() {
    this.getStatistics();
    this.institutionList();
  },
  methods: {
    institutionList() {
      getInstitutionList().then((res) => {
        this.$set(
          this.from.from[
            this.from.from.findIndex((item) => item.name == "institution")
          ],
          "options",
          res.list.map((item) => {
            return {
              label: item.name,
              value: item.id
            };
          })
        );
        console.log(this.from.from);
      });
    },
    //重置搜索结果
    resetForm() {
      this.onSearch("");
@@ -559,8 +616,8 @@
      });
    },
    // 热门搜索
    hotSearchClick(item) {
      this.onSearch({ text: item.name });
    hotSearchClick(item, index) {
      this.onSearch({ text: item.name }, index);
    },
    // 左侧的机构统计等等按钮
    handInstitCLick(item, name) {
@@ -593,9 +650,16 @@
          document.querySelector(".fbox1").style.height = box1Height + "px";
        }
      });
      if (this.isAdvancedSearch) {
        this.keywords = "";
        this.CurrentPage = 1;
      }
    },
    // 高级搜索
    async onSubmit(val) {
      this.keywords = "";
      this.hotAciveIndex = "";
      this.aSearchData = val;
      this.profession.index = Number(val.tagId);
      this.profession.id = Number(val.tagId);
      const currentDynasty = this.dynasty.list.find(
@@ -606,7 +670,7 @@
        this.dynasty.id = currentDynasty.dynastyId;
      }
      this.submitData = val;
      this.CurrentPage = 1;
      let Obj = {
        keywords: "", //搜索框检索
        name: val.name, //姓名
@@ -618,7 +682,6 @@
        dynasty: val.dynasty, //朝代id
        dynastyId: this.dynasty.id, //朝代id
        institution: val.institution, //机构
        bookId: null, //来源id
        page: this.CurrentPage,
        pageSize: this.pageSize
      };
@@ -632,8 +695,15 @@
      });
    },
    // 基础搜索
    async onSearch(val) {
    async onSearch(val, index) {
      this.keywords = val.text;
      this.aSearchData = "";
      if (index !== undefined) {
        this.keywords = "";
        this.hotAciveIndex = index;
      } else {
        this.hotAciveIndex = "";
      }
      let Obj = {
        keywords: val.text, //搜索框检索
        name: "", //姓名
@@ -691,21 +761,33 @@
    CurrentChange(val) {
      if (this.CurrentPage != val) {
        this.CurrentPage = val;
        this.onSearch("");
        if (this.isAdvancedSearch) {
          this.onSubmit(this.aSearchData);
        } else {
          this.onSearch({ text: this.keywords });
        }
      }
    },
    // 上一页
    PrevClick(val) {
      if (this.CurrentPage != val) {
        this.CurrentPage = val;
        this.onSearch("");
        if (this.isAdvancedSearch) {
          this.onSubmit(this.aSearchData);
        } else {
          this.onSearch({ text: this.keywords });
        }
      }
    },
    // 下一页
    NextClick(val) {
      if (this.CurrentPage != val) {
        this.CurrentPage = val;
        this.onSearch("");
        if (this.isAdvancedSearch) {
          this.onSubmit(this.aSearchData);
        } else {
          this.onSearch({ text: this.keywords });
        }
      }
    }
  }
@@ -783,46 +865,42 @@
/* 右侧 */
.rightList {
  padding-left: 0.2rem !important;
}
.rightList .light {
  padding: 0.1rem 0.2rem !important;
}
  .light {
    padding: 0.1rem 0.2rem !important;
  }
.rightList .lightTop {
  font-size: 0.14rem !important;
}
  .lightTop {
    font-size: 0.14rem !important;
  }
.rightList .el-button {
  font-size: 0.12rem !important;
  padding: 0.05rem 0.18rem !important;
}
  .el-button {
    font-size: 0.12rem !important;
    padding: 0.05rem 0.18rem !important;
  }
.rightList .lightBo {
  font-size: 0.14rem !important;
}
  .lightBo {
    font-size: 0.14rem !important;
.rightList .lightBo .is-leaf {
  background-color: #c1d3ea !important;
  color: #2c2c2c !important;
  font-weight: 400;
}
    .is-leaf {
      background-color: #c1d3ea !important;
      color: #2c2c2c !important;
      font-weight: 400;
.rightList .lightBo .is-leaf .cell {
  height: 0.3rem !important;
  line-height: 0.3rem !important;
}
      .cell {
        height: 0.3rem !important;
        line-height: 0.3rem !important;
      }
    }
  }
  .el-table__body-wrapper {
    .el-table__row {
      height: 0.46rem !important;
      line-height: 0.46rem !important;
      .cell {
        height: 0.3rem !important;
        line-height: 0.3rem !important;
      }
    }
  }
.rightList .el-table__body-wrapper .el-table__row {
  height: 0.46rem !important;
  line-height: 0.46rem !important;
}
.rightList .el-table__body-wrapper .el-table__row .cell {
  height: 0.3rem !important;
  line-height: 0.3rem !important;
}
@media screen and (min-width: 2560px) and (max-width: 3840px) {
@@ -844,11 +922,11 @@
  .hotSearch {
    font-size: 0.12rem !important;
    margin-bottom: 0.19rem !important;
  }
    li {
      font-size: 0.12rem !important;
      margin: 0 0.1rem;
    }
  .hotSearch li {
    font-size: 0.12rem !important;
    margin: 0 0.1rem;
  }
  .advancedSeaTrue,
@@ -905,33 +983,32 @@
    padding: 0.1rem 0.09rem;
    min-height: 2rem !important;
    position: relative;
  }
  .boox ul {
    margin-top: 0.16rem !important;
  }
    ul {
      margin-top: 0.16rem !important;
    }
  .boox h3 {
    font-size: 0.14rem;
    margin-left: 0.1rem;
  }
    h3 {
      font-size: 0.14rem;
      margin-left: 0.1rem;
    }
  .boox li {
    height: 0.3rem;
    line-height: 0.3rem;
    padding: 0 0.2rem !important;
    margin: 0.05rem 0 !important;
    border-radius: 0.3rem !important;
  }
    li {
      height: 0.3rem;
      line-height: 0.3rem;
      padding: 0 0.2rem !important;
      margin: 0.05rem 0 !important;
      border-radius: 0.3rem !important;
    }
  .boox .toggleButton1 {
    position: absolute;
    bottom: 0.1rem !important;
    left: 40% !important;
  }
    .toggleButton1 {
      position: absolute;
      bottom: 0.1rem !important;
      left: 40% !important;
    }
    .toggleButton {
      font-size: 0.14rem !important;
    }
  .boox .toggleButton {
    font-size: 0.14rem !important;
  }
  .zhongjianleft {
@@ -966,46 +1043,42 @@
  /* 右侧 */
  .rightList {
    padding-left: 0.2rem !important;
  }
  .rightList .light {
    padding: 0.1rem 0.2rem !important;
  }
    .light {
      padding: 0.1rem 0.2rem !important;
    }
  .rightList .lightTop {
    font-size: 0.14rem !important;
  }
    .lightTop {
      font-size: 0.14rem !important;
    }
  .rightList .el-button {
    font-size: 0.12rem !important;
    padding: 0.05rem 0.18rem !important;
  }
    .el-button {
      font-size: 0.12rem !important;
      padding: 0.05rem 0.18rem !important;
    }
  .rightList .lightBo {
    font-size: 0.14rem !important;
  }
    .lightBo {
      font-size: 0.14rem !important;
  .rightList .lightBo .is-leaf {
    background-color: #c1d3ea !important;
    color: #2c2c2c !important;
    font-weight: 400;
  }
      .is-leaf {
        background-color: #c1d3ea !important;
        color: #2c2c2c !important;
        font-weight: 400;
  .rightList .lightBo .is-leaf .cell {
    height: 0.3rem !important;
    line-height: 0.3rem !important;
  }
        .cell {
          height: 0.3rem !important;
          line-height: 0.3rem !important;
        }
      }
    }
    .el-table__body-wrapper {
      .el-table__row {
        height: 0.46rem !important;
        line-height: 0.46rem !important;
        .cell {
          height: 0.3rem !important;
          line-height: 0.3rem !important;
        }
      }
    }
  .rightList .el-table__body-wrapper .el-table__row {
    height: 0.46rem !important;
    line-height: 0.46rem !important;
  }
  .rightList .el-table__body-wrapper .el-table__row .cell {
    height: 0.3rem !important;
    line-height: 0.3rem !important;
  }
}
@@ -1028,11 +1101,11 @@
  .hotSearch {
    font-size: 0.12rem !important;
    margin-bottom: 0.19rem !important;
  }
    li {
      font-size: 0.12rem !important;
      margin: 0 0.1rem;
    }
  .hotSearch li {
    font-size: 0.12rem !important;
    margin: 0 0.1rem;
  }
  .advancedSeaTrue1 {
    border: 1px solid #c1d3ea;
@@ -1091,34 +1164,33 @@
    padding: 0.1rem 0.09rem;
    min-height: 2rem !important;
    position: relative;
  }
  .boox ul {
    margin-top: 0.16rem !important;
    margin-bottom: 0.2rem !important;
  }
    ul {
      margin-top: 0.16rem !important;
      margin-bottom: 0.2rem !important;
    }
  .boox h3 {
    font-size: 0.14rem;
    margin-left: 0.1rem;
  }
    h3 {
      font-size: 0.14rem;
      margin-left: 0.1rem;
    }
  .boox li {
    height: 0.3rem;
    line-height: 0.3rem;
    padding: 0 0.2rem !important;
    margin: 0.05rem 0 !important;
    border-radius: 0.3rem !important;
  }
    li {
      height: 0.3rem;
      line-height: 0.3rem;
      padding: 0 0.2rem !important;
      margin: 0.05rem 0 !important;
      border-radius: 0.3rem !important;
    }
  .boox .toggleButton1 {
    position: absolute;
    bottom: 0.1rem !important;
    left: 40% !important;
  }
    .toggleButton1 {
      position: absolute;
      bottom: 0.1rem !important;
      left: 40% !important;
    }
    .toggleButton {
      font-size: 0.14rem !important;
    }
  .boox .toggleButton {
    font-size: 0.14rem !important;
  }
  .zhongjianleft {
@@ -1155,46 +1227,42 @@
  .rightList {
    width: 100%;
    padding-left: 0.2rem !important;
  }
  .rightList .light {
    padding: 0.1rem 0.2rem !important;
  }
    .light {
      padding: 0.1rem 0.2rem !important;
    }
  .rightList .lightTop {
    font-size: 0.14rem !important;
  }
    .lightTop {
      font-size: 0.14rem !important;
    }
  .rightList .el-button {
    font-size: 0.12rem !important;
    padding: 0.05rem 0.18rem !important;
  }
    .el-button {
      font-size: 0.12rem !important;
      padding: 0.05rem 0.18rem !important;
    }
  .rightList .lightBo {
    font-size: 0.14rem !important;
  }
  .rightList .lightBo .is-leaf {
    background-color: #c1d3ea !important;
    color: #2c2c2c !important;
    font-weight: 400;
  }
    .lightBo {
      font-size: 0.14rem !important;
  .rightList .lightBo .is-leaf .cell {
    height: 0.3rem !important;
    line-height: 0.3rem !important;
  }
      .is-leaf {
        background-color: #c1d3ea !important;
        color: #2c2c2c !important;
        font-weight: 400;
  .rightList .el-table__body-wrapper .el-table__row {
    height: 0.46rem !important;
    line-height: 0.46rem !important;
  }
        .cell {
          height: 0.3rem !important;
          line-height: 0.3rem !important;
        }
      }
    }
    .el-table__body-wrapper {
      .el-table__row {
        height: 0.46rem !important;
        line-height: 0.46rem !important;
        .cell {
          height: 0.3rem !important;
          line-height: 0.3rem !important;
        }
      }
    }
  .rightList .el-table__body-wrapper .el-table__row .cell {
    height: 0.3rem !important;
    line-height: 0.3rem !important;
  }
}
@@ -1205,20 +1273,16 @@
.hotSearch {
  font-size: 0.12rem;
  margin-bottom: 0.19rem;
  li {
    font-size: 0.12rem;
    margin: 0 0.1rem;
  }
}
/*    .a {
      height: 2rem;
   }
   .b {
      height: 100px;
   } */
.hotSearch li {
  font-size: 0.12rem;
  margin: 0 0.1rem;
}
.hotSearch li.active {
  color: #027edc !important;
  font-weight: bold;
}
.box {
  transition: height 0.3s;
@@ -1234,34 +1298,33 @@
  min-height: 2rem !important;
  position: relative;
  border: 1px solid #c1d3ea !important;
}
.boox ul {
  margin-top: 0.16rem !important;
}
  ul {
    margin-top: 0.16rem !important;
  }
.boox h3 {
  font-size: 0.14rem;
  margin-left: 0.1rem;
}
  h3 {
    font-size: 0.14rem;
    margin-left: 0.1rem;
  }
.boox li {
  height: 0.3rem;
  line-height: 0.3rem;
  padding: 0 0.2rem !important;
  margin: 0.05rem 0 !important;
  border-radius: 0.3rem !important;
  font-size: 0.14rem;
}
  li {
    height: 0.3rem;
    line-height: 0.3rem;
    padding: 0 0.2rem !important;
    margin: 0.05rem 0 !important;
    border-radius: 0.3rem !important;
    font-size: 0.14rem;
  }
.boox .toggleButton1 {
  position: absolute;
  bottom: 0.1rem !important;
  left: 40% !important;
}
  .toggleButton1 {
    position: absolute;
    bottom: 0.1rem !important;
    left: 40% !important;
  }
  .toggleButton {
    font-size: 0.14rem !important;
  }
.boox .toggleButton {
  font-size: 0.14rem !important;
}
::v-deep .el-table th,