|
@@ -21,6 +21,7 @@ class SchoolService extends CrudService {
|
|
|
assert(schid, 'schid不能为空');
|
|
|
// 取得excle中数据
|
|
|
const _filepath = this.ctx.app.config.baseUrl + filepath;
|
|
|
+ console.log(_filepath);
|
|
|
const studatas = await this.getImportXLSXData(_filepath, termid, schid);
|
|
|
// 将得到的数据校验
|
|
|
const datacheck = await this.datacheck(studatas);
|
|
@@ -36,7 +37,9 @@ class SchoolService extends CrudService {
|
|
|
|
|
|
// 获取导入的XLSX文件中的数据
|
|
|
async getImportXLSXData(filepath, termid, schid) {
|
|
|
- const workbook = XLSX.readFile(filepath);
|
|
|
+ console.log(filepath);
|
|
|
+ const file = await this.ctx.curl(filepath);
|
|
|
+ const workbook = XLSX.read(file.data);
|
|
|
// 读取内容
|
|
|
let exceldata = [];
|
|
|
const sheetNames = workbook.SheetNames; // 获取表名
|
|
@@ -87,6 +90,11 @@ class SchoolService extends CrudService {
|
|
|
data.msg = '姓名不允许为空';
|
|
|
errormsg.push(data);
|
|
|
}
|
|
|
+ if (!data.gender) {
|
|
|
+ errorcode = '1';
|
|
|
+ data.msg = '性别不允许为空';
|
|
|
+ errormsg.push(data);
|
|
|
+ }
|
|
|
if (!data.id_number) {
|
|
|
errorcode = '1';
|
|
|
data.msg = '身份证号不允许为空';
|