|
@@ -226,6 +226,7 @@ class SchoolService extends CrudService {
|
|
|
const headRow = worksheet.getRow(1);
|
|
|
// 设置,检查表头
|
|
|
headRow.eachCell((cell, coli) => {
|
|
|
+ console.log(cell.value);
|
|
|
if (cell.value !== '序号') {
|
|
|
const r = cols.find(f => f.key === cell.value);
|
|
|
if (r) {
|
|
@@ -237,11 +238,10 @@ class SchoolService extends CrudService {
|
|
|
throw new BusinessError(`模板中"${cell.value}"列错误,请检查excel!`);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
// 检查表头结果,如果有没有 colIndex,说明表头里有不符合要求的,退回去
|
|
|
- const excelIsRigth = cols.find(f => f.colIndex);
|
|
|
- if (!excelIsRigth) throw new BusinessError(ErrorCode.DATA_INVALID, 'Excel表格格式不正确,请使用系统提供的模板!');
|
|
|
+ const excelIsRigth = cols.every(f => f.colIndex);
|
|
|
+ if (!excelIsRigth) throw new BusinessError(ErrorCode.DATA_INVALID, 'Excel表格格式不正确,请使用系统提供的模板,或重新下载模板!');
|
|
|
// 删除掉第一行 表头行,这不是数据
|
|
|
worksheet.spliceRows(0, 1);
|
|
|
const stuList = [];
|