From 3d8cb6c1787dec23cbc85d4b262fd1f00654f891 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 18 二月 2020 01:33:07 +0800 Subject: [PATCH] 2020-02-18 --- src/tabviews/commontable/index.jsx | 68 +++++++-------------------------- 1 files changed, 15 insertions(+), 53 deletions(-) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 4da0895..1ddb53e 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -121,6 +121,10 @@ if (col.field) { _arrField.push(col.field) + // if () { // 鏉冮檺榛戝悕鍗� + // col.Hide = 'true' + // } + _logcolumns.push(col) } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 @@ -558,17 +562,15 @@ if (btn.execSuccess === 'grid' && type === 'success') { this.reloadtable() } else if (btn.execError === 'grid' && type === 'error') { - this.reloadview() - } else if (btn.execSuccess === 'view' && type === 'success') { this.reloadtable() + } else if (btn.execSuccess === 'view' && type === 'success') { + this.reloadview() } else if (btn.execError === 'view' && type === 'error') { this.reloadview() } else if (btn.popClose === 'view' && type === 'pop') { this.reloadview() } else if (btn.popClose === 'grid' && type === 'pop') { this.reloadtable() - } else if (type === 'excelOut') { - this.handleDefaultExcelout(btn) } } @@ -597,59 +599,18 @@ } /** - * @description 浣跨敤榛樿瀛樺偍杩囩▼ sPC_Get_TableData 瀵煎嚭excel琛ㄦ牸 + * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - handleDefaultExcelout = (btn) => { + getexceloutparam = () => { const { MenuName } = this.props - const { arr_field, orderBy, search, setting, config } = this.state + const { arr_field, orderBy, search, setting} = this.state - let _arr_labels = [] // 鍒楀悕绉伴泦 - let _arr_label_field = [] // 鍒楀悕绉板瓧娈甸泦 - - config.columns.forEach(col => { - if (col.field) { - _arr_labels.push(col.label) - _arr_label_field.push(`${col.field} as ${col.label}`) - } - }) - - _arr_labels = _arr_labels.join(',') - _arr_label_field = _arr_label_field.join(',') - - let _search = Utils.joinMainSearchkey(search) - _search = _search ? 'where ' + _search : '' - - // 鑾峰彇excel鏁版嵁锛屼笌鑾峰彇鍒楄〃鏁版嵁涓嶅悓涓烘湭璁剧疆椤电爜绛夊弬鏁� - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: _arr_labels, - appkey: window.GLOB.appkey || '' + return { + arr_field: arr_field, + orderBy: orderBy || setting.order, + search: search, + menuName: MenuName } - - let _orderBy = orderBy || setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` - - param.LText = Utils.formatOptions(LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.DateCount = '' - - let name = `${MenuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` - - Api.getExcelOut(param, name).then(res => { - if (res && res.status === false) { - this.refs.mainButton.execError(res, btn) - } else { - this.refs.mainButton.execSuccess(btn) - } - }) } /** @@ -843,6 +804,7 @@ ContainerId={this.state.ContainerId} refreshdata={this.refreshbyaction} triggerPopview={this.triggerPopview} + getexceloutparam={this.getexceloutparam} gettableselected={this.gettableselected} /> : null } -- Gitblit v1.8.0