From 5088d267c69e87673c85ba302dd9dc62c9da4951 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 16 二月 2020 18:54:49 +0800 Subject: [PATCH] 2020-02-16 --- src/tabviews/subtable/index.jsx | 26 +++++++++++--------------- 1 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index ad821f1..a88f0f8 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -46,8 +46,7 @@ loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� pageIndex: 1, // 椤电爜 pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 - orderColumn: '', // 鎺掑簭瀛楁 - orderType: 'asc', // 鎺掑簭鏂瑰紡 + orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� configMap: {}, // 椤甸潰閰嶇疆淇℃伅锛氫笅鎷夈�佹寜閽瓑 popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� @@ -321,15 +320,14 @@ * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� */ getCustomParam = (BID) => { - const { pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state + const { pageIndex, pageSize, orderBy, search, setting } = this.state let _search = Utils.formatCustomMainSearch(search) let param = { PageIndex: pageIndex, PageSize: pageSize, - OrderCol: orderColumn, - OrderType: orderType, + OrderCol: orderBy || setting.order, BID: BID, ..._search } @@ -357,7 +355,7 @@ * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� */ getDefaultParam = (BID) => { - const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state + const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state let _search = Utils.joinMainSearchkey(search) _search = _search ? 'where ' + _search : '' @@ -370,7 +368,7 @@ appkey: window.GLOB.appkey || '' } - let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order + let _orderBy = orderBy || setting.order let _dataresource = setting.dataresource if (/\s/.test(_dataresource)) { @@ -403,7 +401,7 @@ _search = '' } - let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` + let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` let DateCount = `select count(1) as total from ${_dataresource} ${_search}` param.LText = Utils.formatOptions(LText) @@ -446,8 +444,7 @@ loading: true, pageIndex: pagination.current, pageSize: pagination.pageSize, - orderColumn: sorter.field || this.state.setting.orderColumn, - orderType: sorter.order || 'asc' + orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' }, () => { this.loadmaindata() }) @@ -485,8 +482,7 @@ loading: false, pageIndex: 1, pageSize: 10, - orderColumn: '', - orderType: 'asc', + orderBy: '', search: '', configMap: {} }, () => { @@ -520,7 +516,7 @@ */ handleDefaultExcelout = (btn) => { const { MenuName } = this.props - const { arr_field, orderColumn, orderType, search, setting, config } = this.state + const { arr_field, orderBy, search, setting, config } = this.state let _arr_labels = [] // 鍒楀悕绉伴泦 let _arr_label_field = [] // 鍒楀悕绉板瓧娈甸泦 @@ -546,14 +542,14 @@ appkey: window.GLOB.appkey || '' } - let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order + 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` + 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' -- Gitblit v1.8.0