Browse Source

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/YangHuCost

TonyKang 6 years atrás
parent
commit
295cb8b925

+ 36 - 27
modules/main/facade/ration_facade.js

@@ -164,7 +164,7 @@ async function replaceRations(userID,data,compilation) {
     let recodes = [];
     let recodes = [];
     for(let recode of data.nodeInfo){
     for(let recode of data.nodeInfo){
         let stdRation = await searchDao.getRationItem(userID,compilation._id,data.libIDs,recode.newCode, null);
         let stdRation = await searchDao.getRationItem(userID,compilation._id,data.libIDs,recode.newCode, null);
-        let newRecode = await replaceRation(recode,stdRation,data.defaultLibID,data.projectID,data.calQuantity,compilation);
+        let newRecode = await replaceRation(recode,stdRation,data.defaultLibID,data.projectID,data.calQuantity,compilation,data.cleanzmhs);
         if(newRecode){
         if(newRecode){
             recodes.push(newRecode);
             recodes.push(newRecode);
         }else {
         }else {
@@ -186,20 +186,20 @@ async function getDefaultProgramID(data) {
     return programID;
     return programID;
 }
 }
 
 
-async function replaceRation(nodeInfo,stdRation,defaultLibID,projectID,calQuantity,compilation) {
+async function replaceRation(nodeInfo,stdRation,defaultLibID,projectID,calQuantity,compilation,cleanzmhs) {
     if(nodeInfo.newCode == null||nodeInfo.newCode ==""){//说明是删除编号,则要变成一条空定额
     if(nodeInfo.newCode == null||nodeInfo.newCode ==""){//说明是删除编号,则要变成一条空定额
         await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
         await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
         return await setEmptyRation(projectID,nodeInfo.ID);
         return await setEmptyRation(projectID,nodeInfo.ID);
     }else if(stdRation){
     }else if(stdRation){
-        await deleRationSubRecode(projectID,nodeInfo.ID);//删除定额下挂的各种数据,如定额工料机等
-        let newRation = await updateRation(stdRation,defaultLibID,nodeInfo.ID,nodeInfo.billsItemID,projectID,calQuantity);//生成并插入新的定额
-        return await addRationSubList(stdRation,newRation,nodeInfo.needInstall,compilation);
+        await deleRationSubRecode(projectID,nodeInfo.ID,cleanzmhs);//删除定额下挂的各种数据,如定额工料机等
+        let newRation = await updateRation(stdRation,defaultLibID,nodeInfo.ID,nodeInfo.billsItemID,projectID,calQuantity,cleanzmhs);//生成并插入新的定额
+        return await addRationSubList(stdRation,newRation,nodeInfo.needInstall,compilation,cleanzmhs);
     }else {
     }else {
         return null;
         return null;
     }
     }
 }
 }
 
 
-async function addRationSubList(stdRation,newRation,needInstall,compilation) {
+async function addRationSubList(stdRation,newRation,needInstall,compilation,cleanzmhs=false) {
     let startTime = +new Date();
     let startTime = +new Date();
     let ration_gljs = await addRationGLJ(stdRation,newRation,compilation);
     let ration_gljs = await addRationGLJ(stdRation,newRation,compilation);
     let addRationGLJTime = +new Date();
     let addRationGLJTime = +new Date();
@@ -208,13 +208,16 @@ async function addRationSubList(stdRation,newRation,needInstall,compilation) {
     let addRationCoeTime = +new Date();
     let addRationCoeTime = +new Date();
     console.log("添加定额coe时间-----"+(addRationCoeTime - addRationGLJTime));
     console.log("添加定额coe时间-----"+(addRationCoeTime - addRationGLJTime));
     let ration_installations = [];
     let ration_installations = [];
-    if(needInstall && stdRation.type == 'std'){//只有标准的定额才有安装增加费,补充的定额没有安装增加费
-        ration_installations =  await addRationInstallFee(stdRation,newRation);
+    let ration_template = [];
+    if(cleanzmhs == false){//清除子目换算即cleanzmh==true时 模板子目、安装增加费不用恢复成标准的
+        if(needInstall && stdRation.type == 'std'){//只有标准的定额才有安装增加费,补充的定额没有安装增加费
+            ration_installations =  await addRationInstallFee(stdRation,newRation);
+        }
+        let addRationInstallFeeTime = +new Date();
+        console.log("添加定额install时间-----"+(addRationInstallFeeTime - addRationCoeTime));
+        //添加定额模板子目
+        ration_template = await addRationTemplate(stdRation,newRation);
     }
     }
-    let addRationInstallFeeTime = +new Date();
-    console.log("添加定额install时间-----"+(addRationInstallFeeTime - addRationCoeTime));
-    //添加定额模板子目
-    let ration_template = await addRationTemplate(stdRation,newRation);
     return {ration:newRation,ration_gljs:ration_gljs,ration_coes:ration_coes,ration_installations:ration_installations,ration_templates:ration_template?[ration_template]:[]};
     return {ration:newRation,ration_gljs:ration_gljs,ration_coes:ration_coes,ration_installations:ration_installations,ration_templates:ration_template?[ration_template]:[]};
 }
 }
 
 
@@ -468,18 +471,23 @@ async function addRationGLJ(std,newRation,compilation) {
     return rationGLJShowList;
     return rationGLJShowList;
 }
 }
 
 
-async function deleRationSubRecode(projectID,rationID) {//删除挂在定额下的数据,如工程量明细,定额工料机等
+async function deleRationSubRecode(projectID,rationID,cleanzmhs=false) {//删除挂在定额下的数据,如工程量明细,定额工料机等
     let delete_query={projectID: projectID, rationID: rationID};
     let delete_query={projectID: projectID, rationID: rationID};
     //删除工程量明细
     //删除工程量明细
-    await deleteSubListByQuery(delete_query) ;
+    await deleteSubListByQuery(delete_query,cleanzmhs) ;
 }
 }
 
 
-async function deleteSubListByQuery(delete_query) {
-    await quantity_detail.deleteByQuery(delete_query) ;//删除工程量明细
+async function deleteSubListByQuery(delete_query,cleanzmhs=false) {
+    if(cleanzmhs == false){//清空子目换算即cleanzmh==true时不需要清空工程量明细、模板关联子目、安装增加费
+        await quantity_detail.deleteByQuery(delete_query) ;//删除工程量明细
+        await rationInstallationModel.deleteMany(delete_query);//删除安装增加费
+        await rationTemplateModel.deleteMany(delete_query);//删除模板关联子目
+    }
+    //to do稳定土也要删除
+
     await ration_coe.deleteMany(delete_query);//删除附注条件
     await ration_coe.deleteMany(delete_query);//删除附注条件
     await ration_glj.deleteMany(delete_query);//删除定额工料机
     await ration_glj.deleteMany(delete_query);//删除定额工料机
-    await rationInstallationModel.deleteMany(delete_query);//删除安装增加费
-    await rationTemplateModel.deleteMany(delete_query);//删除模板关联子目
+
 }
 }
 
 
 async function updateCoeAdjust(data,compilation) {
 async function updateCoeAdjust(data,compilation) {
@@ -516,7 +524,7 @@ async function updateCoeAdjust(data,compilation) {
 
 
 
 
 
 
-async function  updateRation(std,defaultLibID,rationID,billsItemID,projectID,calQuantity) {
+async function  updateRation(std,defaultLibID,rationID,billsItemID,projectID,calQuantity,cleanzmh=false) {
     // insertNewRation
     // insertNewRation
     let ration ={};
     let ration ={};
     ration.code = std.code;
     ration.code = std.code;
@@ -546,16 +554,17 @@ async function  updateRation(std,defaultLibID,rationID,billsItemID,projectID,cal
     else if(std.rationRepId === defaultLibID && ration.from === 'cpt') {
     else if(std.rationRepId === defaultLibID && ration.from === 'cpt') {
         ration.prefix = '补';
         ration.prefix = '补';
     }
     }
-    if(std.feeType == undefined || std.feeType == null || std.feeType ==''){//定额取费专业为空的情况下,取项目属性中的定额取费专业ID
-        ration.programID = await getProgramForProject(projectID);
-    }else {
-        ration.programID = std.feeType;
-    }
     ration.rationAssList = createRationAss(std);//生成辅助定额
     ration.rationAssList = createRationAss(std);//生成辅助定额
-    if(calQuantity){
-       await CalculateQuantity(ration,billsItemID,projectID);
+    if(cleanzmh==false){//如果是清空子目换算,即cleanzmh==true 保留定额工程量、工程量表达式、含量(分解系数)、取费专业(取费类别)
+        if(std.feeType == undefined || std.feeType == null || std.feeType ==''){//定额取费专业为空的情况下,取项目属性中的定额取费专业ID
+            ration.programID = await getProgramForProject(projectID);
+        }else {
+            ration.programID = std.feeType;
+        }
+        if( calQuantity){
+            await CalculateQuantity(ration,billsItemID,projectID);
+        }
     }
     }
-
      let unsetObject = {
      let unsetObject = {
          "marketUnitFee":1,
          "marketUnitFee":1,
          'marketTotalFee':1,
          'marketTotalFee':1,

+ 19 - 1
modules/pm/facade/pm_facade.js

@@ -25,7 +25,8 @@ module.exports={
     isFirst: isFirst,
     isFirst: isFirst,
     getShareInfo: getShareInfo,
     getShareInfo: getShareInfo,
     prepareInitialData: prepareInitialData,
     prepareInitialData: prepareInitialData,
-    changeFile:changeFile
+    changeFile:changeFile,
+    copyForSectionError: copyForSectionError,
 };
 };
 
 
 
 
@@ -903,6 +904,23 @@ async function updateUsedList(userId, compilation) {
 async function copyCompleRationSection(userId, compilationId) {
 async function copyCompleRationSection(userId, compilationId) {
     await sectionTreeDao.copyDataFromTemplate(userId, compilationId);
     await sectionTreeDao.copyDataFromTemplate(userId, compilationId);
 }
 }
+
+/*
+ * 解决问题:
+ * 发布了编办之后,才设置了人材机库模板,导致已登录的用户不存在人材机库的分类树
+ * 为该编办下,人材机分类模板为空的用户,拷贝模板数据
+ * */
+async function copyForSectionError(compilation) {
+    let users = await userModel.find({}, '_id');
+    for (let user of users) {
+        let userId = user._id.toString();
+        let existCount = await compleGljSectionModel.find({userId}).count();
+        if (existCount === 0) {
+            await copyCompleGljSection(userId, compilation);
+        }
+    }
+}
+
 //拷贝补充人材机分类树
 //拷贝补充人材机分类树
 async function copyCompleGljSection(userId, compilationId) {
 async function copyCompleGljSection(userId, compilationId) {
     let templateData = await compleGljSectionTModel.find({compilationId: compilationId});
     let templateData = await compleGljSectionTModel.find({compilationId: compilationId});

+ 1 - 1
public/web/gljUtil.js

@@ -182,7 +182,7 @@ let gljUtil = {
         let quantity_decimal = decimalObj.glj.quantity;
         let quantity_decimal = decimalObj.glj.quantity;
         let process_decimal = decimalObj.process;
         let process_decimal = decimalObj.process;
         let priceCoe = this.isDef(tenderCoe)?tenderCoe:1;
         let priceCoe = this.isDef(tenderCoe)?tenderCoe:1;
-        if (this.notEditType.indexOf(glj.unit_price.type)!=-1&&glj.ratio_data.length>0) {//对于混凝土、配合比、砂浆、机械台班等有组成物的材料,价格需根据组成物计算得出。
+        if (!this.isConcreteType(glj.unit_price.type)&& this.notEditType.indexOf(glj.unit_price.type)!=-1&&glj.ratio_data.length>0) {//对于机械台班等有组成物的材料,价格需根据组成物计算得出(排除混凝土、配合比、砂浆这几个类型直接为0)
             let p =0;
             let p =0;
             for(let ratio of glj.ratio_data){
             for(let ratio of glj.ratio_data){
                 let tem =  _.find(projectGLJDatas.gljList,{
                 let tem =  _.find(projectGLJDatas.gljList,{

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

@@ -17,7 +17,6 @@ var sheetCommonObj = {
         spreadBook.options.showDragFillSmartTag = false;
         spreadBook.options.showDragFillSmartTag = false;
         return spreadBook;
         return spreadBook;
     },
     },
-
     initSheet: function(sheet, setting, rowCount) {
     initSheet: function(sheet, setting, rowCount) {
         var me = this;
         var me = this;
         var spreadNS = GC.Spread.Sheets;
         var spreadNS = GC.Spread.Sheets;
@@ -193,6 +192,9 @@ var sheetCommonObj = {
             if(setting.header[col].cellType === "replaceButton"){
             if(setting.header[col].cellType === "replaceButton"){
                 this.setReplaceButton(row,col,sheet,setting.header[col]);
                 this.setReplaceButton(row,col,sheet,setting.header[col]);
             }
             }
+            if(setting.header[col].cellType === "cusButton"){
+                this.setCusButton(row,col,sheet,setting);
+            }
 
 
             if(setting.header[col].cellType === "tipsCell"){
             if(setting.header[col].cellType === "tipsCell"){
                 this.setTipsCell(row,col,sheet,setting.header[col]);
                 this.setTipsCell(row,col,sheet,setting.header[col]);
@@ -545,6 +547,18 @@ var sheetCommonObj = {
         };
         };
         return new selectButton();
         return new selectButton();
     },
     },
+    setCusButton:function (row,col,sheet,setting) {
+        let functionName = setting.header[col].callback;
+        let readOnly = setting.disable[setting.header[col].disable];
+        if(typeof(readOnly) == 'function' ){
+            readOnly = readOnly(row,col);
+        }
+        if(functionName){
+            sheet.setCellType(row, col,this.getCusButtonCellType(setting.callback[functionName],readOnly));
+        }
+        //sheet.setCellType(row, col,this.getSelectButton(header.headerWidth),GC.Spread.Sheets.SheetArea.viewport);
+    },
+
     getCusButtonCellType:function (callback,readOnly=false) {
     getCusButtonCellType:function (callback,readOnly=false) {
         var ns = GC.Spread.Sheets;
         var ns = GC.Spread.Sheets;
         function CusButtonCellType() {
         function CusButtonCellType() {
@@ -559,8 +573,10 @@ var sheetCommonObj = {
                     var imageWidth = 25;
                     var imageWidth = 25;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
                     ctx.save();
                     ctx.save();
-                    ctx.fillStyle = style.backColor;
-                    ctx.fillRect(x,y,w,h);
+                    if(style.backColor){
+                        ctx.fillStyle = style.backColor;
+                        ctx.fillRect(x,y,w,h);
+                    }
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
                     ctx.beginPath();
                     ctx.beginPath();
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
                     ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);

+ 1 - 1
public/web/tree_sheet/tree_sheet_helper.js

@@ -170,7 +170,7 @@ var TREE_SHEET_HELPER = {
                         }/*else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示  这里改成在 计量单位那里提示
                         }/*else if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示  这里改成在 计量单位那里提示
                             tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
                             tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
                         }*/
                         }*/
-                        if(tag!=null&&tag!="") sheet.setTag(iRow, iCol,tag);
+                        if(tag!=null) sheet.setTag(iRow, iCol,tag);
                     }
                     }
                     /*if(colSetting.data.field=="name"){ 2018-08-06 改成在编号列悬浮提示
                     /*if(colSetting.data.field=="name"){ 2018-08-06 改成在编号列悬浮提示
                         let tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
                         let tag = node.data.itemCharacterText?node.data.itemCharacterText:'';

+ 9 - 9
web/building_saas/main/js/models/calc_base.js

@@ -712,7 +712,7 @@ let baseFigureMap = {
         },
         },
         '定额建筑安装工程费(其中定额设备购置费按40%计)': {
         '定额建筑安装工程费(其中定额设备购置费按40%计)': {
             base: 'DEJZAZGCSBSS', fixedFlag: null,
             base: 'DEJZAZGCSBSS', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“安全生产费”
         //只允许固定类别是“安全生产费”
@@ -760,48 +760,48 @@ let baseFigureMap = {
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '养护单位(业主)管理费': {
         '养护单位(业主)管理费': {
             base: 'YHDWYZGLF', fixedFlag: null,
             base: 'YHDWYZGLF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '信息化费': {
         '信息化费': {
             base: 'XXHF', fixedFlag: null,
             base: 'XXHF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '路线工程监理费': {
         '路线工程监理费': {
             base: 'LXGCJLF', fixedFlag: null,
             base: 'LXGCJLF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '独立桥梁隧道工程监理费': {
         '独立桥梁隧道工程监理费': {
             base: 'QLSDGCJLF', fixedFlag: null,
             base: 'QLSDGCJLF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [ fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '设计文件审查费': {
         '设计文件审查费': {
             base: 'SJWJSCF', fixedFlag: null,
             base: 'SJWJSCF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '路线勘察设计费': {
         '路线勘察设计费': {
             base: 'LXKCSJF', fixedFlag: null,
             base: 'LXKCSJF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         //只允许固定类别是“专项费用”、“土地使用及拆迁补偿费“、“养护工程其他费”下的清单使用
         '独立桥梁隧道维修加固勘察设计费': {
         '独立桥梁隧道维修加固勘察设计费': {
             base: 'QLSDKCSJF', fixedFlag: null,
             base: 'QLSDKCSJF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         '招标代理及标底(最高投标限价)编制费': {
         '招标代理及标底(最高投标限价)编制费': {
             base: 'ZBDLJBDBZF', fixedFlag: null,
             base: 'ZBDLJBDBZF', fixedFlag: null,
-            filter: [fixedFlag.SPECIAL_COST, fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
+            filter: [fixedFlag.LAND_USED_DEMOLITION, fixedFlag.MAINTENANCE_EXPENSES],
             pick: true
             pick: true
         },
         },
         //只允许固定类别是“价差预备费”的清单使用
         //只允许固定类别是“价差预备费”的清单使用

+ 22 - 8
web/building_saas/main/js/models/calc_program.js

@@ -143,7 +143,17 @@ let calcTools = {
         sheet.setSelection(idx, 0, rowsCount, colsCount);
         sheet.setSelection(idx, 0, rowsCount, colsCount);
         sheet.showRow(idx, GC.Spread.Sheets.VerticalPosition.center);
         sheet.showRow(idx, GC.Spread.Sheets.VerticalPosition.center);
     },
     },
-
+    clearFees: function (treeNode) {
+        if (!treeNode || !treeNode.data.feesIndex) {
+            return;
+        }
+        let clearFeeField = ['unitFee', 'totalFee', 'tenderUnitFee', 'tenderTotalFee'];
+        for (let feeField in treeNode.data.feesIndex) {
+            for (let subFee of clearFeeField) {
+                treeNode.data.feesIndex[feeField][subFee] = 0;
+            }
+        }
+    },
     initFees: function (treeNode){
     initFees: function (treeNode){
         if (!treeNode.data.fees) {
         if (!treeNode.data.fees) {
             treeNode.data.fees = [];
             treeNode.data.fees = [];
@@ -1666,15 +1676,15 @@ class CalcProgram {
                         buf = (sum_rtf / bq).toDecimal(decimalObj.process);
                         buf = (sum_rtf / bq).toDecimal(decimalObj.process);
                         btuf = (sum_rttf / btq).toDecimal(decimalObj.process);
                         btuf = (sum_rttf / btq).toDecimal(decimalObj.process);
                     };
                     };
-                    if (isBaseFeeType(ft.type) ||
-                        (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice && ft.type == "common")){
+                    // if (isBaseFeeType(ft.type) ||
+                    //     (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice && ft.type == "common")){
                         btf = sum_rtf;
                         btf = sum_rtf;
                         bttf = sum_rttf;
                         bttf = sum_rttf;
-                    }
-                    else{
-                        btf = (buf.toDecimal(decimalObj.bills.unitPrice) * bq).toDecimal(decimalObj.process);
-                        bttf = (btuf.toDecimal(decimalObj.bills.unitPrice) * btq).toDecimal(decimalObj.process);
-                    };
+                    // }
+                    // else{
+                    //     btf = (buf.toDecimal(decimalObj.bills.unitPrice) * bq).toDecimal(decimalObj.process);
+                    //     bttf = (btuf.toDecimal(decimalObj.bills.unitPrice) * btq).toDecimal(decimalObj.process);
+                    // };
                 };
                 };
 
 
                 ftObj.totalFee = btf.toDecimal(decimalObj.bills.totalPrice);
                 ftObj.totalFee = btf.toDecimal(decimalObj.bills.totalPrice);
@@ -1756,6 +1766,10 @@ class CalcProgram {
             ttf = ttf.toDecimal(decimalObj.bills.totalPrice);
             ttf = ttf.toDecimal(decimalObj.bills.totalPrice);
             deleteUselessFees(treeNode);
             deleteUselessFees(treeNode);
             calcTools.checkFeeField(treeNode, {'fieldName': 'common', 'unitFee': uf, 'totalFee': tf, 'tenderUnitFee': tuf, 'tenderTotalFee': ttf});
             calcTools.checkFeeField(treeNode, {'fieldName': 'common', 'unitFee': uf, 'totalFee': tf, 'tenderUnitFee': tuf, 'tenderTotalFee': ttf});
+            //第一部分建安费下,使用基数计算的清单,定额建安费应=金额
+            if (cbTools.getBelongFlagList(treeNode).includes(fixedFlag.CONSTRUCTION_INSTALL_FEE)) {
+                calcTools.checkFeeField(treeNode, {'fieldName': 'rationCommon', 'unitFee': uf, 'totalFee': tf, 'tenderUnitFee': tuf, 'tenderTotalFee': ttf});
+            }
 
 
             // 总造价清单还要做单项工程、建设项目的四大项金额汇总
             // 总造价清单还要做单项工程、建设项目的四大项金额汇总
             if (calcTools.isTotalCostBill(treeNode)){
             if (calcTools.isTotalCostBill(treeNode)){

+ 6 - 0
web/building_saas/main/js/models/fee_rate.js

@@ -344,6 +344,12 @@ var FeeRate = {
                     me.datas.libID=data.libID;
                     me.datas.libID=data.libID;
                     me.datas.libName=data.libName;
                     me.datas.libName=data.libName;
                     me.datas.feeRateID=data.feeRateID;
                     me.datas.feeRateID=data.feeRateID;
+                    if(newVal==feeRate.libID){//如果是本身,则是恢复标准值,设置回旧的树节点折叠属性
+                       let oldRates =  me.datas.rates;
+                       for(let i =0;i< oldRates.length;i++){
+                           data.rates[i].collapsed = oldRates[i].collapsed;
+                       }
+                    }
                     me.datas.rates=data.rates;
                     me.datas.rates=data.rates;
                     projectObj.project.markUpdateProject({projectID:projectObj.project.ID(),feeRateID:me.getActivateFeeRateFileID()},'feeRate');
                     projectObj.project.markUpdateProject({projectID:projectObj.project.ID(),feeRateID:me.getActivateFeeRateFileID()},'feeRate');
                     me.onFeeRateFileChange();
                     me.onFeeRateFileChange();

+ 5 - 1
web/building_saas/main/js/models/main_consts.js

@@ -28,7 +28,9 @@ const baseMaterialTypes = [
     gljType.MORTAR,
     gljType.MORTAR,
     gljType.MIX_RATIO,
     gljType.MIX_RATIO,
     gljType.COMMERCIAL_CONCRETE,
     gljType.COMMERCIAL_CONCRETE,
-    gljType.COMMERCIAL_MORTAR
+    gljType.COMMERCIAL_MORTAR,
+    gljType.PURCHASE_COMPONENT,
+    gljType.GREEN_SEEDLING
 ];
 ];
 // 计算基数 [定额基价机械费] 要用到的机械类型。
 // 计算基数 [定额基价机械费] 要用到的机械类型。
 const baseMachineTypes = [
 const baseMachineTypes = [
@@ -49,6 +51,8 @@ const allMaterialTypes = [
     gljType.MIX_RATIO,
     gljType.MIX_RATIO,
     gljType.COMMERCIAL_CONCRETE,
     gljType.COMMERCIAL_CONCRETE,
     gljType.COMMERCIAL_MORTAR,
     gljType.COMMERCIAL_MORTAR,
+    gljType.PURCHASE_COMPONENT,
+    gljType.GREEN_SEEDLING,
     gljType.MAIN_MATERIAL,
     gljType.MAIN_MATERIAL,
     gljType.EQUIPMENT
     gljType.EQUIPMENT
 ];
 ];

+ 3 - 3
web/building_saas/main/js/models/ration.js

@@ -377,7 +377,7 @@ var Ration = {
                 ration.contain = scMathUtil.roundForObj(ration.quantity/billsQuantity,process_decimal);
                 ration.contain = scMathUtil.roundForObj(ration.quantity/billsQuantity,process_decimal);
             }
             }
         };
         };
-        ration.prototype.updateRationCodes = function (recodes) {
+        ration.prototype.updateRationCodes = function (recodes,cleanzmhs = false) {
             let libID =  rationLibObj.getCurrentStdRationLibID();
             let libID =  rationLibObj.getCurrentStdRationLibID();
             let libIDs = rationLibObj.getStdRationLibIDs();
             let libIDs = rationLibObj.getStdRationLibIDs();
             let defaultLibID = rationLibObj.getDefaultStdRationLibID();
             let defaultLibID = rationLibObj.getDefaultStdRationLibID();
@@ -396,14 +396,14 @@ var Ration = {
                     needInstall = project.Bills.isFBFX(r.node);
                     needInstall = project.Bills.isFBFX(r.node);
                 }
                 }
                 r.value===null||r.value===undefined?"":r.value = r.value.replace(/[\s\r\n]/g, "");//去掉空格回车换行等字符
                 r.value===null||r.value===undefined?"":r.value = r.value.replace(/[\s\r\n]/g, "");//去掉空格回车换行等字符
-                if(r.value != r.node.data.code){
+                if(cleanzmhs  == true||r.value != r.node.data.code){
                     nodeInfo.push({ID:r.node.data.ID,billsItemID:r.node.data.billsItemID,newCode:r.value,needInstall:needInstall});
                     nodeInfo.push({ID:r.node.data.ID,billsItemID:r.node.data.billsItemID,newCode:r.value,needInstall:needInstall});
                     refershNodes.push(r.node);
                     refershNodes.push(r.node);
                 }
                 }
             }
             }
             let calQuantity = optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
             let calQuantity = optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
             $.bootstrapLoading.start();
             $.bootstrapLoading.start();
-            CommonAjax.post("/ration/replaceRations",{nodeInfo:nodeInfo,libIDs:libIDs,defaultLibID: defaultLibID,projectID:projectID,calQuantity:calQuantity},function (data) {
+            CommonAjax.post("/ration/replaceRations",{nodeInfo:nodeInfo,libIDs:libIDs,defaultLibID: defaultLibID,projectID:projectID,calQuantity:calQuantity,cleanzmhs:cleanzmhs},function (data) {
                 for(let recode of data){
                 for(let recode of data){
                    let node =  mainTree.getNodeByID(recode.ration.ID);
                    let node =  mainTree.getNodeByID(recode.ration.ID);
                    if(node) {
                    if(node) {

+ 12 - 65
web/building_saas/main/js/views/calc_base_view.js

@@ -140,8 +140,7 @@ let calcBaseView = {
     ifEdit: function (type, row) {
     ifEdit: function (type, row) {
         if (type == 'ration'){
         if (type == 'ration'){
             return true;
             return true;
-        }
-        else{
+        } else{
             let selected = projectObj.project.mainTree.items[row];
             let selected = projectObj.project.mainTree.items[row];
             return selected && MainTreeCol.readOnly.forCalcBase(selected)?false:true;
             return selected && MainTreeCol.readOnly.forCalcBase(selected)?false:true;
         }
         }
@@ -344,70 +343,18 @@ let calcBaseView = {
             }
             }
         });
         });
     },
     },
-
-    getCalcBaseCellType:function (type) {
-        var ns = GC.Spread.Sheets;
-        function CalcBaseCellType() {
-            var init=false;
+    onCalcBaseButtonClick:function (hitinfo,type='bills') {
+        let me = calcBaseView;
+        let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+        if(hitinfo.sheet.getParent() === projectObj.mainSpread){
+            projectObj.mainController.setTreeSelected(node);
         }
         }
-        CalcBaseCellType.prototype = new ns.CellTypes.Text();
-        CalcBaseCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            if(!projectReadOnly && calcBaseView.ifEdit(type, options.row)){
-                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
-                    var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = 15;
-                    var imageWidth = 25;
-                    var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
-                    ctx.save();
-                    ctx.fillStyle = style.backColor;
-                    ctx.fillRect(x,y,w,h);
-                    ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
-                    ctx.beginPath();
-                    ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
-                    ctx.arc(imageX+imageWidth/2-4,imageY+imageHeight/2,1,0,360,false);
-                    ctx.arc(imageX+imageWidth/2+4,imageY+imageHeight/2,1,0,360,false);
-                    ctx.fillStyle="black";//填充颜色,默认是黑色
-                    ctx.fill();//画实心圆
-                    ctx.closePath();
-                    ctx.restore();
-                    w = w - imageWidth - imageMagin;
-                }
-            }
-            GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-        };
-        CalcBaseCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
-            return {
-                x: x,
-                y: y,
-                row: context.row,
-                col: context.col,
-                cellStyle: cellStyle,
-                cellRect: cellRect,
-                sheetArea: context.sheetArea
-            };
-        };
-        CalcBaseCellType.prototype.processMouseDown = function (hitinfo) {
-            let me = calcBaseView;
-            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
-                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageWidth = 25;
-                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
-                        let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
-                        if(hitinfo.sheet.getParent() === projectObj.mainSpread){
-                            projectObj.mainController.setTreeSelected(node);
-                        }
-                        hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
-                        calcBaseView.confirmBtn.attr('toggle', 'calcBase');
-                        changeCalcBaseFeeRate('calcBase');
-                        $('#tabCalcBase').tab('show');
-                        calcBaseView.initCalctor(type);
-                    }
-                }
-            }
-        };
-        return new CalcBaseCellType();
-    },
+        hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
+        calcBaseView.confirmBtn.attr('toggle', 'calcBase');
+        changeCalcBaseFeeRate('calcBase');
+        $('#tabCalcBase').tab('show');
+        calcBaseView.initCalctor(type);
+    }
 };
 };
 
 
 $(document).ready(function () {
 $(document).ready(function () {

+ 15 - 2
web/building_saas/main/js/views/calc_program_manage.js

@@ -25,7 +25,7 @@ let calcProgramManage = {
             // {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
             // {headerName:"ID",headerWidth:80,dataCode:"ID", hAlign: "center"},
             {headerName:"费用代号",headerWidth:CP_Col_Width.code, dataCode:"code", dataType: "String"},
             {headerName:"费用代号",headerWidth:CP_Col_Width.code, dataCode:"code", dataType: "String"},
             {headerName:"费用名称",headerWidth:CP_Col_Width.name, dataCode:"name", dataType: "String"},
             {headerName:"费用名称",headerWidth:CP_Col_Width.name, dataCode:"name", dataType: "String"},
-            {headerName:"计算基数",headerWidth:CP_Col_Width.dispExprUser, dataCode:"dispExprUser", dataType: "String"},
+            {headerName:"计算基数",headerWidth:CP_Col_Width.dispExprUser, dataCode:"dispExprUser", dataType: "String",cellType:'cusButton',callback:'calcBase',disable:'calcBase'},
             {headerName:"费率",headerWidth:CP_Col_Width.feeRate, dataCode:"feeRate", dataType: "Number",hAlign: "right",decimalField:"feeRate"},
             {headerName:"费率",headerWidth:CP_Col_Width.feeRate, dataCode:"feeRate", dataType: "Number",hAlign: "right",decimalField:"feeRate"},
             {headerName:"费用类别",headerWidth:CP_Col_Width.displayFieldName, dataCode:"displayFieldName", dataType: "String", hAlign: "center"},
             {headerName:"费用类别",headerWidth:CP_Col_Width.displayFieldName, dataCode:"displayFieldName", dataType: "String", hAlign: "center"},
             {headerName:"基数说明",headerWidth:CP_Col_Width.statement, dataCode:"statement", dataType: "String"},
             {headerName:"基数说明",headerWidth:CP_Col_Width.statement, dataCode:"statement", dataType: "String"},
@@ -36,6 +36,17 @@ let calcProgramManage = {
             lockColumns:[2,5],
             lockColumns:[2,5],
             colHeaderHeight: CP_Col_Width.colHeader,
             colHeaderHeight: CP_Col_Width.colHeader,
             rowHeaderWidth: CP_Col_Width.rowHeader
             rowHeaderWidth: CP_Col_Width.rowHeader
+        },
+        //callback 和disable都是和 cusButton配套使用的
+        callback:{
+            calcBase:function (hitinfo) {
+                calcBaseView.onCalcBaseButtonClick(hitinfo,'ration');
+            }
+        },
+        disable:{
+            calcBase:function (row,col) {
+                return projectReadOnly || !calcBaseView.ifEdit('ration', row)
+            }
         }
         }
     },
     },
 
 
@@ -67,11 +78,13 @@ let calcProgramManage = {
         me.detailSheet.bind(GC.Spread.Sheets.Events.RangeChanged, me.onRangeChanged);
         me.detailSheet.bind(GC.Spread.Sheets.Events.RangeChanged, me.onRangeChanged);
         me.detailSheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onDetailEnterCell);
         me.detailSheet.bind(GC.Spread.Sheets.Events.EnterCell, me.onDetailEnterCell);
         me.detailSheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
         me.detailSheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
+        me.detailSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function (e,info) {
+            info.sheet.repaint();
+        });
         sheetCommonObj.showData(me.mainSheet, me.mainSetting, me.datas);
         sheetCommonObj.showData(me.mainSheet, me.mainSetting, me.datas);
 
 
         me.detailSheet.name('calc_detail');
         me.detailSheet.name('calc_detail');
         feeRateObject.setFeeRateCellCol(me.detailSheet, _.findIndex(me.detailSetting.header,{'dataCode':'feeRate'}));
         feeRateObject.setFeeRateCellCol(me.detailSheet, _.findIndex(me.detailSetting.header,{'dataCode':'feeRate'}));
-        me.detailSheet.getRange(-1, _.findIndex(me.detailSetting.header, {'dataCode': 'dispExprUser'}), -1, 1).cellType(calcBaseView.getCalcBaseCellType('ration'));
         sheetCommonObj.showData(me.detailSheet, me.detailSetting, me.datas[0].calcItems);
         sheetCommonObj.showData(me.detailSheet, me.detailSetting, me.datas[0].calcItems);
         me.getfeeRateColor(me.datas[0].calcItems);
         me.getfeeRateColor(me.datas[0].calcItems);
         customRowHeader(me.detailSheet, me.datas[0].calcItems.length);
         customRowHeader(me.detailSheet, me.datas[0].calcItems.length);

+ 3 - 1
web/building_saas/main/js/views/fee_rate_view.js

@@ -1017,7 +1017,9 @@ $(function(){
     $('#changeConfirm').bind('click', function (){
     $('#changeConfirm').bind('click', function (){
         var newVal=$('#standardSelect').val();
         var newVal=$('#standardSelect').val();
         var feeRateFile = projectObj.project.FeeRate.getActivateFeeRate();
         var feeRateFile = projectObj.project.FeeRate.getActivateFeeRate();
-        if(newVal&&newVal!=feeRateFile.libID)  feeRateObject.changeFeeRateStandard(newVal);
+        feeRateObject.changeFeeRateStandard(newVal);
+        //这里改成不判断了,只是点击确定了就重选
+        //if(newVal&&newVal!=feeRateFile.libID)  feeRateObject.changeFeeRateStandard(newVal);
     });
     });
 
 
     $('#saveAs').bind('click', function (){
     $('#saveAs').bind('click', function (){

+ 7 - 4
web/building_saas/main/js/views/main_tree_col.js

@@ -304,8 +304,10 @@ let MainTreeCol = {
                 return  quantityEditObj.getQuantityEditCellType();
                 return  quantityEditObj.getQuantityEditCellType();
             }
             }
         },
         },
-        calcBase: function () {
-            return calcBaseView.getCalcBaseCellType('bills');
+        calcBase: function (node) {
+            let readOnly = projectReadOnly || !calcBaseView.ifEdit('bills', projectObj.project.mainTree.items.indexOf(node));
+            return sheetCommonObj.getCusButtonCellType(calcBaseView.onCalcBaseButtonClick,readOnly)
+            //return calcBaseView.getCalcBaseCellType('bills');
         },
         },
 
 
         // CSL, 2017-11-28
         // CSL, 2017-11-28
@@ -360,8 +362,9 @@ let MainTreeCol = {
         evaluationProject:function (node) {
         evaluationProject:function (node) {
             if(node.sourceType == ModuleNames.ration) return new GC.Spread.Sheets.CellTypes.CheckBox();
             if(node.sourceType == ModuleNames.ration) return new GC.Spread.Sheets.CellTypes.CheckBox();
         },
         },
-        commonTotalFee: function () {
-            return projectObj.getCommonTotalFeeCellType();
+        commonTotalFee: function (node) {
+            let readOnly = projectReadOnly || !calcBaseView.ifEdit('bills', projectObj.project.mainTree.items.indexOf(node));
+            return sheetCommonObj.getCusButtonCellType(projectObj.onCommonTotalFeeButtonClick,readOnly) //projectObj.getCommonTotalFeeCellType();
         },
         },
         specialProvisional: function (node) {
         specialProvisional: function (node) {
             if(!MainTreeCol.readOnly.specialProvisional(node)){
             if(!MainTreeCol.readOnly.specialProvisional(node)){

+ 42 - 72
web/building_saas/main/js/views/project_view.js

@@ -496,14 +496,12 @@ var projectObj = {
                     }
                     }
                     node.data.userCalcBase = value;
                     node.data.userCalcBase = value;
                     project.calcBase.calculate(node);
                     project.calcBase.calculate(node);
-                    //删除清单基数,单价要清空
-                    if (value === '') {
-                        calcTools.setFieldValue(node, 'feesIndex.common.unitFee', 0);
-                    }
                     if(!project.calcBase.success){
                     if(!project.calcBase.success){
                         let activeCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
                         let activeCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
                         projectObj.mainController.refreshTreeNode([node]);
                         projectObj.mainController.refreshTreeNode([node]);
                         return;
                         return;
+                    } else if (value === '') {//删除清单基数,要清空费用
+                        calcTools.clearFees(node);
                     }
                     }
                     // if (value) {value = parseFloat(value).toDecimal(decimalObj.decimal("totalPrice", node))};
                     // if (value) {value = parseFloat(value).toDecimal(decimalObj.decimal("totalPrice", node))};
                 };
                 };
@@ -1359,8 +1357,14 @@ var projectObj = {
                     },
                     },
                     visible: function(key, opt){//2018-11-08  新需求,这个按钮先隐藏,有需要再放开
                     visible: function(key, opt){//2018-11-08  新需求,这个按钮先隐藏,有需要再放开
                         let selected = project.mainTree.selected;
                         let selected = project.mainTree.selected;
-                        return selected && selected.sourceType == ModuleNames.bills &&
-                            !_.isEmpty(selected.data.flagsIndex) && selected.data.flagsIndex.fixed.flag === fixedFlag.EQUIPMENT_ACQUISITION_FEE
+                        if (selected && selected.sourceType == ModuleNames.bills) {
+                            //属于的固定清单
+                            let belongFlag = cbTools.getBelongFlag(selected);
+                            if (belongFlag && belongFlag === fixedFlag.EQUIPMENT_ACQUISITION_FEE) {
+                                return true;
+                            }
+                        }
+                        return false;
                     }
                     }
                 },
                 },
                 "spr2": '--------',
                 "spr2": '--------',
@@ -1380,6 +1384,21 @@ var projectObj = {
                         return projectObj.project.isInstall();
                         return projectObj.project.isInstall();
                     }
                     }
                 },
                 },
+                "cleanzmhs":{
+                    name:'清空定额调整',
+                    icon: 'fa-remove',
+                    callback: function (key, opt) {
+                        let selected = project.mainTree.selected;
+                        projectObj.project.Ration.updateRationCodes([{'node':selected, value:selected.data.code}],true);
+                    },
+                    visible: function(key, opt){
+                        let selected = project.mainTree.selected;
+                        if (selected && selected.sourceType == ModuleNames.ration) {
+                            return true;
+                        }
+                        return false;
+                    }
+                },
                 "delete": {
                 "delete": {
                     name: '删除',
                     name: '删除',
                     icon: 'fa-remove',
                     icon: 'fa-remove',
@@ -1923,72 +1942,19 @@ var projectObj = {
         }
         }
         return this.itemCol?!this.itemCol.visible:true;
         return this.itemCol?!this.itemCol.visible:true;
     },
     },
-    //综合合价cellType
-    getCommonTotalFeeCellType:function () {
-        let type = 'bills';
-        var ns = GC.Spread.Sheets;
-        function CommonTotalFeeCellType() {
-            var init=false;
-        }
-        CommonTotalFeeCellType.prototype = new ns.CellTypes.Text();
-        CommonTotalFeeCellType.prototype.paint = function (ctx, value, x, y, w, h, style, options) {
-            if(!projectReadOnly && calcBaseView.ifEdit(type, options.row)){
-                if(options.sheet.getActiveRowIndex()==options.row&&options.sheet.getActiveColumnIndex()==options.col){
-                    var image = document.getElementById('f_btn'),imageMagin = 3;
-                    var imageHeight = 15;
-                    var imageWidth = 25;
-                    var imageX = x + w - imageWidth- imageMagin, imageY = y + h / 2 - imageHeight / 2;
-                    ctx.save();
-                    ctx.fillStyle = style.backColor;
-                    ctx.fillRect(x,y,w,h);
-                    ctx.drawImage(image, imageX, imageY,imageWidth,imageHeight);
-                    ctx.beginPath();
-                    ctx.arc(imageX+imageWidth/2,imageY+imageHeight/2,1,0,360,false);
-                    ctx.arc(imageX+imageWidth/2-4,imageY+imageHeight/2,1,0,360,false);
-                    ctx.arc(imageX+imageWidth/2+4,imageY+imageHeight/2,1,0,360,false);
-                    ctx.fillStyle="black";//填充颜色,默认是黑色
-                    ctx.fill();//画实心圆
-                    ctx.closePath();
-                    ctx.restore();
-                    w = w - imageWidth - imageMagin;
-                }
-            }
-             GC.Spread.Sheets.CellTypes.Text.prototype.paint.apply(this, arguments);
-        };
-        CommonTotalFeeCellType.prototype.getHitInfo = function (x, y, cellStyle, cellRect, context) {
-            return {
-                x: x,
-                y: y,
-                row: context.row,
-                col: context.col,
-                cellStyle: cellStyle,
-                cellRect: cellRect,
-                sheetArea: context.sheetArea
-            };
-        };
-        CommonTotalFeeCellType.prototype.processMouseDown = function (hitinfo) {
-            let me = calcBaseView;
-            if(hitinfo.sheet.getActiveRowIndex()==hitinfo.row&&hitinfo.sheet.getActiveColumnIndex()==hitinfo.col){
-                var offset=hitinfo.cellRect.x+hitinfo.cellRect.width-6;
-                var imageWidth = 25;
-                if(hitinfo.x<offset&&hitinfo.x>offset-imageWidth){
-                    if(!projectReadOnly && me.ifEdit(type, hitinfo.row)){
-                        let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
-                        if(hitinfo.sheet.getParent() === projectObj.mainSpread){
-                            projectObj.mainController.setTreeSelected(node);
-                        }
-                        hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
-                        calcBaseView.confirmBtn.attr('toggle', 'commonTotalFee');
-                        //changeCalcBaseFeeRate('commonTotalFee');//公路上不需要费率选项页
-                        changeCalcBaseFeeRate('calcBase');
-                        $('#tabCalcBase').tab('show');
-                        calcBaseView.initCalctor(type);
-                        //feeRateObject.showSelectModal(hitinfo);
-                    }
-                }
-            }
-        };
-        return new CommonTotalFeeCellType();
+    onCommonTotalFeeButtonClick:function(hitinfo){
+        let me = calcBaseView;
+        let node = projectObj.project.mainTree.items[hitinfo.row] ? projectObj.project.mainTree.items[hitinfo.row] : null;
+        if(hitinfo.sheet.getParent() === projectObj.mainSpread){
+            projectObj.mainController.setTreeSelected(node);
+        }
+        hitinfo.sheet.setActiveCell(hitinfo.row, hitinfo.col);
+        calcBaseView.confirmBtn.attr('toggle', 'commonTotalFee');
+        //changeCalcBaseFeeRate('commonTotalFee');//公路上不需要费率选项页
+        changeCalcBaseFeeRate('calcBase');
+        $('#tabCalcBase').tab('show');
+        calcBaseView.initCalctor('bills');
+            //feeRateObject.showSelectModal(hitinfo);
     },
     },
     selectColAndFocus :function (newNode,field = 'code') {//选中单元格并设置焦点
     selectColAndFocus :function (newNode,field = 'code') {//选中单元格并设置焦点
         if(newNode){
         if(newNode){
@@ -3287,6 +3253,10 @@ $('#calcBaseFeeRateConf').click(function () {
             $('#calcBaseFeeRate').modal('hide');
             $('#calcBaseFeeRate').modal('hide');
         }
         }
     }
     }
+    //删除清单基数,要清空费用
+    if (projectObj.project.calcBase.success && calcBaseValue === '') {
+        calcTools.clearFees(selected);
+    }
     if(!projectObj.project.calcBase.success && cusFeeRate==false){
     if(!projectObj.project.calcBase.success && cusFeeRate==false){
         return;
         return;
     } else if((!validateFeeRate || selected.data.feeRateID === parseInt(feeRateObject.feeRateSelection.ID)) && needToSave) {
     } else if((!validateFeeRate || selected.data.feeRateID === parseInt(feeRateObject.feeRateSelection.ID)) && needToSave) {