From 6afdec0062dacbded57e166230eb22cc55ced0c1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 08 五月 2021 14:30:21 +0800 Subject: [PATCH] 2021-05-08 --- src/tabviews/custom/index.jsx | 97 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 66 insertions(+), 31 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index d3c9587..40f0818 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -184,7 +184,7 @@ config.urlFields.forEach(field => { let val = `'${param ? (param[field] || '') : ''}'` regs.push({ - reg: new RegExp(field, 'ig'), + reg: new RegExp('@' + field + '@', 'ig'), value: val }) }) @@ -479,7 +479,7 @@ } item.components = this.filterComponent(item.components, roleId, permAction, permMenus) - } else if (item.type === 'pie' || item.type === 'bar' || item.type === 'line' || item.type === 'dashboard') { + } else if (['pie', 'bar', 'line', 'dashboard', 'scatter'].includes(item.type)) { if ( item.plot.blacklist && item.plot.blacklist.length > 0 && item.plot.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0 @@ -508,7 +508,43 @@ }) } if (item.type === 'table' && item.subtype === 'normaltable') { - item.cols = this.getCols(item.cols, roleId, permMenus) + let statFields = [] + let getCols = (cols) => { + return cols.filter(col => { + if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + return false + } else if (col.Hide === 'true') { + return false + } + if (col.type === 'number' && col.sum === 'true' && !statFields.includes(col.field)) { + statFields.push(col) + } else if (col.type === 'colspan') { + col.subcols = getCols(col.subcols || []) + if (col.subcols.length === 0) { + return false + } + } else if (col.type === 'custom') { + col.elements = col.elements.map(cell => { + if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height) { + cell.innerHeight = 'auto' + } + return cell + }) + } + + if (col.linkmenu && col.linkmenu.length > 0) { + let menu_id = col.linkmenu.pop() + col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' + } else { + col.linkThdMenu = '' + } + + return true + }) + } + + item.cols = getCols(item.cols) + item.statFields = statFields } // 鏉冮檺杩囨护 @@ -527,9 +563,15 @@ cell = this.getPrinter(cell, item.uuid) } + if (cell.btnstyle) { // 鍏煎 + cell.style = cell.style || {} + cell.style = {...cell.style, ...cell.btnstyle} + } + return isHS || permAction[cell.uuid] }) } + if (item.type === 'card') { item.subcards.forEach(card => { let _hasheight = card.style.height && card.style.height !== 'auto' @@ -552,6 +594,10 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) } + if (card.btnstyle) { // 鍏煎 + card.style = card.style || {} + card.style = {...card.style, ...card.btnstyle} + } } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { cell.innerHeight = 'auto' } @@ -570,6 +616,10 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) + } + if (card.btnstyle) { // 鍏煎 + card.style = card.style || {} + card.style = {...card.style, ...card.btnstyle} } } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { cell.innerHeight = 'auto' @@ -593,6 +643,11 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) } + + if (card.btnstyle) { // 鍏煎 + card.style = card.style || {} + card.style = {...card.style, ...card.btnstyle} + } } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { cell.innerHeight = 'auto' } @@ -613,6 +668,11 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) + } + + if (cell.btnstyle) { // 鍏煎 + cell.style = cell.style || {} + cell.style = {...cell.style, ...cell.btnstyle} } return isHS || permAction[cell.uuid] @@ -658,31 +718,6 @@ return item } - getCols = (cols, roleId, permMenus) => { - return cols.filter(col => { - if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { - return false - } else if (col.Hide === 'true') { - return false - } - if (col.type === 'colspan') { - col.subcols = this.getCols(col.subcols || [], roleId, permMenus) - if (col.subcols.length === 0) { - return false - } - } - - if (col.linkmenu && col.linkmenu.length > 0) { - let menu_id = col.linkmenu.pop() - col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' - } else { - col.linkThdMenu = '' - } - - return true - }) - } - // 鏍煎紡鍖栭粯璁よ缃� formatSetting = (components, params, mainSearch, inherit, regs) => { return components.map(component => { @@ -720,7 +755,7 @@ } }) delete component.scripts - + component.setting.$name = component.name || '' component.setting.execute = component.setting.execute !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 component.setting.laypage = component.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 @@ -818,8 +853,8 @@ // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) { - _customScript && console.info(`${_dataresource ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`) - _dataresource && console.info(_dataresource) + _customScript && console.info(`${setting.$name ? `/*缁勪欢-${setting.$name} 鑷畾涔夎剼鏈�*/\n` : ''}${_dataresource ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`) + _dataresource && console.info(`${setting.$name ? `/*缁勪欢-${setting.$name} 鏁版嵁婧�*/\n` : ''}` + _dataresource) } return { -- Gitblit v1.8.0