|
@@ -227,7 +227,10 @@ class TrainplanService extends CrudService {
|
|
|
'.xlsx';
|
|
|
const respath =
|
|
|
'http://free.liaoningdoupo.com:80/files/train/' + nowDate + '.xlsx';
|
|
|
-
|
|
|
+ const wb = {
|
|
|
+ SheetNames: [],
|
|
|
+ Sheets: {},
|
|
|
+ };
|
|
|
for (let i = 0; i < trainplanIds.length; i++) {
|
|
|
// 批次期次都在这里面
|
|
|
const trainplan = await this.model.findOne({ _id: trainplanIds[i] });
|
|
@@ -325,15 +328,11 @@ class TrainplanService extends CrudService {
|
|
|
const ref = outputPos[0] + ':' + outputPos[outputPos.length - 1];
|
|
|
|
|
|
// 构建 workbook 对象
|
|
|
- const wb = {
|
|
|
- SheetNames: [ 'sheet1' ],
|
|
|
- Sheets: {
|
|
|
- sheet1: Object.assign({}, output, { '!ref': ref }),
|
|
|
- },
|
|
|
- };
|
|
|
- // 导出 Excel
|
|
|
- XLSX.writeFile(wb, path);
|
|
|
+ wb.SheetNames.push('sheet' + i);
|
|
|
+ wb.Sheets['sheet' + i] = Object.assign({}, output, { '!ref': ref });
|
|
|
}
|
|
|
+ // 导出 Excel
|
|
|
+ XLSX.writeFile(wb, path);
|
|
|
return respath;
|
|
|
}
|
|
|
|