|
@@ -1111,7 +1111,7 @@ $(document).ready(() => {
|
|
const workbook = XLSX.read(data, {type: 'binary'}); // 以二进制流方式读取得到整份excel表格对象
|
|
const workbook = XLSX.read(data, {type: 'binary'}); // 以二进制流方式读取得到整份excel表格对象
|
|
const jsonData = transExcel(XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]], { defval: null }));
|
|
const jsonData = transExcel(XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]], { defval: null }));
|
|
if (!(jsonData[0] && jsonData[0].b_code !== undefined && jsonData[0].b_code !== null &&
|
|
if (!(jsonData[0] && jsonData[0].b_code !== undefined && jsonData[0].b_code !== null &&
|
|
- jsonData[0].GLJcode !== undefined && jsonData[0].name !== undefined && jsonData[0].name !== undefined &&
|
|
|
|
|
|
+ jsonData[0].gljcode !== undefined && jsonData[0].name !== undefined && jsonData[0].name !== undefined &&
|
|
jsonData[0].unit !== undefined && jsonData[0].unit_price !== undefined)) {
|
|
jsonData[0].unit !== undefined && jsonData[0].unit_price !== undefined)) {
|
|
throw 'excel必须按指定格式内容上传';
|
|
throw 'excel必须按指定格式内容上传';
|
|
}
|
|
}
|
|
@@ -1132,7 +1132,7 @@ $(document).ready(() => {
|
|
iconv.skipDecodeWarning = true
|
|
iconv.skipDecodeWarning = true
|
|
tree = JSON.parse(iconv.decode(data, ascii.encoding));// 需要转码,否则前端处理中文会出现乱码
|
|
tree = JSON.parse(iconv.decode(data, ascii.encoding));// 需要转码,否则前端处理中文会出现乱码
|
|
if (!(tree[0] && tree[0].b_code !== undefined && tree[0].b_code !== null &&
|
|
if (!(tree[0] && tree[0].b_code !== undefined && tree[0].b_code !== null &&
|
|
- tree[0].GLJcode !== undefined && tree[0].name !== undefined && tree[0].name !== undefined &&
|
|
|
|
|
|
+ tree[0].gljcode !== undefined && tree[0].name !== undefined && tree[0].name !== undefined &&
|
|
tree[0].unit !== undefined && tree[0].unit_price !== undefined)) {
|
|
tree[0].unit !== undefined && tree[0].unit_price !== undefined)) {
|
|
throw 'json必须按指定格式内容上传';
|
|
throw 'json必须按指定格式内容上传';
|
|
}
|
|
}
|
|
@@ -1164,10 +1164,10 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
needPushTree.push(t);
|
|
needPushTree.push(t);
|
|
// for (const c of t.children) {
|
|
// for (const c of t.children) {
|
|
- // const mbOrder = _.findIndex(materialBillsData, { code: c.GLJcode, name: c.name, unit: c.unit });
|
|
|
|
- // if (c.b_code !== null && mbOrder === -1 && _.findIndex(pushBillsData, { code: c.GLJcode, name: c.name, unit: c.unit }) === -1) {
|
|
|
|
|
|
+ // const mbOrder = _.findIndex(materialBillsData, { code: c.gljcode, name: c.name, unit: c.unit });
|
|
|
|
+ // if (c.b_code !== null && mbOrder === -1 && _.findIndex(pushBillsData, { code: c.gljcode, name: c.name, unit: c.unit }) === -1) {
|
|
// pushBillsData.push({
|
|
// pushBillsData.push({
|
|
- // code: c.GLJcode,
|
|
|
|
|
|
+ // code: c.gljcode,
|
|
// name: c.name,
|
|
// name: c.name,
|
|
// unit: c.unit,
|
|
// unit: c.unit,
|
|
// spec: c.specs,
|
|
// spec: c.specs,
|
|
@@ -1287,7 +1287,7 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
const mbList = [];
|
|
const mbList = [];
|
|
for (const mb of t.children) {
|
|
for (const mb of t.children) {
|
|
- const mbInfo = _.find(materialBillsData, { code: mb.GLJcode, name: mb.name, unit: mb.unit });
|
|
|
|
|
|
+ const mbInfo = _.find(materialBillsData, { code: mb.gljcode, name: mb.name, unit: mb.unit });
|
|
if (mbInfo) {
|
|
if (mbInfo) {
|
|
const num = parseFloat(mb.quantity);
|
|
const num = parseFloat(mb.quantity);
|
|
if (num < 0 || !/^\d+(\.\d{1,6})?$/.test(num)) {
|
|
if (num < 0 || !/^\d+(\.\d{1,6})?$/.test(num)) {
|
|
@@ -1373,7 +1373,7 @@ $(document).ready(() => {
|
|
function transExcel(results) {
|
|
function transExcel(results) {
|
|
const mapInfo = {
|
|
const mapInfo = {
|
|
'清单编号': 'b_code',
|
|
'清单编号': 'b_code',
|
|
- '工料编号': 'GLJcode',
|
|
|
|
|
|
+ '工料编号': 'gljcode',
|
|
'名称': 'name',
|
|
'名称': 'name',
|
|
'单位': 'unit',
|
|
'单位': 'unit',
|
|
'规格': 'specs',
|
|
'规格': 'specs',
|