From 6bb2a23358624f72c886fccff39bfb54de868e4f Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期五, 01 八月 2025 14:59:39 +0800
Subject: [PATCH] jgjl

---
 src/views/system/package/index.vue |   54 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/src/views/system/package/index.vue b/src/views/system/package/index.vue
index 7a4c5e5..6bad63d 100644
--- a/src/views/system/package/index.vue
+++ b/src/views/system/package/index.vue
@@ -151,7 +151,7 @@
       <el-row style="display: flex; width: 1300px">
         <el-col>
           <div style="text-align: center; margin-bottom: 10px; margin-top: 10px">椤圭洰鍒楄〃</div>
-          <el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" v-model="filterText" @input="debounceFilter" clearable />
+          <el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" v-model="queryParams1.nr" @input="handleFilterInput" clearable />
           <div class="tab3" style="height: 365px">
             <el-tree
               class="filter-tree"
@@ -162,6 +162,7 @@
               node-key="proId"
               @check-change="handleCurrentChecked"
               :default-checked-keys="checkedkey"
+              :filter-node-method="filterNode"
               ref="tree"
               :render-content="renderContent"
             >
@@ -295,6 +296,7 @@
         page: 1,
         pageSize: 30,
         nr: "",
+        xb: "",
       },
       form: {
         xianprice: null,
@@ -319,11 +321,12 @@
     this.getCategory();
   },
   methods: {
-    debounceFilter() {
-      clearTimeout(this.debounceTimer);
-      this.debounceTimer = setTimeout(() => {
-        this.filterTree();
-      }, 600);
+    handleFilterInput() {
+      this.queryParams1.page = 1;
+      this.getDataList();
+      this.$nextTick(() => {
+        this.$refs.tree.setCheckedKeys(this.checkedNodes);
+      });
     },
     filterTree() {
       if (!this.filterText) {
@@ -332,6 +335,15 @@
       }
       const filterTextLower = this.filterText.toLowerCase();
       this.filteredTreeData = this.filterNodes(this.originalTreeData, filterTextLower);
+    },
+    filterNode(value, data) {
+      if (!value) return true;
+      console.log(value, 6666);
+
+      return (
+        data.proName.indexOf(value) !== -1 ||
+        (data.proEngName && data.proEngName.indexOf(value) !== -1)
+      );
     },
     filterNodes(nodes, filterText) {
       return nodes.filter(node => {
@@ -417,9 +429,30 @@
         this.keywordList = response.rows;
       });
     },
-    sel(val) {
+    /* sel(val) {
       let id = val;
       this.keys = id.join(",");
+    }, */
+    sel(val) {
+      const maleId = "4"; // 鈥滅敺鈥濈殑 ID
+      const femaleId = "5"; // 鈥滃コ鈥濈殑 ID
+      let selectedIds = [...val]; // 澶嶅埗褰撳墠閫変腑鐨� ID 鏁扮粍
+
+      // 瀹炵幇鈥滅敺鈥濆拰鈥滃コ鈥濅簰鏂ラ�昏緫
+      if (selectedIds.includes(maleId) && selectedIds.includes(femaleId)) {
+        selectedIds = selectedIds.slice(-1); // 淇濈暀鏈�鍚庨�変腑鐨勪竴涓�
+        this.$message.warning("鈥滅敺鈥濆拰鈥滃コ鈥濆叧閿瓧浜掓枼锛屽彧鑳介�夋嫨涓�涓紒");
+      }
+
+      // 鏇存柊 form.keywords 鍜� keys
+      this.form.keywords = selectedIds;
+      this.keys = selectedIds.join(",");
+
+      // 璋冪敤 getDataList锛屼紶閫掓墍鏈夐�変腑鐨勫叧閿瓧 ID锛堥�楀彿鍒嗛殧锛�
+      // this.getDataList({ xb: this.keys });
+      this.queryParams1.xb = this.keys; // 馃憟 鏇存柊鏌ヨ鍙傛暟
+      this.queryParams1.page = 1; // 馃憟 鍒囨崲鏉′欢鏃堕噸缃〉鐮�
+      this.getDataList(); // 涓嶉渶瑕佸啀浼犲弬浜�
     },
     getCategory() {
       this.loading = true;
@@ -665,9 +698,10 @@
         </span>
       );
     },
-    getDataList() {
+    getDataList(params = {}) {
       this.loading = true;
-      search(this.queryParams1).then((response) => {
+      const query = { ...this.queryParams1, ...params };
+      search(query).then((response) => {
         this.Treedata = response.data.list;
         this.total1 = response.data.total;
         this.pics = this.DataList.reduce((total, item) => total + item.priceOrd, 0);
@@ -676,8 +710,8 @@
         this.$nextTick(() => {
           this.$refs.tree.setCheckedKeys(this.checkedNodes);
           this.initializing = false;
-          this.loading = false;
         });
+        this.loading = false;
       }).catch(() => {
         this.loading = false;
       });

--
Gitblit v1.8.0