cloud-web-corejs 1.0.54-dev.550 → 1.0.54-dev.551
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/excelImport/mixins.js +774 -1
- package/src/components/luckysheet/export.js +19 -0
- package/src/components/luckysheet/templateJson.js +12078 -0
- package/src/components/luckysheet/view.vue +2 -2
- package/src/components/oplogTable/mixins.js +83 -4
- package/src/components/xform/utils/formHttp.js +162 -0
|
@@ -5,6 +5,7 @@ import FileSaver from 'file-saver'
|
|
|
5
5
|
export var testaaa = function (){
|
|
6
6
|
console.log("...");
|
|
7
7
|
}
|
|
8
|
+
|
|
8
9
|
export var exportExcel = function(luckysheet, value) {
|
|
9
10
|
// 参数为luckysheet.getluckysheetfile()获取的对象
|
|
10
11
|
// 1.创建工作簿,可以为工作簿添加属性
|
|
@@ -19,10 +20,12 @@ export var exportExcel = function(luckysheet, value) {
|
|
|
19
20
|
const worksheet = workbook.addWorksheet(table.name)
|
|
20
21
|
const merge = (table.config && table.config.merge) || {}
|
|
21
22
|
const borderInfo = (table.config && table.config.borderInfo) || {}
|
|
23
|
+
const colWidth = (table.config && (table.config.colwidth || table.config.columnlen)) || {}
|
|
22
24
|
// 3.设置单元格合并,设置单元格边框,设置单元格样式,设置值
|
|
23
25
|
setStyleAndValue(table.data, worksheet)
|
|
24
26
|
setMerge(merge, worksheet)
|
|
25
27
|
setBorder(borderInfo, worksheet)
|
|
28
|
+
setColumnWidth(colWidth, worksheet)
|
|
26
29
|
return true
|
|
27
30
|
})
|
|
28
31
|
|
|
@@ -52,10 +55,12 @@ export var generateExcelBlob = function(luckysheet, fileName) {
|
|
|
52
55
|
const worksheet = workbook.addWorksheet(table.name)
|
|
53
56
|
const merge = (table.config && table.config.merge) || {}
|
|
54
57
|
const borderInfo = (table.config && table.config.borderInfo) || {}
|
|
58
|
+
const colWidth = (table.config && (table.config.colwidth || table.config.columnlen)) || {}
|
|
55
59
|
// 3.设置单元格合并,设置单元格边框,设置单元格样式,设置值
|
|
56
60
|
setStyleAndValue(table.data, worksheet)
|
|
57
61
|
setMerge(merge, worksheet)
|
|
58
62
|
setBorder(borderInfo, worksheet)
|
|
63
|
+
setColumnWidth(colWidth, worksheet)
|
|
59
64
|
return true
|
|
60
65
|
})
|
|
61
66
|
|
|
@@ -388,3 +393,17 @@ function createCellPos(n) {
|
|
|
388
393
|
}
|
|
389
394
|
return s
|
|
390
395
|
}
|
|
396
|
+
|
|
397
|
+
var setColumnWidth = function(colWidth, worksheet) {
|
|
398
|
+
if (!Object.keys(colWidth).length) return
|
|
399
|
+
|
|
400
|
+
// 获取所有列索引并排序
|
|
401
|
+
const colIndexes = Object.keys(colWidth).map(Number).sort((a, b) => a - b)
|
|
402
|
+
|
|
403
|
+
// 为每一列设置宽度
|
|
404
|
+
colIndexes.forEach(colIndex => {
|
|
405
|
+
const width = colWidth[colIndex]
|
|
406
|
+
// ExcelJS 使用 1-based 索引
|
|
407
|
+
worksheet.getColumn(colIndex + 1).width = width
|
|
408
|
+
})
|
|
409
|
+
}
|