From 5c4837cdef21239ab1f192aade5e08b2cb75fcc0 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期三, 14 五月 2025 17:56:40 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/wyyDatabase

---
 src/views/achievements/index.vue |  116 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 93 insertions(+), 23 deletions(-)

diff --git a/src/views/achievements/index.vue b/src/views/achievements/index.vue
index 8e4fe0e..93253d3 100644
--- a/src/views/achievements/index.vue
+++ b/src/views/achievements/index.vue
@@ -72,19 +72,19 @@
               <li class="left-title">
                 <div>
                   <span>{{ annual.title }}</span>
-                  <span>
+                  <span @click="timeSortChange()">
                     鏃堕棿
                     <img
                       class="sort-Icon"
-                      :src="[isDisplay ? sortTop : sortBottom]"
+                      :src="[resourceTypeSortInfo ? sortTop : sortBottom]"
                       alt=""
                     />
                   </span>
-                  <span
+                  <span @click="countSortChange()"
                     >鏂囩尞閲�
                     <img
                       class="sort-Icon"
-                      :src="[isDisplay ? sortBottom : sortTop]"
+                      :src="[particularYearSortInfo ? sortTop : sortBottom]"
                       alt=""
                     />
                   </span>
@@ -128,11 +128,11 @@
               <li class="left-title">
                 <div>
                   <span>{{ sources.title }}</span>
-                  <span>
+                  <span @click="sourcesSortChange()">
                     鏂囩尞閲�
                     <img
                       class="sort-Icon"
-                      :src="[isDisplay ? sortBottom : sortTop]"
+                      :src="[sourceFromSortInfo ? sortBottom : sortTop]"
                       alt=""
                     />
                   </span>
@@ -198,9 +198,9 @@
             <!-- title閮ㄥ垎 -->
             <ul class="right-header">
               <li v-for="(item, index) in associationList" :key="index">
-                <p>{{ item.type }} : {{ item.content }}</p>
+                <p>{{ item.type }} : {{ item.name }}</p>
                 <img
-                  @click="removeAssociationList(item.content)"
+                  @click="removeAssociationList(item)"
                   :src="errorIcon"
                   alt=""
                 />
@@ -451,6 +451,9 @@
       subjectCheckList: [],
 
       postedSortInfo: true,
+      resourceTypeSortInfo: true,
+      particularYearSortInfo: true,
+      sourceFromSortInfo: true,
       // 骞村害
       annual: {
         title: "骞村害",
@@ -525,7 +528,6 @@
     };
   },
   mounted() {
-    console.log(this.$route.query, "query");
     this.inputType = this.$route.query.type;
     this.inputValue = this.$route.query.value;
     this.getSelectData();
@@ -534,12 +536,15 @@
 
   methods: {
     categoryChange(typeName, val) {
+      console.log(val, "val");
+      console.log(typeName, "typeName");
       if (val.checked) {
         this.categoryChecList.push(val.value);
         this.associationList.push({
           type: typeName,
           content: val.name,
           value: val.value,
+          name: val.valueName || val.name,
         });
       } else {
         const index = this.categoryChecList.findIndex(
@@ -653,10 +658,36 @@
 
     // 鍒犻櫎
     removeAssociationList(value) {
+      console.log(value, "value");
       this.associationList = this.associationList.filter(
-        (item) => item.content !== value
+        (item) => item.content !== value.content
       );
       this.inputValue = "";
+
+      switch (value.value) {
+        case "resourceType":
+          this.categoryOBJ.list.forEach((item) => {
+            if (item.name == value.content) {
+              item.checked = false;
+            }
+          });
+          break;
+
+        case "particularYear":
+          this.annual.list.forEach((item) => {
+            if (item.name == value.content) {
+              item.checked = false;
+            }
+          });
+          break;
+        case "sourceFrom":
+          this.sources.list.forEach((item) => {
+            if (item.name == value.content) {
+              item.checked = false;
+            }
+          });
+          break;
+      }
       // 閫氱煡鐖剁粍浠舵暟鎹凡鏀瑰彉
       this.getItemList();
     },
@@ -737,8 +768,6 @@
     // 璇锋眰鏁版嵁
     getItemList() {
       this.loading = true;
-      console.log(this.inputValue, " inputValue");
-      console.log(this.inputType, " inputType");
 
       let searchData = {}; // 鍒濆鍖栦竴涓┖瀵硅薄鏉ュ瓨鍌ㄦ悳绱㈡暟鎹�
       if (this.inputValue) {
@@ -771,23 +800,31 @@
         }
       }
 
-      console.log(this.associationList, "searchData11111");
+      console.log(this.associationList, "this.associationList");
       if (this.associationList && this.associationList.length) {
+        let resourceTypeValueList = [];
+        let particularYearValueList = [];
+        let sourceFromValueList = [];
+
         this.associationList.forEach((item) => {
+          debugger;
           if (item.value !== "all") {
             if (item.value == "year") {
               const endDate = item.content.split("/")[0] + "/12/31 23:59:59";
               const startDate = item.content.split("/")[0] + "/01/01 00:00:00";
               searchData[item.value + ">="] = startDate;
               searchData[item.value + "<="] = endDate;
-            } else if (item.value) {
-              // searchData[item.value + "*"] = item.content;
-              const key =
-                item.value === "resourceType" ? "resourceType*" : item.value;
-              if (!searchData[key]) {
-                searchData[key] = []; // 濡傛灉灞炴�т笉瀛樺湪锛屽垵濮嬪寲涓烘暟缁�
+            } else if (item.value != "year") {
+              if (item.value == "resourceType") {
+                resourceTypeValueList.push(item.content);
+                searchData[item.value + "*"] = resourceTypeValueList;
+              } else if (item.value == "particularYear") {
+                particularYearValueList.push(item.content);
+                searchData[item.value + "*"] = particularYearValueList;
+              } else if (item.value == "sourceFrom") {
+                sourceFromValueList.push(item.content);
+                searchData[item.value + "*"] = sourceFromValueList;
               }
-              searchData[key].push(item.content);
             } else {
               searchData["||" + item.value + "*"] = item.content;
             }
@@ -799,8 +836,11 @@
       //     searchData[key] = searchData[key][0];
       //   }
       // }
-
       console.log(searchData, "searchData");
+      console.log(this.resourceTypeValueList, "resourceTypeValueList");
+      const isResourceTypeValueList = this.categoryChecList.filter(
+        (item) => this.resourceTypeValueList.indexOf(item) !== -1
+      );
       MG.resource
         .getItem({
           path: "*",
@@ -815,8 +855,8 @@
           fields: {
             cmsType: ["cmsItem"],
             "resourceType*":
-              this.categoryChecList.length > 0
-                ? this.categoryChecList
+              isResourceTypeValueList.length > 0
+                ? isResourceTypeValueList
                 : this.resourceTypeValueList,
             source: [],
             isbn: [],
@@ -830,6 +870,7 @@
             AIReading: [],
             file: [],
             IssueNumber: [],
+            // "particularYear*": ["2009"],
             GroupBy: [["particularYear"], ["sourceFrom"], ["resourceType"]],
             "subjectAffiliation*": this.subjectCheckList,
             ...searchData,
@@ -893,6 +934,35 @@
       this.postedSortInfo = !this.postedSortInfo;
       this.getItemList();
     },
+    timeSortChange() {
+      this.resourceTypeSortInfo = !this.resourceTypeSortInfo;
+      this.annual.list.sort((a, b) => {
+        a.name - b.name;
+      });
+      if (this.resourceTypeSortInfo) {
+        this.annual.list.sort((a, b) => a.name - b.name);
+      } else {
+        this.annual.list.sort((a, b) => b.name - a.name);
+      }
+    },
+    countSortChange() {
+      this.particularYearSortInfo = !this.particularYearSortInfo;
+
+      if (!this.particularYearSortInfo) {
+        this.annual.list.sort((a, b) => a.num - b.num);
+      } else {
+        this.annual.list.sort((a, b) => b.num - a.num);
+      }
+      console.log(this.annual.list, "this.annual.list");
+    },
+    sourcesSortChange() {
+      this.sourceFromSortInfo = !this.sourceFromSortInfo;
+      if (this.sourceFromSortInfo) {
+        this.sources.list.sort((a, b) => a.num - b.num);
+      } else {
+        this.sources.list.sort((a, b) => b.num - a.num);
+      }
+    },
     getResourceTypeClass(typeName) {
       switch (typeName) {
         case "journal":

--
Gitblit v1.9.1