From eaff2fbd473362115c8c45e22b86b2ecb73e5a97 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 10 九月 2026 15:17:12 +0800
Subject: [PATCH] 新疆——新聚lims 1.标准库层级需要修改层级,行业-标准,总共两级;实验室换成行业 2.每个标准下的检验项列表加一个搜索查询功能
---
src/views/standard/standardLibrary/components/BatchCopy.vue | 89 +++++++++++++++-----------------------------
1 files changed, 30 insertions(+), 59 deletions(-)
diff --git a/src/views/standard/standardLibrary/components/BatchCopy.vue b/src/views/standard/standardLibrary/components/BatchCopy.vue
index 7ea84b4..b369746 100644
--- a/src/views/standard/standardLibrary/components/BatchCopy.vue
+++ b/src/views/standard/standardLibrary/components/BatchCopy.vue
@@ -229,11 +229,11 @@
<span
><i
:class="`node_i ${
- data.children != undefined
- ? data.code === '[1]'
+ isLeaf(data)
+ ? 'el-icon-tickets'
+ : data.code === '[1]'
? 'el-icon-folder-opened'
: 'el-icon-folder'
- : 'el-icon-tickets'
}`"
></i>
{{ data.code }} {{ data.label }}</span
@@ -467,6 +467,12 @@
selectStandardTreeList2,
selectsStandardMethodByFLSSM,
} from "@/api/standard/standardLibrary";
+import {
+ isLeaf,
+ buildSelectTree,
+ deriveTreeFields,
+ dropLastLabel,
+} from "@/utils/standardTree";
export default {
name: "BatchCopy",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
@@ -498,6 +504,8 @@
search: null,
expandedKeys: [],
selectTree: null,
+ // 褰撳墠閫変腑鐨勬爲鑺傜偣锛岀敤浜庢寜灞傜骇鎺ㄥ瀛楁
+ treeNode: null,
standardMethodListId: null,
methodLoad: false,
methods: [],
@@ -516,6 +524,8 @@
},
// 鏂规硶闆嗗悎
methods: {
+ // 渚涙ā鏉垮垽鏂彾瀛�(鏍囧噯)鑺傜偣
+ isLeaf,
// 鑾峰彇宸﹁竟琛ㄦ牸鏁版嵁
getList() {
this.batchCopyDia = true;
@@ -685,7 +695,8 @@
selectStandardTreeList() {
this.selectStandardTreeLoading = true;
selectStandardTreeList2().then((res) => {
- this.list = res.data;
+ this.list = res.data || [];
+ this.expandedKeys = [];
this.list.forEach((a) => {
this.expandedKeys.push(a.label);
});
@@ -694,39 +705,8 @@
},
// 閫夋嫨鏍峰搧鍚嶇О鐨勫洖璋�
handleNodeClick(val, node, el) {
- this.selectTree = "";
- this.getNodeParent(node);
- let flag = false;
- if (node.level == 3) {
- if (node.data.children.length > 0) {
- node.data.children.forEach((a) => {
- let key = Object.keys(a);
- if (!key.includes("level")) {
- flag = true;
- }
- });
- }
- }
- this.selectTree = this.selectTree.replace(" - ", "");
- if (flag) {
- this.selectTree = " - - " + this.selectTree;
- }
- let data = this.selectTree.split(" - ");
- let data2 = "";
- for (let index = data.length - 1; index >= 0; index--) {
- data2 += " - " + data[index];
- }
- this.selectTree = data2.replace(" - ", "");
- },
- getNodeParent(val) {
- if (val.parent != null) {
- if (val.data.children === null) {
- this.selectTree += " - " + val.label + " - " + "null";
- } else {
- this.selectTree += " - " + val.label;
- }
- this.getNodeParent(val.parent);
- }
+ this.treeNode = node;
+ this.selectTree = buildSelectTree(node, "null");
},
changeStandardMethodListId() {
// 鏍规嵁妫�楠屾爣鍑嗘煡鍙宠竟table鏁版嵁
@@ -753,38 +733,29 @@
tree: this.selectTree,
}).then((res) => {
this.methodLoad = false;
- try {
- if (
- res.data.standardMethodList.length == 0 &&
- this.selectTree.split("-").length == 5
- ) {
- let arr = this.selectTree.split("-");
- let arr0 = arr.slice(0, arr.length - 1);
- let selectTree = arr0
- .join("-")
- .substring(0, arr0.join("-").length - 1);
+ const list = (res.data && res.data.standardMethodList) || [];
+ // 褰撳墠鏄彾瀛�(鏍囧噯)鍗存煡涓嶅埌鏍囧噯鏃讹紝鍥為��鍒扮埗绾у啀鏌ヤ竴娆�
+ if (list.length === 0 && this.treeNode && isLeaf(this.treeNode.data)) {
+ const parentTree = dropLastLabel(this.selectTree);
+ if (parentTree) {
selectsStandardMethodByFLSSM({
- tree: selectTree,
+ tree: parentTree,
}).then((ress) => {
- this.methods = ress.data.standardMethodList;
+ this.methods = (ress.data && ress.data.standardMethodList) || [];
});
- } else {
- this.methods = res.data.standardMethodList;
+ return;
}
- } catch (e) {}
+ }
+ this.methods = list;
});
},
activeStandardTree() {
- let trees = this.selectTree.split(" - ");
- if (trees.length < 3) {
+ const { labels, sample, sampleType } = deriveTreeFields(this.treeNode);
+ if (labels.length < 2) {
this.$message.error("鏈�夋嫨瀵硅薄");
return;
}
- if (trees[3] === undefined || trees[3] === "" || trees[3] === "- ") {
- this.sample = trees[2];
- } else {
- this.sample = trees[3];
- }
+ this.sample = sample || sampleType;
this.selectStandardTree = false;
},
handleSelectionChange0(val) {
--
Gitblit v1.9.3