From 71e3da644eca32a5aa40503e903efb0640748093 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 七月 2023 17:00:59 +0800
Subject: [PATCH] 2023-07-21

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

diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index a31ae6b..c24ba02 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -557,6 +557,29 @@
 
       return col
     })
+
+    if (data && data[0]) {
+      let errors = []
+      columns.forEach(col => {
+        if (col.Column && data[0][col.Column] === undefined) {
+          errors.push(col.Text)
+        }
+      })
+
+      if (errors.length) {
+        notification.error({
+          top: 92,
+          message: '鏁版嵁涓己灏戝瓧娈碉細' + errors.join('銆�'),
+          duration: 5
+        })
+
+        this.setState({
+          loading: false
+        })
+        
+        return
+      }
+    }
     
     try {
       if (imgCol) {
@@ -583,13 +606,13 @@
   
           columns.forEach((col, i) => {
             let val = item[col.Column]
-            if (typeof(val) === 'number') {
+            if (col.type === 'number' && typeof(val) === 'number') {
               if (col.abs === 'true') {
                 val = Math.abs(val)
               }
               if (col.round) {
                 val = Math.round(val * col.round) / col.round
-                val = val.toFixed(col.decimal)
+                // val = val.toFixed(col.decimal)
               }
             }
 
@@ -672,13 +695,13 @@
           columns.forEach((col, i) => {
             let val = item[col.Column]
 
-            if (typeof(val) === 'number') {
+            if (col.type === 'number' && typeof(val) === 'number') {
               if (col.abs === 'true') {
                 val = Math.abs(val)
               }
               if (col.round) {
                 val = Math.round(val * col.round) / col.round
-                val = val.toFixed(col.decimal)
+                // val = val.toFixed(col.decimal)
               }
             }
 
@@ -803,10 +826,9 @@
     let script = btn.verify.script
 
     if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
-      script = script.replace(/\$@/ig, '/*')
-      script = script.replace(/@\$/ig, '*/')
+      script = script.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
     } else {
-      script = script.replace(/@\$|\$@/ig, '')
+      script = script.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
     }
 
     let allSearch = Utils.getAllSearchOptions(search)
@@ -922,13 +944,11 @@
       })
 
       if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
-        _dataresource = _dataresource.replace(/\$@/ig, '/*')
-        _dataresource = _dataresource.replace(/@\$/ig, '*/')
-        customScript = customScript.replace(/\$@/ig, '/*')
-        customScript = customScript.replace(/@\$/ig, '*/')
+        _dataresource = _dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
+        customScript = customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'')
       } else {
-        _dataresource = _dataresource.replace(/@\$|\$@/ig, '')
-        customScript = customScript.replace(/@\$|\$@/ig, '')
+        _dataresource = _dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
+        customScript = customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'')
       }
     }
 
@@ -1143,6 +1163,10 @@
       let node = document.getElementById('tab' + id)
       node && node.click()
     }
+
+    if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊
+      MKEmitter.emit('refreshPopButton', btn.$tabId)
+    }
   }
 
   /**
@@ -1184,6 +1208,10 @@
     } else if (btn.execError !== 'never') {
       MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', [])
     }
+
+    if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊
+      MKEmitter.emit('refreshPopButton', btn.$tabId)
+    }
   }
 
   render() {
@@ -1219,6 +1247,7 @@
     return (
       <Button
         type={type}
+        id={'button' + btn.uuid}
         title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')}
         loading={loading}
         disabled={disabled}

--
Gitblit v1.8.0