From 1b27559a90417a6f608be0c61e88a6f9e3ea1b40 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期五, 26 七月 2024 11:53:31 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TCM_CharacterLibrary

---
 src/pages/knowledgeBase/knowledgeBase.vue |  128 ++++++++++++++++++++++++++++++++----------
 1 files changed, 97 insertions(+), 31 deletions(-)

diff --git a/src/pages/knowledgeBase/knowledgeBase.vue b/src/pages/knowledgeBase/knowledgeBase.vue
index 638d85e..111bf5d 100644
--- a/src/pages/knowledgeBase/knowledgeBase.vue
+++ b/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>
@@ -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,
       // 楂樼骇鎼滅储
@@ -303,12 +309,12 @@
               }
             ]
           },
-          {
-            type: "input",
-            label: "鑱屽畼",
-            name: "official",
-            value: ""
-          },
+          // {
+          //   type: "input",
+          //   label: "鑱屽畼",
+          //   name: "official",
+          //   value: ""
+          // },
           {
             type: "select",
             label: "鎬у埆",
@@ -331,16 +337,16 @@
           },
           {
             type: "input",
-            label: "鏃堕棿",
+            label: "鏃舵湡",
             name: "dynasty",
             value: ""
-          },
-          {
-            type: "input",
-            label: "鏈烘瀯",
-            name: "institution",
-            value: ""
           }
+          // {
+          //   type: "select",
+          //   label: "鏈烘瀯",
+          //   name: "institution",
+          //   options: []
+          // }
         ]
       },
 
@@ -359,7 +365,7 @@
       activeBox: null,
       // 鏃舵湡
       dynasty: {
-        title: "鏃朵唬",
+        title: "鏃舵湡",
         id: "",
         index: "",
         list: []
@@ -391,16 +397,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 +607,8 @@
       });
     },
     // 鐑棬鎼滅储
-    hotSearchClick(item) {
-      this.onSearch({ text: item.name });
+    hotSearchClick(item, index) {
+      this.onSearch({ text: item.name }, index);
     },
     // 宸︿晶鐨勬満鏋勭粺璁$瓑绛夋寜閽�
     handInstitCLick(item, name) {
@@ -596,6 +644,9 @@
     },
     // 楂樼骇鎼滅储
     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(
@@ -632,8 +683,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 +749,25 @@
     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("");
+        this.onSearch({ text: this.keywords });
       }
     },
     // 涓嬩竴椤�
     NextClick(val) {
       if (this.CurrentPage != val) {
         this.CurrentPage = val;
-        this.onSearch("");
+        this.onSearch({ text: this.keywords });
       }
     }
   }
@@ -1209,6 +1271,10 @@
   li {
     font-size: 0.12rem;
     margin: 0 0.1rem;
+    &.active {
+      color: #027edc !important;
+      font-weight: bold;
+    }
   }
 }
 

--
Gitblit v1.9.1