Merge branch 'main' into test
This commit is contained in:
commit
d701c62d11
|
@ -572,12 +572,14 @@ import { fromList } from "@/libs/constants.js";
|
|||
import timeOptions from "@/utils/timeOptions";
|
||||
import * as FileSaver from "file-saver";
|
||||
import Worker from "worker-loader!@/worker/calcWorker.js";
|
||||
import { roterPre } from "@/settings";
|
||||
export default {
|
||||
components: { orderDetail, cardsData, userDetails },
|
||||
data() {
|
||||
return {
|
||||
pickerOptions: timeOptions,
|
||||
orderId: 0,
|
||||
roterPre: roterPre,
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0,
|
||||
|
@ -759,66 +761,68 @@ export default {
|
|||
// document.body.removeChild(downloadLink);
|
||||
// },
|
||||
async exports() {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: "导出中...",
|
||||
spinner: "el-icon-loading",
|
||||
background: "hsla(0, 0%, 100%, .9)",
|
||||
});
|
||||
let excelData = JSON.parse(JSON.stringify(this.tableFrom)),
|
||||
data = [];
|
||||
excelData.page = 1;
|
||||
excelData.limit = 200;
|
||||
let pageCount = 1;
|
||||
let lebData = {};
|
||||
// let work;
|
||||
for (let i = 0; i < pageCount; i++) {
|
||||
lebData = await this.downData(excelData);
|
||||
// if(work){
|
||||
// work.setContent(lebData.export)
|
||||
// }else{
|
||||
// work = createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename);
|
||||
// const loading = this.$loading({
|
||||
// lock: true,
|
||||
// text: "导出中...",
|
||||
// spinner: "el-icon-loading",
|
||||
// background: "hsla(0, 0%, 100%, .9)",
|
||||
// });
|
||||
// let excelData = JSON.parse(JSON.stringify(this.tableFrom)),
|
||||
// data = [];
|
||||
// excelData.page = 1;
|
||||
// excelData.limit = 200;
|
||||
// let pageCount = 1;
|
||||
// let lebData = {};
|
||||
// // let work;
|
||||
// for (let i = 0; i < pageCount; i++) {
|
||||
// lebData = await this.downData(excelData);
|
||||
// // if(work){
|
||||
// // work.setContent(lebData.export)
|
||||
// // }else{
|
||||
// // work = createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename);
|
||||
// // }
|
||||
// //循环次数
|
||||
// pageCount = Math.ceil(lebData.count / excelData.limit);
|
||||
// // 数据同步
|
||||
// if (lebData.export.length) {
|
||||
// data = data.concat(lebData.export);
|
||||
// excelData.page++;
|
||||
// }
|
||||
//循环次数
|
||||
pageCount = Math.ceil(lebData.count / excelData.limit);
|
||||
// 数据同步
|
||||
if (lebData.export.length) {
|
||||
data = data.concat(lebData.export);
|
||||
excelData.page++;
|
||||
}
|
||||
}
|
||||
console.log("开始处理");
|
||||
// 获取计算开始的时间
|
||||
let start = performance.now();
|
||||
// 新建一个线程
|
||||
let worker = new Worker();
|
||||
// 线程之间通过postMessage进行通信
|
||||
worker.postMessage({
|
||||
header: lebData.header,
|
||||
title: lebData.title,
|
||||
data,
|
||||
foot: lebData.foot,
|
||||
filename: lebData.filename,
|
||||
});
|
||||
// 监听message事件
|
||||
worker.addEventListener("message", (e) => {
|
||||
// 关闭线程
|
||||
worker.terminate();
|
||||
// 获取计算结束的时间
|
||||
let end = performance.now();
|
||||
// 得到总的计算时间
|
||||
let durationTime = end - start;
|
||||
// }
|
||||
// console.log("开始处理");
|
||||
// // 获取计算开始的时间
|
||||
// let start = performance.now();
|
||||
// // 新建一个线程
|
||||
// let worker = new Worker();
|
||||
// // 线程之间通过postMessage进行通信
|
||||
// worker.postMessage({
|
||||
// header: lebData.header,
|
||||
// title: lebData.title,
|
||||
// data,
|
||||
// foot: lebData.foot,
|
||||
// filename: lebData.filename,
|
||||
// });
|
||||
// // 监听message事件
|
||||
// worker.addEventListener("message", (e) => {
|
||||
// // 关闭线程
|
||||
// worker.terminate();
|
||||
// // 获取计算结束的时间
|
||||
// let end = performance.now();
|
||||
// // 得到总的计算时间
|
||||
// let durationTime = end - start;
|
||||
|
||||
console.log("计算结果:", e.data);
|
||||
let { blob, filename } = e.data;
|
||||
FileSaver.saveAs(blob, filename + ".xlsx");
|
||||
loading.close();
|
||||
console.log(`代码执行了 ${durationTime} 毫秒`);
|
||||
});
|
||||
// this.exportCsv(lebData.header,data,lebData.filename)
|
||||
// createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename)
|
||||
// work.saveAndDowloade(lebData.filename)
|
||||
return;
|
||||
// console.log("计算结果:", e.data);
|
||||
// let { blob, filename } = e.data;
|
||||
// FileSaver.saveAs(blob, filename + ".xlsx");
|
||||
// loading.close();
|
||||
// console.log(`代码执行了 ${durationTime} 毫秒`);
|
||||
// });
|
||||
// // this.exportCsv(lebData.header,data,lebData.filename)
|
||||
// // createWorkBook(lebData.header, lebData.title, data, lebData.foot,lebData.filename)
|
||||
// // work.saveAndDowloade(lebData.filename)
|
||||
// return;
|
||||
let excelData = JSON.parse(JSON.stringify(this.tableFrom));
|
||||
this.exportRecord(excelData);
|
||||
},
|
||||
/**订单列表 */
|
||||
downData(excelData) {
|
||||
|
@ -828,9 +832,9 @@ export default {
|
|||
});
|
||||
});
|
||||
},
|
||||
// 导出
|
||||
exportRecord() {
|
||||
exportOrderApi(this.tableFrom)
|
||||
|
||||
exportRecord(excelData) {
|
||||
exportOrderApi(excelData)
|
||||
.then((res) => {
|
||||
const h = this.$createElement;
|
||||
this.$msgbox({
|
||||
|
@ -841,7 +845,9 @@ export default {
|
|||
h("span", null, '"查看~ '),
|
||||
]),
|
||||
confirmButtonText: "我知道了",
|
||||
}).then((action) => {});
|
||||
}).then((action) => {
|
||||
this.$router.push({ path: this.roterPre + "/group/exportList" });
|
||||
});
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$message.error(res.message);
|
||||
|
|
|
@ -1166,37 +1166,63 @@ export default {
|
|||
this.$refs.editAttr.getAttrDetail(row.product_id);
|
||||
},
|
||||
async exports() {
|
||||
let excelData = JSON.parse(JSON.stringify(this.tableFrom)),
|
||||
data = [];
|
||||
excelData.page = 1;
|
||||
excelData.limit = 200;
|
||||
let pageCount = 1;
|
||||
let lebData = {};
|
||||
for (let i = 0; i < pageCount; i++) {
|
||||
lebData = await this.downData(excelData);
|
||||
pageCount = Math.ceil(lebData.count / excelData.limit);
|
||||
if (lebData.export.length) {
|
||||
data = data.concat(lebData.export);
|
||||
excelData.page++;
|
||||
}
|
||||
}
|
||||
createWorkBook(
|
||||
lebData.header,
|
||||
lebData.title,
|
||||
data,
|
||||
lebData.foot,
|
||||
lebData.filename
|
||||
);
|
||||
return;
|
||||
let excelData = JSON.parse(JSON.stringify(this.tableFrom));
|
||||
this.exportRecord(excelData);
|
||||
// data = [];
|
||||
// excelData.page = 1;
|
||||
// excelData.limit = 200;
|
||||
// let pageCount = 1;
|
||||
// let lebData = {};
|
||||
// for (let i = 0; i < pageCount; i++) {
|
||||
// lebData = await this.downData(excelData);
|
||||
// pageCount = Math.ceil(lebData.count / excelData.limit);
|
||||
// if (lebData.export.length) {
|
||||
// data = data.concat(lebData.export);
|
||||
// excelData.page++;
|
||||
// }
|
||||
// }
|
||||
// createWorkBook(
|
||||
// lebData.header,
|
||||
// lebData.title,
|
||||
// data,
|
||||
// lebData.foot,
|
||||
// lebData.filename
|
||||
// );
|
||||
// return;
|
||||
},
|
||||
/**订单列表 */
|
||||
downData(excelData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exportProductApi(excelData).then((res) => {
|
||||
exportProductApi(excelData)
|
||||
.then((res) => {
|
||||
return resolve(res.data);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
// 导出
|
||||
exportRecord() {
|
||||
exportProductApi(this.tableFrom)
|
||||
.then((res) => {
|
||||
const h = this.$createElement;
|
||||
this.$msgbox({
|
||||
title: "提示",
|
||||
message: h("p", null, [
|
||||
h("span", null, '文件正在生成中,请稍后点击"'),
|
||||
h("span", { style: "color: teal" }, "导出记录"),
|
||||
h("span", null, '"查看~ '),
|
||||
]),
|
||||
confirmButtonText: "我知道了",
|
||||
}).then((action) => {
|
||||
this.$router.push({ path: this.roterPre + "/group/exportList" });
|
||||
});
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
// 具体日期
|
||||
onchangeTime(e) {
|
||||
this.timeVal = e;
|
||||
|
|
|
@ -650,6 +650,7 @@ import newsCategory from "@/components/newsCategory/index.vue";
|
|||
import userDetail from "./userDetails";
|
||||
import userCreate from "./userCreate";
|
||||
import couponList from "./couponList";
|
||||
import { roterPre } from "@/settings";
|
||||
import createWorkBook from "@/utils/newToExcel.js";
|
||||
const checkMobile = (rule, value, cb) => {
|
||||
const regMobile = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
||||
|
@ -784,6 +785,7 @@ export default {
|
|||
total: 0,
|
||||
},
|
||||
uid: "",
|
||||
roterPre: roterPre,
|
||||
listLoading: true,
|
||||
multipleSelection: [],
|
||||
ids: "",
|
||||
|
@ -1033,35 +1035,37 @@ export default {
|
|||
},
|
||||
// 导出
|
||||
async exportList() {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: "正在拼命导出中,请耐心等待...",
|
||||
spinner: "el-icon-loading",
|
||||
background: "hsla(0, 0%, 100%, .9)",
|
||||
});
|
||||
let excelData = JSON.parse(JSON.stringify(this.userFrom)),
|
||||
data = [];
|
||||
excelData.page = 1;
|
||||
excelData.limit = 500;
|
||||
let pageCount = 1;
|
||||
let lebData = {};
|
||||
for (let i = 0; i < pageCount; i++) {
|
||||
lebData = await this.downData(excelData);
|
||||
pageCount = Math.ceil(lebData.count / excelData.limit);
|
||||
if (lebData.export.length) {
|
||||
data = data.concat(lebData.export);
|
||||
excelData.page++;
|
||||
}
|
||||
}
|
||||
createWorkBook(
|
||||
lebData.header,
|
||||
lebData.title,
|
||||
data,
|
||||
lebData.foot,
|
||||
lebData.filename
|
||||
);
|
||||
loading.close();
|
||||
return;
|
||||
// const loading = this.$loading({
|
||||
// lock: true,
|
||||
// text: "正在拼命导出中,请耐心等待...",
|
||||
// spinner: "el-icon-loading",
|
||||
// background: "hsla(0, 0%, 100%, .9)",
|
||||
// });
|
||||
// let excelData = JSON.parse(JSON.stringify(this.userFrom)),
|
||||
// data = [];
|
||||
// excelData.page = 1;
|
||||
// excelData.limit = 500;
|
||||
// let pageCount = 1;
|
||||
// let lebData = {};
|
||||
// for (let i = 0; i < pageCount; i++) {
|
||||
// lebData = await this.downData(excelData);
|
||||
// pageCount = Math.ceil(lebData.count / excelData.limit);
|
||||
// if (lebData.export.length) {
|
||||
// data = data.concat(lebData.export);
|
||||
// excelData.page++;
|
||||
// }
|
||||
// }
|
||||
// createWorkBook(
|
||||
// lebData.header,
|
||||
// lebData.title,
|
||||
// data,
|
||||
// lebData.foot,
|
||||
// lebData.filename
|
||||
// );
|
||||
// loading.close();
|
||||
// return;
|
||||
let excelData = JSON.parse(JSON.stringify(this.userFrom));
|
||||
this.exportRecord(excelData);
|
||||
},
|
||||
/**导出用户列表 */
|
||||
downData(excelData) {
|
||||
|
@ -1071,6 +1075,26 @@ export default {
|
|||
});
|
||||
});
|
||||
},
|
||||
exportRecord(excelData) {
|
||||
exportUserApi(excelData)
|
||||
.then((res) => {
|
||||
const h = this.$createElement;
|
||||
this.$msgbox({
|
||||
title: "提示",
|
||||
message: h("p", null, [
|
||||
h("span", null, '文件正在生成中,请稍后点击"'),
|
||||
h("span", { style: "color: teal" }, "导出记录"),
|
||||
h("span", null, '"查看~ '),
|
||||
]),
|
||||
confirmButtonText: "我知道了",
|
||||
}).then((action) => {
|
||||
this.$router.push({ path: this.roterPre + "/group/exportList" });
|
||||
});
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
sendSuccess() {
|
||||
this.visibleCoupon = false;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue