|
@@ -87,11 +87,25 @@ var Bills = {
|
|
|
this.tree.loadDatas(this.datas);
|
|
|
};
|
|
|
|
|
|
+ bills.prototype.setMaxID = function (ID) {
|
|
|
+ this.tree.maxNodeID(ID);
|
|
|
+ };
|
|
|
+
|
|
|
// 提交数据后的错误处理方法
|
|
|
bills.prototype.doAfterUpdate = function(err, data){
|
|
|
// to do
|
|
|
};
|
|
|
|
|
|
+ bills.prototype.getCounterData = function (count) {
|
|
|
+ var updateData = {'projectID': this.project.ID()};
|
|
|
+ if (count) {
|
|
|
+ updateData[this.getSourceType()] = this.tree.maxNodeID() + count;
|
|
|
+ } else {
|
|
|
+ updateData[this.getSourceType()] = this.tree.maxNodeID() + 1;
|
|
|
+ }
|
|
|
+ return updateData;
|
|
|
+ };
|
|
|
+
|
|
|
bills.prototype.insertBills = function (parentId, nextSiblingId) {
|
|
|
var insertData = this.tree.getInsertData(parentId, nextSiblingId);
|
|
|
var that = this;
|
|
@@ -100,8 +114,10 @@ var Bills = {
|
|
|
if (data.type === idTree.updateType.new) {
|
|
|
that.datas.push(data.data);
|
|
|
}
|
|
|
- })
|
|
|
- project.pushNow('insertBills', ModuleNames.bills, tools.coverseTreeUpdateData(insertData));
|
|
|
+ });
|
|
|
+ this.project.pushNow('insertBills', [this.getSourceType(), this.project.projCounter()],
|
|
|
+ [ tools.coverseTreeUpdateData(insertData), this.getCounterData()]);
|
|
|
+ //project.pushNow('insertBills', ModuleNames.bills, tools.coverseTreeUpdateData(insertData));
|
|
|
|
|
|
return this.tree.insert(parentId, nextSiblingId);
|
|
|
};
|
|
@@ -119,7 +135,9 @@ var Bills = {
|
|
|
newData = data.data;
|
|
|
}
|
|
|
});
|
|
|
- project.pushNow('insertStdBills', ModuleNames.bills, tools.coverseTreeUpdateData(insertData));
|
|
|
+ this.project.pushNow('insertStdBills', [this.getSourceType(), this.project.projCounter()],
|
|
|
+ [ tools.coverseTreeUpdateData(insertData), this.getCounterData()]);
|
|
|
+ //project.pushNow('insertStdBills', ModuleNames.bills, tools.coverseTreeUpdateData(insertData));
|
|
|
|
|
|
return this.tree.insertByData(newData, parentId, nextSiblingId);
|
|
|
}
|