From 7de94e2ea37803216e5afe9d40e7121c87a5344e Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期四, 24 四月 2025 14:21:14 +0800
Subject: [PATCH] 富文本复制粘贴图片上传至url

---
 src/utils/ruoyi.js |   40 +++++++++++-----------------------------
 1 files changed, 11 insertions(+), 29 deletions(-)

diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js
index 2714962..7aa9ab6 100644
--- a/src/utils/ruoyi.js
+++ b/src/utils/ruoyi.js
@@ -1,5 +1,3 @@
-
-
 /**
  * 閫氱敤js鏂规硶灏佽澶勭悊
  * Copyright (c) 2019 ruoyi
@@ -86,7 +84,7 @@
   return actions.join('');
 }
 
-// 鍥炴樉鏁版嵁瀛楀吀锛堝瓧绗︿覆鏁扮粍锛�
+// 鍥炴樉鏁版嵁瀛楀吀锛堝瓧绗︿覆銆佹暟缁勶級
 export function selectDictLabels(datas, value, separator) {
   if (value === undefined || value.length ===0) {
     return "";
@@ -165,37 +163,22 @@
   };
 
   var childrenListMap = {};
-  var nodeIds = {};
   var tree = [];
-
   for (let d of data) {
-    let parentId = d[config.parentId];
-    if (childrenListMap[parentId] == null) {
-      childrenListMap[parentId] = [];
+    let id = d[config.id];
+    childrenListMap[id] = d;
+    if (!d[config.childrenList]) {
+      d[config.childrenList] = [];
     }
-    nodeIds[d[config.id]] = d;
-    childrenListMap[parentId].push(d);
   }
 
   for (let d of data) {
-    let parentId = d[config.parentId];
-    if (nodeIds[parentId] == null) {
+    let parentId = d[config.parentId]
+    let parentObj = childrenListMap[parentId]
+    if (!parentObj) {
       tree.push(d);
-    }
-  }
-
-  for (let t of tree) {
-    adaptToChildrenList(t);
-  }
-
-  function adaptToChildrenList(o) {
-    if (childrenListMap[o[config.id]] !== null) {
-      o[config.childrenList] = childrenListMap[o[config.id]];
-    }
-    if (o[config.childrenList]) {
-      for (let c of o[config.childrenList]) {
-        adaptToChildrenList(c);
-      }
+    } else {
+      parentObj[config.childrenList].push(d)
     }
   }
   return tree;
@@ -227,7 +210,6 @@
   return result
 }
 
-
 // 杩斿洖椤圭洰璺緞
 export function getNormalPath(p) {
   if (p.length === 0 || !p || p == 'undefined') {
@@ -237,7 +219,7 @@
   if (res[res.length - 1] === '/') {
     return res.slice(0, res.length - 1)
   }
-  return res;
+  return res
 }
 
 // 楠岃瘉鏄惁涓篵lob鏍煎紡

--
Gitblit v1.9.3