From 328be53b4461397cd96da79c7e40c892bdb94e2a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 15 六月 2025 21:00:39 +0800 Subject: [PATCH] 2025-06-15 --- src/tabviews/custom/components/tree/antd-tree/index.jsx | 37 ++++++++++++++++++++++++++----------- 1 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index e218c48..0f4a527 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -36,6 +36,7 @@ } loaded = false + options = null UNSAFE_componentWillMount () { const { config } = this.props @@ -70,6 +71,8 @@ window.GLOB.SyncData.delete(_config.dataName) } + } else if (_config.setting.supModule && !BID) { + _config.setting.onload = 'false' } let lineActions = [] @@ -275,8 +278,8 @@ if (config.uuid !== menuId) return - if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠� - MKEmitter.emit('reloadData', config.setting.supModule, BID) + if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { + MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) } else { this.loadData() } @@ -362,11 +365,12 @@ return } let parentNodes = [] - let _options = [] let logMap = new Map() let selectKey = selectedKeys[0] || '' let selectData = '' let hasSelectKey = false + + this.options = [] data.forEach(item => { let pval = item[config.wrap.parentField] + '' @@ -397,7 +401,7 @@ $parentId: '' }) } else if (pval) { - _options.push({ + this.options.push({ ...item, $$uuid: uuid, $title: item[config.wrap.labelField] || '', @@ -406,7 +410,17 @@ }) } }) - let _treedata = this.getTree(parentNodes, _options) + let _treedata = this.getTree(parentNodes) + + if (this.options.length) { + this.options.forEach(item => { + _treedata.push({ + ...item, + mk_floor: 1, + $$title: <span style={{color: '#f5222d'}}>{item.$title}</span> + }) + }) + } let _treeNodes = [] @@ -483,11 +497,11 @@ /** * @description 鑾峰彇缁撴瀯鏍戜俊鎭� */ - getTree = (parents, options) => { + getTree = (parents) => { parents.forEach(parent => { parent.children = [] // 娣诲姞鑿滃崟鐨勫瓙鍏冪礌 - options = options.filter(option => { + this.options = this.options.filter(option => { if (option.$parentId === parent.$key) { option.mk_floor = parent.mk_floor + 1 parent.children.push(option) @@ -499,7 +513,7 @@ if (parent.children.length === 0) { parent.children = null } else { - parent.children = this.getTree(parent.children, options) + parent.children = this.getTree(parent.children) } }) return parents @@ -517,7 +531,7 @@ </TreeNode> ) } - return <TreeNode icon={<FileOutlined />} key={item.$key} title={item.$title} dataRef={item} isLeaf /> + return <TreeNode icon={<FileOutlined />} key={item.$key} title={item.$$title || item.$title} dataRef={item} isLeaf /> }) } @@ -526,7 +540,7 @@ let title = null if (actShow === 'line') { title = <> - {item.$title} + {item.$$title || item.$title} <MainAction BID={this.state.BID} BData={this.state.BData} @@ -538,7 +552,7 @@ </> } else { title = <> - {item.$title} + {item.$$title || item.$title} <Dropdown overlay={ <div className="mk-tree-dropdown-wrap" onClick={(e) => e.stopPropagation()}> <MainAction @@ -659,6 +673,7 @@ </Tree> </div> : null} {treeNodes && treeNodes.length === 0 ? <Empty description={false}/> : null} + {!treeNodes ? <div style={{height: '100px'}}></div> : null} </div> ) } -- Gitblit v1.8.0