From d0764c7facff9abf00af6f3ff06a26260d1d8770 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 12 五月 2025 16:34:25 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/utils/utils-custom.js |  217 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 204 insertions(+), 13 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index e66d16d..464d315 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -2762,7 +2762,15 @@
   text = text.filter(Boolean)
   menu = menu.filter(Boolean)
 
-  sql = sql.map(n => n.replace(/(:|锛�)$/g, ''))
+  sql = sql.map(n => n.replace(/^\s+|\s+$/g, '').replace(/(:|锛�)$/g, ''))
+  btn = btn.map(n => n.replace(/^\s+|\s+$/g, ''))
+  ops = ops.map(n => n.replace(/^\s+|\s+$/g, ''))
+  menu = menu.map(n => n.replace(/^\s+|\s+$/g, ''))
+
+  sql = sql.filter(Boolean)
+  btn = btn.filter(Boolean)
+  ops = ops.filter(Boolean)
+  menu = menu.filter(Boolean)
 
   sql = Array.from(new Set(sql))
   btn = Array.from(new Set(btn))
@@ -2810,6 +2818,21 @@
   }
 
   let replaceTitle = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
+
     if聽(/(:|锛�)$/g.test(val)) {
       let _val = val.replace(/(:|锛�)$/g,聽'')
       if聽(titDict[_val]) {
@@ -2820,6 +2843,83 @@
     }聽else if (titDict[val]) {
       val = titDict[val]
     }
+
+    val = s + val + e
+
+    return val
+  }
+
+  let replaceBtn = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
+
+    if (btnDict[val]) {
+      val = btnDict[val]
+    }
+
+    val = s + val + e
+
+    return val
+  }
+
+  let replaceList = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
+
+    if (lisDict[val]) {
+      val = lisDict[val]
+    }
+
+    val = s + val + e
+
+    return val
+  }
+
+  let replaceMenu = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
+
+    if (menuDict[val]) {
+      val = menuDict[val]
+    }
+
+    val = s + val + e
 
     return val
   }
@@ -2856,8 +2956,8 @@
   }
 
   let filterBtn = (btn) => {
-    if (btn.label && btnDict[btn.label]) {
-      btn.label = btnDict[btn.label]
+    if (btn.label) {
+      btn.label = replaceBtn(btn.label)
     }
 
     if (btn.OpenType === 'tab' && btn.linkmenu) {
@@ -2956,8 +3056,8 @@
       n.dataSource = filterSql(n.dataSource)
     } else if (n.options) {
       n.options.forEach(o => {
-        if (o.Text && lisDict[o.Text]) {
-          o.Text = lisDict[o.Text]
+        if (o.Text) {
+          o.Text = replaceList(o.Text)
         }
       })
     }
@@ -3097,8 +3197,8 @@
           item.wrap.linkmenu = item.wrap.linkmenu.slice(0, 24) + tail
         } else if (item.type === 'menubar') {
           item.subMenus = item.subMenus.map(cell => {
-            if (cell.setting.name && menuDict[cell.setting.name]) {
-              cell.setting.name = menuDict[cell.setting.name]
+            if (cell.setting.name) {
+              cell.setting.name = replaceMenu(cell.setting.name)
             }
             if (cell.setting.type === 'linkmenu') {
               cell.setting.linkMenuId = cell.setting.linkMenuId.slice(0, 24) + tail
@@ -3246,6 +3346,20 @@
   }
 
   let replaceTitle = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
     if聽(/(:|锛�)$/g.test(val)) {
       let _val = val.replace(/(:|锛�)$/g,聽'')
       if聽(titDict[_val]) {
@@ -3256,6 +3370,83 @@
     }聽else if (titDict[val]) {
       val = titDict[val]
     }
+
+    val = s + val + e
+
+    return val
+  }
+
+  let replaceBtn = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
+
+    if (btnDict[val]) {
+      val = btnDict[val]
+    }
+
+    val = s + val + e
+
+    return val
+  }
+
+  let replaceList = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
+
+    if (lisDict[val]) {
+      val = lisDict[val]
+    }
+
+    val = s + val + e
+
+    return val
+  }
+
+  let replaceMenu = (val)聽=> {
+    let s = ''
+    let e = ''
+    if (/^\s+/g) {
+      val = val.replace(/^\s+/g,聽(w) => {
+        s = w
+        return ''
+      })
+    }
+    if (/\s+$/g) {
+      val = val.replace(/\s+$/g,聽(w) => {
+        e = w
+        return ''
+      })
+    }
+
+    if (menuDict[val]) {
+      val = menuDict[val]
+    }
+
+    val = s + val + e
 
     return val
   }
@@ -3292,8 +3483,8 @@
   }
 
   let filterBtn = (btn) => {
-    if (btn.label && btnDict[btn.label]) {
-      btn.label = btnDict[btn.label]
+    if (btn.label) {
+      btn.label = replaceBtn(btn.label)
     }
 
     if (!btn.verify) return
@@ -3341,8 +3532,8 @@
       n.dataSource = filterSql(n.dataSource)
     } else if (n.options) {
       n.options.forEach(o => {
-        if (o.Text && lisDict[o.Text]) {
-          o.Text = lisDict[o.Text]
+        if (o.Text) {
+          o.Text = replaceList(o.Text)
         }
       })
     }
@@ -3423,8 +3614,8 @@
 
         if (item.type === 'menubar') {
           item.subMenus = item.subMenus.map(cell => {
-            if (cell.setting.name && menuDict[cell.setting.name]) {
-              cell.setting.name = menuDict[cell.setting.name]
+            if (cell.setting.name) {
+              cell.setting.name = replaceMenu(cell.setting.name)
             }
             return cell
           })

--
Gitblit v1.8.0