From 48db4d4b22331f32bf6c6a0956a7cd4245ad6fde Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 29 六月 2023 09:30:34 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/index.jsx |   57 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 3c6b9b3..c34c160 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { notification, Spin, Row, Col } from 'antd'
+import { notification, Spin, Row, Col, Modal } from 'antd'
 
 import Api from '@/api'
 import zhCN from '@/locales/zh-CN/main.js'
@@ -40,6 +40,7 @@
 const CustomChart = asyncComponent(() => import('./components/chart/custom-chart'))
 const TimeLine = asyncComponent(() => import('./components/timeline/normal-timeline'))
 const AntvG6 = asyncComponent(() => import('./components/chart/antv-G6'))
+const AntvX6 = asyncComponent(() => import('./components/chart/antv-X6'))
 const Voucher = asyncComponent(() => import('./components/module/voucher'))
 const Account = asyncComponent(() => import('./components/module/account'))
 const Iframe = asyncComponent(() => import('./components/iframe'))
@@ -52,7 +53,6 @@
     param: PropTypes.any,        // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟
     Tab: PropTypes.string,       // 寮圭獥鏍囩
     MenuID: PropTypes.string,    // 鑿滃崟Id
-    MenuNo: PropTypes.string,    // 鑿滃崟鍙傛暟
     MenuName: PropTypes.string,  // 鑿滃崟鍚嶇О
     changeTemp: PropTypes.func
   }
@@ -80,7 +80,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { MenuID } = this.props
+    const { MenuID, MenuName } = this.props
 
     let _param = {
       func: 'sPC_Get_LongParam',
@@ -97,6 +97,7 @@
         config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
         config = JSON.parse(config)
         config.MenuID = MenuID
+        config.MenuName = MenuName || config.MenuName
       } catch (e) {
         console.warn('Parse Failure')
         config = ''
@@ -207,7 +208,7 @@
       let initInters = []
 
       config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters)
-      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache)
+      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache, config.MenuName)
       
       // 鑾峰彇涓绘悳绱㈡潯浠�
       let mainSearch = []
@@ -336,7 +337,7 @@
     }
   }
 
-  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) => {
+  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName) => {
     return components.filter(item => {
       item.$pageId = pageId
       item.$cache = cache
@@ -348,7 +349,7 @@
         delete item.style.shadowColor
       }
 
-      item.$menuname = (this.props.MenuName || '') + '-' + (item.name || '')
+      item.$menuname = (MenuName || '') + '-' + (item.name || '')
 
       if (item.type === 'tabs') {
         if (
@@ -423,7 +424,7 @@
         item.subtabs = item.subtabs.map(tab => {
           tab.$pageId = pageId
 
-          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache)
+          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName)
           return tab
         })
 
@@ -436,10 +437,10 @@
           return false
         }
 
-        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache)
+        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName)
 
         return true
-      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) {
+      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) {
         if (
           item.plot.blacklist && item.plot.blacklist.length > 0 &&
           item.plot.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0
@@ -1087,6 +1088,20 @@
 
     Api.genericInterface(param).then(result => {
       if (result.status) {
+        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
+            })
+          }
+        }
+
         delete result.status
         delete result.message
         delete result.ErrMesg
@@ -1111,11 +1126,19 @@
           data: '',
           loading: false
         })
-        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
+          })
+        }
       }
     })
   }
@@ -1408,6 +1431,12 @@
             <AntvG6 config={item} data={data} mainSearch={mainSearch}/>
           </Col>
         )
+      } else if (item.type === 'antvX6') {
+        return (
+          <Col span={item.width} style={style} key={item.uuid}>
+            <AntvX6 config={item}/>
+          </Col>
+        )
       } else if (item.type === 'module' && item.subtype === 'voucher') {
         return (
           <Col span={item.width} style={style} key={item.uuid}>

--
Gitblit v1.8.0