king
2023-01-17 c39acd25c3e8747be16773a003f519e4ef801640
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 = []
        let requires = []
  
        columns.forEach(col => {
        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 = []
@@ -641,6 +645,16 @@
  
        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')