| | |
| | | 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' |
| | |
| | | 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 = [] |
| | |
| | | |
| | | 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') |
| | | |