Просмотр исходного кода

工程特征库制度性
补充人材机库费率数据

zhongzewei 6 лет назад
Родитель
Сommit
100d4c5468

+ 12 - 6
modules/pm/facade/pm_facade.js

@@ -784,13 +784,19 @@ async function getFullPath(projectID) {
     }
 }
 
-async function getProjectFeature(libID,feeStandardName){
-    let lib = await featureLibModel.findOne({'ID':libID})
-    if(lib){
-        let eng = _.find(lib.feature,{'key':'engineering'})
-        if(eng) eng.value = feeStandardName;
+//@param {String}libID(工程特征库ID) {Object}assign(需要赋值的key-value)
+async function getProjectFeature(libID, assign) {
+    let lib = await featureLibModel.findOne({'ID':libID});
+    if (lib) {
+        for (let key in assign) {
+            let obj = _.find(lib.feature, {key: key});
+            if (obj) {
+                obj.value = assign[key];
+            }
+        }
         return lib.feature;
-    }else {
+
+    } else {
         return [];
     }
 }

+ 7 - 2
modules/pm/models/project_model.js

@@ -165,8 +165,13 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                     //data.updateData.property.basicInformation = basicInformation;
                     //工程特征
                     if(data.updateData.property.featureLibID){
-                        //工程专业显示费用定额的名称
-                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, data.updateData.property.feeStandardName);
+                        //项目类别(valuationType)、养护类别(engineering)、费用标准(feeStandard)根据新建分选的选项去赋值
+                        let assign = {
+                            valuationType: data.updateData.property.valuationType === 'bill' ? '预算' : '工程量清单',
+                            engineering: data.updateData.property.engineeringName,
+                            feeStandard: data.updateData.property.feeStandardName
+                        };
+                        data.updateData.property.projectFeature = await pmFacade.getProjectFeature(data.updateData.property.featureLibID, assign);
                     }
                     /*projectFeature[0]['value'] = data.updateData.property.engineeringName || '';
                     data.updateData.property.projectFeature = projectFeature;*/

+ 80 - 143
web/building_saas/complementary_glj_lib/js/glj.js

@@ -73,8 +73,7 @@ let repositoryGljObj = {
     gljList: [],
     stdGljList:[],
     complementaryGljList: [],
-    machineModel: {textArr: ['特', '大', '中', '小'], comboItems: [{text: '特', value: 1}, {text: '大', value: 2},{text: '中', value: 3}, {text: '小', value: 4}]},
-    machineModelIdx: {'1': '特', '2': '大', '3': '中', '4': '小'},
+    feeDataCode: ['grossWeightCoe', 'purchaseStorageRate', 'offSiteTransportLossRate', 'handlingLossRate'],
     distTypeTree: null,//add
     setting: {
         header:[
@@ -84,7 +83,10 @@ let repositoryGljObj = {
             {headerName:"单位",headerWidth:45,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
             {headerName:"定额价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
             {headerName:"类型",headerWidth:90,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
-            {headerName:"机型",headerWidth:60,dataCode:"model", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"毛重系数",headerWidth:90,dataCode:"grossWeightCoe", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"采购保管费率",headerWidth:90,dataCode:"purchaseStorageRate", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"场外运输损耗率",headerWidth:100,dataCode:"offSiteTransportLossRate", dataType: "Number", hAlign: "center", vAlign: "center"},
+            {headerName:"每增一次装卸损耗率",headerWidth:100,dataCode:"handlingLossRate", dataType: "Number", hAlign: "center", vAlign: "center"},
             {headerName:"是否新增",headerWidth:60,dataCode:"isComplementary", hAlign: "center", vAlign: "center"}
         ],
         view:{
@@ -111,10 +113,9 @@ let repositoryGljObj = {
         sheet.resumeEvent();
     },
     getComboData: function (gljDistType) {
-        let me = this;
         let distType;
         let distTypeTree = {
-            prefix: 'gljType',
+            prefix : 'gljType',
             distTypes: {},
             comboDatas: [],
             distTypesArr: []
@@ -124,20 +125,20 @@ let repositoryGljObj = {
                 data: typeData,
                 children: [],
                 parent: null
-            }
+            };
             distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
             distTypeTree.distTypesArr.push(typeObj);
         });
         gljDistType.forEach(function (typeData) {
             distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
             let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
-            if (parent) {
+            if(parent){
                 distType.parent = parent;
                 parent.children.push(distType);
             }
         });
         distTypeTree.distTypesArr.forEach(function (distTypeObj) {
-            if (distTypeObj.data.fullName !== '材料' && distTypeObj.data.fullName !== '机械') {
+            if(allowGljType.includes(distTypeObj.data.ID)){
                 distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
             }
         });
@@ -170,7 +171,6 @@ let repositoryGljObj = {
         });
     },
     getGljItems: function(stdGljLibId, callback) {
-        console.log('enterGG');
         let me = this;
         CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
@@ -217,11 +217,8 @@ let repositoryGljObj = {
                     sheet.setCellType(row, isComplementaryCol, baseCell);
                 }
             });
-            sheetOpr.showData(sheet, me.setting, cacheSection, me.distTypeTree, me.machineModelIdx);
+            sheetOpr.showData(sheet, me.setting, cacheSection, me.distTypeTree);
             sheetCommonObj.setDynamicCombo(sheet, 0, 5, sheet.getRowCount(), me.distTypeTree.comboDatas, false, 'text');
-            sheetCommonObj.setDynamicCombo(sheet, 0, 6, sheet.getRowCount(), me.machineModel.comboItems, false, 'text');
-
-
             cacheSection = null;
         }
     },
@@ -277,21 +274,6 @@ let repositoryGljObj = {
         return v !== undefined && v !== null;
     },
 
-    //成为了组成物,暂时只需要判断主材的
-    isComponent: function (gljId, gljList) {
-        for(let i = 0, len = gljList.length; i < len; i++){
-            let gljComponent = gljList[i].component;
-            if(gljList[i].gljType === 4 && this.isDef(gljComponent) && gljComponent.length > 0){
-                for(let j = 0, jLen = gljComponent.length; j < jLen; j++){
-                    if(gljComponent[j].ID === gljId){
-                        return true;
-                    }
-                }
-            }
-        }
-        return false;
-    },
-
     getCurrentComponent: function (gljComponent) {
         let me = repositoryGljObj, rst = [];
         for(let i = 0; i < gljComponent.length; i++){
@@ -405,11 +387,9 @@ let repositoryGljObj = {
                     }
                 }
             }
-        }
-        else{
+        } else{
             me.currentGlj = null;
         }
-
         //组成物表能编辑则显示,否则隐藏该工作表
         let rightWidth = getLocalCache('compleGLjrightContentWidth') || '25%';
         rightWidth = rightWidth.replace('%', '');
@@ -503,7 +483,7 @@ let repositoryGljObj = {
     },
     onButtonClicked: function (sender, args) {
         let me = repositoryGljObj;
-        if(args.col === 6 && args.row < me.currentCache.length){
+        if(me.setting.header[args.col].dataCode === 'isComplementary' && args.row < me.currentCache.length){
             args.sheet.setValue(args.row, args.col, true);
         }
     },
@@ -512,18 +492,19 @@ let repositoryGljObj = {
         let rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row);
         me.currentEditingGlj = rObj;
         me.orgCode = me.workBook.getSheet(0).getValue(args.row, 0);
+        let dataCode = me.setting.header[args.col].dataCode;
         if(args.row < me.currentCache.length){
             me.currentGlj = me.currentCache[args.row];
-            if(args.col === 0 || (args.col === 4 && allowComponent.includes(me.currentGlj.gljType) && me.currentGlj.component.length > 0)
-                || (args.col === 6 && me.currentGlj.gljType !== 301) || args.col === 7){
+            //费率数据列只有普通材料能用,可添加组成物的人材机,基价只读
+            if (dataCode === 'code'|| (me.feeDataCode.includes(dataCode) && me.currentGlj.gljType !== 201) ||
+                (dataCode === 'basePrice' && allowComponent.includes(me.currentGlj.gljType)) ||
+                dataCode === 'isComplementary'){
                 args.cancel = true;
-            }
-            else {
+            } else {
                 rObj.ID = me.currentGlj.ID;
                 rObj.gljClass = me.currentGlj.gljClass;
             }
-        }
-        else {
+        } else {
             me.currentGlj = null;
         }
     },
@@ -531,29 +512,29 @@ let repositoryGljObj = {
         let me = repositoryGljObj, that = gljComponentOprObj,
             rObj = sheetOpr.combineRowData(me.workBook.getSheet(0), me.setting, args.row, me),
             updateArr = [], addArr = [], updateBasePrcArr = [];
+        let dataCode = me.setting.header[args.col].dataCode;
         me.editingRowIdx = args.row;
         rObj.basePrice = rObj.basePrice ? rObj.basePrice : 0;
         //更新
         if (me.currentEditingGlj["ID"]) {
             rObj["ID"] = me.currentEditingGlj["ID"];
             rObj.gljClass = me.currentEditingGlj.gljClass;
-            //for(let col =0; col< me.setting.header.length; col++){
-                if(me.currentEditingGlj[me.setting.header[args.col].dataCode] !== rObj[me.setting.header[args.col].dataCode]){
-                    //me.addGljObj = rObj;
+                if(me.currentEditingGlj[dataCode] !== rObj[dataCode]){
                     //编码、名称、单位、类型不可为空
-                    if(rObj[me.setting.header[0].dataCode] && rObj[me.setting.header[1].dataCode] && rObj[me.setting.header[3].dataCode] && rObj[me.setting.header[5].dataCode]
-                    &&rObj[me.setting.header[0].dataCode].toString().trim().length !== 0 && rObj[me.setting.header[1].dataCode].toString().trim().length !== 0 && rObj[me.setting.header[3].dataCode].toString().trim().length !== 0&&
-                        rObj[me.setting.header[5].dataCode].toString().trim().length !== 0){
+                    if(rObj.code && rObj.name && rObj.unit && rObj.gljType
+                    &&rObj.code.toString().trim().length !== 0 && rObj.name.toString().trim().length !== 0 && rObj.unit.toString().trim().length !== 0&&
+                        rObj.gljType.toString().trim().length !== 0){
                         if(rObj.gljType !== me.currentEditingGlj.gljType){//修改了工料机类型
-                                if(me.currentGlj){
-                                    me.currentGlj.component = [];
+                            if(me.currentGlj){
+                                me.currentGlj.component = [];
+                            }
+                            //工料机类型不为普通材料时,情况费率数据
+                            if (me.currentEditingGlj.gljType === 201 && rObj.gljType !== 201) {
+                                for (let feeCode of me.feeDataCode) {
+                                    if (me.currentEditingGlj[feeCode]) {
+                                        rObj[feeCode] = null;
+                                    }
                                 }
-                               /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
-                                    rObj.basePrice = 0;
-                                }*/
-                            //工料机类型不为机械台班时,清空机型
-                            if(me.currentEditingGlj.gljType === 301 && rObj.gljType !== 301 && me.currentEditingGlj.model){
-                                rObj.model = null;
                             }
                             if(componentType.includes(me.currentEditingGlj.gljType) &&
                                 !(machineComponent.includes(me.currentEditingGlj.gljType) && machineComponent.includes(rObj.gljType))
@@ -570,8 +551,13 @@ let repositoryGljObj = {
                                 }
                             }
                             sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, 5);
-                        }
-                        else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
+                        } else if (me.feeDataCode.includes(dataCode) && rObj[dataCode] !== me.currentEditingGlj[dataCode]) {
+                            if(isNaN(rObj[dataCode])){
+                                args.sheet.setValue(args.row, args.col, me.currentEditingGlj[dataCode] ? me.currentEditingGlj[dataCode] : '');
+                                alert(`${me.setting.header[args.col].headerName}只能输入数值!`);
+                                return;
+                            }
+                        } else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
                             //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
                             if(isNaN(parseFloat(rObj.basePrice))){
                                 alert('单价只能为数值!');
@@ -588,22 +574,20 @@ let repositoryGljObj = {
                                     updateArr.push(updateGljs.updateBasePrcArr[i]);
                                 }
                             }
-                            //rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? that.round(parseFloat(rObj.basePrice), 2) : 0;
                         }
                         rObj.component = me.currentGlj.component;
                         updateArr.push(rObj);
                     }
                     else{
-                        if(me.setting.header[args.col].dataCode === 'gljType'){
-                            let distTypeVal =  me.distTypeTree.distTypes[me.distTypeTree.prefix + me.currentEditingGlj[me.setting.header[args.col].dataCode]].data.fullName;
+                        if(dataCode === 'gljType'){
+                            let distTypeVal =  me.distTypeTree.distTypes[me.distTypeTree.prefix + me.currentEditingGlj[dataCode]].data.fullName;
                             args.sheet.setValue(args.row, args.col, distTypeVal);
                         }
                         else{
-                            args.sheet.setValue(args.row, args.col, me.currentEditingGlj[me.setting.header[args.col].dataCode]);
+                            args.sheet.setValue(args.row, args.col, me.currentEditingGlj[dataCode]);
                         }
                     }
                 }
-          //  }
             //--------------------------------------
             if(me.currentEditingGlj.basePrice !== rObj.basePrice){
                 //update basePrice of ration when editting basePrice of glj
@@ -634,16 +618,12 @@ let repositoryGljObj = {
             if(typeof rObj.code !== 'undefined'){
                 me.addGljObj = rObj;
                 let isCanSav = true;
-                if(!rObj[me.setting.header[0].dataCode] || !rObj[me.setting.header[1].dataCode] || !rObj[me.setting.header[3].dataCode] || !rObj[me.setting.header[5].dataCode]){
+                if(!rObj.code || !rObj.name || !rObj.unit || !rObj.gljType){
                     isCanSav = false;
                 }
                 if(isCanSav){
                     me.addGljObj = null;
                     rObj.component = [];
-                    //如果类型为混凝土、砂浆、配合比、机械台班时,添加时填写的单价清空
-                   /* if(me.allowComponent.indexOf(rObj.gljType) !== -1){
-                        rObj.basePrice = 0;
-                    }*/
                     rObj.basePrice = !isNaN(parseFloat(rObj.basePrice)) && (rObj.basePrice && typeof rObj.basePrice !== 'undefined') ? parseFloat(rObj.basePrice) : 0;
                     addArr.push(rObj);
                 }
@@ -659,10 +639,7 @@ let repositoryGljObj = {
     },
     delGljs: function (sels) {
         let me = repositoryGljObj;
-        let sheet = me.workBook.getSheet(0),
-            updateArr = [], removeArr = [],
-            tempRemoveArr= [],
-            refGljCodes = [], //已被引用的工料机
+        let updateArr = [], removeArr = [],
             updateBasePrcArr = [],//删除基价单位后重新计算
             canUpdate = false,
             cacheSection = me.currentCache;
@@ -682,7 +659,6 @@ let repositoryGljObj = {
                                 }
                             }
                             removeArr.push(cacheSection[sels[i].row + j].ID);
-                            //tempRemoveArr.push({ID: cacheSection[sels[i].row + j].ID, code: cacheSection[sels[i].row + j].code});
                             //删除后重新计算引用了此工料机的定额单价
                             updateBasePrcArr.push({gljId: cacheSection[sels[i].row + j].ID, gljType: cacheSection[sels[i].row + j].gljType, basePrice: 0, delete: 1});
                         }
@@ -807,7 +783,6 @@ let repositoryGljObj = {
     validUpdateObj: function (pasteObj, rowIdx) {
         let rst = {updateGlj: [], updateBasePrcArr: []}, backUpObj = {},
             me = repositoryGljObj,
-            that = gljComponentOprObj,
             tempObj = me.currentCache[rowIdx],
             reCalBasePrc = false,
             isValid = true;
@@ -856,8 +831,10 @@ let repositoryGljObj = {
                     pasteObj.gljType = me.distTypeTree.comboDatas[i].value;
                     isExsit = true;
                     reCalBasePrc = true;
-                    if(pasteObj.gljType !== 301 && tempObj.gljType === 301){
-                        tempObj.model = null;
+                    if (pasteObj.gljType !== 201 && tempObj.gljType === 201) {
+                        for (let feeCode of me.feeDataCode) {
+                            tempObj[feeCode] = null;
+                        }
                     }
                     if(componentType.includes(tempObj.gljType)&&
                         !(machineComponent.includes(tempObj.gljType) && machineComponent.includes(pasteObj.gljType)) &&
@@ -874,9 +851,6 @@ let repositoryGljObj = {
                         }
                     }
                     tempObj.component = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.component : [];
-                    /*if(me.allowComponent.indexOf(tempObj.gljType) !== -1){
-                        tempObj.basePrice = tempObj.gljType === me.distTypeTree.comboDatas[i].value ? tempObj.basePrice : 0;
-                    }*/
                     tempObj.gljType = me.distTypeTree.comboDatas[i].value;
                     tempObj.shortName = me.distTypeTree.distTypes[me.distTypeTree.prefix + tempObj.gljType].data.shortName;
                     break;
@@ -884,6 +858,16 @@ let repositoryGljObj = {
             }
             if(!isExsit) isValid = false;
         }
+        for (let feeCode of me.feeDataCode) {
+            if (typeof pasteObj[feeCode] !== 'undefined' && !isNaN(pasteObj[feeCode])) {
+                if ((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 201) ||
+                    (tempObj.gljType && tempObj.gljType === 201)) {
+                    tempObj[feeCode] = pasteObj[feeCode];
+                } else {
+                    isValid = false;
+                }
+            }
+        }
         //
         pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? scMathUtil.roundTo(parseFloat(pasteObj.basePrice), 2) :
             me.currentCache[rowIdx].basePrice;
@@ -900,34 +884,10 @@ let repositoryGljObj = {
                 }
             }
         }
-        if(typeof pasteObj.model !== 'undefined'){
-            if(!me.machineModel.textArr.includes(pasteObj.model)){
-                isValid = false;
-            }
-            else {
-                let existsModel = false;
-                if((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 301) ||
-                    (tempObj.gljType && tempObj.gljType === 301)){
-                    me.machineModel.comboItems.forEach(function (item) {
-                        if(item.text === pasteObj.model){
-                            tempObj.model = item.value;
-                            existsModel = true;
-                        }
-                    });
-                    if(!existsModel){
-                        isValid = false;
-                    }
-                }
-                else {
-                    isValid = false;
-                }
-            }
-        }
         if(isValid){
             rst.updateGlj.push(tempObj);
             if(reCalBasePrc){
                 //重新计算定额基价对象
-                //rst.updateBasePrc = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
                 let newReObj = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
                 rst.updateBasePrcArr.push(newReObj);
             }
@@ -973,15 +933,10 @@ let repositoryGljObj = {
             }
 
         }
-        if(typeof pasteObj.model !== 'undefined' && pasteObj.model){
-            if(!me.machineModel.textArr.includes(pasteObj.model) || pasteObj.gljType !== 301){
+        for (let feeCode of me.feeDataCode) {
+            if (typeof pasteObj[feeCode] !== 'undefined' && (isNaN(pasteObj[feeCode]) || pasteObj.gljType !== 201)) {
                 return false;
             }
-            me.machineModel.comboItems.forEach(function (item) {
-                if(item.text === pasteObj.model){
-                    pasteObj.model = item.value;
-                }
-            });
         }
         pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? parseFloat(pasteObj.basePrice) : 0;
         if(!me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
@@ -1002,6 +957,7 @@ let repositoryGljObj = {
             if(info.cellRange.col === 0){
                 return false;
             }
+            //可添加组成物的人材机基价由组成物基价计算得来,基价列只读
             else if(info.cellRange.col <= 4 && info.cellRange.col + info.cellRange.colCount - 1 >= 4){
                 for(let i = 0, len = info.cellRange.rowCount; i < len; i++){
                     let row = i + info.cellRange.row;
@@ -1020,13 +976,11 @@ let repositoryGljObj = {
     },
     onClipboardPasting: function(sender, args) {
         let me = repositoryGljObj;
-        let maxCol = args.cellRange.col + args.cellRange.colCount - 1;
         if (!me.canPasted(args)) {
             args.cancel = true;
         }
     },
     onClipboardPasted: function(e, info) {
-        //  if(info.pasteData.text.trim().length > 0){
         let me = repositoryGljObj;
         let updateArr = [], addArr = [];
         let items = sheetOpr.analyzePasteData(me.setting, info);
@@ -1034,20 +988,17 @@ let repositoryGljObj = {
             maxRow = me.currentCache.length - 1,//当前数据最大行数
             updateBasePrcArr = [] ,
             updateCount, resumeArr = [];
-        if(endRow <= maxRow){
-            //updateItems = items;
+        if(endRow <= maxRow){//只有更新
             for(let i = 0; i < items.length; i++){
                 let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
                 if(updateObj && typeof updateObj.updateGlj !== 'undefined' && updateObj.updateGlj.length > 0){
-                    //updateArr = updateObj.updateGlj;
                     updateArr = updateArr.concat(updateObj.updateGlj);
                     if(typeof updateObj.updateBasePrcArr !== 'undefined'){
                         updateBasePrcArr = updateBasePrcArr.concat(updateObj.updateBasePrcArr);
                     }
                 }
             }
-        }
-        else if(beginRow <= maxRow && endRow > maxRow){
+        } else if(beginRow <= maxRow && endRow > maxRow){//更新+新增
             updateCount = maxRow - beginRow + 1;
             for(let i = 0; i < updateCount; i++){
                 let updateObj = me.validUpdateObj(items[i], info.cellRange.row + i);
@@ -1059,29 +1010,17 @@ let repositoryGljObj = {
                     }
                 }
             }
-            if(info.cellRange.colCount === me.setting.header.length -1){
-                for(let i = updateCount ; i < items.length; i++){
-                    if(me.isValidObj(items[i])){
-                        items[i].component = [];
-                        //类型为混凝土、砂浆、配合比、机械时,基价只能组成物计算
-                        /* if(me.allowComponent.indexOf(items[i].gljType) !== -1){
-                         items[i].basePrice = 0;
-                         }*/
-                        addArr.push(items[i]);
-                    }
+            for(let i = updateCount ; i < items.length; i++){
+                if(me.isValidObj(items[i])){
+                    items[i].component = [];
+                    addArr.push(items[i]);
                 }
             }
-        }
-        else{
-            if(info.cellRange.colCount === me.setting.header.length -1){
-                for(let i = 0; i < items.length; i++){
-                    if(me.isValidObj(items[i])){
-                        items[i].component = [];
-                        /*if(me.allowComponent.indexOf(items[i].gljType) !== -1){
-                         items[i].basePrice = 0;
-                         }*/
-                        addArr.push(items[i]);
-                    }
+        } else{//新增
+            for(let i = 0; i < items.length; i++){
+                if(me.isValidObj(items[i])){
+                    items[i].component = [];
+                    addArr.push(items[i]);
                 }
             }
         }
@@ -1095,15 +1034,13 @@ let repositoryGljObj = {
             for(let i = 0; i < resumeArr.length ; i++){
                 if(resumeArr[i] < me.currentCache.length){
                     for(let col = 0; col < me.setting.header.length -1; col++){
-                        if(me.setting.header[col].dataCode === 'gljType'){
-                            let gljType = me.currentCache[resumeArr[i]][me.setting.header[col].dataCode];
+                        let dCode = me.setting.header[col].dataCode;
+                        if(dCode === 'gljType'){
+                            let gljType = me.currentCache[resumeArr[i]][dCode];
                             sheet.setValue(resumeArr[i], col, me.distTypeTree.distTypes["gljType" + gljType].data.fullName);
                         }
-                        else if(me.setting.header[col].dataCode === 'model'){
-                            sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode] ? me.machineModelIdx[me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]]: '');
-                        }
                         else{
-                            sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][me.setting.header[col].dataCode]);
+                            sheet.setValue(resumeArr[i], col, me.currentCache[resumeArr[i]][dCode]);
                         }
                     }
                 }
@@ -1121,7 +1058,6 @@ let repositoryGljObj = {
         if(updateBasePrcArr.length > 0 && me.rationLibs.length > 0){
             me.updateRationBasePrcRq(updateBasePrcArr);
         }
-        // }
     },
     updateRationBasePrcRq: function (basePrcArr) {
         CommonAjax.post('/complementartGlj/api/updateRationBasePrc', {basePrcArr: basePrcArr}, function (rstData) {
@@ -1163,10 +1099,11 @@ let repositoryGljObj = {
             me.showGljItems(me.complementaryGljList, me.gljCurTypeId);
             //getCurrentGlj
             let row = me.workBook.getSheet(0).getSelections()[0].row;
-            me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
+           /* me.currentGlj = row < me.currentCache.length ? me.currentCache[row] : null;
             me.currentComponent = me.currentGlj ?  me.getCurrentComponent(me.currentGlj.component) : [];
             sheetOpr.cleanData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, -1);
-            sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);
+            sheetOpr.showData(gljComponentOprObj.workBook.getSheet(0), gljComponentOprObj.setting, me.currentComponent);*/
+            me.initSel(row);
         }
         let errCaller = function (err) {
             alert('保存失败');

+ 2 - 3
web/building_saas/complementary_glj_lib/js/gljComponent.js

@@ -220,7 +220,6 @@ let gljComponentOprObj = {
         if(thatRow < that.currentCache.length){
             that.currentGlj = that.currentCache[thatRow];
             if(me.setting.view.lockedCols.indexOf(args.col) !== -1 || !allowComponent.includes(that.currentGlj.gljType) ||
-                (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.stdGljList.concat(that.complementaryGljList))) ||
                 (args.col === 4 && (!that.currentComponent|| args.row >= that.currentComponent.length))){
                 args.cancel = true;
             }
@@ -359,8 +358,8 @@ let gljComponentOprObj = {
         let me = gljComponentOprObj, that = repositoryGljObj;
         let maxCol = info.cellRange.col + info.cellRange.colCount - 1;
         //复制的列数超过正确的列数,不可复制
-        if(info.cellRange.col !== 4 && info.cellRange.colCount > 1 || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.stdGljList.concat(that.complementaryGljList)))){
-            args.cancel = true;
+        if(info.cellRange.col !== 4 && info.cellRange.colCount > 1){
+            info.cancel = true;
         }
     },
     onClipboardPasted: function (sender, info) {

+ 1 - 12
web/building_saas/complementary_glj_lib/js/sheetOpr.js

@@ -113,7 +113,7 @@ let sheetOpr = {
             area.vAlign(GC.Spread.Sheets.VerticalAlign.center);
         }
     },
-    showData: function(sheet, setting, data, distTypeTree, machineModelIdx) {
+    showData: function(sheet, setting, data, distTypeTree) {
         var me = this, ch = GC.Spread.Sheets.SheetArea.viewport;
         sheet.suspendPaint();
         sheet.suspendEvent();
@@ -141,9 +141,6 @@ let sheetOpr = {
                     let distTypeVal =  distTypeTree.distTypes[distTypeTree.prefix + data[row].gljType].data.fullName;
                     sheet.setValue(row, col, distTypeVal, ch);
                 }
-                else if(setting.header[col].dataCode === 'model' && data[row].model){
-                    sheet.setValue(row, col, machineModelIdx ? machineModelIdx[data[row].model] : '');
-                }
                 else {
                     sheet.setValue(row, col, data[row][setting.header[col].dataCode], ch);
                     sheet.setTag(row, 0, data[row].ID, ch);
@@ -200,7 +197,6 @@ let sheetOpr = {
         var rst = {};
         let comboBoxCellType = sheet.getCellType(row, 5);
         let items = comboBoxCellType.items();
-        let machineItems = sheet.getCellType(row, 6).items();
         for (var col = 0; col < setting.header.length; col++) {
             if(setting.header[col].dataCode === 'gljType'){
                 items.forEach(function(item){
@@ -212,13 +208,6 @@ let sheetOpr = {
                     }
                 });
             }
-            else if(setting.header[col].dataCode === 'model'){
-                machineItems.forEach(function(item){
-                    if(sheet.getValue(row, col) === item.text){
-                        rst[setting.header[col].dataCode] = item.value;
-                    }
-                });
-            }
             else if (setting.header[col].dataCode === 'code'){
                 if(repositoryGljObj){
                     let stdGljList = repositoryGljObj.stdGljList,

+ 0 - 7
web/building_saas/main/js/models/bills.js

@@ -792,13 +792,6 @@ var Bills = {
                     }
                     gljOprObj.refreshView();
                 });
-                //添加内容为定额子目时,根据特征及内容添加规则刷新清单
-                if(updateData['ration']){
-                    let addRuleSetting = getAddRuleSetting();
-                    if(addRuleSetting && addRuleSetting.addContent === '5'){
-                        addRuleUseToBills(getAddRuleSetting(), projectObj.project.mainTree.items);
-                    }
-                };
 
                 if (isDeleteChild){
                     calcTools.forceSelect(parentNode);

+ 16 - 26
web/building_saas/main/js/views/project_property_projFeature.js

@@ -20,10 +20,11 @@ let projFeatureView = {
             allowUserDragFill: false,
             scrollbarMaxAlign : true
         },
-        numRows: [],//6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+        numRows: [],
+        combos: [],
         dateRows: [],
         locked: {
-            rows: [0, 1],
+            rows: [0],
             cols: [0]
         }
     },
@@ -79,7 +80,7 @@ let projFeatureView = {
         if(!this.workBook){
             this.workBook = new GC.Spread.Sheets.Workbook($('#projFeatureSpread')[0], {sheetCount: 1});
             sheetCommonObj.spreadDefaultStyle(this.workBook);
-            sheetCommonObj.bindEscKey(this.workBook, [{sheet: this.workBook.getSheet(0), editStarting: this.onEditStarting, editEnded: this.onEditEnded}]);
+            sheetCommonObj.bindEscKey(this.workBook, [{sheet: this.workBook.getSheet(0), editStarting: null, editEnded: this.onEditEnded}]);
             this.setOptions(this.workBook, this.setting.options);
             this.buildHeader(this.workBook.getActiveSheet(), this.setting.header);
             this.bindEvent(this.workBook);
@@ -89,10 +90,9 @@ let projFeatureView = {
     bindEvent: function (workBook) {
         const _events = GC.Spread.Sheets.Events;
         let sheet = workBook.getActiveSheet();
-        sheet.bind(_events.EditStarting, this.onEditStarting);
+        sheet.options.isProtected = true;
         sheet.bind(_events.EditEnded, this.onEditEnded);
         sheet.bind(_events.EnterCell, this.onEnterCell);
-        sheet.bind(_events.ClipboardPasting, this.onClipboardPasting);
         sheet.bind(_events.ClipboardPasted, this.onClipboardPasted);
     },
 
@@ -105,6 +105,10 @@ let projFeatureView = {
             me.initTree(sheet, true, datas);
             sheet.setFormatter(-1, 1, '@');
            for(let row = 0;row < datas.length ; row ++){
+               //锁定
+               if (!me.setting.locked.rows.includes(row)) {
+                   sheet.getCell(row, 1).locked(false);
+               }
                if(datas[row].cellType == 'comboBox'){
                    let options = datas[row].options?datas[row].options.split("@"):[];
                    me.setCombo(sheet, row, options);
@@ -119,16 +123,6 @@ let projFeatureView = {
         this.renderSheetFuc(sheet, fuc);
     },
 
-    onEditStarting: function (sender, args) {
-        let me = projFeatureView;
-        if(me.setting.locked.cols.indexOf(args.col) !== -1){
-            args.cancel = true;
-        }
-        if(args.col === 1 && me.setting.locked.rows.indexOf(args.row) !== -1){
-            args.cancel = true;
-        }
-    },
-
     onEditEnded: function (sender, args) {
         let me = projFeatureView;
         let v =  args.editingText ? args.editingText.toString().trim() : '';
@@ -148,13 +142,6 @@ let projFeatureView = {
         args.sheet.repaint();
     },
 
-    onClipboardPasting: function (sender, args) {
-        let me = projFeatureView;
-        if(me.setting.locked.cols.indexOf(args.cellRange.col) !== -1){
-            args.cancel = true;
-        }
-    },
-
     onClipboardPasted: function (sender, args) {
         let me = projFeatureView;
         let items = sheetCommonObj.analyzePasteData(me.setting, args);
@@ -165,11 +152,8 @@ let projFeatureView = {
         for(let i = 0, len = items.length; i < len; i++){
             let row = i + args.cellRange.row;
             let comboItems = me.getComboItemsByRow(row);
-            if(me.setting.locked.rows.indexOf(row) !== -1){
-                recRows.push(row);
-            }
             //粘贴下拉框数据过滤
-            else if(comboItems && comboItems.indexOf(items[i].value) !== -1){
+            if(comboItems && comboItems.indexOf(items[i].value) !== -1){
                 recRows.push(row);
             }
             else if(me.setting.numRows.indexOf(row) !== -1 && !me.isNum(items[i].value)){
@@ -220,6 +204,12 @@ let projFeatureView = {
     initDatas: function (datas) {
         this.datas = [];
         for(let i = 0, len = datas.length; i < len; i++){
+            if (typeof datas[i].readOnly === 'string') {
+                datas[i].readOnly = JSON.parse(datas[i].readOnly);
+            }
+            if (datas[i].readOnly && !this.setting.locked.rows.includes(i)) {
+                this.setting.locked.rows.push(i);
+            }
             this.datas.push(this.copyObj(datas[i]));
         }
     },