king
2024-10-18 df2a8398142b7a5176552e254422300b5a014ece
src/tabviews/custom/components/calendar/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Spin, notification, Modal } from 'antd'
import { Spin } from 'antd'
import Api from '@/api'
import asyncComponent from '@/utils/asyncComponent'
@@ -45,6 +45,8 @@
      BData = window.GLOB.CacheData.get(_config.$pageId)
    }
    let BID = BData ? (BData.$BID || '') : ''
    if (_config.setting.interType === 'system') {
      if (/@mk_year@/ig.test(_config.setting.dataresource) || /@mk_year@/ig.test(_config.setting.customScript)) {
        _config.setting.$re_year = true
@@ -63,8 +65,12 @@
      _config.action = []
    }
    if (_config.setting.supModule && !BID) {
      _config.setting.onload = 'false'
    }
    this.setState({
      BID: BData ? (BData.$BID || '') : '',
      BID: BID,
      BData: BData,
      config: _config,
      search: _config.$searches
@@ -100,11 +106,11 @@
  }
  initExec = () => {
    const { config } = this.state
    const { config, BID } = this.state
    if (config.$cache) {
      if (config.$time) {
        Api.getLCacheConfig(config.uuid, config.$time).then(res => {
        Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => {
          if (!res.valid && config.setting.onload === 'true') {
            setTimeout(() => {
              this.loadData('init')
@@ -128,7 +134,7 @@
          this.setState({data: _data})
        })
      } else {
        Api.getLCacheConfig(config.uuid, 0).then(res => {
        Api.getLCacheConfig(config.uuid, 0, BID).then(res => {
          if (!res.data || this.loaded) return
  
          let _data = []
@@ -180,8 +186,8 @@
    if (config.uuid !== menuId) return
    if (position === 'mainline' && config.setting.supModule && BID) { // 刷新源组件时,附带刷新上级行与当前组件
      MKEmitter.emit('reloadData', config.setting.supModule, BID)
    if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) {
      MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID)
    } else {
      this.loadData()
    }
@@ -243,7 +249,7 @@
    if (result.status) {
      this.loaded = true
      if (config.$cache && type === 'init') {
        Api.writeCacheConfig(config.uuid, result.data || [])
        Api.writeCacheConfig(config.uuid, result.data || [], BID)
      }
      let data = []
@@ -264,36 +270,13 @@
        loading: false
      })
      
      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
          })
        }
      }
      UtilsDM.querySuccess(result)
    } else {
      this.setState({
        loading: false
      })
      
      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
        })
      }
      UtilsDM.queryFail(result)
    }
  }