import { shortcut, Widget, deepClone } from "@/core"; import { Msg } from "@/base"; import { TreeView } from "@/case"; @shortcut() export class MultiTreeCombo extends Widget { static xtype = "demo.multi_select_tree"; props = { baseCls: "" }; mounted() { this.tree.populate(); } render() { const self = this; const items = deepClone(Demo.CONSTANTS.TREE); return { type: "bi.absolute", items: [ { el: { type: "bi.multi_select_tree", ref(_ref) { self.tree = _ref; }, itemsCreator(options, callback) { console.log(options); // 根据不同的类型处理相应的结果 switch (options.type) { case TreeView.REQ_TYPE_INIT_DATA: break; case TreeView.REQ_TYPE_ADJUST_DATA: break; case TreeView.REQ_TYPE_SELECT_DATA: break; case TreeView.REQ_TYPE_GET_SELECTED_DATA: break; default: break; } callback({ items: deepClone(items), }); }, width: 300, value: { 根目录: {}, }, }, top: 50, bottom: 50, left: 50, right: 50, }, { el: { type: "bi.button", height: 30, text: "getValue", handler() { Msg.toast(JSON.stringify(self.tree.getValue())); }, }, left: 50, right: 50, bottom: 20, } ], }; } }