From 71e3da644eca32a5aa40503e903efb0640748093 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 七月 2023 17:00:59 +0800 Subject: [PATCH] 2023-07-21 --- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 97 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 72 insertions(+), 25 deletions(-) diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 2192239..c24ba02 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -220,7 +220,8 @@ } else { this.execError(result) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.execError({}) }) } else if (btn.intertype === 'inner') { // 浣跨敤鍐呴儴鍑芥暟 @@ -233,7 +234,8 @@ } else { this.execError(result) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.execError({}) }) } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 浣跨敤澶栭儴鍑芥暟 @@ -285,7 +287,8 @@ } else { this.execError(result) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.execError({}) }) } else if (btn.intertype === 'outer' && btn.innerFunc) { @@ -349,7 +352,8 @@ } else { this.execError(res) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.execError({}) }) } else { @@ -437,13 +441,15 @@ } else { this.execError(result) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.execError({}) }) } else { this.execError(res) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.execError({}) }) } @@ -525,7 +531,8 @@ } else { this.execError(result) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.execError({}) }) } @@ -550,6 +557,29 @@ return col }) + + if (data && data[0]) { + let errors = [] + columns.forEach(col => { + if (col.Column && data[0][col.Column] === undefined) { + errors.push(col.Text) + } + }) + + if (errors.length) { + notification.error({ + top: 92, + message: '鏁版嵁涓己灏戝瓧娈碉細' + errors.join('銆�'), + duration: 5 + }) + + this.setState({ + loading: false + }) + + return + } + } try { if (imgCol) { @@ -576,13 +606,13 @@ columns.forEach((col, i) => { let val = item[col.Column] - if (typeof(val) === 'number') { + if (col.type === 'number' && typeof(val) === 'number') { if (col.abs === 'true') { val = Math.abs(val) } if (col.round) { val = Math.round(val * col.round) / col.round - val = val.toFixed(col.decimal) + // val = val.toFixed(col.decimal) } } @@ -665,13 +695,13 @@ columns.forEach((col, i) => { let val = item[col.Column] - if (typeof(val) === 'number') { + if (col.type === 'number' && typeof(val) === 'number') { if (col.abs === 'true') { val = Math.abs(val) } if (col.round) { val = Math.round(val * col.round) / col.round - val = val.toFixed(col.decimal) + // val = val.toFixed(col.decimal) } } @@ -796,10 +826,9 @@ let script = btn.verify.script if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - script = script.replace(/\$@/ig, '/*') - script = script.replace(/@\$/ig, '*/') + script = script.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { - script = script.replace(/@\$|\$@/ig, '') + script = script.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } let allSearch = Utils.getAllSearchOptions(search) @@ -842,7 +871,8 @@ } else { this.execError(res) } - }, () => { + }, (error) => { + if (error && error.ErrCode === 'LoginError') return this.updateStatus('over') }) } @@ -899,7 +929,7 @@ defaultSql = btn.verify.defaultSql || 'true' _dataresource = btn.verify.dataresource || '' queryType = btn.verify.queryType - primaryKey = btn.verify.primaryKey || 'ID' + // primaryKey = btn.verify.primaryKey || 'ID' if (/\s/.test(_dataresource)) { _dataresource = '(' + _dataresource + ') tb' @@ -914,13 +944,11 @@ }) if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _dataresource = _dataresource.replace(/\$@/ig, '/*') - _dataresource = _dataresource.replace(/@\$/ig, '*/') - customScript = customScript.replace(/\$@/ig, '/*') - customScript = customScript.replace(/@\$/ig, '*/') + _dataresource = _dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + customScript = customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { - _dataresource = _dataresource.replace(/@\$|\$@/ig, '') - customScript = customScript.replace(/@\$|\$@/ig, '') + _dataresource = _dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + customScript = customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } } @@ -1008,9 +1036,9 @@ if (btn.Ot === 'requiredOnce' && selectedData && selectedData.length > 0) { primaryId = selectedData.map(d => d.$$uuid || '').filter(Boolean).join(',') if (_search && primaryId) { - _search += ` and ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` + _search += ` and ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` } else if (primaryId) { - _search = `where ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` + _search = `where ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` } } @@ -1118,12 +1146,26 @@ MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, '', []) } - btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) + if (btn.syncComponentId) { + if (btn.syncComponentId === 'multiComponent') { + btn.syncComponentIds.forEach((id, i) => { + setTimeout(() => { + MKEmitter.emit('reloadData', id) + }, 20 * i) + }) + } else { + MKEmitter.emit('reloadData', btn.syncComponentId) + } + } if (btn.switchTab && btn.switchTab.length > 0) { let id = btn.switchTab[btn.switchTab.length - 1] let node = document.getElementById('tab' + id) node && node.click() + } + + if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) } } @@ -1166,6 +1208,10 @@ } else if (btn.execError !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', []) } + + if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } render() { @@ -1201,6 +1247,7 @@ return ( <Button type={type} + id={'button' + btn.uuid} title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} loading={loading} disabled={disabled} -- Gitblit v1.8.0