From f7d1f17bdcb8c3e794a798165737bb7529dbe8ca Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 26 三月 2020 12:15:19 +0800 Subject: [PATCH] 2020-03-26 --- src/tabviews/subtabtable/index.jsx | 79 +++++++-------------------------------- 1 files changed, 15 insertions(+), 64 deletions(-) diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 0c4b5be..8057ba0 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -11,12 +11,14 @@ import Utils from '@/utils/utils.js' import options from '@/store/options.js' +import asyncComponent from '@/utils/asyncComponent' import SubTable from '@/tabviews/zshare/normalTable' -import SubAction from '@/tabviews/zshare/actionList' import SubSearch from '@/tabviews/zshare/topSearch' import NotFount from '@/components/404' import './index.scss' + +const SubAction = asyncComponent(() => import('@/tabviews/zshare/actionList')) class SubTabModalTable extends Component { static propTpyes = { @@ -49,7 +51,7 @@ pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - configMap: {} // 椤甸潰閰嶇疆淇℃伅锛氫笅鎷夈�佹寜閽瓑 + triggerBtn: null // 鎸夐挳瑙﹀彂 } /** @@ -532,7 +534,7 @@ pageSize: 10, orderBy: '', search: '', - configMap: {} + triggerBtn: null }, () => { this.loadconfig() }) @@ -550,68 +552,10 @@ this.reloadtable() } else if (btn.execError === 'view' && type === 'error') { this.reloadview() - } else if (type === 'excelOut') { - this.handleDefaultExcelout(btn) } if (type === 'success') { this.props.refreshSupView() } - } - - /** - * @description 浣跨敤榛樿瀛樺偍杩囩▼ sPC_Get_TableData 瀵煎嚭excel琛ㄦ牸 - */ - handleDefaultExcelout = (btn) => { - const { MenuName } = this.props - const { arr_field, orderBy, search, setting, config } = 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 + ')' : '' - // 鑾峰彇鍒楄〃鏁版嵁 - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: _arr_labels, - BID: this.props.BID, - appkey: window.GLOB.appkey || '' - } - - 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.subtabButton.execError(res, btn) - } else { - this.refs.subtabButton.execSuccess(btn) - } - }) } /** @@ -629,7 +573,14 @@ * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� */ buttonTrigger = (btn, record) => { - this.refs.subtabButton.actionTrigger(btn, record) + this.setState({ + triggerBtn: { + uuid: new Date().getTime(), + parentId: this.props.MenuID, + button: btn, + data: record + } + }) } UNSAFE_componentWillMount () { @@ -651,7 +602,7 @@ } render() { - const { setting, searchlist, actions, columns, loadingview, viewlost } = this.state + const { setting, searchlist, actions, columns, loadingview, viewlost, triggerBtn } = this.state return ( <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> @@ -666,8 +617,8 @@ {actions ? <div style={{minHeight: '25px'}}> <SubAction - ref="subtabButton" type="subtab" + triggerBtn={triggerBtn} menuType={this.props.menuType} setting={setting} actions={actions} -- Gitblit v1.8.0