From 474c68f0fea10cc62977c67d186732b3346cdd53 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 17 一月 2023 18:04:45 +0800
Subject: [PATCH] 2023-01-17

---
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 8dc3084..3d93b36 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -3,7 +3,7 @@
 import moment from 'moment'
 import { is, fromJS } from 'immutable'
 import { Button, Modal, notification, message } from 'antd'
-import * as XLSX from 'xlsx'
+import * as XLSX from 'sheetjs-style'
 
 import Utils from '@/utils/utils.js'
 import options from '@/store/options.js'
@@ -602,11 +602,15 @@
         let _header = []
         let _topRow = {}
         let colwidth = []
-  
-        columns.forEach(col => {
+        let requires = []
+
+        columns.forEach((col, i) => {
           _header.push(col.Column)
           _topRow[col.Column] = col.Text
           colwidth.push({width: col.Width || 20})
+          if (col.required === 'true') {
+            requires.push(i)
+          }
         })
   
         let table = []
@@ -638,8 +642,18 @@
         })
   
         const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true})
-  
+
         ws['!cols'] = colwidth
+
+        if (requires.length) {
+          let cols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+          requires.forEach(col => {
+            if (cols[col]) {
+              ws[cols[col] + '1'].s = {font: { color: { rgb: 'F5222D' } }}
+            }
+          })
+        }
+        // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA"  }}, font: { color: { rgb: "1890FF" } }}
   
         const wb = XLSX.utils.book_new()
         XLSX.utils.book_append_sheet(wb, ws, 'Sheet1')

--
Gitblit v1.8.0