|
@@ -1589,6 +1589,7 @@ $(document).ready(() => {
|
|
|
if (/(xls|xlsx|XLS|XLSX)$/.test(ext)) {
|
|
|
const workbook = XLSX.read(data, {type: 'binary'}); // 以二进制流方式读取得到整份excel表格对象
|
|
|
const jsonData = transExcel(XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]], { defval: null }));
|
|
|
+ console.log(jsonData);
|
|
|
if (!(jsonData[0] && jsonData[0].code !== undefined && jsonData[0].code !== null && jsonData[0].unit !== undefined && jsonData[0].name !== undefined &&
|
|
|
jsonData[0].spec !== undefined && jsonData[0].msg_tp !== undefined && jsonData[0].msg_times !== undefined)) {
|
|
|
throw 'excel必须按指定格式内容上传';
|
|
@@ -1934,7 +1935,7 @@ $(document).ready(() => {
|
|
|
zhKeys.forEach(zhKey => {
|
|
|
const enKey = mapInfo[zhKey];
|
|
|
|
|
|
- enObj[enKey] = zhObj[zhKey];
|
|
|
+ enObj[enKey] = zhObj[zhKey] && _.isString(zhObj[zhKey]) ? _.trim(zhObj[zhKey]) : zhObj[zhKey];
|
|
|
});
|
|
|
|
|
|
return enObj
|