From fc8c8d714687a22f711d642d192bd4149f3b7e88 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 22 四月 2024 11:15:14 +0800
Subject: [PATCH] 2024-04-22

---
 src/tabviews/custom/components/chart/antv-X6/index.jsx |   29 +++++++++++++++++++++++------
 1 files changed, 23 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 4e155ba..03c7b22 100644
--- a/src/tabviews/custom/components/chart/antv-X6/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx
@@ -388,7 +388,8 @@
     status: 0,
     flowname: '',
     flowcode: '',
-    orgs: []
+    orgs: [],
+    empty: true
   }
 
   selectNode = null
@@ -526,6 +527,7 @@
                     worker_id: work.worker_id || '',
                     workercode: work.workercode || '',
                     workername: work.workername || '',
+                    job_type: job.job_type || '',
                     parentIds: [com.OrgCode, dep.co_pro_code, job.jobcode],
                     parentNames: [com.OrgName, dep.co_pro_name, job.jobname]
                   }
@@ -553,6 +555,7 @@
                     worker_id: work.worker_id || '',
                     workercode: work.workercode || '',
                     workername: work.workername || '',
+                    job_type: job.job_type || '',
                     parentIds: [com.OrgCode, dep.co_pro_code, job.jobcode, group.work_group],
                     parentNames: [com.OrgName, dep.co_pro_name, job.jobname, group.work_group]
                   }
@@ -590,8 +593,8 @@
     const { BID } = this.state
 
     if (!BID) {
+      this.cells = []
       if (!is(fromJS(this.data), fromJS([]))) {
-        this.cells = []
         this.handleData()
       }
       this.setState({empty: true})
@@ -624,7 +627,8 @@
         status: item.status || 0,
         flowname: item.works_flow_name || '',
         flowcode: item.works_flow_code || '',
-        loading: false
+        loading: false,
+        empty: cells.length === 0
       })
 
       if (result.message) {
@@ -1003,8 +1007,19 @@
       if (!isNew) return
 
       let target = edge.getTargetCell()
+      let source = edge.getSourceCell()
 
-      if (!target) return
+      if (!target || !source) return
+
+      if (source.prop('mknode') === 'end') {
+        notification.warning({
+          top: 92,
+          message: '缁撴潫鑺傜偣涓嶅彲娣诲姞鍒嗘敮锛�',
+          duration: 2
+        })
+        graph.removeCells([edge])
+        return
+      }
 
       let mkdata = target.prop('mkdata')
 
@@ -1012,6 +1027,8 @@
         edge.prop('mknode', 'endEdge')
       } else if (target.prop('mknode') === 'start') {
         edge.prop('mknode', 'startEdge')
+      } else if (source.prop('mknode') === 'start') {
+        edge.prop('mknode', 'firstEdge')
       }
       if (mkdata) {
         edge.prop('mkdata', {status: mkdata.status, statusName: mkdata.statusName})
@@ -2224,12 +2241,12 @@
   }
 
   render() {
-    const { loading, config, node, orgs, status, flowname } = this.state
+    const { loading, config, node, orgs, status, flowname, empty } = this.state
 
     let style = {...config.style}
 
     if (config.plot.function === 'show') {
-      if (config.plot.empty === 'hidden' && this.cells.length === 0) {
+      if (config.plot.empty === 'hidden' && empty) {
         style.position = 'absolute'
         style.width = '100%'
         style.zIndex = -1

--
Gitblit v1.8.0