|
@@ -26,9 +26,15 @@ let installationFeeObj={
|
|
|
return installationFeeObj.getDisplayText(item);
|
|
|
},
|
|
|
forRule:function (item,val) {//
|
|
|
- let feeRule = projectObj.project.installation_fee.getFeeRuleByID(item.libID,val);
|
|
|
- if(feeRule){
|
|
|
- return feeRule.rule;
|
|
|
+ let install_fee = projectObj.project.installation_fee;
|
|
|
+ let impactRules =install_fee.getFeeRuleBySection({libID:item.libID,ID:item.sectionId});
|
|
|
+ if(_.find(impactRules,{ID:val})){
|
|
|
+ return val;
|
|
|
+ }else {
|
|
|
+ let feeRule = projectObj.project.installation_fee.getFeeRuleByID(item.libID,val);
|
|
|
+ if(feeRule){
|
|
|
+ return feeRule.rule;
|
|
|
+ }
|
|
|
}
|
|
|
return val;
|
|
|
}
|
|
@@ -812,6 +818,9 @@ let installationFeeObj={
|
|
|
}
|
|
|
installation_fee.updateFeeRule({position:recode.code,billID:recode.ID},rationInstall.libID,rationInstall.ruleId,function (){
|
|
|
me.refreshRationInstallationRow(riselection.row);
|
|
|
+ installation_fee.calcInstallationFee(function () {
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
updateFeeRulePosition:function (recode) {
|
|
@@ -866,6 +875,9 @@ let installationFeeObj={
|
|
|
};
|
|
|
projectObj.project.ration_installation.update(updateData,function (data) {
|
|
|
me.refreshRationInstallationRow(ri_row);
|
|
|
+ projectObj.project.installation_fee.calcInstallationFee(function () {
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
updateFeeItemPosition:function(recode){
|
|
@@ -933,6 +945,7 @@ let installationFeeObj={
|
|
|
},
|
|
|
onRationInstallValueChange:function (e,info) {
|
|
|
let me = installationFeeObj;
|
|
|
+ let installation_fee = projectObj.project.installation_fee
|
|
|
if(info.newValue==info.oldValue){
|
|
|
return;
|
|
|
}
|
|
@@ -958,8 +971,8 @@ let installationFeeObj={
|
|
|
}
|
|
|
if(fieldID=='unifiedSetting'){//勾选统一设置
|
|
|
updateData.ruleId = '';
|
|
|
- let feeItem = projectObj.project.installation_fee.getFeeItemByID(raInstallation.libID,raInstallation.feeItemId);
|
|
|
- let section = projectObj.project.installation_fee.getInstallSectionByID(raInstallation.libID,raInstallation.sectionId);
|
|
|
+ let feeItem = installation_fee.getFeeItemByID(raInstallation.libID,raInstallation.feeItemId);
|
|
|
+ let section = installation_fee.getInstallSectionByID(raInstallation.libID,raInstallation.sectionId);
|
|
|
if(section&&feeItem&&feeItem.isCal == 1){
|
|
|
updateData.ruleId = section.feeRuleId;
|
|
|
}
|
|
@@ -967,6 +980,9 @@ let installationFeeObj={
|
|
|
updateData[fieldID] = info.newValue;
|
|
|
projectObj.project.ration_installation.update(updateData,function (data) {
|
|
|
me.refreshRationInstallationRow(info.row);
|
|
|
+ installation_fee.calcInstallationFee(function () {
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
modifyFeeRuleValueChange:function (e,info) {
|
|
@@ -1202,7 +1218,7 @@ let installationFeeObj={
|
|
|
install_fee.calcInstallationFee(function (isChange) {
|
|
|
if(isChange){
|
|
|
projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
- gljOprObj.refreshView();
|
|
|
+ installationFeeObj.showRationInstallationData(projectObj.project.mainTree.selected);
|
|
|
}
|
|
|
console.log("cal end");
|
|
|
});
|
|
@@ -1217,6 +1233,49 @@ let installationFeeObj={
|
|
|
$("#all_project_calc").prop("checked",false);
|
|
|
$("#FB_calc").prop("checked",true);
|
|
|
}
|
|
|
+ },
|
|
|
+ applyRuleTo:function(level,row){//level:FX/FB/PJ
|
|
|
+ let selectRecord = this.rationInstallData[row];
|
|
|
+ let ration_installation = projectObj.project.ration_installation;
|
|
|
+ let rationID = selectRecord.rationID;
|
|
|
+ let condition = {'libID':selectRecord.libID,'feeItemId':selectRecord.feeItemId,'sectionId':selectRecord.sectionId};
|
|
|
+ let rationList = [];
|
|
|
+ let rationNode = projectObj.project.mainTree.getNodeByID(rationID);
|
|
|
+ if(!rationNode){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(level == 'FX'){//应用到分项
|
|
|
+ let children = rationNode.parent.children;//兄弟节点
|
|
|
+ for(let c of children){
|
|
|
+ if(c.data.type == rationType.ration){
|
|
|
+ rationList.push(c.data.ID);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ condition.rationID = rationList;
|
|
|
+ }else if(level == 'FB'){//应用到分部
|
|
|
+ let FBNode = rationNode.parent.parent;//分部节点
|
|
|
+ let rationNodeList = projectObj.project.mainTree.getLeavesNodes(FBNode);
|
|
|
+ for(let r of rationNodeList){
|
|
|
+ if(r.data.type == rationType.ration){
|
|
|
+ rationList.push(r.data.ID);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ condition.rationID = rationList;
|
|
|
+ }
|
|
|
+ //应用到项目的时候就不用加入rationList做判断
|
|
|
+ let riList = ration_installation.getDataByConditions(condition);
|
|
|
+ let IDList = _.map(riList,'ID');
|
|
|
+ ration_installation.applyRuleByIDs(selectRecord.projectID,IDList,selectRecord.ruleId,function () {
|
|
|
+ //计算安装增加费
|
|
|
+ projectObj.project.installation_fee.calcInstallationFee(function (isChange) {
|
|
|
+ if(isChange){
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRationByParentID:function () {
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
|