修改bug
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-12-12 13:45:25
|
||||
* @LastEditTime: 2024-03-22 09:47:09
|
||||
* @LastEditTime: 2024-03-26 09:42:08
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@@ -185,7 +185,7 @@ import moment from 'moment';
|
||||
import { parseTime } from '../../core/mixins/code-filter';
|
||||
import { getCorePLList } from '@/api/base/coreProductionLine'
|
||||
import FileSaver from 'file-saver'
|
||||
import * as XLSX from 'xlsx'
|
||||
// import * as XLSX from 'xlsx'
|
||||
const tableProps = [
|
||||
{
|
||||
// width: 128,
|
||||
@@ -422,30 +422,33 @@ export default {
|
||||
// 处理查询参数
|
||||
var xlsxParam = { raw: true };
|
||||
/* 从表生成工作簿对象 */
|
||||
var wb = XLSX.utils.table_to_book(
|
||||
document.querySelector("#exportTable"),
|
||||
xlsxParam
|
||||
);
|
||||
/* 获取二进制字符串作为输出 */
|
||||
var wbout = XLSX.write(wb, {
|
||||
bookType: "xlsx",
|
||||
bookSST: true,
|
||||
type: "array",
|
||||
});
|
||||
try {
|
||||
FileSaver.saveAs(
|
||||
//Blob 对象表示一个不可变、原始数据的类文件对象。
|
||||
//Blob 表示的不一定是JavaScript原生格式的数据。
|
||||
//File 接口基于Blob,继承了 blob 的功能并将其扩展使其支持用户系统上的文件。
|
||||
//返回一个新创建的 Blob 对象,其内容由参数中给定的数组串联组成。
|
||||
new Blob([wbout], { type: "application/octet-stream" }),
|
||||
//设置导出文件名称
|
||||
"许昌安彩年成品生产汇总.xlsx"
|
||||
import('xlsx').then(excel => {
|
||||
var wb = excel.utils.table_to_book(
|
||||
document.querySelector("#exportTable"),
|
||||
xlsxParam
|
||||
);
|
||||
} catch (e) {
|
||||
if (typeof console !== "undefined") console.log(e, wbout);
|
||||
}
|
||||
return wbout;
|
||||
/* 获取二进制字符串作为输出 */
|
||||
var wbout = excel.write(wb, {
|
||||
bookType: "xlsx",
|
||||
bookSST: true,
|
||||
type: "array",
|
||||
});
|
||||
try {
|
||||
FileSaver.saveAs(
|
||||
//Blob 对象表示一个不可变、原始数据的类文件对象。
|
||||
//Blob 表示的不一定是JavaScript原生格式的数据。
|
||||
//File 接口基于Blob,继承了 blob 的功能并将其扩展使其支持用户系统上的文件。
|
||||
//返回一个新创建的 Blob 对象,其内容由参数中给定的数组串联组成。
|
||||
new Blob([wbout], { type: "application/octet-stream" }),
|
||||
//设置导出文件名称
|
||||
"许昌安彩年成品生产汇总.xlsx"
|
||||
);
|
||||
} catch (e) {
|
||||
if (typeof console !== "undefined") console.log(e, wbout);
|
||||
}
|
||||
return wbout;
|
||||
//do something......
|
||||
})
|
||||
},
|
||||
// startYear() {
|
||||
// if (this.yearValue2 && this.yearValue2 < this.yearValue1) {
|
||||
|
||||
Reference in New Issue
Block a user