From b871888a4ee32d15adfd52fdfabc44c7c674db0e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 17 九月 2026 16:36:45 +0800
Subject: [PATCH] 新疆——新聚lims 1.标准维护预览附件问题
---
src/utils/standardTree.js | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/utils/standardTree.js b/src/utils/standardTree.js
index 458f12d..9f96784 100644
--- a/src/utils/standardTree.js
+++ b/src/utils/standardTree.js
@@ -1,7 +1,8 @@
/**
* 鏍囧噯搴撴爲閫氱敤宸ュ叿
*
- * 灞傜骇涓嶅浐瀹氾細children 涓� null / undefined / 绌烘暟缁勭殑鑺傜偣鍗充负銆屾爣鍑嗐�嶅彾瀛愩��
+ * 鏍囧噯搴撳浐瀹氫袱绾э細code=[1] 涓鸿涓氾紝code=[2] 涓烘爣鍑嗐��
+ * 鍏煎娌℃湁 code 鐨勬棫鎺ュ彛鏁版嵁鏃讹紝鍐嶅洖閫�鍒� children 鍒ゆ柇鍙跺瓙銆�
* 鏍戣矾寰勭粺涓�鐢� " - " 杩炴帴锛屾牸寮忎笌鍘嗗彶瀹炵幇閫愬瓧鑺備繚鎸佷竴鑷达細
* 椤跺眰鐪熷疄鑺傜偣鐨� parent 鏄� Element UI 鐨勮櫄鎷熸牴锛屽洜姝ゆ牴鑺傜偣浼氳繘鍏ヨ矾寰勩��
*/
@@ -9,6 +10,8 @@
// 鏄惁鍙跺瓙锛堟爣鍑嗭級
export function isLeaf(data) {
if (!data) return true;
+ if (data.code === '[1]') return false;
+ if (data.code === '[2]') return true;
const children = data.children;
return children === null || children === undefined || children.length === 0;
}
@@ -33,7 +36,10 @@
let cur = node;
while (cur && cur.parent) {
if (isLeaf(cur.data)) {
- tokens.push(cur.label, leafMarker);
+ const leafValue = cur.data && cur.data.standardMethodId
+ ? (cur.data.value || cur.label)
+ : cur.label;
+ tokens.push(leafValue, leafMarker);
} else {
tokens.push(cur.label);
}
@@ -72,6 +78,14 @@
// 鍘绘帀璺緞鏈锛岀敤浜庛�屽綋鍓嶆槸鍙跺瓙浣嗘煡涓嶅埌鏍囧噯銆嶆椂鍥為��鍒扮埗绾ф煡璇�
export function dropLastLabel(path) {
if (!path) return '';
- const idx = path.lastIndexOf(' - ');
- return idx === -1 ? '' : path.slice(0, idx);
+ const tokens = path.split(' - ');
+ if (tokens.length <= 1) return '';
+ // 鍙跺瓙璺緞鏍煎紡涓衡�滆涓� - null - 鏍囧噯鈥濇垨鈥滆涓� - - 鏍囧噯鈥濄��
+ // 鍘绘帀鏍囧噯鍚嶅悗杩樿鍘绘帀浠呯敤浜庢爣璇嗗彾瀛愮殑鍗犱綅娈碉紝鐖惰矾寰勬墠鏄湡瀹炵殑琛屼笟璺緞銆�
+ tokens.pop();
+ const marker = tokens[tokens.length - 1];
+ if (marker === '' || marker === 'null') {
+ tokens.pop();
+ }
+ return tokens.join(' - ');
}
--
Gitblit v1.9.3