From 1ba430d58ea3fd662d09b99f6e22ed3b3564a356 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 03 二月 2023 14:15:31 +0800 Subject: [PATCH] 2023-02-03 --- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 42 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 3d93b36..41f9ddb 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -18,6 +18,7 @@ static propTpyes = { BID: PropTypes.string, // 涓昏〃ID BData: PropTypes.any, // 涓昏〃鏁版嵁 + selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� @@ -776,6 +777,7 @@ * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� */ getExcelCustomParam = (orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { + const { btn, selectedData } = this.props let _search = Utils.formatCustomMainSearch(search) let param = { @@ -786,6 +788,13 @@ // 鏁版嵁绠$悊鏉冮檺 if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' + } + + if (btn.Ot === 'requiredOnce' && selectedData && selectedData.length > 0) { + let primaryId = selectedData.map(d => d.$$uuid || '').filter(Boolean).join(',') + if (primaryId) { + param.ID = primaryId + } } if (this.props.BID) { @@ -804,17 +813,19 @@ * @description 鑾峰彇榛樿瀛樺偍杩囩▼璇锋眰鍙傛暟 */ getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { - const { setting, btn } = this.props + const { setting, btn, selectedData, BID } = this.props let defaultSql = setting.execute || setting.default || 'true' let customScript = setting.customScript || '' let _dataresource = setting.dataresource || '' let queryType = setting.queryType + let primaryKey = setting.primaryKey || 'ID' if (btn.verify.dataType === 'custom') { defaultSql = btn.verify.defaultSql || 'true' _dataresource = btn.verify.dataresource || '' queryType = btn.verify.queryType + primaryKey = btn.verify.primaryKey || 'ID' if (/\s/.test(_dataresource)) { _dataresource = '(' + _dataresource + ') tb' @@ -857,8 +868,8 @@ param.dataM = 'Y' } - if (this.props.BID) { - param.BID = this.props.BID + if (BID) { + param.BID = BID } let userName = sessionStorage.getItem('User_Name') || '' @@ -914,6 +925,16 @@ _search = '' } + let primaryId = '' + if (btn.Ot === 'requiredOnce' && selectedData && selectedData.length > 0) { + primaryId = selectedData.map(d => d.$$uuid || '').filter(Boolean).join(',') + if (_search && primaryId) { + _search += ` and ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` + } else if (primaryId) { + _search = `where ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` + } + } + let LText = '' if (defaultSql !== 'false' && !pagination) { @@ -949,6 +970,21 @@ ` } + LText = LText.replace(/@ID@/ig, `'${primaryId || ''}'`) + param.custom_script = param.custom_script.replace(/@ID@/ig, `'${primaryId || ''}'`) + LText = LText.replace(/@BID@/ig, `'${BID}'`) + param.custom_script = param.custom_script.replace(/@BID@/ig, `'${BID}'`) + LText = LText.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + param.custom_script = param.custom_script.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + LText = LText.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + param.custom_script = param.custom_script.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + LText = LText.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + param.custom_script = param.custom_script.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + LText = LText.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + param.custom_script = param.custom_script.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + LText = LText.replace(/@typename@/ig, `'admin'`) + param.custom_script = param.custom_script.replace(/@typename@/ig, `'admin'`) + // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { param.custom_script && console.info(`${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${param.custom_script}`) -- Gitblit v1.8.0