king
2023-06-28 f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd
src/tabviews/custom/popview/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'
@@ -41,6 +41,7 @@
const Voucher = asyncComponent(() => import('../components/module/voucher'))
const Iframe = asyncComponent(() => import('../components/iframe'))
const AntvG6 = asyncComponent(() => import('../components/chart/antv-G6'))
const AntvX6 = asyncComponent(() => import('../components/chart/antv-X6'))
class CustomPage extends Component {
  static propTpyes = {
@@ -97,7 +98,7 @@
    // 数据缓存设置
    if (config.cacheUseful === 'true') {
      if (!['day', 'hour'].includes(config.timeUnit)) {
      if (!['day', 'hour', 'minute'].includes(config.timeUnit)) {
        config.timeUnit = 'day'
      }
      config.cacheTime = config.cacheTime || 1
@@ -302,9 +303,7 @@
        item.search = Utils.initSearchVal(item.search)
      }
      let mutil = false
      if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件
        mutil = true
        item.setting.supModule = item.supNodes[0].componentId
      } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') {
        let pid = item.setting.supModule.pop()
@@ -322,13 +321,6 @@
          cell = this.resetButton(item, cell, Tab)
          cell.$toolbtn = true
          if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
            cell.syncComponentId = ''
            if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
              cell.execSuccess = 'mainline'
            }
          }
          return true
        })
@@ -371,13 +363,6 @@
                  if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
            
                  cell = this.resetButton(item, cell, Tab)
                  if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
                    cell.syncComponentId = ''
                    if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
                      cell.execSuccess = 'mainline'
                    }
                  }
                } else {
                  cell = this.resetElement(cell)
                }
@@ -430,19 +415,36 @@
              if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
              cell = this.resetButton(item, cell, Tab)
              if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
                cell.syncComponentId = ''
                if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
                  cell.execSuccess = 'mainline'
                }
              }
            } else {
              cell = this.resetElement(cell)
            }
            return true
          })
          if (card.setting.click === 'menus') {
            if (card.menus) {
              card.menus = card.menus.filter(m => !!m.MenuID)
              if (card.menus.length === 0) {
                card.menus = null
              }
            }
            if (!card.menus || item.subtype !== 'datacard' || card.$cardType === 'extendCard') {
              card.setting.click = ''
            }
          } else if (card.setting.click === 'menu') {
            if (!Array.isArray(card.setting.menu)) {
              card.setting.click = ''
            }
          }
          if (item.subtype === 'dualdatacard' && card.$cardType !== 'extendCard') {
            if (card.backSetting && card.backSetting.click === 'menu') {
              if (!Array.isArray(card.backSetting.menu)) {
                card.backSetting.click = ''
              }
            }
          }
          if (!card.backElements || card.backElements.length === 0) return
@@ -451,13 +453,6 @@
              if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
              cell = this.resetButton(item, cell, Tab)
              if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
                cell.syncComponentId = ''
                if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
                  cell.execSuccess = 'mainline'
                }
              }
            } else {
              cell = this.resetElement(cell)
            }
@@ -478,13 +473,6 @@
            if (cell.hidden === 'true' || cell.OpenType === 'popview') return false
            cell = this.resetButton(item, cell, Tab)
            if (cell.syncComponentId && cell.syncComponentId === item.wrap.supModule) {
              cell.syncComponentId = ''
              if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
                cell.execSuccess = 'mainline'
              }
            }
          } else {
            cell = this.resetElement(cell)
          }
@@ -595,6 +583,32 @@
        cell.controlVals = cell.controlVal.split(',')
      } else {
        cell.controlVals = [(cell.controlVal || '')]
      }
    }
    if (cell.syncComponentId) {
      if (cell.syncComponentId === item.setting.supModule) {
        cell.syncComponentId = ''
        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
          cell.execSuccess = 'mainline'
        }
      } else if (cell.syncComponentId === 'multiComponent') {
        let ids = cell.syncComponents.map(m => {
          return m.syncComId.pop() || ''
        })
        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
            cell.execSuccess = 'mainline'
          }
          ids = ids.filter(id => id !== item.setting.supModule)
        }
        if (ids.length === 0) {
          cell.syncComponentId = ''
        } else {
          cell.syncComponentIds = ids
        }
      }
    }
@@ -784,6 +798,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
@@ -808,11 +836,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
          })
        }
      }
    })
  }
@@ -1040,6 +1076,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 {
        return null
      }