فهرست منبع

Merge branch '1.0.0_online' of http://192.168.1.41:3000/SmartCost/ConstructionCost into 1.0.0_online

zhongzewei 6 سال پیش
والد
کامیت
c40e9e66ba

+ 4 - 3
public/web/sheet/sheet_common.js

@@ -129,7 +129,7 @@ var sheetCommonObj = {
                 sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
             }
             if(setting.header[col].cellType === "comboBox"){
-                this.setComboBox(-1,col,sheet,setting.header[col].options,setting.header[col].editorValueType);
+                this.setComboBox(-1,col,sheet,setting.header[col].options,setting.header[col].editorValueType,setting.header[col].editable);
             }
 
             for (let row = 0; row < data.length; row++) {
@@ -259,7 +259,7 @@ var sheetCommonObj = {
                 this.setCheckBoxCell(row,col,sheet,val)
             }
             if(setting.header[col].cellType === "comboBox"){
-                this.setComboBox(row,col,sheet,setting.header[col].options,setting.header[col].editorValueType);
+                this.setComboBox(row,col,sheet,setting.header[col].options,setting.header[col].editorValueType,setting.header[col].editable);
             }
             if(setting.header[col].cellType === "selectButton"){
                 this.setSelectButton(row,col,sheet,setting.header[col]);
@@ -394,11 +394,12 @@ var sheetCommonObj = {
         c.isThreeState(threeState);
         return c
     },
-    setComboBox(row,col,sheet,options,editorValueType){
+    setComboBox(row,col,sheet,options,editorValueType,editable){
         //let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
         let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
         if(options){
             dynamicCombo.items(options);
+            if(editable == true)  dynamicCombo.editable(true);//可编辑
             if(editorValueType==true){
                 dynamicCombo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
             }

+ 2 - 1
web/building_saas/main/js/models/exportSEIInterface.js

@@ -78,7 +78,7 @@ let exportUtil = {
         }else {
             total = scMathUtil.roundForObj(total/building,6);
         }
-        coe = coe?coe:1;
+        coe = gljUtil.isDef(coe)?coe:1;
         return scMathUtil.roundForObj(total*coe,decimal);
     },
     calUnitWidthCoe:function (total,noNeedCoe) {
@@ -427,6 +427,7 @@ async function exportSEI(projectID) {
         }
         function setFeatures(tender,arr) {
             let features = tender.property.engineerFeatures?tender.property.engineerFeatures:[];
+            if(features.length == 0) return;
             let parentMap = _.groupBy(features,"ParentID");
             let rootNodes = parentMap["-1"]?parentMap["-1"]:parentMap[null];
             for(let r of rootNodes){

+ 49 - 28
web/building_saas/main/js/views/index_view.js

@@ -64,7 +64,7 @@ let indexObj= {
             {headerName: "数量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
             {headerName: "市场价合价", headerWidth: 120, dataCode: "totalPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
-            {headerName: "工料指标", headerWidth: 120, dataCode: "materialIndexType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[]},
+            {headerName: "工料指标", headerWidth: 120, dataCode: "materialIndexType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[],editable:true},
             {headerName: "工料指标单位", headerWidth: 150, dataCode: "materialIndexUnit", hAlign: "center", dataType: "String"},
             {headerName: "单位转换系数", headerWidth: 150, dataCode: "materialIndexCoe", hAlign: "center", dataType: "String",validator:"number"}
         ],
@@ -80,8 +80,8 @@ let indexObj= {
             {headerName: "工程量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number"},
             {headerName: "综合单价", headerWidth: 70, dataCode: "unitFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
             {headerName: "综合合价", headerWidth: 120, dataCode: "totalFee", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
-            {headerName: "工程经济指标类别", headerWidth: 120, dataCode: "economicType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[]},
-            {headerName: "工程量指标类别", headerWidth: 150, dataCode: "quantityIndexType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[]},
+            {headerName: "工程经济指标类别", headerWidth: 120, dataCode: "economicType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[],editable:true},
+            {headerName: "工程量指标类别", headerWidth: 150, dataCode: "quantityIndexType", hAlign: "center", dataType: "String",cellType:'comboBox',options:[],editable:true},
             {headerName: "工程量指标单位", headerWidth: 150, dataCode: "quantityIndexUnit", hAlign: "center", dataType: "String"},
             {headerName: "单位转换系数", headerWidth: 150, dataCode: "quantityIndexCoe", hAlign: "center", dataType: "String",validator:"number"}
         ],
@@ -305,7 +305,7 @@ let indexObj= {
         function setQuantities(items,data) {
             let quantity = 0;
             for (let i of items){
-                let coe = i.quantityIndexCoe && i.quantityIndexCoe!=""?parseFloat(i.quantityIndexCoe):1;
+                let coe = i.quantityIndexCoe && i.quantityIndexCoe!=""?parseFloat(i.quantityIndexCoe):0;
                 i.quantity = scMathUtil.roundForObj(parseFloat(i.quantity)*coe,getDecimal("process"));
                 quantity = scMathUtil.roundForObj(quantity +  i.quantity,getDecimal("process"));
             }
@@ -365,7 +365,7 @@ let indexObj= {
             for(let g of gljs){
                 if(!g.quantity || g.quantity=="") continue;
                 let marketPrice = gljUtil.getMarketPrice(g,projectGLJData,calcOptions,decimalObj,false,_,scMathUtil); // gljOprObj.setGLJPrice(tem,g);
-                let materialIndexCoe = g.materialIndexCoe?scMathUtil.roundForObj(g.materialIndexCoe,getDecimal("process")):1;
+                let materialIndexCoe = g.materialIndexCoe?scMathUtil.roundForObj(g.materialIndexCoe,getDecimal("process")):0;
                 let t_quantity = scMathUtil.roundForObj(g.quantity * materialIndexCoe,getDecimal("process"));
                 quantity = scMathUtil.roundForObj(t_quantity + quantity,getDecimal("process"));
                 let temPrice = scMathUtil.roundForObj(g.quantity * marketPrice,getDecimal("process"));
@@ -399,6 +399,7 @@ let indexObj= {
         let datas = [],allNodes=[];
         let controller = projectObj.mainController, project = projectObj.project;
         let  FBFX = project.Bills.getFBFXNode(controller);
+        let IDMap = _.indexBy(this.ecoQuantityDatas,"ID");
         if(FBFX){
             allNodes.push(FBFX);
             controller.tree.getAllSubNode(FBFX.source,allNodes);
@@ -424,7 +425,7 @@ let indexObj= {
                 quantityIndexType:d.quantityIndexType,
                 quantityIndexUnit:d.quantityIndexUnit,
                 quantityIndexCoe:d.quantityIndexCoe,
-                collapsed:false
+                collapsed:IDMap[d.ID]?IDMap[d.ID].collapsed:false
             };
             parentMap[d.ParentID] = tem;
             datas.push(tem);
@@ -481,7 +482,7 @@ let indexObj= {
     },
     setComboOptions:function (property,setting,field) {
         if(!property) return;
-        let options = [];
+        let options = [""];
         for(let p of property){
             options.push(p.name);
         }
@@ -494,7 +495,7 @@ let indexObj= {
     onEcoQuantityValueChange:function (sender,info) {
         let value = info.newValue;
         let dataCode = indexObj.ecoQuantitySetting.header[info.col].dataCode;
-        if(!info.newValue){
+        if(!gljUtil.isDef(info.newValue)){
             return;
         }
         if (value&&!sheetCommonObj.checkData(info.col,indexObj.ecoQuantitySetting, value)) {
@@ -503,6 +504,7 @@ let indexObj= {
         }
         let recode = indexObj.ecoQuantityDatas[info.row];
         let data = indexObj.getEcoQuantityUpdateData(recode,dataCode,value);
+        if(data == null)  return indexObj.showDatas();
         projectObj.project.updateNodesAndRefresh([data],indexObj.showDatas)
     },
     onEngineerInfoValueChange:function (sender,info) {
@@ -580,7 +582,7 @@ let indexObj= {
     onMaterialChange:function (sender,info) {
         let value = info.newValue,updateMap = {};
         let dataCode = indexObj.materialSetting.header[info.col].dataCode;
-        if(!info.newValue){
+        if(!gljUtil.isDef(info.newValue)){
             return;
         }
         if (value&&!sheetCommonObj.checkData(info.col,indexObj.materialSetting, value)) {
@@ -614,8 +616,13 @@ let indexObj= {
         let updateMap = {};
         for(let c of info.changedCells){
             let value=  info.sheet.getCell(c.row, c.col).text();
+            let dataCode = indexObj.materialSetting.header[c.col].dataCode;
             let recode = indexObj.materialDatas[c.row];
-            let tem = indexObj.getMaterialUpdateData(recode,value);
+            if (value&&!sheetCommonObj.checkData(c.col,indexObj.materialSetting, value)) {
+                alert('输入的数据类型不对,请重新输入!');
+                return indexObj.showDatas();
+            }
+            let tem = indexObj.getMaterialUpdateData(recode,dataCode,value);
             if(tem) updateMap[recode.id] = tem;
         }
         if(_.isEmpty(updateMap)) return indexObj.showDatas();
@@ -629,18 +636,26 @@ let indexObj= {
         tem.data[dataCode] = newValue;
         if(!recode) return null;
         if(dataCode == "quantityIndexType"){
-            let mainQuantities = projectObj.project.property.mainQuantities;
-            if (!mainQuantities) return null;
-            let m =  _.find(mainQuantities,{name:newValue});
-            if(!m) return null;
-            tem.data["quantityIndexUnit"] = m.unit;
-            tem.data["quantityIndexCoe"] = recode.unit == m.unit? 1:null;
+            if(newValue == ""){
+                tem.data["quantityIndexUnit"] = "";
+                tem.data["quantityIndexCoe"] = null;
+            }else {
+                let mainQuantities = projectObj.project.property.mainQuantities;
+                if (!mainQuantities) return null;
+                let m =  _.find(mainQuantities,{name:newValue});
+                if(!m) return null;
+                tem.data["quantityIndexUnit"] = m.unit;
+                tem.data["quantityIndexCoe"] = recode.unit == m.unit? 1:null;
+            }
+
         }
         if(dataCode == "economicType"){//这里就主要查找输入是否是下列选项中的一个,值已经在上面设置了
-            let economics = projectObj.project.property.economics;
-            if (!economics) return null;
-            let m =  _.find(economics,{name:newValue});
-            if(!m) return null;
+            if(newValue != ""){
+                let economics = projectObj.project.property.economics;
+                if (!economics) return null;
+                let m =  _.find(economics,{name:newValue});
+                if(!m) return null;
+            }
         }
         return tem;
 
@@ -649,14 +664,20 @@ let indexObj= {
         let data = {};
         data[dataCode] = newValue;
         if(dataCode == "materialIndexType"){
-            let materials = projectObj.project.property.materials;
-            if (!materials) return null;
-            if(!recode) return null;
-            let m =  _.find(materials,{name:newValue});
-            if(!m) return null;
-            data["materialIndexUnit"] = m.unit;
-            data["materialIndexCoe"] =  recode.unit == m.unit ?1: null;
-            if(recode.name == "水泥" && m.name == "水泥")  data["materialIndexCoe"] = 0.001;
+            if(newValue == ""){
+                data["materialIndexUnit"] = "";
+                data["materialIndexCoe"] =  null;
+            }else {
+                let materials = projectObj.project.property.materials;
+                if (!materials) return null;
+                if(!recode) return null;
+                let m =  _.find(materials,{name:newValue});
+                if(!m) return null;
+                data["materialIndexUnit"] = m.unit;
+                data["materialIndexCoe"] =  recode.unit == m.unit ?1: null;
+                if(recode.name == "水泥" && m.name == "水泥")  data["materialIndexCoe"] = 0.001;
+            }
+
         }
         return data
     },