From ac4e2892a68bb4ef5b35e8e2e12e76d3ec3ede35 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 07 七月 2023 18:50:11 +0800
Subject: [PATCH] 2023-07-07

---
 src/tabviews/custom/components/chart/custom-chart/index.jsx |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx
index 19713cf..6d9ee7b 100644
--- a/src/tabviews/custom/components/chart/custom-chart/index.jsx
+++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx
@@ -4,7 +4,7 @@
 import { Chart } from '@antv/g2'
 import DataSet from '@antv/data-set'
 import * as echarts from 'echarts'
-import { Spin, Empty, notification } from 'antd'
+import { Spin, Empty, notification, Modal } from 'antd'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -267,7 +267,7 @@
 
     let result = await Api.genericInterface(param)
     if (result.status) {
-      if (config.$cache) {
+      if (config.$cache && config.setting.onload !== 'false') {
         Api.writeCacheConfig(config.uuid, result.data || '')
       }
 
@@ -280,16 +280,44 @@
         this.data = result.data || []
         this.handleData()
       }
+
+      if (config.timer && config.clearField && result.data && result.data[0]) {
+        let vals = (config.clearValue || '').split(',')
+        if (vals.includes(result.data[0][config.clearField])) {
+          this.timer && this.timer.stop()
+        }
+      }
+      if (result.message) {
+        if (result.ErrCode === 'Y') {
+          Modal.success({
+            title: result.message
+          })
+        } else if (result.ErrCode === 'S') {
+          notification.success({
+            top: 92,
+            message: result.message,
+            duration: 2
+          })
+        }
+      }
     } else {
       this.setState({
         loading: false
       })
       this.timer && this.timer.stop()
-      notification.error({
-        top: 92,
-        message: result.message,
-        duration: 10
-      })
+      
+      if (!result.message) return
+      if (result.ErrCode === 'N') {
+        Modal.error({
+          title: result.message,
+        })
+      } else if (result.ErrCode !== '-2') {
+        notification.error({
+          top: 92,
+          message: result.message,
+          duration: 10
+        })
+      }
     }
   }
 

--
Gitblit v1.8.0