From a94b0a4d15b26ecf8fe99f0a1c3e60d60b97766d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 15 八月 2023 14:22:03 +0800 Subject: [PATCH] 2023-08-15 --- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 97 ++++++++++++++++++++++-------------------------- 1 files changed, 45 insertions(+), 52 deletions(-) diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 9dd06cc..d5489f8 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -6,7 +6,6 @@ import * as XLSX from 'sheetjs-style' import Utils from '@/utils/utils.js' -import options from '@/store/options.js' import Api from '@/api' import MKEmitter from '@/utils/events.js' import MkIcon from '@/components/mk-icon' @@ -239,8 +238,8 @@ let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) if (window.GLOB.mkHS) { - if (btn.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi + if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { + param.rduri = window.GLOB.cloudServiceApi param.userid = sessionStorage.getItem('CloudUserID') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { @@ -300,8 +299,8 @@ delete res.status if (window.GLOB.mkHS) { - if (btn.sysInterface === 'true' && options.cloudServiceApi) { - res.rduri = options.cloudServiceApi + if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { + res.rduri = window.GLOB.cloudServiceApi res.userid = sessionStorage.getItem('CloudUserID') || '' res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { @@ -384,8 +383,8 @@ delete res.status if (window.GLOB.mkHS) { - if (btn.sysInterface === 'true' && options.cloudServiceApi) { - res.rduri = options.cloudServiceApi + if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { + res.rduri = window.GLOB.cloudServiceApi res.userid = sessionStorage.getItem('CloudUserID') || '' res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { @@ -472,8 +471,8 @@ param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) if (window.GLOB.mkHS) { - if (btn.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi + if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { + param.rduri = window.GLOB.cloudServiceApi param.userid = sessionStorage.getItem('CloudUserID') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { @@ -913,7 +912,7 @@ /** * @description 鑾峰彇榛樿瀛樺偍杩囩▼璇锋眰鍙傛暟 */ - getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { + getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 9999) => { const { setting, btn, selectedData, BID } = this.props let defaultSql = setting.execute || setting.default || 'true' @@ -949,8 +948,8 @@ } } + let custompage = /@pageSize@/i.test(_dataresource + customScript) let _search = Utils.joinMainSearchkey(search) - _search = _search ? 'where ' + _search : '' let param = { @@ -988,44 +987,37 @@ let district = sessionStorage.getItem('district') || '' let address = sessionStorage.getItem('address') || '' - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } + let allSearch = Utils.getAllSearchOptions(search) + let regoptions = allSearch.map(item => { + return { + reg: new RegExp('@' + item.key + '@', 'ig'), + value: `'${item.value}'` + } + }) - let regoptions = null - if (queryType === 'statistics' || param.custom_script) { - let allSearch = Utils.getAllSearchOptions(search) + regoptions.push({ + reg: new RegExp('@userName@', 'ig'), + value: userName + }, { + reg: new RegExp('@fullName@', 'ig'), + value: fullName + }, { + reg: new RegExp('@orderBy@', 'ig'), + value: orderBy || '' + }, { + reg: new RegExp('@pageSize@', 'ig'), + value: pageSize + }, { + reg: new RegExp('@pageIndex@', 'ig'), + value: pageIndex + }) - regoptions = allSearch.map(item => { - return { - reg: new RegExp('@' + item.key + '@', 'ig'), - value: `'${item.value}'` - } - }) - - regoptions.push({ - reg: new RegExp('@userName@', 'ig'), - value: userName - }, { - reg: new RegExp('@fullName@', 'ig'), - value: fullName - }, { - reg: new RegExp('@orderBy@', 'ig'), - value: orderBy || '' - }, { - reg: new RegExp('@pageSize@', 'ig'), - value: pageSize - }, { - reg: new RegExp('@pageIndex@', 'ig'), - value: pageIndex - }) - } + regoptions.forEach(item => { + _dataresource = _dataresource.replace(item.reg, item.value) + param.custom_script = param.custom_script.replace(item.reg, item.value) + }) if (queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 - regoptions.forEach(item => { - _dataresource = _dataresource.replace(item.reg, item.value) - }) _search = '' } @@ -1041,19 +1033,18 @@ let LText = '' - if (defaultSql !== 'false' && !pagination) { - LText = ` select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` + if (custompage) { + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + } else if (defaultSql !== 'false' && !pagination) { + 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 ` } else if (defaultSql !== 'false') { - 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 ` + 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 (param.custom_script) { param.custom_script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' ${param.custom_script} ` - regoptions.forEach(item => { - param.custom_script = param.custom_script.replace(item.reg, item.value) - }) if (LText) { LText += ` @@ -1090,7 +1081,7 @@ param.custom_script = param.custom_script.replace(/@typename@/ig, `'admin'`) // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 - if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { + if (window.GLOB.debugger === true) { param.custom_script && console.info(`${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${param.custom_script}`) LText && console.info(LText) } @@ -1100,6 +1091,8 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) param.DateCount = '' + param.username = userName + param.fullname = fullName if (window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉 param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) -- Gitblit v1.8.0