From e1dbc27fbe3f083322f87fc46070191c619c5199 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 07 八月 2023 20:31:06 +0800
Subject: [PATCH] 2023-08-07

---
 src/tabviews/custom/components/chart/antv-X6/index.jsx |  106 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 100 insertions(+), 6 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx
index 693f914..87c4c48 100644
--- a/src/tabviews/custom/components/chart/antv-X6/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx
@@ -386,7 +386,7 @@
     node: null,
     loading: false,
     status: 0,
-    rolelist: []
+    orgs: []
   }
 
   selectNode = null
@@ -424,7 +424,7 @@
       this.loadData()
 
       if (_config.plot.function === 'edit') {
-        this.getrolelist()
+        this.getorganizations()
       }
     })
   }
@@ -469,7 +469,7 @@
     }
   }
 
-  getrolelist = () => {
+  getorganizations = () => {
     Api.genericInterface({func: 's_get_organizations_v1'}).then(res => {
       if (!res.status) {
         notification.error({
@@ -480,7 +480,101 @@
         return
       }
 
-      this.setState({rolelist: res.data || []})
+      let orgs = []
+      res.organizations && res.organizations.forEach(com => {
+        let _com = {
+          key: com.OrgCode,
+          title: com.OrgName,
+          shortName: com.ShortName,
+          checkable: false,
+          disabled: true,
+          children: []
+        }
+
+        com.departments.forEach(dep => {
+          let _dep = {
+            key: dep.co_pro_code,
+            title: dep.co_pro_name,
+            checkable: false,
+            disabled: true,
+            children: []
+          }
+
+          dep.jobs.forEach(job => {
+            let _job = {
+              key: job.jobcode,
+              title: job.jobname,
+              checkable: false,
+              disabled: true,
+              children: []
+            }
+  
+            job.work_group.forEach(group => {
+              if (group.work_group === 'normal') {
+                group.workers.forEach(work => {
+                  let _work = {
+                    key: work.worker_id,
+                    title: work.workername,
+                    email: work.email || '',
+                    images: work.images || '',
+                    mob: work.mob || '',
+                    sex: work.sex || '',
+                    work_grade: work.work_grade || '',
+                    worker_id: work.worker_id || '',
+                    workercode: work.workercode || '',
+                    workername: work.workername || '',
+                  }
+  
+                  _job.children.push(_work)
+                })
+              } else {
+                let _group = {
+                  key: group.work_group,
+                  title: group.work_group,
+                  checkable: false,
+                  disabled: true,
+                  children: []
+                }
+
+                group.workers.forEach(work => {
+                  let _work = {
+                    key: work.worker_id,
+                    title: work.workername,
+                    email: work.email || '',
+                    images: work.images || '',
+                    mob: work.mob || '',
+                    sex: work.sex || '',
+                    work_grade: work.work_grade || '',
+                    worker_id: work.worker_id || '',
+                    workercode: work.workercode || '',
+                    workername: work.workername || '',
+                  }
+  
+                  _group.children.push(_work)
+                })
+
+                if (_group.children.length > 0) {
+                  _job.children.push(_group)
+                }
+              }
+            })
+
+            if (_job.children.length > 0) {
+              _dep.children.push(_job)
+            }
+          })
+
+          if (_dep.children.length > 0) {
+            _com.children.push(_dep)
+          }
+        })
+
+        if (_com.children.length > 0) {
+          orgs.push(_com)
+        }
+      })
+
+      this.setState({orgs: orgs})
     })
   }
 
@@ -1867,7 +1961,7 @@
   }
 
   render() {
-    const { loading, config, node, rolelist, status } = this.state
+    const { loading, config, node, orgs, status } = this.state
 
     let style = {...config.style}
 
@@ -1947,7 +2041,7 @@
           <div id={config.uuid + 'container'} className="mk-container"></div>
           <div className="mk-node-edit">
             <div className="header">璁剧疆</div>
-            {!node ? <div className="empty">鏈�変腑</div> : <NodeUpdate node={node} rolelist={rolelist} onChange={this.changeProps}/>}
+            {!node ? <div className="empty">鏈�変腑</div> : <NodeUpdate node={node} orgs={orgs} onChange={this.changeProps}/>}
           </div>
         </div>
       </div>

--
Gitblit v1.8.0