Sfoglia il codice sorgente

Merge branch 'olym'

olym 7 anni fa
parent
commit
b23aee3e67

+ 1 - 1
modules/glj/controllers/glj_controller.js

@@ -109,7 +109,7 @@ class GLJController extends BaseController {
         try {
             // 可编辑的字段
             let editableField = ['is_evaluate', 'unit_price.market_price', 'is_adjust_price', 'mix_ratio.consumption',
-                'supply'];
+                'supply', 'supply_quantity'];
             if (editableField.indexOf(field) < 0) {
                 throw '对应字段不能编辑';
             }

+ 4 - 3
modules/glj/models/glj_list_model.js

@@ -104,7 +104,7 @@ class GLJListModel extends BaseModel {
             let quantityList = {};
             // 整理数据
             for (let tmp of quantityData) {
-                let tmpNum = parseInt(tmp.rationQuantity);
+                let tmpNum = parseFloat(tmp.rationQuantity);
                 tmpNum = isNaN(tmpNum) ? 1 : tmpNum;
                 if (quantityList[tmp.projectGLJID] === undefined) {
                     quantityList[tmp.projectGLJID] = tmp.quantity * tmpNum;
@@ -204,6 +204,7 @@ class GLJListModel extends BaseModel {
             glj.quantity = quantityList[projectGljId] !== undefined ? quantityList[projectGljId] : 0;
             glj.quantity = totalComposition[glj.code] !== undefined ? totalComposition[glj.code] : glj.quantity;
             glj.quantity = compositionConsumption[gljId] !== undefined ?  glj.quantity + compositionConsumption[gljId] : glj.quantity;
+            glj.quantity = parseFloat(glj.quantity).toFixed(3);
 
             // 组成物数据
             gljList[index].ratio_data = mixRatioData[gljId] !== undefined ? mixRatioData[gljId] : [];
@@ -421,7 +422,7 @@ class GLJListModel extends BaseModel {
     async compositionInit(data, unitPriceFileId) {
         let gljId = data.glj_id === undefined ? 0 : data.glj_id;
         let projectId = data.project_id === undefined ? 0 : data.project_id;
-        if (code === 0 || projectId === 0) {
+        if (gljId === 0 || projectId === 0) {
             throw '参数错误';
         }
         let fromTable = data.from === undefined ? 'std' : data.from;
@@ -521,7 +522,7 @@ class GLJListModel extends BaseModel {
             }
 
             // 查找对应的项目工料机数据
-            let [gljData, compositionList] = await this.getCompositionGLJList(projectGLJData.code, projectGLJData.project_id);
+            let [gljData, compositionList] = await this.getCompositionGLJList(projectGLJData.glj_id, projectGLJData.project_id);
 
             if (gljData.length <= 0) {
                 throw '没有对应的组成物项目工料机';

+ 6 - 1
web/building_saas/glj/js/common_spread.js

@@ -49,7 +49,12 @@ CommonSpreadJs.prototype.init = function(target) {
     this.sheet.autoGenerateColumns = false;
     // 设置表单不可编辑
     this.sheet.options.isProtected = true;
-
+    this.sheet.options.protectionOptions = {
+        allowSelectLockedCells: true,
+        allowSelectUnlockedCells: true,
+        allowResizeRows: true,
+        allowResizeColumns: true
+    };
     return this.spread;
 };
 

+ 10 - 5
web/building_saas/glj/js/project_glj_spread.js

@@ -244,6 +244,7 @@ ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
     let connectCodeColumn = this.sheetObj.getFieldColumn('connect_code');
     let consumptionColumn = this.sheetObj.getFieldColumn('consumption');
     let supplyColumn = this.sheetObj.getFieldColumn('supply');
+    let supplyQuantity = this.sheetObj.getFieldColumn('supply_quantity');
     let activeSheet = this.sheetObj.getSheet();
 
     for (let data of sourceData) {
@@ -256,16 +257,20 @@ ProjectGLJSpread.prototype.specialColumn = function (sourceData) {
             activeSheet.getCell(rowCounter, isEvaluateColumn, GC.Spread.Sheets.SheetArea.viewport).locked(true);
             activeSheet.setValue(rowCounter, isEvaluateColumn, '');
         }
-
+        // 设置供货方式列是否可选
+        if (this.supplyReadonlyType.indexOf(data.unit_price.type) >= 0) {
+            // 锁定该单元格
+            activeSheet.getCell(rowCounter, supplyColumn,  GC.Spread.Sheets.SheetArea.viewport).locked(true);
+        }
+        // 如果为部分甲供或者为全部甲供则甲供数量需要可编辑
+        if (data.supply === 1 || data.supply === 2) {
+            activeSheet.getCell(rowCounter, supplyQuantity,  GC.Spread.Sheets.SheetArea.viewport).locked(false);
+        }
         // 供货方式数据
         let supplyIndex = parseInt(data.supply);
         supplyIndex = isNaN(supplyIndex) ? 0 : supplyIndex;
         let supplyText = this.supplyType[supplyIndex] !== undefined ? this.supplyType[supplyIndex] : '自行采购';
         activeSheet.setValue(rowCounter, supplyColumn, supplyText);
-        if (this.supplyReadonlyType.indexOf(data.unit_price.type) >= 0) {
-            // 锁定该单元格
-            activeSheet.getCell(rowCounter, supplyColumn,  GC.Spread.Sheets.SheetArea.viewport).locked(true);
-        }
 
         // 如果类型为混凝土、砂浆、配合比、机械,则市场单价和供货方式不能修改
         if (canNotChangeTypeId.indexOf(data.unit_price.type) >= 0) {