|
@@ -20,11 +20,11 @@ var pageOprObj = {
|
|
|
html = html.replace("XXX定额库", rationLibName);
|
|
|
$("#rationname")[0].outerHTML = html;
|
|
|
me.rationLibName = rationLibName;
|
|
|
- repositoryGljObj.getGljTree(rationLibName, function(repId){
|
|
|
- repositoryGljObj.buildSheet(container);
|
|
|
- repositoryGljObj.getGljItems(repId);
|
|
|
- sheetCommonObj.shieldAllCells(repositoryGljObj.workBook.getSheet(0), repositoryGljObj.setting);
|
|
|
- });
|
|
|
+ repositoryGljObj.currentRepositoryId = parseInt(rationLibId);
|
|
|
+ repositoryGljObj.getGljTree(rationLibId);
|
|
|
+ repositoryGljObj.buildSheet(container);
|
|
|
+ repositoryGljObj.getGljItems(rationLibId);
|
|
|
+ sheetCommonObj.shieldAllCells(repositoryGljObj.workBook.getSheet(0), repositoryGljObj.setting);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -53,12 +53,12 @@ repositoryGljObj = {
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
- getGljTree: function(rationLibName, callback) {
|
|
|
+ getGljTree: function(rationLibId) {
|
|
|
var me = this;
|
|
|
$.ajax({
|
|
|
type:"POST",
|
|
|
url:"api/getGljTree",
|
|
|
- data:{"rationLibName": rationLibName},
|
|
|
+ data:{"rationLibId": rationLibId},
|
|
|
dataType:"json",
|
|
|
cache:false,
|
|
|
timeout:20000,
|
|
@@ -67,11 +67,8 @@ repositoryGljObj = {
|
|
|
zTreeHelper.createTree(result.data, gljSetting, "repositoryTree", me);
|
|
|
if (result.data && result.data.length > 0) {
|
|
|
me.gljCurTypeId = result.data[0].ID;
|
|
|
- if (callback) {
|
|
|
- var repId = -1;
|
|
|
- repId = result.data[0].repositoryId;
|
|
|
- callback(repId);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ gljTypeTreeOprObj.addRootNode();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -82,7 +79,6 @@ repositoryGljObj = {
|
|
|
},
|
|
|
getGljItems: function(repId) {
|
|
|
var me = this;
|
|
|
- me.currentRepositoryId = repId;
|
|
|
$.ajax({
|
|
|
type:"POST",
|
|
|
url:"api/getGljItems",
|
|
@@ -398,6 +394,21 @@ var gljTypeTreeOprObj = {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ addRootNode: function() {
|
|
|
+ var me = repositoryGljObj, rawNode = {ParentID: -1, NextSiblingID: -1, Name: "所有"}, lastNodeId = -1;
|
|
|
+ if (me.treeObj) {
|
|
|
+ var rootNodes = me.treeObj.getNodes();
|
|
|
+ if (rootNodes.length == 0) {
|
|
|
+ gljTypeTreeOprObj.addNewNode(rawNode, lastNodeId, function(err, rst){
|
|
|
+ if (!(err)) {
|
|
|
+ var newNodes = [], isSilent = false;
|
|
|
+ newNodes.push({ repositoryId: rst.data.repositoryId, ID: rst.data.ID, ParentID: rst.data.ParentID, NextSiblingID:-1, Name:"所有",isParent:false, items:[]});
|
|
|
+ me.treeObj.addNodes(null, -1, newNodes, isSilent);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
addNewNode : function(rawNode, lastNodeId, callback){
|
|
|
$.ajax({
|
|
|
type:"POST",
|