|
|
@@ -382,6 +382,73 @@ var PROJECT = {
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
+ project.prototype.updateMainBills = function(node,newval){
|
|
|
+ let datas = [];
|
|
|
+ let data = {
|
|
|
+ type:node.sourceType,
|
|
|
+ data:{
|
|
|
+ ID:node.data.ID,
|
|
|
+ mainBills:newval
|
|
|
+ }
|
|
|
+ };
|
|
|
+ datas.push(data);
|
|
|
+ setChildren(node,newval,datas);//同步设置所有子项
|
|
|
+ setParent(node,newval,datas);//设置父节点
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ this.updateNodes(datas,function () {
|
|
|
+ let nodes = [];
|
|
|
+ for(let d of datas){
|
|
|
+ let node = projectObj.project.mainTree.findNode(d.data.ID);
|
|
|
+ if(node){
|
|
|
+ node.data.mainBills = d.data.mainBills;
|
|
|
+ nodes.push(node)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ projectObj.mainController.refreshTreeNode(nodes);
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ });
|
|
|
+
|
|
|
+ function setChildren(pnode,newValue,datas) {//同步设置所有子项
|
|
|
+ if(pnode.children.length > 0 && pnode.children[0].sourceType == ModuleNames.bills){//设置子项不包括定额
|
|
|
+ for(let c of pnode.children){
|
|
|
+ let data = {
|
|
|
+ type:c.sourceType,
|
|
|
+ data:{
|
|
|
+ ID:c.data.ID,
|
|
|
+ mainBills:newValue
|
|
|
+ }
|
|
|
+ };
|
|
|
+ datas.push(data);
|
|
|
+ setChildren(c,newValue,datas)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function setParent(cnode,newValue,datas) {
|
|
|
+ let diferrent = false;
|
|
|
+ if(cnode.parent && !projectObj.project.Bills.isMeasureNode(cnode.parent)){//排除措施项目节点
|
|
|
+ for(b of cnode.parent.children){
|
|
|
+ if(b == cnode) continue
|
|
|
+ if(b.data.mainBills!== newValue){//有兄弟节点的值和本节点不一样,则父节点设置为null
|
|
|
+ diferrent = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let pvalue = diferrent === true?null:newValue;
|
|
|
+ let data = {
|
|
|
+ type:cnode.parent.sourceType,
|
|
|
+ data:{
|
|
|
+ ID:cnode.parent.data.ID,
|
|
|
+ mainBills:pvalue
|
|
|
+ }
|
|
|
+ };
|
|
|
+ datas.push(data);
|
|
|
+ setParent(cnode.parent,pvalue,datas);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
project.prototype.updateNodes = function (datas,callback) {
|
|
|
/* let datas = [
|
|
|
{
|