From d823c59ba0b5f73e06c90d8bcae4dd25f5dfab64 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 九月 2023 17:18:02 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/utils/utils-datamanage.js | 80 +++++++++++++++------------------------ 1 files changed, 31 insertions(+), 49 deletions(-) diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index be72648..3bac86d 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -11,7 +11,6 @@ * @param {Number} pageIndex 椤电爜 * @param {Number} pageSize 姣忛〉鏁伴噺 * @param {String} BID 涓婄骇ID - * @return {Object} param */ static getQueryDataParams (setting, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id, year) { let param = null @@ -54,36 +53,31 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc + + if (setting.recordUser === 'true') { + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + } } else { - if (window.GLOB.mkHS) { - if (setting.sysInterface === 'true' && window.GLOB.cloudServiceApi) { - param.rduri = window.GLOB.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + } else if (setting.sysInterface === 'external') { + if (window.GLOB.systemType === 'production') { + param.$token = setting.exProInterface || '' + } else { + param.$token = setting.exInterface || '' } } else { - if (setting.sysInterface === 'true') { - if (window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } - } else if (setting.sysInterface === 'external') { - if (window.GLOB.systemType === 'production') { - param.$token = setting.exProInterface || '' - } else { - param.$token = setting.exInterface || '' - } + if (window.GLOB.systemType === 'production' && setting.proInterface) { + param.rduri = setting.proInterface } else { - if (window.GLOB.systemType === 'production' && setting.proInterface) { - param.rduri = setting.proInterface - } else { - param.rduri = setting.interface - } - let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') - if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { - param.$login = true - } + param.rduri = setting.interface + } + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { + param.$login = true } } @@ -201,16 +195,14 @@ let arr_field = setting.all_field || setting.arr_field if (_dataresource) { - if (setting.laypage && orderBy) { - if (setting.custompage) { - LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + if (setting.custompage) { + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + } else if (setting.laypage && orderBy) { + LText = `/*system_query*/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 ` + if (setting.sub_field) { + DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` } else { - LText = `/*system_query*/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 ` - if (setting.sub_field) { - DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` - } else { - DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` - } + DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` } } else if (orderBy) { LText = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` @@ -288,10 +280,8 @@ param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // special HS鑷畾涔夊嚱鏁版煡璇� - if (setting.tableName === 's_custom_script' && window.GLOB.cloudServiceApi) { - param.rduri = window.GLOB.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + if (setting.tableName === 's_custom_script' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi } } @@ -443,13 +433,6 @@ _customScript = _customScript.replace(item.reg, item.value) }) - // _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') - // _customScript = _customScript.replace(/@select\$|\$select@/ig, '') - // _dataresource = _dataresource.replace(/\$sum@/ig, '/*') - // _dataresource = _dataresource.replace(/@sum\$/ig, '*/') - // _customScript = _customScript.replace(/\$sum@/ig, '/*') - // _customScript = _customScript.replace(/@sum\$/ig, '*/') - let _search = '' if (setting.queryType !== 'statistics' && _dataresource) { _search = Utils.joinMainSearchkey(searchlist) @@ -492,8 +475,7 @@ primaryKey: setting.primaryKey || '', foreign_key: '', sql: _dataresource, - script: _customScript, - // transaction: setting.transaction === 'true' + script: _customScript } } -- Gitblit v1.8.0