From ff14fa5e4efaf4e3e6a307473e9bd2881da265c1 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期五, 18 四月 2025 12:55:34 +0800
Subject: [PATCH] 支持文件&图片组件自定义地址&参数

---
 src/utils/ruoyi.js |   52 ++++++++++++++--------------------------------------
 1 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js
index 3ba2868..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,16 +219,10 @@
   if (res[res.length - 1] === '/') {
     return res.slice(0, res.length - 1)
   }
-  return res;
+  return res
 }
 
 // 楠岃瘉鏄惁涓篵lob鏍煎紡
-export async function blobValidate(data) {
-  try {
-    const text = await data.text();
-    JSON.parse(text);
-    return false;
-  } catch (error) {
-    return true;
-  }
-}
\ No newline at end of file
+export function blobValidate(data) {
+  return data.type !== 'application/json'
+}

--
Gitblit v1.9.3