|
|
@@ -54,17 +54,49 @@ ProjectController = {
|
|
|
}
|
|
|
},
|
|
|
addRootBill:function (project, sheetController) {//添加大项费用
|
|
|
- let newSource = null, newNode = null
|
|
|
- newSource = project.Bills.insertBills(-1, project.mainTree.selected.source.getNextSiblingID(),true);
|
|
|
- newNode = project.mainTree.insert(-1, project.mainTree.selected.getNextSiblingID());
|
|
|
+ if (!project || !sheetController) { return null; }
|
|
|
+ this.addSpecialBill(project, sheetController,null, null,true,billType.DXFY);
|
|
|
+ },
|
|
|
+ addFB:function(project, sheetController) {//添加分部
|
|
|
+ if (!project || !sheetController) { return null; }
|
|
|
+ let selected = project.mainTree.selected;
|
|
|
+ if(selected.parent==null&&isFlag(selected.data)&&selected.data.flagsIndex.fixed.flag==fixedFlag.SUB_ENGINERRING){//选中的是分部分项,则插入做为最后一个子项
|
|
|
+ this.addSpecialBill(project, sheetController,selected, null,true,billType.FB);
|
|
|
+ }
|
|
|
+ if(selected.parent){
|
|
|
+ this.addSpecialBill(project, sheetController,selected.parent, selected.nextSibling,true,billType.FB);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ addFX:function(project, sheetController) {//添加分项
|
|
|
+ if (!project || !sheetController) { return null; }
|
|
|
+ let selected = project.mainTree.selected;
|
|
|
+ if(selected.data.type==billType.FB||(selected.parent==null&&isFlag(selected.data)&&selected.data.flagsIndex.fixed.flag==fixedFlag.SUB_ENGINERRING)){//选中的是分部或者是分部分项工程,则插入做为最后一个子项
|
|
|
+ this.addSpecialBill(project, sheetController,selected, null,true,billType.FX);
|
|
|
+ }
|
|
|
+ if(selected.parent){
|
|
|
+ if(selected.data.type==billType.FX){
|
|
|
+ this.addSpecialBill(project, sheetController,selected.parent, selected.nextSibling,true,billType.FX);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addSpecialBill(project,sheetController,parent,nextSibling,isUserAdd,type){
|
|
|
+ let newSource = null, newNode = null;
|
|
|
+ let b_nexID = nextSibling==null?-1:nextSibling.source.getID();//主树和清单树,对应的树节点ID不一样
|
|
|
+ let m_nexID = nextSibling==null?-1:nextSibling.getID();
|
|
|
+ let b_parent = parent==null?-1:parent.source.getID();
|
|
|
+ let m_parent = parent==null?-1:parent.getID();
|
|
|
+
|
|
|
+ newSource = project.Bills.insertSpecialBill(b_parent, b_nexID,isUserAdd,type);
|
|
|
+ newNode = project.mainTree.insert(m_parent,m_nexID);
|
|
|
if (newNode) {
|
|
|
newNode.source = newSource;
|
|
|
newNode.sourceType = project.Bills.getSourceType();
|
|
|
newNode.data = newSource.data;
|
|
|
this.syncDisplayNewNode(sheetController, newNode);
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
+
|
|
|
addRation: function (project, sheetController, rationType, std) {
|
|
|
if (!project || !sheetController) { return; }
|
|
|
|