zhongshujie
2 天以前 25b5057646af92c74835756cd16d255c4b047821
侧边栏勾选
2个文件已修改
216 ■■■■ 已修改文件
src/assets/js/middleGround/api/resource.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/achievements/index.vue 214 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/api/resource.js
@@ -97,7 +97,7 @@
          repositoryInfo,
          coverSize,
        });
        return { datas, total: data.totalCount };
        return { datas, total: data.totalCount, groups: data.groups};
      }
      return { datas: [], total: 0 };
    });
src/views/achievements/index.vue
@@ -37,27 +37,27 @@
            <!-- 类型 -->
            <ul>
              <li class="left-title">
                <span>{{ category.title }}</span>
                <p @click="category.isDisplay = !category.isDisplay">
                <span>{{ categoryOBJ.title }}</span>
                <p @click="categoryOBJ.isDisplay = !categoryOBJ.isDisplay">
                  <img
                    :src="[category.isDisplay ? topIcon : bottomIcon]"
                    :src="[categoryOBJ.isDisplay ? topIcon : bottomIcon]"
                    alt=""
                  />
                </p>
              </li>
              <li class="left-main" v-if="category.isDisplay">
              <li class="left-main" v-if="categoryOBJ.isDisplay">
                <div
                  class="category-main"
                  v-for="(item, index) in category.list"
                  v-for="(item, index) in categoryOBJ.list"
                  :key="index"
                >
                  <el-checkbox
                    class="el-checkbox"
                    v-model="item.checked"
                    :title="item.name"
                    @change="categoryChange(item)"
                    @change="categoryChange(categoryOBJ.title, item)"
                    style="display: inline-block; vertical-align: middle"
                    >{{ item.name }}</el-checkbox
                    >{{ item.valueName }}</el-checkbox
                  >
                  <span
                    class=""
@@ -109,8 +109,9 @@
                    class="el-checkbox"
                    v-model="item.checked"
                    :title="item.years"
                    >{{ item.years }}</el-checkbox
                  >
                    @change="categoryChange(annual.title, item)"
                    >{{ item.name }}
                  </el-checkbox>
                  <span class="">{{ item.num }}</span>
                </div>
                <p
@@ -156,6 +157,7 @@
                    class="el-checkbox"
                    :title="item.name"
                    v-model="item.checked"
                    @change="categoryChange(sources.title, item)"
                    >{{ item.name }}</el-checkbox
                  >
                  <span class="">{{ item.num }}</span>
@@ -433,28 +435,16 @@
        isDisplay: true,
        id: "",
        index: "",
        list: [
          {
            name: "期刊",
            num: 190,
            check: false,
          },
          {
            name: "图书",
            num: 190,
            check: false,
          },
          {
            name: "视频",
            num: 190,
            check: false,
          },
          {
            name: "音频",
            num: 190,
            check: false,
          },
        ],
        list: [],
      },
      // 类型
      categoryOBJ: {
        title: "类型",
        isDisplay: true,
        id: "",
        index: "",
        list: [],
      },
      categoryChecList: [],
      subjectCheckList: [],
@@ -466,38 +456,7 @@
        isDisplay: true,
        id: "",
        index: "",
        list: [
          {
            years: "2025",
            num: 10,
            check: false,
          },
          {
            years: "2024",
            num: 18,
            check: false,
          },
          {
            years: "2023",
            num: 21,
            check: false,
          },
          {
            years: "2022",
            num: 19,
            check: false,
          },
          {
            years: "2021",
            num: 22,
            check: false,
          },
          {
            years: "2020",
            num: 24,
            check: false,
          },
        ],
        list: [],
      },
      // 文献来源
      sources: {
@@ -505,33 +464,7 @@
        isDisplay: true,
        id: "",
        index: "",
        list: [
          {
            name: "北京中医药大学大学学报",
            num: 190,
            check: false,
          },
          {
            name: "北京师范大学",
            num: 19,
            check: false,
          },
          {
            name: "中国中医科学院",
            num: 22,
            check: false,
          },
          {
            name: "北京中医药大学大学学报",
            num: 31,
            check: false,
          },
          {
            name: "广州中医药大学",
            num: 25,
            check: false,
          },
        ],
        list: [],
      },
      // 学科
      subject: {
@@ -595,15 +528,17 @@
    this.inputType = this.$route.query.type;
    this.inputValue = this.$route.query.value;
    this.getSelectData();
    this.getSidebarData();
  },
  methods: {
    categoryChange(val) {
    categoryChange(typeName, val) {
      if (val.checked) {
        this.categoryChecList.push(val.value);
        this.associationList.push({
          type: "类型",
          type: typeName,
          content: val.name,
          value: val.value,
        });
      } else {
        const index = this.categoryChecList.findIndex(
@@ -741,14 +676,70 @@
        this.getItemList();
      }
    },
    //获取侧边栏数据
    getSidebarData() {
      MG.resource
        .getItem({
          path: "*",
          queryType: "*",
          fields: {
            GroupBy: [["particularYear"], ["sourceFrom"], ["resourceType"]],
            "subjectAffiliation*": this.subjectCheckList,
          },
        })
        .then((res) => {
          // 处理group的数据
          console.log(res, "res009");
          res.groups.forEach((item) => {
            if (
              item.key == "particularYear" &&
              item.datas &&
              item.datas.length
            ) {
              item.datas.forEach((citem) => {
                this.annual.list.push({
                  name: citem.groupKey,
                  num: citem.count,
                  value: item.key,
                  check: false,
                });
              });
            }
            if (item.key == "sourceFrom" && item.datas && item.datas.length) {
              item.datas.forEach((citem) => {
                this.sources.list.push({
                  name: citem.groupKey,
                  num: citem.count,
                  value: item.key,
                  check: false,
                });
              });
            }
            if (item.key == "resourceType" && item.datas && item.datas.length) {
              item.datas.forEach((citem) => {
                this.categoryOBJ.list.push({
                  name: citem.groupKey,
                  valueName: this.getGroupKey(citem.groupKey),
                  value: item.key,
                  num: citem.count,
                  check: false,
                });
              });
            }
          });
        });
    },
    // 请求数据
    getItemList() {
      this.loading = true;
      console.log(this.inputValue, " inputValue");
      console.log(this.inputType, " inputType");
      let searchData = {}; // 初始化一个空对象来存储搜索数据
      debugger;
      if (this.inputValue) {
        // 如果输入值存在
        if (this.inputType != "all") {
@@ -780,7 +771,6 @@
      }
      console.log(this.associationList, "searchData11111");
      if (this.associationList && this.associationList.length) {
        this.associationList.forEach((item) => {
          if (item.value !== "all") {
@@ -790,13 +780,24 @@
              searchData[item.value + ">="] = startDate;
              searchData[item.value + "<="] = endDate;
            } else if (item.value) {
              searchData[item.value + "*"] = item.content;
              // searchData[item.value + "*"] = item.content;
              const key =
                item.value === "resourceType" ? "resourceType*" : item.value;
              if (!searchData[key]) {
                searchData[key] = []; // 如果属性不存在,初始化为数组
              }
              searchData[key].push(item.content);
            } else {
              searchData["||" + item.value + "*"] = item.content;
            }
          }
        });
      }
      // for (let key in searchData) {
      //   if (searchData[key].length === 1) {
      //     searchData[key] = searchData[key][0];
      //   }
      // }
      console.log(searchData, "searchData");
      MG.resource
@@ -819,6 +820,8 @@
            source: [],
            isbn: [],
            year: [],
            particularYear: [],
            contributor: [],
            abstract: [],
            keyWords: [],
            author: [],
@@ -826,13 +829,13 @@
            AIReading: [],
            file: [],
            IssueNumber: [],
            GroupBy: [["particularYear"], ["sourceFrom"], ["resourceType"]],
            "subjectAffiliation*": this.subjectCheckList,
            ...searchData,
          },
        })
        .then((res) => {
          console.log(res, "全部内容");
          console.log(res, "res");
          res.datas.forEach((item) => {
            item.year = moment(item.year).format("YYYY-MM-DD");
            if (typeof item.keyWords === "string") {
@@ -906,6 +909,23 @@
      }
    },
    getGroupKey(typeName) {
      switch (typeName) {
        case "journal":
          return "期刊";
        case "books":
          return "图书";
        case "video":
          return "视频";
        case "audio":
          return "音频";
        case "newspaper":
          return "newspaper-color";
        default:
          return "other-color";
      }
    },
    openAiReading(text, name) {
      this.AIReading = text;
      this.aIName = name;