From 24842b40de5cd60700bf69dfd38a0332f5431e36 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 23 五月 2025 10:55:07 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/utils/utils-custom.js | 266 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 245 insertions(+), 21 deletions(-) diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index d6efda5..87a4db3 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -2431,6 +2431,8 @@ * @description 鑾峰彇璇█杞崲淇℃伅 */ export function getLangTrans (config) { + if (sessionStorage.getItem('lang') !== 'zh-CN') return '' + let langList = sessionStorage.getItem('langList') let appType = sessionStorage.getItem('appType') @@ -2438,18 +2440,19 @@ langList = sessionStorage.getItem('applangList') } - if (!langList) return - - let defLang = '' + if (!langList) return '' try { langList = JSON.parse(langList) - defLang = langList[0] } catch (e) { - defLang = '' + langList = '' } - if (!defLang) return '' + if (!langList) return '' + + langList = langList.filter(n => n !== 'zh-CN') + + if (langList.length === 0) return '' let sql = [] let btn = [] @@ -2539,6 +2542,9 @@ if (item.wrap && item.wrap.title) { sql.push(item.wrap.title) } + if (item.plot && item.plot.title) { + sql.push(item.plot.title) + } if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) { if (item.setting.interType === 'system') { @@ -2546,6 +2552,9 @@ item.scripts && item.scripts.forEach(script => { filterSql(script.sql) }) + } + if (item.setting.supModTip) { + sql.push(item.setting.supModTip) } } @@ -2723,6 +2732,9 @@ filterSql(script.sql) }) } + if (item.setting.supModTip) { + sql.push(item.setting.supModTip) + } }) } @@ -2756,7 +2768,20 @@ 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((n) => { + if (!n) return false + if (/^[a-zA-Z_]+$/.test(n)) return false + + return true + }) + btn = btn.filter(Boolean) + ops = ops.filter(Boolean) + menu = menu.filter(Boolean) sql = Array.from(new Set(sql)) btn = Array.from(new Set(btn)) @@ -2775,8 +2800,6 @@ let result = [] langList.forEach(lan => { - if (lan === defLang) return - list.forEach(n => { result.push(`'${lan}',${n}`) }) @@ -2806,6 +2829,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]) { @@ -2816,6 +2854,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 } @@ -2852,8 +2967,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) { @@ -2952,8 +3067,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) } }) } @@ -3018,6 +3133,9 @@ if (item.wrap && item.wrap.title) { item.wrap.title = replaceTitle(item.wrap.title) } + if (item.plot && item.plot.title) { + item.plot.title = replaceTitle(item.plot.title) + } if (item.wrap && (item.wrap.click === 'menu' || item.wrap.click === 'menus')) { if (item.wrap.click === 'menu') { resetMenu(item.wrap) @@ -3037,6 +3155,9 @@ item.scripts && item.scripts.forEach(script => { script.sql = filterSql(script.sql) }) + } + if (item.setting.supModTip) { + item.setting.supModTip = replaceTitle(item.setting.supModTip) } } @@ -3090,8 +3211,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 @@ -3214,6 +3335,9 @@ script.sql = filterSql(script.sql) }) } + if (item.setting.supModTip) { + item.setting.supModTip = replaceTitle(item.setting.supModTip) + } }) } @@ -3239,6 +3363,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]) { @@ -3249,6 +3387,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 } @@ -3285,8 +3500,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 @@ -3334,8 +3549,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) } }) } @@ -3358,12 +3573,18 @@ if (item.wrap && item.wrap.title) { item.wrap.title = replaceTitle(item.wrap.title) } + if (item.plot && item.plot.title) { + item.plot.title = replaceTitle(item.plot.title) + } if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) { if (item.setting.interType === 'system') { item.setting.dataresource = filterSql(item.setting.dataresource) item.scripts && item.scripts.forEach(script => { script.sql = filterSql(script.sql) }) + } + if (item.setting.supModTip) { + item.setting.supModTip = replaceTitle(item.setting.supModTip) } } @@ -3413,8 +3634,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 }) @@ -3525,6 +3746,9 @@ script.sql = filterSql(script.sql) }) } + if (item.setting.supModTip) { + item.setting.supModTip = replaceTitle(item.setting.supModTip) + } }) } -- Gitblit v1.8.0