From 6f2b0cab4c9a4dacfebb2d6fbd4ec2fdc14e22ba Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 29 四月 2024 15:29:58 +0800 Subject: [PATCH] 2024-04-29 --- src/utils/utils-custom.js | 73 ++++++++++++++++++++++++++++++++---- 1 files changed, 64 insertions(+), 9 deletions(-) diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 8926d01..841817d 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -193,6 +193,42 @@ } /** + * @description 鑾峰彇鎸囧畾缁勪欢 + * @return {String} 缁勪欢id + */ + static getComponent (Id) { + let interfaces = window.GLOB.customMenu.interfaces + let components = window.GLOB.customMenu.components + let cell = null + + let mapComponents = (components = []) => { + components.forEach(item => { + if (item.uuid === Id) { + cell = item + }else if (item.type === 'tabs') { + item.subtabs.forEach(f_tab => { + mapComponents(f_tab.components) + }) + } else if (item.type === 'group') { + mapComponents(item.components) + } + }) + } + + mapComponents(components) + + if (!cell && interfaces) { + interfaces.forEach(m => { + if (m.uuid === Id && m.status === 'true') { + cell = m + } + }) + } + + return cell + } + + /** * @description 鑾峰彇涓婄骇妯″潡 * @return {String} selfId 褰撳墠缁勪欢id */ @@ -540,7 +576,16 @@ return cell }) } - } else if (item.type === 'table' && item.cols) { + } else if (item.type === 'table') { + if (item.supNodes && item.supNodes.length > 0) { + item.supNodes = item.supNodes.map(cell => { + cell.nodes = cell.nodes.map(n => md5(commonId + n)) + cell.componentId = cell.nodes[cell.nodes.length - 1] + + return cell + }) + } + let loopCol = (cols) => { return cols.map(col => { if (col.type === 'action') { @@ -578,7 +623,7 @@ }) } - item.cols = loopCol(item.cols) + item.cols = loopCol(item.cols || []) if (item.colsCtrls) { item.colsCtrls = item.colsCtrls.map(col => { @@ -846,7 +891,7 @@ return cell }) } - } else if (item.type === 'table' && item.cols) { + } else if (item.type === 'table') { let loopCol = (cols) => { return cols.map(col => { if (col.type === 'action') { @@ -887,7 +932,7 @@ }) } - item.cols = loopCol(item.cols) + item.cols = loopCol(item.cols || []) if (item.colsCtrls) { item.colsCtrls = item.colsCtrls.map(col => { @@ -1009,7 +1054,7 @@ } else if (item.type === 'daterange') { value = '1949-10-01 00:00:00.000,1949-10-02 00:00:00.000' } else if (item.type === 'range') { - value = item.initval || `${item.minValue || '-999999'},${item.maxValue || '999999'}` + value = item.initval || `${item.minValue || '-999999999'},${item.maxValue || '999999999'}` } else if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) { type = 'multi' } @@ -1058,7 +1103,7 @@ searchText.push('(' + item.key + ' >= \'' + val[0] + '\' AND ' + item.key + ' < \'' + val[1] + '\')') } else if (item.type === 'range') { let val = item.value.split(',') - searchText.push('(' + item.key + ' >= ' + (val[0] || -999999) + ' AND ' + item.key + ' < ' + (val[1] || 999999) + ')') + searchText.push('(' + item.key + ' >= ' + (val[0] || -999999999) + ' AND ' + item.key + ' <= ' + (val[1] || 999999999) + ')') } else if (item.type === 'datemonth') { if (item.match === '=') { searchText.push('(' + item.key + ' = \'' + item.value + '\')') @@ -1122,10 +1167,10 @@ let val = item.value.split(',') options.push({ reg: new RegExp('@' + item.key + '@', 'ig'), - value: `${val[0] || -999999}` + value: `${val[0] || -999999999}` }, { reg: new RegExp('@' + item.key + '1@', 'ig'), - value: `${val[1] || 999999}` + value: `${val[1] || 999999999}` }) } else if (item.type === 'datemonth') { if (item.match === '=') { @@ -1649,6 +1694,16 @@ if (card.$c_ds) { columns = card.columns.map(c => c.field) + + if (card.setting.primaryKey && !columns.includes(card.setting.primaryKey)) { + let key = card.setting.primaryKey.toLowerCase() + columns.forEach(f => { + if (f.toLowerCase() === key) { + card.setting.primaryKey = f + } + }) + } + if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) { @@ -1665,7 +1720,7 @@ } else if (!card.setting.supModule) { errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) } - } else if (card.type === 'card' && card.subtype === 'datacard') { // 鏁版嵁鍗★紝鍙兘鏈夊涓婄骇 + } else if ((card.type === 'card' && card.subtype === 'datacard') || card.subtype === 'normaltable') { // 鏁版嵁鍗°�乼able锛屽彲鑳芥湁澶氫笂绾� if (card.wrap.supType !== 'multi' && !card.setting.supModule) { errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) } -- Gitblit v1.8.0