|
@@ -13,8 +13,12 @@ $(document).ready(function() {
|
|
|
this.setting = setting;
|
|
|
this.filingTree = null;
|
|
|
this.pageCount = 15;
|
|
|
+ this.expandKey = 'filing-' + window.location.pathname.split('/')[2];
|
|
|
+ const cache = getLocalCache(this.expandKey);
|
|
|
+ this.expandCache = cache ? cache.split(',') : [];
|
|
|
}
|
|
|
analysisFiling(data) {
|
|
|
+ const self = this;
|
|
|
this.dragTree.loadDatas(data);
|
|
|
this.dragTree.recursiveFun(this.dragTree.children, x => {
|
|
|
if (x.children && x.children.length > 0) {
|
|
@@ -36,6 +40,7 @@ $(document).ready(function() {
|
|
|
source_node: x,
|
|
|
};
|
|
|
if (result.source_node.is_fixed) result.isParent = true;
|
|
|
+ if (result.source_node.is_folder || result.source_node.is_fixed) result.open = self.expandCache.indexOf(result.id) >= 0;
|
|
|
return result;
|
|
|
});
|
|
|
this.filingTree = $.fn.zTree.init($('#filing'), this.setting, sortNodes);
|
|
@@ -235,6 +240,15 @@ $(document).ready(function() {
|
|
|
}
|
|
|
return result.join('/');
|
|
|
}
|
|
|
+ expandFiling(node, expand) {
|
|
|
+ if (expand) {
|
|
|
+ this.expandCache.push(node.id);
|
|
|
+ } else{
|
|
|
+ const index = this.expandCache.indexOf(node.id);
|
|
|
+ if (index >= 0) this.expandCache.splice(index, 1);
|
|
|
+ }
|
|
|
+ setLocalCache(this.expandKey, this.expandCache.join(','));
|
|
|
+ }
|
|
|
}
|
|
|
const levelTreeSetting = {
|
|
|
view: {
|
|
@@ -285,7 +299,13 @@ $(document).ready(function() {
|
|
|
beforeRemove: function(e, key, node, isCancel) {
|
|
|
$('#del-filing').modal('show');
|
|
|
return false;
|
|
|
- }
|
|
|
+ },
|
|
|
+ onExpand(e, key, node) {
|
|
|
+ filingObj.expandFiling(node, true);
|
|
|
+ },
|
|
|
+ onCollapse: function(e, key, node) {
|
|
|
+ filingObj.expandFiling(node, false);
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
const filingObj = new FilingObj(levelTreeSetting);
|