Bladeren bron

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

Tony Kang 3 jaren geleden
bovenliggende
commit
e2b840d947

+ 3 - 2
web/building_saas/main/js/models/calc_program.js

@@ -541,7 +541,8 @@ let calcTools = {
           // 不能直接用glj.tenderPrice,这个值不可靠。当调价界面删除单价系数后,tenderPrice没有实时计算,取得的值为0
           rst.eTU = rst.eTU + (me.uiGLJQty(glj.tenderQuantity) * glj.tenderPrice).toDecimal(decimalObj.process);
           rst.eTU = rst.eTU.toDecimal(decimalObj.process);
-        } else {
+        }
+        /*         } else {
           // 组成物。
           if (!compositionTypes.includes(glj.type)) continue;
           let mds = projectObj.project.composition.getCompositionByGLJ(glj);
@@ -558,7 +559,7 @@ let calcTools = {
             rst.eTU = rst.eTU + (mdTU * glj.tenderQuantity).toDecimal(decimalObj.process);
             rst.eTU = rst.eTU.toDecimal(decimalObj.process);
           }
-        }
+        } */
       }
       rst.eU = rst.eU.toDecimal(decimalObj.bills.unitPrice);
       rst.eTU = rst.eTU.toDecimal(decimalObj.bills.unitPrice);

+ 40 - 4
web/building_saas/main/js/views/project_glj_view.js

@@ -1420,6 +1420,24 @@ projectGljObject = {
     if ($("#freight_ration").is(":visible") && materialCalcObj.freightRationSpread) materialCalcObj.freightRationSpread.refresh();
     if ($("#price_ration").is(":visible") && materialCalcObj.priceRationSpread) materialCalcObj.priceRationSpread.refresh();
   },
+  getColIndex: function (colName) {
+    const headerArr = this.projectGljSetting.header;
+    for (let index = 0; index < headerArr.length; index++) {
+      const e = headerArr[index];
+      if (e.headerName === colName) return index;
+    }
+    return -1;
+  },
+  getSheetDataRowAndPrice: function (gljIndex) {
+    const pGlj = projectObj.project.projectGLJ.datas.gljMap[gljIndex];
+    if (!pGlj) return null;
+    const sheetDataArr = this.projectGljSheetData;
+    for (let index = 0; index < sheetDataArr.length; index++) {
+      const e = sheetDataArr[index];
+      if (e.id === pGlj.id) return { row: index, price: e.unit_price.market_price };
+    }
+    return null;
+  },
 };
 
 function getProjectResizeEles() {
@@ -1784,7 +1802,8 @@ $(function () {
       sheetData[0][1].value === "名称" &&
       sheetData[0][2].value === "规格" &&
       sheetData[0][3].value === "单位" &&
-      sheetData[0][4].value === "预算价";
+      sheetData[0][4].value === "类型" &&
+      sheetData[0][5].value === "预算价";
     if (!isRightHead) throw err;
 
     let rst = [];
@@ -1794,7 +1813,8 @@ $(function () {
         name: sheetData[row][1].value,
         specs: sheetData[row][2].value,
         unit: sheetData[row][3].value,
-        unitPrice: sheetData[row][4].value,
+        type: sheetData[row][4].value,
+        unitPrice: sheetData[row][5].value,
       };
       rst.push(rowData);
     }
@@ -1859,8 +1879,24 @@ $(function () {
       }
 
       showAlert("正在导入预算价...", true);
-      //
-      let gljList = projectObj.project.projectGLJ.datas.gljList;
+      debugger;
+      const priceCol = projectGljObject.getColIndex("预算价");
+      console.log(projectGljObject.projectGljSheetData);
+      const changeInfo = [];
+      for (const pd of priceData) {
+        const idx = gljUtil.getIndex(pd, gljKeyArray);
+        const pGlj = projectGljObject.getSheetDataRowAndPrice(idx);
+        if (pGlj && pGlj.price !== pd.unitPrice) {
+          changeInfo.push({ row: pGlj.row, col: priceCol, value: pd.unitPrice });
+        }
+      }
+      if (changeInfo.length > 0) projectGljObject.batchUpdateProjectGLJ(changeInfo, "projectGljSheet");
+      $("#showAlert").hide();
+      $(me).removeClass("disabled");
+      $("#importPriceForm").modal("hide");
+      if ($.bootstrapLoading.isLoading()) {
+        $.bootstrapLoading.end();
+      }
     } catch (err) {
       console.log(err);
       showAlert(err);