From ea06034e06a30d3e97838c7885ae7694273a8ca1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 05 十二月 2024 20:03:51 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/tabviews/custom/components/tree/antd-tree/index.jsx |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx
index f6ef504..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
@@ -364,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] + ''
@@ -399,7 +401,7 @@
           $parentId: ''
         })
       } else if (pval) {
-        _options.push({
+        this.options.push({
           ...item,
           $$uuid: uuid,
           $title: item[config.wrap.labelField] || '',
@@ -408,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 = []
 
@@ -485,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)
@@ -501,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
@@ -519,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 />
     })
   }
 
@@ -528,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}
@@ -540,7 +552,7 @@
         </>
       } else {
         title = <>
-          {item.$title}
+          {item.$$title || item.$title}
           <Dropdown overlay={
             <div className="mk-tree-dropdown-wrap" onClick={(e) => e.stopPropagation()}>
               <MainAction
@@ -661,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