From e15d032770157952bab8d9b15177ac03d736851c Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期六, 09 五月 2026 17:34:53 +0800
Subject: [PATCH] 医疗信息
---
src/utils/ruoyi.js | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js
index ef61200..d8782ff 100644
--- a/src/utils/ruoyi.js
+++ b/src/utils/ruoyi.js
@@ -50,6 +50,43 @@
});
return time_str;
}
+/**
+ * 灏嗛�楀彿鍒嗛殧鐨勫瓧绗︿覆杞崲涓哄搴旂殑label瀛楃涓�
+ * @param {string} str - 閫楀彿鍒嗛殧鐨勫瓧绗︿覆锛屽 "2,3,1"
+ * @param {Array} options - 閫夐」鏁扮粍锛屾牸寮�: [{value: "1", label: "閫夐」1"}, ...]
+ * @returns {string} - 閫楀彿鍒嗛殧鐨刲abel瀛楃涓�
+ */
+export function getLabelsFromString(str, options) {
+ if (!str || !options || !Array.isArray(options)) {
+ return "";
+ }
+
+ // 灏嗗瓧绗︿覆鍒嗗壊涓烘暟缁�
+ const valueArray = str
+ .split(",")
+ .map(item => item.trim())
+ .filter(item => item !== "");
+
+ if (valueArray.length === 0) {
+ return "";
+ }
+
+ // 鍒涘缓value鍒發abel鐨勬槧灏�
+ const valueToLabelMap = {};
+ options.forEach(option => {
+ if (option.value !== undefined && option.label !== undefined) {
+ valueToLabelMap[option.value] = option.label;
+ }
+ });
+
+ // 鑾峰彇瀵瑰簲鐨刲abel
+ const labelArray = valueArray.map(value => {
+ return valueToLabelMap[value] || value; // 濡傛灉鎵句笉鍒板搴攍abel锛屽氨杩斿洖鍘熷��
+ });
+
+ // 杩斿洖閫楀彿鍒嗛殧鐨刲abel瀛楃涓�
+ return labelArray.join(",");
+}
export function donatebaseinfoEdit(data) {
updateDonatebaseinfo(data);
}
--
Gitblit v1.9.3