import { Listtreeview } from "./list/listtreeview"; import { each, shortcut, i18nText } from "@/core"; /** * guy * 异步树 * @class ListListDisplayTree * @extends TreeView */ @shortcut() export class ListDisplayTree extends Listtreeview { static xtype = "bi.list_display_tree"; static EVENT_CHANGE = "EVENT_CHANGE"; props() { return { extraCls: "bi-list-display-tree", }; } // 配置属性 _configSetting() { function beforeCollapse(treeId, treeNode) { return false; } function getFont(treeId, node) { return node.isLeaf ? {} : { color: "#999999" }; } return { view: { selectedMulti: false, dblClickExpand: false, showIcon: false, nameIsHTML: true, showTitle: false, fontCss: getFont, }, data: { key: { title: "title", name: "text", }, simpleData: { enable: true, }, }, callback: { beforeCollapse, }, }; } _dealWidthNodes(nodes) { nodes = super._dealWidthNodes(...arguments); each(nodes, (i, node) => { node.isParent = node.isParent || node.parent; if (node.text == null) { if (node.count > 0) { node.text = `${node.value}(${i18nText("BI-Basic_Altogether")}${node.count}${i18nText( "BI-Basic_Count" )})`; } } }); return nodes; } initTree(nodes, setting) { this.nodes = BI.$.fn.zTree.init(this.tree.element, setting || this._configSetting(), nodes); } }