$(document).ready(function() { class FilingObj { constructor(setting) { // 原始数据整理后的树结构,用来整理zTree显示 this.dragTree = createDragTree({ id: 'id', pid: 'tree_pid', level: 'tree_level', order: 'tree_order', rootId: '-1' }); // 界面显示的zTree this.setting = setting; this.filingTree = null; this.pageCount = 15; } analysisFiling(data) { this.dragTree.loadDatas(data); this.dragTree.recursiveFun(this.dragTree.children, x => { if (x.children && x.children.length > 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; } }); const sortNodes = this.dragTree.nodes.map(x => { const result = { id: x.id, tree_pid: x.tree_pid, name: x.name + (x.total_file_count > 0 ? `(${x.total_file_count})` : ''), spid: x.spid, source_node: x, }; if (result.source_node.is_fixed) result.isParent = true; return result; }); this.filingTree = $.fn.zTree.init($('#filing'), this.setting, sortNodes); } _getFileHtml(file) { const html = []; html.push('
添加单位下全部用户
${u.name}${u.mobile}
`); html.push(`${u.role}`); html.push(`