From 9a47acddeb1e6c8a22538a6f12d525106a6f6e5a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 30 四月 2025 11:17:42 +0800 Subject: [PATCH] 2025-04-30 --- src/utils/utils-custom.js | 143 +++++++++++++++++++++++++++-------------------- 1 files changed, 82 insertions(+), 61 deletions(-) diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 3cda7e8..81c7381 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -2288,40 +2288,6 @@ duration: 5 }) return false - } else if (/,\./ig.test(sql)) { - let lines = [] - sql.split(/\n/).forEach((s, i) => { - if (/,\./ig.test(s)) { - lines.push(i + 1) - } - }) - - lines = lines.join('銆�') - lines = lines ? '(绗�' + lines + '琛�)' : '' - - notification.warning({ - top: 92, - message: label + `${lines}锛屼笉鍙嚭鐜拌嫳鏂囬�楀彿,.`, - duration: 5 - }) - return false - } else if (/\.,/ig.test(sql)) { - let lines = [] - sql.split(/\n/).forEach((s, i) => { - if (/\.,/ig.test(s)) { - lines.push(i + 1) - } - }) - - lines = lines.join('銆�') - lines = lines ? '(绗�' + lines + '琛�)' : '' - - notification.warning({ - top: 92, - message: label + `${lines}锛屼笉鍙嚭鐜拌嫳鏂囬�楀彿.,`, - duration: 5 - }) - return false } else if (/鈥榺鈥�/ig.test(sql)) { let lines = [] sql.split(/\n/).forEach((s, i) => { @@ -2424,6 +2390,38 @@ duration: 5 }) return false + } else if (/,\./ig.test(sql)) { + let lines = [] + sql.split(/\n/).forEach((s, i) => { + if (/,\./ig.test(s)) { + lines.push(i + 1) + } + }) + + lines = lines.join('銆�') + lines = lines ? '(绗�' + lines + '琛�)' : '' + + notification.warning({ + top: 92, + message: label + `${lines}锛屼笉鍙嚭鐜拌嫳鏂囬�楀彿,.`, + duration: 5 + }) + } else if (/\.,/ig.test(sql)) { + let lines = [] + sql.split(/\n/).forEach((s, i) => { + if (/\.,/ig.test(s)) { + lines.push(i + 1) + } + }) + + lines = lines.join('銆�') + lines = lines ? '(绗�' + lines + '琛�)' : '' + + notification.warning({ + top: 92, + message: label + `${lines}锛屼笉鍙嚭鐜拌嫳鏂囬�楀彿.,`, + duration: 5 + }) } return true @@ -2748,6 +2746,8 @@ text = text.filter(Boolean) menu = menu.filter(Boolean) + sql = sql.map(n => n.replace(/(:|锛�)$/g, '')) + sql = Array.from(new Set(sql)) btn = Array.from(new Set(btn)) ops = Array.from(new Set(ops)) @@ -2783,16 +2783,31 @@ 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]) { - card.value = titDict[card.value] + if (card.value) { + card.value = replaceTitle(card.value) } } - if (card.prefix && titDict[card.prefix]) { - card.prefix = titDict[card.prefix] + if (card.prefix) { + card.prefix = replaceTitle(card.prefix) } - if (card.postfix && titDict[card.postfix]) { - card.postfix = titDict[card.postfix] + if (card.postfix) { + card.postfix = replaceTitle(card.postfix) } + } + + let replaceTitle = (val)聽=> { + if聽(/(:|锛�)$/g.test(val)) { + let _val = val.replace(/(:|锛�)$/g,聽'') + if聽(titDict[_val]) { + val = titDict[_val] + val.substr(-1) + }聽else if (titDict[val]) { + val = titDict[val] + } + }聽else if (titDict[val]) { + val = titDict[val] + } + + return val } let getuuid = () => { @@ -2904,8 +2919,8 @@ } let filterForm = (n) => { - if (n.label && titDict[n.label]) { - n.label = titDict[n.label] + if (n.label) { + n.label = replaceTitle(n.label) } if (n.resourceType === '1') { n.dataSource = filterSql(n.dataSource) @@ -2966,8 +2981,8 @@ components.forEach(item => { if (item.type === 'tabs') { item.subtabs.forEach(tab => { - if (tab.label && titDict[tab.label]) { - tab.label = titDict[tab.label] + if (tab.label) { + tab.label = replaceTitle(tab.label) } traversal(tab.components) }) @@ -2975,9 +2990,7 @@ traversal(item.components) } else { if (item.wrap && item.wrap.title) { - if (titDict[item.wrap.title]) { - item.wrap.title = titDict[item.wrap.title] - } + item.wrap.title = replaceTitle(item.wrap.title) } if (item.wrap && (item.wrap.click === 'menu' || item.wrap.click === 'menus')) { if (item.wrap.click === 'menu') { @@ -3003,8 +3016,8 @@ if (item.columns) { item.columns.forEach(cell => { - if (cell.label && titDict[cell.label]) { - cell.label = titDict[cell.label] + if (cell.label) { + cell.label = replaceTitle(cell.label) } }) } @@ -3123,14 +3136,14 @@ } else if (item.type === 'table') { let loopCol = (cols) => { cols.forEach(col => { - if (col.label && titDict[col.label]) { - col.label = titDict[col.label] + if (col.label) { + col.label = replaceTitle(col.label) } - if (col.prefix && titDict[col.prefix]) { - col.prefix = titDict[col.prefix] + if (col.prefix) { + col.prefix = replaceTitle(col.prefix) } - if (col.postfix && titDict[col.postfix]) { - col.postfix = titDict[col.postfix] + if (col.postfix) { + col.postfix = replaceTitle(col.postfix) } if (col.type === 'colspan') { loopCol(col.subcols) @@ -4997,7 +5010,7 @@ let sFields = getSearches(searches) let _columns = [] - if (item.subtype === 'dualdatacard') { + if (item.subtype === 'dualdatacard' && item.setting.subdata !== 'sub_data_string') { _columns = [...item.columns, ...item.subColumns] } else if (item.columns) { _columns = [...item.columns] @@ -5030,6 +5043,7 @@ // } let _search = '' + if (item.setting.execute !== 'false') { _dataresource = item.setting.dataresource || '' _search = '@mk_search@' @@ -5039,14 +5053,21 @@ _search = '' } + let custompage = false + let testSql = _dataresource + _customScript + _tailScript + + if (/order\s+by\s+sort_id\s*$/i.test(_dataresource)) { + custompage = true + } else if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql)) { + custompage = true + } + if (/\s/.test(_dataresource) && !/\)\s+tb$/.test(_dataresource)) { _dataresource = '(' + _dataresource + ') tb' } item.setting.dataresource = _dataresource item.setting.customScript = _customScript - - let testSql = _dataresource + _customScript + _tailScript let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] let secSql = [`@ErrorCode='S',@retmsg =''`] @@ -5100,12 +5121,12 @@ let DateCount = '' if (_dataresource) { /*system_query*/ - if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql) || (item.wrap && item.wrap.tree === 'true')) { + if (custompage || (item.wrap && item.wrap.tree === 'true')) { LText = `select ${arr_field} from ${_dataresource} ${_search} ` } else if (item.setting.laypage === 'true' && item.setting.order) { LText = `select top @pageSize@ ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` reps.push('pageSize', 'orderBy', 'pageIndex') - if (item.subtype === 'dualdatacard') { + if (item.subtype === 'dualdatacard' && item.setting.subdata !== 'sub_data_string') { DateCount = `select count(1) as total from (select distinct ${item.setting.primaryKey || 'ID'} from ${_dataresource} ${_search})a` } else { DateCount = `select count(1) as total from ${_dataresource} ${_search}` @@ -5132,7 +5153,7 @@ let parid = '' let sub_field = '' - if (item.subtype === 'dualdatacard') { + if (item.subtype === 'dualdatacard' && item.setting.subdata !== 'sub_data_string') { arr_field = item.columns.map(col => col.field).join(',') sub_name = item.setting.subdata tabid = item.setting.primaryKey || '' -- Gitblit v1.8.0