From cc281717bbe49a2429a31d0fb10f6adac6d5f773 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 07 三月 2025 16:39:05 +0800
Subject: [PATCH] 导出方法修改
---
src/views/standard/standardLibrary/index.vue | 101 +++++++++++++++++++-------------------------------
1 files changed, 38 insertions(+), 63 deletions(-)
diff --git a/src/views/standard/standardLibrary/index.vue b/src/views/standard/standardLibrary/index.vue
index 180ad2c..36e74a2 100644
--- a/src/views/standard/standardLibrary/index.vue
+++ b/src/views/standard/standardLibrary/index.vue
@@ -206,7 +206,8 @@
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">
@@ -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,10 +911,6 @@
this.updateLoad = true;
updateStandardTree(this.addOb)
.then((res) => {
- if (res.code === 201) {
- this.updateLoad = false;
- return;
- }
this.$message.success("娣诲姞鎴愬姛");
this.$tab.refreshPage();
// this.selectStandardTreeList();
@@ -929,10 +944,6 @@
ask: value,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
});
},
@@ -943,10 +954,6 @@
tell: value,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
});
},
@@ -958,10 +965,6 @@
methodS: value,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
});
},
@@ -973,10 +976,6 @@
radius: value,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
});
},
@@ -987,10 +986,6 @@
price: value,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
});
},
@@ -1001,10 +996,6 @@
manHour: value,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
});
},
@@ -1015,10 +1006,6 @@
templateId: value,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
});
},
@@ -1099,11 +1086,7 @@
state: row.state,
}),
}).then((res) => {
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
- // this.$message.success('宸蹭繚瀛�')
+ this.$message.success('宸蹭繚瀛�')
});
},
filterHandler(value) {
@@ -1253,10 +1236,6 @@
}),
}).then((res) => {
this.sectionLoad = false;
- if (res.code == 201) {
- this.$message.error("鏈繚瀛�");
- return;
- }
this.$message.success("宸蹭繚瀛�");
this.sectionUpDia = false;
});
@@ -1275,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