ソースを参照

清除注释掉的代码

zhongzewei 6 年 前
コミット
ea61f004ac

+ 9 - 164
web/maintain/std_glj_lib/js/glj.js

@@ -247,22 +247,20 @@ let repositoryGljObj = {
                 children: [],
                 parent: null
             };
-                distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
-                distTypeTree.distTypesArr.push(typeObj);
+            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){
-                    distType.parent = parent;
-                    parent.children.push(distType);
-                }
+            distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
+            let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
+            if(parent){
+                distType.parent = parent;
+                parent.children.push(distType);
+            }
         });
         distTypeTree.distTypesArr.forEach(function (distTypeObj) {
             if(allowGljType.includes(distTypeObj.data.ID)){
-            //if(distTypeObj.data.fullName !== '材料' && distTypeObj.data.fullName !== '机械'){
                 distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
-         //   }
             }
         });
         return distTypeTree;
@@ -498,17 +496,6 @@ let repositoryGljObj = {
                 }
             }
             if(isChange){//引用了此组成物
-              /*  let gljBasePrc = that.reCalGljBasePrc(me.getCurrentComponent(thisComponent));
-                if(me.gljList[i].basePrice !== gljBasePrc){
-                    me.gljList[i].basePrice = gljBasePrc;
-                    rst.updateBasePrcArr.push({gljId: me.gljList[i].ID, gljType: me.gljList[i].gljType, basePrice: me.gljList[i].basePrice});
-                }
-                rst.updateArr.push(me.gljList[i]);*/
-             /*   let gljBasePrc = that.reCalGljBasePrc(me.getCurrentComponent(thisComponent));
-                if(me.isGljPriceChange(me.gljList[i], gljBasePrc)){
-                    me.setGljPrice(me.gljList[i], gljBasePrc);
-                    rst.updateBasePrcArr.push({gljId: me.gljList[i].ID, gljType: me.gljList[i].gljType, basePrice: me.getRationGljPrice(me.gljList[i])});
-                }*/
                 rst.updateArr.push(me.gljList[i]);
             }
         }
@@ -527,25 +514,6 @@ let repositoryGljObj = {
         sheet.resumeEvent();
         sheet.resumePaint();
     },
-/*    reshowGljBasePrc: function (glj) {
-        let me = repositoryGljObj;
-        let cacheSection = me.currentCache;
-        let basePriceCol = me.colMapping.fieldToCol['basePrice'];
-        let sheet = me.workBook.getActiveSheet();
-        for(let i = 0; i < cacheSection.length; i++){
-            if(glj.ID === cacheSection[i].ID){
-                cacheSection[i].basePrice = glj.basePrice;
-                sheet.suspendEvent();
-                sheet.suspendPaint();
-                for(let priceCol of me.priceCols){
-                    sheet.setValue(i, priceCol, glj.basePrice);
-                }
-                sheet.resumeEvent();
-                sheet.resumePaint();
-                break;
-            }
-        }
-    },*/
     reSetGljBasePrc: function (gljs) {
         let me = repositoryGljObj;
         let cacheSection = me.currentCache;
@@ -733,37 +701,6 @@ let repositoryGljObj = {
             if(me.dataChanged(me.currentEditingGlj, rObj, args.col)){
                 if(rObj.code && rObj.name && rObj.gljType &&
                     rObj.code.toString().trim().length !== 0 && rObj.name.toString().trim().length !== 0 && rObj.gljType.toString().trim().length !== 0){
-                   /* if(rObj.gljType !== me.currentEditingGlj.gljType){//修改了工料机类型
-                        if(me.currentGlj){
-                            me.currentGlj.component = [];
-                        }
-                        /!*if(me.allowComponent.indexOf(rObj.gljType) !== -1){//更改成可添加组成物的类型,则将定额价设成零
-                         rObj.basePrice = 0;
-                         }*!/
-                        //调整系数,工料机类型为人工和机上人工时,可输入整数
-                        if((me.currentEditingGlj.gljType === 1 || me.currentEditingGlj.gljType === 303) && !(rObj.gljType === 1 || rObj.gljType === 303)){
-                            rObj.adjCoe = null;
-                        }
-                        //工料机类型不为机械台班时,清空机型
-                        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)) &&
-                            !(materialComponent.includes(me.currentEditingGlj.gljType) && materialComponent.includes(rObj.gljType))){//修改了原本是组成物的工料机
-                            //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
-                            let updateGljs = me.getUpdateGljs(rObj, true);
-                            if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
-                                for(let i = 0; i < updateGljs.updateArr.length; i++){
-                                    updateArr.push(updateGljs.updateArr[i]);
-                                }
-                                for(let i = 0; i < updateGljs.updateBasePrcArr.length; i++){
-                                    updateArr.push(updateGljs.updateBasePrcArr[i]);
-                                }
-                            }
-                        }
-                        sheetCommonObj.cleanData(that.workBook.getSheet(0), that.setting, 5);
-                    }*/
                     if(rObj.gljType !== me.currentEditingGlj.gljType){//修改了工料机类型
                         if(!$('#typeAlert').is(':visible')){
                             $('#typeAlert').modal('show');
@@ -803,12 +740,6 @@ let repositoryGljObj = {
                             rObj.component = me.currentGlj.component;
                             updateArr.push(rObj);
                             me.mixUpdateRequest(updateArr, [], []);
-                            //let gljTypeObj = {gljId: me.currentEditingGlj.ID, gljType: rObj.gljType, basePrice: rObj.basePrice};
-                       /*     let gljTypeObj = {gljId: me.currentEditingGlj.ID, gljType: rObj.gljType, basePrice: me.getRationGljPrice(rObj)};
-                            updateBasePrcArr.push(gljTypeObj);
-                            if(me.rationLibs.length > 0){
-                                me.updateRationBasePrcRq(updateBasePrcArr);
-                            }*/
                         });
                         $('.typeClose').unbind('click');
                         $('.typeClose').bind('click', function () {
@@ -832,24 +763,6 @@ let repositoryGljObj = {
                         }
                         rObj.materialCoe = scMathUtil.roundTo(parseFloat(rObj.materialCoe), -5);
                     }
-                    /*else if(rObj.basePrice !== me.currentEditingGlj.basePrice){//修改了单价,可修改单价的必为可成为组成物的
-                        //寻找所有引用了此组成物的工料机,并从组成物中删去此工料机,并重算单价
-                        if(isNaN(parseFloat(rObj.basePrice))){
-                            alert('单价只能输入数值!');
-                            args.sheet.setValue(args.row, args.col, me.currentEditingGlj.basePrice ? me.currentEditingGlj.basePrice : 0);
-                            return;
-                        }
-                        rObj.basePrice = !isNaN(parseFloat(rObj.basePrice))? scMathUtil.roundTo(parseFloat(rObj.basePrice), -2) : me.currentEditingGlj.basePrice;
-                        let updateGljs = me.getUpdateGljs(rObj);
-                        if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
-                            for(let i = 0; i < updateGljs.updateArr.length; i++){
-                                updateArr.push(updateGljs.updateArr[i]);
-                            }
-                            for(let i = 0; i < updateGljs.updateBasePrcArr.length; i++){
-                                updateArr.push(updateGljs.updateBasePrcArr[i]);
-                            }
-                        }
-                    }*/
                     else if(!me.priceIsEqual(rObj, me.currentEditingGlj)){//修改了单价,可修改单价的必为可成为组成物的
                         let rObjPrice = me.getPrice(rObj, args.col),
                             editingGljPrice = me.getPrice(me.currentEditingGlj, args.col);
@@ -883,24 +796,6 @@ let repositoryGljObj = {
                     }
                 }
             }
-            /*if(me.currentEditingGlj.basePrice !== rObj.basePrice){
-                //update basePrice of ration when editting basePrice of glj
-                let gljType = -1;
-                let gljTypeParent = me.distTypeTree.distTypes[me.distTypeTree.prefix + me.currentEditingGlj.gljType].parent;
-                if(gljTypeParent && gljTypeParent.data.ID <=3){
-                    gljType = gljTypeParent.data.ID;
-                }
-                if(!gljTypeParent && me.currentEditingGlj.gljType <= 3){
-                    gljType = me.currentEditingGlj.gljType;
-                }
-                let gljBasePrcObj = {gljId: me.currentEditingGlj.ID, gljType: gljType, basePrice: rObj.basePrice};
-                if(gljBasePrcObj.gljType !== -1){
-                    updateBasePrcArr.push(gljBasePrcObj);
-                    if(me.rationLibs.length > 0){//重算定额单价
-                        me.updateRationBasePrcRq(updateBasePrcArr);
-                    }
-                }
-            }*/
             if(!me.priceIsEqual(rObj, me.currentEditingGlj)){
                 console.log('df');
                 //update basePrice of ration when editting basePrice of glj
@@ -920,15 +815,6 @@ let repositoryGljObj = {
                     }
                 }
             }
-            //update basePrice of ration when editting gljType of glj
-         /*   if(me.currentEditingGlj.gljType !== rObj.gljType){
-
-                let gljTypeObj = {gljId: me.currentEditingGlj.ID, gljType: rObj.gljType, basePrice: rObj.basePrice};
-                updateBasePrcArr.push(gljTypeObj);
-                if(me.rationLibs.length > 0){
-                    me.updateRationBasePrcRq(updateBasePrcArr);
-                }
-            }*/
         }
         //新增
         else {
@@ -1225,23 +1111,6 @@ let repositoryGljObj = {
                 }
             }
         }
-        /*if(typeof pasteObj.basePrice !== 'undefined'){
-            pasteObj.basePrice = !isNaN(parseFloat(pasteObj.basePrice)) && (pasteObj.basePrice && typeof pasteObj.basePrice !== 'undefined') ? scMathUtil.roundTo(parseFloat(pasteObj.basePrice), -2) :
-                me.currentCache[rowIdx].basePrice;
-            if(pasteObj.basePrice !== me.currentCache[rowIdx].basePrice){
-                reCalBasePrc = true;
-                tempObj.basePrice = pasteObj.basePrice;
-                let updateGljs = me.getUpdateGljs(tempObj, false);
-                if(updateGljs.updateArr.length > 0 || updateGljs.updateBasePrcArr.length > 0){
-                    for(let i = 0; i < updateGljs.updateArr.length; i++){
-                        rst.updateGlj.push(updateGljs.updateArr[i]);
-                    }
-                    for(let i = 0; i < updateGljs.updateBasePrcArr.length; i++){
-                        rst.updateBasePrcArr.push(updateGljs.updateBasePrcArr[i]);
-                    }
-                }
-            }
-        }*/
         if(typeof pasteObj.materialType !== 'undefined'){
             if(!me.materialType.textArr.includes(pasteObj.materialType)){
                 isValid = false;
@@ -1293,7 +1162,6 @@ let repositoryGljObj = {
             rst.updateGlj.push(tempObj);
             if(reCalBasePrc){
                 //重新计算定额基价对象
-                //let newReObj = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: tempObj.basePrice};
                 let newReObj = {gljId: tempObj.ID, gljType: tempObj.gljType, basePrice: me.getRationGljPrice(tempObj)};
                 rst.updateBasePrcArr.push(newReObj);
             }
@@ -1455,10 +1323,6 @@ let repositoryGljObj = {
                 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]);
                     }
                 }
@@ -1471,9 +1335,6 @@ let repositoryGljObj = {
                 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]);
                     }
                 }
@@ -1550,20 +1411,6 @@ let repositoryGljObj = {
             }
         });
     },
-  /*  getRationGljIds: function (repId) {
-        let me = repositoryGljObj;
-        $.ajax({
-            type: 'post',
-            url: 'api/getRationGljIds',
-            data: {data: JSON.stringify({repId: repId})},
-            dataType: 'json',
-            success: function(result){
-                if(!result.error){
-                    me.rationGljIds = result.data;
-                }
-            }
-        });
-    },*/
     mixUpdateRequest: function(updateArr, addArr, removeIds) {
         let me = repositoryGljObj;
         if(updateArr.length > 0){
@@ -1895,6 +1742,4 @@ let gljTypeTreeOprObj = {
         $("#addBtn_"+treeNode.tId).unbind().remove();
     }
 
-};
-
-//export {repositoryGljObj};//测试用
+};

+ 0 - 37
web/maintain/std_glj_lib/js/gljComponent.js

@@ -349,11 +349,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.gljList)) ||
-                (args.col === 4 && (!that.currentComponent|| args.row >= that.currentComponent.length))){
-                args.cancel = true;
-            }*/
             if(!(me.colMapping.colToField[args.col] === 'code' || me.colMapping.colToField[args.col].includes('consumeAmt')) || !allowComponent.includes(that.currentGlj.gljType) ||
                 (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList)) ||
                 (args.col === 4 && (!that.currentComponent|| args.row >= that.currentComponent.length))){
@@ -464,15 +459,11 @@ let gljComponentOprObj = {
             else{
                 //只能输入数值
                 sheetsOprObj.showData(me, me.workBook.getSheet(0), me.setting, that.currentComponent);
-            /*    args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
-                    me.currentEditingComponent[me.setting.header[args.col].dataCode]: 0);*/
 
             }
         }
         else{
             sheetsOprObj.showData(me, me.workBook.getSheet(0), me.setting, that.currentComponent);
-           /* args.sheet.setValue(args.row, args.col, me.currentEditingComponent[me.setting.header[args.col].dataCode] ?
-            me.currentEditingComponent[me.setting.header[args.col].dataCode]: '');*/
         }
         if(updateArr.length > 0){
             me.updateComponent(updateArr);
@@ -510,9 +501,6 @@ let gljComponentOprObj = {
         if(maxCol > me.setting.header.length - 1){
             info.cancel = true;
         }
-       /* if(beginDataCode !== 'code' && !beginDataCode.include('consumeAmt') || info.cellRange.colCount > 1 || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList))){
-            info.cancel = true;
-        }*/
     },
     onClipboardPasted: function (sender, info) {
         let me = gljComponentOprObj, that = repositoryGljObj, updateArr = [],
@@ -575,10 +563,6 @@ let gljComponentOprObj = {
                         }
 
                     }
-                  /*  else{
-                        me.workBook.getSheet(0).setValue(info.cellRange.row + i, info.cellRange.col,
-                            typeof that.currentComponent[info.cellRange.row + i] !== 'undefined'? that.currentComponent[info.cellRange.row + i].code : '');
-                    }*/
                 }
                 if(!existCode){
                     me.workBook.getSheet(0).setValue(info.cellRange.row + i, info.cellRange.col,
@@ -624,17 +608,6 @@ let gljComponentOprObj = {
                             }
                         }
                     }
-                    /*if(items[i].consumeAmt.trim().length > 0 && items[i].consumeAmt !== currentObj.consumeAmt){
-                        let roundCons = scMathUtil.roundTo(parseFloat(items[i].consumeAmt), -3);
-                        isChange = true;
-                        currentObj.consumeAmt = roundCons;
-                        for(let j = 0; j < component.length; j++){
-                            if(component[j].ID === currentObj.ID){
-                                component[j].consumeAmt = currentObj.consumeAmt;
-                                break;
-                            }
-                        }
-                    }*/
                     else{
                         sheetsOprObj.showData(me, me.workBook.getSheet(0), me.setting, that.currentComponent);
                         //me.workBook.getSheet(0).setValue(row + i, info.cellRange.col, currentObj.consumeAmt);
@@ -714,14 +687,4 @@ let gljComponentOprObj = {
             return gljPriceProperty;
         }
     }
-    /*  reCalGljBasePrc: function (component) {
-        let me = gljComponentOprObj, gljBasePrc = 0;
-        for(let i = 0; i < component.length; i++){
-            let roundBasePrc = scMathUtil.roundTo(parseFloat(component[i].basePrice), -2);
-            let roundConsumeAmt = scMathUtil.roundTo(parseFloat(component[i].consumeAmt), -3);
-            //gljBasePrc = scMathUtil.roundTo(scMathUtil.roundTo(roundBasePrc * parseFloat(component[i].consumeAmt), -2) + gljBasePrc, -2); 旧算法
-            gljBasePrc = scMathUtil.roundTo(scMathUtil.roundTo(roundBasePrc * roundConsumeAmt, me.processDecimal) + gljBasePrc, me.processDecimal);
-        }
-        return scMathUtil.roundTo(gljBasePrc, -2);
-    }*/
 };