소스 검색

导入Excel,导入时避免导入父项数量、单价、金额

MaiXinRong 4 년 전
부모
커밋
1336957bfc
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      app/lib/analysis_excel.js

+ 6 - 1
app/lib/analysis_excel.js

@@ -281,7 +281,11 @@ class ImportBaseTree {
 
     calculateLeafWithPos () {
         for (const node of this.items) {
-            if (node.children && node.children.length > 0) { continue; }
+            if (node.children && node.children.length > 0) {
+                node.unit_price = null;
+                node.quantity = null;
+                node.total_price = null;
+            }
             if (!node.pos || node.pos.length === 0) { continue; }
             node.quantity = this.ctx.helper.sum(_.map(node.pos, 'quantity'));
             if (node.quantity && node.unit_price) {
@@ -353,6 +357,7 @@ class AnalysisExcelTree {
         node.unit = this.ctx.helper.replaceReturn(row[this.colsDef.unit]);
         const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, node.unit);
         node.quantity = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.quantity]), precision.value);
+        node.sgfh_qty = node.quantity;
         node.unit_price = aeUtils.toNumber(row[this.colsDef.unit_price]);
         node.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
         node.memo = this.ctx.helper.replaceReturn(row[this.colsDef.memo]);