From b09b821ef36fd1ea979e9a5daa98e95732ac81d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 16 七月 2025 18:16:00 +0800
Subject: [PATCH] 2025-07-16

---
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx |   68 +++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 2a87051..f59a12f 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -102,7 +102,7 @@
     if (setting.supModule && !BID) {
       notification.warning({
         top: 92,
-        message: dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒',
+        message: setting.supModTip || dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒',
         duration: 5
       })
     } else {
@@ -381,7 +381,6 @@
       if (btn.dataM === 'true') {
         param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : ''
       }
-
     } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 浣跨敤澶栭儴鍑芥暟
       param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize)
 
@@ -438,7 +437,7 @@
    * @description Excel 鐢熸垚
    */
   exportExcel = (data = [], ErrCode, msg, search) => {
-    const { btn } = this.props
+    const { btn, BID } = this.props
     const { dict } = this.state
     
     let imgCol = false
@@ -522,6 +521,18 @@
         })
         
         return
+      }
+    }
+
+    let excelName = `${btn.verify.excelName || btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}`
+    if (btn.verify.excelName && /@.*@/.test(btn.verify.excelName)) {
+      excelName = btn.verify.excelName.replace(/@bid@/ig, BID)
+      excelName = excelName.replace(/@getdate@/ig, moment().format('YYYYMMDDHHmmss'))
+      if (data[0]) {
+        Object.keys(data[0]).forEach(key => {
+          let reg = new RegExp('@' + key + '@', 'ig')
+          excelName = excelName.replace(reg, data[0][key])
+        })
       }
     }
     
@@ -609,7 +620,7 @@
           table.push(_row)
         })
 
-        this.table2excel(column, table)
+        this.table2excel(column, table, excelName)
 
         this.execSuccess({ErrCode: ErrCode || 'S', message: msg || dict['exc_success'] || '瀵煎嚭鎴愬姛锛�'})
       } else {
@@ -769,7 +780,7 @@
         const wb = XLSX.utils.book_new()
         XLSX.utils.book_append_sheet(wb, ws, btn.verify.sheet || 'Sheet1')
   
-        XLSX.writeFile(wb, `${btn.verify.excelName || btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xlsx`)
+        XLSX.writeFile(wb, excelName + '.xlsx')
   
         this.execSuccess({ErrCode: ErrCode || 'S', message: msg || dict['exc_success'] || '瀵煎嚭鎴愬姛锛�'})
       }
@@ -779,7 +790,7 @@
     }
   }
 
-  table2excel = (column, data) => {
+  table2excel = (column, data, excelName) => {
     let thead = column.reduce((result, item) => {
       return result + `<th>${item.title}</th>`
     }, '')
@@ -813,7 +824,7 @@
     // let url = 'data:application/vnd.ms-excel;base64,' + window.btoa(unescape(encodeURIComponent(html)))
     let link = document.createElement('a')
     link.href = url
-    link.download = `${this.props.btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xls`
+    link.download = excelName + '.xls'
     document.body.appendChild(link)
     link.click()
     document.body.removeChild(link)
@@ -863,7 +874,10 @@
 
     let _setting = {}
     let _orderBy = orderBy || ''
+
     if (btn.verify.dataType === 'custom') {
+      _setting.uuid = btn.uuid
+      _setting.interType = 'system'
       _setting.arr_field = []
 
       btn.verify.columns.forEach(col => {
@@ -878,10 +892,6 @@
 
       if (!_setting.execute) {
         _setting.dataresource = ''
-      }
-
-      if (/\s/.test(_setting.dataresource)) {
-        _setting.dataresource = '(' + _setting.dataresource + ') tb'
       }
 
       let _customScript = ''
@@ -920,7 +930,17 @@
       _setting.tailScript = _tailScript     // 鍚庣疆鑷畾涔夎剼鏈�
 
       _setting.laypage = pagination
-      _setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(_setting.dataresource + _setting.customScript)
+      _setting.custompage = false
+
+      if (/order\s+by\s+sort_id\s*$/i.test(_setting.dataresource)) {
+        _setting.custompage = true
+      } else if (/@pageSize@|@orderBy@|@mk_total/i.test(_setting.dataresource + _setting.customScript)) {
+        _setting.custompage = true
+      }
+
+      if (/\s/.test(_setting.dataresource)) {
+        _setting.dataresource = '(' + _setting.dataresource + ') tb'
+      }
 
       _setting.queryType = btn.verify.queryType
       _setting.$name = btn.logLabel
@@ -932,6 +952,10 @@
       _setting.laypage = pagination
       _setting.arr_field = _setting.all_field || _setting.arr_field
 
+      if (setting.sub_field || setting.laypage !== pagination) {
+        _setting.uuid = btn.uuid
+      }
+
       delete _setting.sub_field
     }
 
@@ -941,17 +965,9 @@
       primaryId = primaryId ? 'excel:' + primaryId : ''
     }
 
-    let param = UtilsDM.getDefaultQueryParam(_setting, search, _orderBy, pageIndex, pageSize, primaryId, BID)
+    let param = UtilsDM.getQueryDataParams(_setting, search, _orderBy, pageIndex, pageSize, BID, primaryId)
     
-    param.DateCount = ''
-
-    // 鏁版嵁绠$悊鏉冮檺
-    if (sessionStorage.getItem('dataM') === 'true') {
-      param.dataM = 'Y'
-    }
-    if (BID) {
-      param.BID = BID
-    }
+    delete param.DateCount
 
     return param
   }
@@ -992,7 +1008,7 @@
     }
 
     if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔
-      MKEmitter.emit('reloadMenuView', tabId)
+      MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
       return
     }
 
@@ -1021,7 +1037,7 @@
     }
 
     if (tabId) {
-      MKEmitter.emit('reloadMenuView', tabId)
+      MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
     }
     
     if (btn.switchTab && btn.switchTab.length > 0) {
@@ -1083,7 +1099,7 @@
         tabId = btn.refreshTab[btn.refreshTab.length - 1]
       }
       if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔
-        MKEmitter.emit('reloadMenuView', tabId)
+        MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
         return
       }
 
@@ -1108,7 +1124,7 @@
       }
 
       if (tabId) {
-        MKEmitter.emit('reloadMenuView', tabId)
+        MKEmitter.emit('reloadMenuView', tabId, btn.urlPar === 'true')
       }
     }
 

--
Gitblit v1.8.0