From 9ff5920c0a58771219b134a7b46b7d0c1e1542ad Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 19 六月 2024 23:50:13 +0800
Subject: [PATCH] 2024-06-19

---
 src/utils/utils-custom.js |  130 +++++++++++++++++++++++++++++++++---------
 1 files changed, 101 insertions(+), 29 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 7673d36..68420fa 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -2083,6 +2083,11 @@
  */
 export function getLangTrans (config) {
   let langList = sessionStorage.getItem('langList')
+  let appType = sessionStorage.getItem('appType')
+
+  if (appType === 'mob' || appType === 'pc') {
+    langList = sessionStorage.getItem('applangList')
+  }
   
   if (!langList) return
 
@@ -2101,6 +2106,7 @@
   let btn = []
   let ops = []
   let text = []
+  let menu = []
 
   let filterElement = (card) => {
     if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) {
@@ -2185,9 +2191,26 @@
           })
         }
         if (item.search) {
-          item.search.forEach(cell => {
-            filterForm(cell)
-          })
+          if (item.type === 'topbar') {
+            if (item.search.fields) {
+              item.search.fields.forEach(cell => {
+                filterForm(cell)
+              })
+            }
+            if (item.search.groups) {
+              item.search.groups.forEach(group => {
+                if (group.fields) {
+                  group.fields.forEach(cell => {
+                    filterForm(cell)
+                  })
+                }
+              })
+            }
+          } else {
+            item.search.forEach(cell => {
+              filterForm(cell)
+            })
+          }
         }
         if (item.action) {
           item.action.forEach(cell => {
@@ -2205,7 +2228,29 @@
           })
         }
 
-        if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+        if (item.type === 'navbar') {
+          if (item.menus) {
+            item.menus.forEach(first => {
+              menu.push(first.name)
+              if (first.sublist) {
+                first.sublist.forEach(sec => {
+                  menu.push(sec.name)
+                  if (sec.sublist) {
+                    sec.sublist.forEach(thd => {
+                      menu.push(thd.name)
+                    })
+                  }
+                })
+              }
+            })
+          }
+        } else if (item.type === 'menubar') {
+          item.subMenus.forEach(cell => {
+            if (cell.setting.name) {
+              menu.push(cell.setting.name)
+            }
+          })
+        } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
           item.subcards.forEach(card => {
             card.elements && card.elements.forEach(cell => {
               if (cell.eleType === 'button') {
@@ -2319,25 +2364,8 @@
 
   traversal(config.components)
 
-  sql = sql.filter(Boolean)
-  btn = btn.filter(Boolean)
-  ops = ops.filter(Boolean)
-  text = text.filter(Boolean)
-
-  sql = Array.from(new Set(sql))
-  btn = Array.from(new Set(btn))
-  ops = Array.from(new Set(ops))
-  text = Array.from(new Set(text))
-
-  sql = sql.map(l => `'${l}','title'`)
-  btn = btn.map(l => `'${l}','button'`)
-  ops = ops.map(l => `'${l}','list'`)
-  text = text.map(l => `'${l}','text'`)
-
-  let list = [...btn, ...sql, ...ops, ...text]
-
   if (config.MenuName) {
-    list.unshift(`'${config.MenuName}','menu'`)
+    menu.push(config.MenuName)
   }
 
   if (config.fstMenuId && config.parentId && config.fstMenuId !== 'BillPrintTemp') {
@@ -2350,13 +2378,33 @@
 
     menulist.forEach(item => {
       if (item.MenuID !== config.fstMenuId) return
-      list.unshift(`'${item.MenuName}','menu'`)
+      menu.push(item.MenuName)
       item.children.forEach(cell => {
         if (cell.MenuID !== config.parentId) return
-        list.unshift(`'${cell.MenuName}','menu'`)
+        menu.push(cell.MenuName)
       })
     })
   }
+
+  sql = sql.filter(Boolean)
+  btn = btn.filter(Boolean)
+  ops = ops.filter(Boolean)
+  text = text.filter(Boolean)
+  menu = menu.filter(Boolean)
+
+  sql = Array.from(new Set(sql))
+  btn = Array.from(new Set(btn))
+  ops = Array.from(new Set(ops))
+  text = Array.from(new Set(text))
+  menu = Array.from(new Set(menu))
+
+  sql = sql.map(l => `'${l}','title'`)
+  btn = btn.map(l => `'${l}','button'`)
+  ops = ops.map(l => `'${l}','list'`)
+  text = text.map(l => `'${l}','text'`)
+  menu = menu.map(l => `'${l}','menu'`)
+
+  let list = [...menu, ...btn, ...sql, ...ops, ...text]
 
   let result = []
 
@@ -2376,7 +2424,7 @@
 /**
  * @description 璇█杞崲
  */
-export function setLangTrans (config, btnDict, titDict, lisDict, regs, tail) {
+export function setLangTrans (config, btnDict, titDict, lisDict, menuDict, regs, tail) {
   let filterElement = (card) => {
     if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) {
       if (card.value && titDict[card.value]) {
@@ -2579,9 +2627,26 @@
           })
         }
         if (item.search) {
-          item.search.forEach(cell => {
-            filterForm(cell)
-          })
+          if (item.type === 'topbar') {
+            if (item.search.fields) {
+              item.search.fields.forEach(cell => {
+                filterForm(cell)
+              })
+            }
+            if (item.search.groups) {
+              item.search.groups.forEach(group => {
+                if (group.fields) {
+                  group.fields.forEach(cell => {
+                    filterForm(cell)
+                  })
+                }
+              })
+            }
+          } else {
+            item.search.forEach(cell => {
+              filterForm(cell)
+            })
+          }
         }
         if (item.action) {
           item.action.forEach(cell => {
@@ -2598,8 +2663,15 @@
           })
         }
 
-        if (item.type === 'menubar') {
+        if (item.type === 'navbar') {
+          item.uuid = item.uuid.slice(0, 24) + tail
+        } else if (item.type === 'login') {
+          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.type === 'linkmenu') {
               cell.setting.linkMenuId = cell.setting.linkMenuId.slice(0, 24) + tail
             }

--
Gitblit v1.8.0