|
@@ -25,16 +25,13 @@ $(document).ready(function() {
|
|
|
this.dragTree.recursiveFun(this.dragTree.children, x => {
|
|
|
if (x.children && x.children.length > 0) {
|
|
|
x.total_file_count = x.children.reduce((pre, c) => {
|
|
|
+ if (x.filing_type === 1) console.log('reduce', c.name, c.total_file_count);
|
|
|
return pre + c.total_file_count
|
|
|
}, 0);
|
|
|
- // x.total_file_count = x.children.map(y => {
|
|
|
- // return y.total_file_count;
|
|
|
- // }).reduce((pre, value) => {
|
|
|
- // return pre + value
|
|
|
- // }, 0);
|
|
|
} else {
|
|
|
- x.total_file_count = x.file_count;
|
|
|
+ x.total_file_count = x.file_count || 0;
|
|
|
}
|
|
|
+ if (x.filing_type === 1) console.log(x.name, x.total_file_count);
|
|
|
});
|
|
|
}
|
|
|
_loadFilingSourceNode() {
|
|
@@ -169,10 +166,20 @@ $(document).ready(function() {
|
|
|
});
|
|
|
}
|
|
|
delFiling(node, callback) {
|
|
|
+ const parent = node.getParentNode();
|
|
|
const self = this;
|
|
|
postData('filing/del', { id: node.id }, function(result) {
|
|
|
+ self.updateFilingFileCount(node, 0);
|
|
|
self.dragTree.loadPostData(result);
|
|
|
self.filingTree.removeNode(node);
|
|
|
+ self.calcTotalFileCount();
|
|
|
+ if (parent) {
|
|
|
+ const path = parent.getPath();
|
|
|
+ for (const p of path) {
|
|
|
+ p.name = p.source_node.name + (p.source_node.total_file_count > 0 ? `(${p.source_node.total_file_count})` : '');
|
|
|
+ filingObj.filingTree.updateNode(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (callback) callback();
|
|
|
});
|
|
|
}
|