From 44e7c74462e3dd3bf4bf24ab34b126d6e59c41f9 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 31 七月 2025 17:59:08 +0800
Subject: [PATCH] qx

---
 src/views/system/package/index.vue |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/src/views/system/package/index.vue b/src/views/system/package/index.vue
index 197f8ae..6bad63d 100644
--- a/src/views/system/package/index.vue
+++ b/src/views/system/package/index.vue
@@ -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,
@@ -333,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 => {
@@ -418,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;
@@ -666,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);
@@ -677,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