From 6afdec0062dacbded57e166230eb22cc55ced0c1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 08 五月 2021 14:30:21 +0800
Subject: [PATCH] 2021-05-08

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

diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 23ac98f..ea6c15d 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -452,29 +452,21 @@
 
       table.push(_topRow)
 
-      if (data && abses.length > 0) {
-        data.forEach(item => {
-          let _row = {}
-          _header.forEach(field => {
-            if (item[field] && abses.includes(field)) {
-              _row[field] = Math.abs(item[field])
-            } else {
-              _row[field] = item[field]
-            }
-          })
-  
-          table.push(_row)
-        })
-      } else if (data) {
-        data.forEach(item => {
-          let _row = {}
-          _header.forEach(field => {
+      data && data.forEach((item, index) => {
+        let _row = {}
+
+        item.$Index = index + 1
+
+        _header.forEach(field => {
+          if (item[field] && abses.includes(field)) {
+            _row[field] = Math.abs(item[field])
+          } else {
             _row[field] = item[field]
-          })
-  
-          table.push(_row)
+          }
         })
-      }
+
+        table.push(_row)
+      })
 
       const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true})
 

--
Gitblit v1.8.0