From 2d55ed180fddd028bf4f839345bf0ef4d2f032e7 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 07 三月 2025 13:34:31 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/lims-ruoyi-before into dev

---
 src/views/standard/standardLibrary/index.vue |  136 ++++++++++++++++++--------------------------
 1 files changed, 56 insertions(+), 80 deletions(-)

diff --git a/src/views/standard/standardLibrary/index.vue b/src/views/standard/standardLibrary/index.vue
index 4ead05c..36e74a2 100644
--- a/src/views/standard/standardLibrary/index.vue
+++ b/src/views/standard/standardLibrary/index.vue
@@ -206,16 +206,17 @@
           height: calc(100% - 30px);
           overflow-y: scroll;
           scrollbar-width: none;
-        " @node-click="handleNodeClick" @node-expand="nodeOpen" @node-collapse="nodeClose" @node-drop="handleDrop">
+        " @node-click="handleNodeClick"
+               @node-drop="handleDrop">
         <div slot-scope="{ node, data }" class="custom-tree-node">
           <el-row style="width: 100%">
             <el-col :class="{ sort: node.level > 3 }" :span="19" :title="data.label" style="text-align: left">
               <span>
                 <i :class="`node_i ${data.children != undefined
-                    ? data.code === '[1]'
-                      ? 'el-icon-folder-opened'
-                      : 'el-icon-folder'
-                    : 'el-icon-tickets'
+                  ? data.code === '[1]'
+                    ? 'el-icon-folder-opened'
+                    : 'el-icon-folder'
+                  : 'el-icon-tickets'
                   }`"></i>
                 {{ data.label }}
               </span>
@@ -225,7 +226,7 @@
               (node.data.children === null ||
                 node.data.children === undefined)
             " :span="2" style="text-align: right">
-              <el-button size="mini" type="text" @click="editTreeName(node.data)">
+              <el-button size="mini" type="text" @click.stop="editTreeName(node.data)">
                 <i class="el-icon-edit"></i>
               </el-button>
             </el-col>
@@ -286,8 +287,8 @@
             <template slot-scope="scope">
               <el-input v-if="
                 checkPermi(['standard:standardLibrary:upStandardProduct'])
-              " v-model="scope.row.ask" :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="瑕佹眰鍊�"
-                size="small" type="textarea" @change="(value) => upStandardProductList(value, scope.row.id)"></el-input>
+              " v-model="scope.row.ask" :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="瑕佹眰鍊�" size="small"
+                type="textarea" @change="(value) => upStandardProductList(value, scope.row.id)"></el-input>
               <span v-else>{{ scope.row.ask }}</span>
             </template>
           </el-table-column>
@@ -306,7 +307,7 @@
               <el-select v-if="
                 checkPermi(['standard:standardLibrary:upStandardProduct'])
               " v-model="scope.row.methodS" clearable placeholder="璇曢獙鏂规硶" size="small" @change="(value) => upStandardProductListOfMethodS(value, scope.row.id)
-                  ">
+                ">
                 <el-option v-for="(a, i) in scope.row.method &&
                   JSON.parse(scope.row.method)" :key="i" :label="a" :value="a"></el-option>
               </el-select>
@@ -318,7 +319,7 @@
               <el-select v-if="
                 checkPermi(['standard:standardLibrary:upStandardProduct'])
               " v-model="scope.row.radius" clearable placeholder="鏉′欢" size="small" @change="(value) => upStandardProductListOfRadius(value, scope.row.id)
-                  ">
+                ">
                 <el-option v-for="(a, i) in scope.row.radiusList &&
                   JSON.parse(scope.row.radiusList)" :key="i" :label="a" :value="a"></el-option>
               </el-select>
@@ -331,7 +332,7 @@
               <el-input v-if="
                 checkPermi(['standard:standardLibrary:upStandardProduct'])
               " v-model="scope.row.price" placeholder="鍗曚环(鍏�)" size="small" @change="(value) => upStandardProductListOfPrice(value, scope.row.id)
-                  ">
+                ">
               </el-input>
               <span v-else>{{ scope.row.price }}</span>
             </template>
@@ -341,7 +342,7 @@
               <el-input v-if="
                 checkPermi(['standard:standardLibrary:upStandardProduct'])
               " v-model="scope.row.manHour" placeholder="鍗曚环(鍏�)" size="small" @change="(value) => upStandardProductListOfManHour(value, scope.row.id)
-                  ">
+                ">
               </el-input>
               <span v-else>{{ scope.row.manHour }}</span>
             </template>
@@ -351,7 +352,7 @@
             <template slot-scope="scope">
               <el-select v-model="scope.row.templateId" :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct'])
                 " filterable size="small" @change="(value) =>
-                    upStandardProductListOfTemplate(value, scope.row.id)
+                  upStandardProductListOfTemplate(value, scope.row.id)
                   ">
                 <el-option v-for="(a, ai) in templateList" :key="ai" :label="a.name" :value="a.id"></el-option>
               </el-select>
@@ -367,10 +368,10 @@
             </template>
           </el-table-column>
         </el-table>
-        <el-pagination :current-page="currentPage" :page-size="300" :total="total"
-          layout="total, prev, pager, next, jumper" style="position: absolute; right: 16px; bottom: 1px"
-          @current-change="handleCurrentChange">
-        </el-pagination>
+        <!-- <el-pagination :current-page="currentPage" :page-size="300" :total="total" layout="total"
+          style="position: absolute; right: 16px; bottom: 1px" @current-change="handleCurrentChange">
+        </el-pagination> -->
+        <p style="text-align: right;margin-right: 20px;color: #333;">鍏眥{ total }}鏉�</p>
       </el-row>
     </div>
 
@@ -682,10 +683,42 @@
         }
       }
     },
-    filterNode(value, data) {
-      if (!value) return true;
-      return data.label.indexOf(value) !== -1;
+    // 璋冪敤tree杩囨护鏂规硶 涓枃鑻辫繃婊�
+    filterNode (value, data, node) {
+      if (!value) {銆�銆�銆�銆�//濡傛灉鏁版嵁涓虹┖锛屽垯杩斿洖true,鏄剧ず鎵�鏈夌殑鏁版嵁椤�
+        return true
+      }
+      // 鏌ヨ鍒楄〃鏄惁鏈夊尮閰嶆暟鎹紝灏嗗�煎皬鍐欙紝鍖归厤鑻辨枃鏁版嵁
+      let val = value.toLowerCase()
+      return this.chooseNode(val, data, node) // 璋冪敤杩囨护浜屽眰鏂规硶
     },
+    // 杩囨护鐖惰妭鐐� / 瀛愯妭鐐� (濡傛灉杈撳叆鐨勫弬鏁版槸鐖惰妭鐐逛笖鑳藉尮閰嶏紝鍒欒繑鍥炶鑺傜偣浠ュ強鍏朵笅鐨勬墍鏈夊瓙鑺傜偣锛涘鏋滃弬鏁版槸瀛愯妭鐐癸紝鍒欒繑鍥炶鑺傜偣鐨勭埗鑺傜偣銆俷ame鏄腑鏂囧瓧绗︼紝enName鏄嫳鏂囧瓧绗�.
+    chooseNode (value, data, node) {
+      if (data.label.indexOf(value) !== -1) {
+        return true
+      }
+      const level = node.level
+      // 濡傛灉浼犲叆鐨勮妭鐐规湰韬氨鏄竴绾ц妭鐐瑰氨涓嶇敤鏍¢獙浜�
+      if (level === 1) {
+        return false
+      }
+      // 鍏堝彇褰撳墠鑺傜偣鐨勭埗鑺傜偣
+      let parentData = node.parent
+      // 閬嶅巻褰撳墠鑺傜偣鐨勭埗鑺傜偣
+      let index = 0
+      while (index < level - 1) {
+        // 濡傛灉鍖归厤鍒扮洿鎺ヨ繑鍥烇紝姝ゅname鍊兼槸涓枃瀛楃锛宔nName鏄嫳鏂囧瓧绗︺�傚垽鏂尮閰嶄腑鑻辨枃杩囨护
+        if (parentData.data.label.indexOf(value) !== -1) {
+          return true
+        }
+        // 鍚﹀垯鐨勮瘽鍐嶅線涓婁竴灞傚仛鍖归厤
+        parentData = parentData.parent
+        index++
+      }
+      // 娌″尮閰嶅埌杩斿洖false
+      return false
+    },
+
     searchFilter() {
       this.$refs.tree.filter(this.search);
     },
@@ -745,7 +778,6 @@
           }
           this.selectTree = data2.replace(" - ", "");
           delStandardTree({ tree: this.selectTree }).then((res) => {
-            if (res.code == 201) return;
             this.$message.success("宸插垹闄�");
             let arr = this.selectTree.split(" - ");
             this.deleteStandard(this.list, arr[arr.length - 1]);
@@ -764,15 +796,6 @@
           item.children && this.deleteStandard(item.children, label);
         }
       });
-    },
-    nodeOpen(data, node, el) {
-      $($(el.$el).find(".node_i")[0]).attr(
-        "class",
-        "node_i el-icon-folder-opened"
-      );
-    },
-    nodeClose(data, node, el) {
-      $($(el.$el).find(".node_i")[0]).attr("class", "node_i el-icon-folder");
     },
     selectEnumByCategoryForFactory() {
       this.getConfigKey("sys_factory").then((response) => {
@@ -855,10 +878,6 @@
       this.addLoad = true;
       addStandardTree(this.addOb)
         .then((res) => {
-          if (res.code === 201) {
-            this.addLoad = false;
-            return;
-          }
           this.$message.success("娣诲姞鎴愬姛");
           this.addDia = false;
           this.list
@@ -892,12 +911,9 @@
       this.updateLoad = true;
       updateStandardTree(this.addOb)
         .then((res) => {
-          if (res.code === 201) {
-            this.updateLoad = false;
-            return;
-          }
           this.$message.success("娣诲姞鎴愬姛");
-          this.selectStandardTreeList();
+          this.$tab.refreshPage();
+          // this.selectStandardTreeList();
           this.updateDia = false;
           this.updateLoad = false;
         })
@@ -928,10 +944,6 @@
           ask: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -942,10 +954,6 @@
           tell: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -957,10 +965,6 @@
           methodS: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -972,10 +976,6 @@
           radius: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -986,10 +986,6 @@
           price: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1000,10 +996,6 @@
           manHour: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1014,10 +1006,6 @@
           templateId: value,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
         this.$message.success("宸蹭繚瀛�");
       });
     },
@@ -1098,11 +1086,7 @@
           state: row.state,
         }),
       }).then((res) => {
-        if (res.code == 201) {
-          this.$message.error("鏈繚瀛�");
-          return;
-        }
-        // this.$message.success('宸蹭繚瀛�')
+        this.$message.success('宸蹭繚瀛�')
       });
     },
     filterHandler(value) {
@@ -1252,10 +1236,6 @@
           }),
         }).then((res) => {
           this.sectionLoad = false;
-          if (res.code == 201) {
-            this.$message.error("鏈繚瀛�");
-            return;
-          }
           this.$message.success("宸蹭繚瀛�");
           this.sectionUpDia = false;
         });
@@ -1274,10 +1254,6 @@
           },
         }).then((res) => {
           this.sectionLoad = false;
-          if (res.code == 201) {
-            this.$message.error("鏈繚瀛�");
-            return;
-          }
           this.$message.success("宸蹭繚瀛�");
           this.sectionUpDia = false;
           this.currentPage0 = 1;

--
Gitblit v1.9.3