1
YM
2024-06-07 c99cfa08505196fd6ba4d0ea8bd4dcf7a1fb268e
src/pages/knowledgeBase/knowledgeBase.vue
@@ -7,7 +7,7 @@
      <!-- <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>
@@ -194,7 +194,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 +207,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 +259,8 @@
  getPDownload,
  getPList,
  getHotSearch,
  getPersonList
  getPersonList,
  getInstitutionList
} from "@/api/index.js";
export default {
  components: {
@@ -264,6 +269,7 @@
  },
  data() {
    return {
      hotAciveIndex: "",
      // 高级搜索显示
      isAdvancedSearch: false,
      // 高级搜索
@@ -331,15 +337,15 @@
          },
          {
            type: "input",
            label: "时间",
            label: "时期",
            name: "dynasty",
            value: ""
          },
          {
            type: "input",
            type: "select",
            label: "机构",
            name: "institution",
            value: ""
            options: []
          }
        ]
      },
@@ -359,7 +365,7 @@
      activeBox: null,
      // 时期
      dynasty: {
        title: "时代",
        title: "时期",
        id: "",
        index: "",
        list: []
@@ -395,12 +401,53 @@
    };
  },
  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 +606,8 @@
      });
    },
    // 热门搜索
    hotSearchClick(item) {
      this.onSearch({ text: item.name });
    hotSearchClick(item, index) {
      this.onSearch({ text: item.name }, index);
    },
    // 左侧的机构统计等等按钮
    handInstitCLick(item, name) {
@@ -632,8 +679,14 @@
      });
    },
    // 基础搜索
    async onSearch(val) {
    async onSearch(val, index) {
      this.keywords = val.text;
      if (index !== undefined) {
        this.keywords = "";
        this.hotAciveIndex = index;
      } else {
        this.hotAciveIndex = "";
      }
      let Obj = {
        keywords: val.text, //搜索框检索
        name: "", //姓名
@@ -1209,6 +1262,10 @@
  li {
    font-size: 0.12rem;
    margin: 0 0.1rem;
    &.active {
      color: #027edc !important;
      font-weight: bold;
    }
  }
}