king
2022-07-22 0c439ced2c97905cb2b02f5f689a37b19369fb8a
src/tabviews/formtab/index.jsx
@@ -2,7 +2,7 @@
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { notification, Spin, Tabs, Icon} from 'antd'
import { notification, Spin, Tabs} from 'antd'
import moment from 'moment'
import Api from '@/api'
@@ -12,7 +12,7 @@
import options from '@/store/options.js'
import asyncComponent from '@/utils/asyncLoadComponent'
import MKEmitter from '@/utils/events.js'
import MkIcon from '@/components/mk-icon'
import FormGroup from './formgroup'
import FormAction from './actionList'
import NotFount from '@/components/404'
@@ -48,11 +48,11 @@
   * @description 获取页面配置信息
   */
  async loadconfig () {
    const { permAction } = this.props
    const { permAction, MenuID } = this.props
    let param = {
      func: 'sPC_Get_LongParam',
      MenuID: this.props.MenuID
      MenuID: MenuID
    }
    let result = await Api.getCacheConfig(param)
    if (result.status) {
@@ -103,11 +103,24 @@
        config.tabgroups = _tabgroups
      }
      // 权限过滤
      if (this.props.menuType !== 'HS') {
      if (!window.GLOB.mkHS) {
        config.action = config.action.filter(item => permAction[item.uuid])
        config.tabgroups.forEach(group => {
          group.sublist = group.sublist.filter(tab => permAction[tab.linkTab])
          group.sublist = group.sublist.filter(tab => {
            if (tab.supMenu === 'mainTable') {
              tab.supMenu = MenuID
            }
            return permAction[tab.linkTab]
          })
        })
      } else {
        config.tabgroups.forEach(group => {
          group.sublist = group.sublist.filter(tab => {
            if (tab.supMenu === 'mainTable') {
              tab.supMenu = MenuID
            }
            return true
          })
        })
      }
@@ -141,8 +154,8 @@
        primaryId: this.props.param.primaryId || '',
        data: this.props.param.data || null,
        BIDs: {
          mainTable: config.setting.onload !== 'false' ? (this.props.param.primaryId || '') : '',
          mainTabledata: config.setting.onload !== 'false' ? (config.setting.datatype === 'query' ? '' : this.props.param.data) : ''
          [MenuID]: config.setting.onload !== 'false' ? (this.props.param.primaryId || '') : '',
          [MenuID + 'data']: config.setting.onload !== 'false' ? (config.setting.datatype === 'query' ? '' : this.props.param.data) : ''
        }
      }, () => {
        this.improveSelectOption(config.groups)
@@ -183,7 +196,7 @@
          item.options.unshift({
            key: Utils.getuuid(),
            Value: '',
            Text: this.state.dict['main.all']
            Text: '全部'
          })
        }
  
@@ -201,7 +214,7 @@
          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
          param.secretkey = Utils.encrypt(param.LText, param.timestamp)
          if (this.props.menuType === 'HS') { // 云端数据验证
          if (window.GLOB.mkHS) { // 云端数据验证
            param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
            if (item.database === 'sso' && options.cloudServiceApi) { // 存在云端地址时,使用云端系统参数
@@ -340,11 +353,7 @@
      this.setState({
        data: _data,
        primaryId: _primaryId,
        BIDs: {
          ...BIDs,
          mainTable: _primaryId,
          mainTabledata: _data
        }
        BIDs: { ...BIDs, [this.props.MenuID]: _primaryId, [this.props.MenuID + 'data']: _data }
      })
      if (_data && (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc))) {
@@ -429,7 +438,7 @@
    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
    param.DateCount = ''
    if (this.props.menuType !== 'HS') { // 云端数据验证
    if (!window.GLOB.mkHS) { // 云端数据验证
      param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
    }
@@ -447,7 +456,7 @@
    if (setting.interType === 'inner') {
      param.func = setting.innerFunc
    } else {
      if (this.props.menuType === 'HS') {
      if (window.GLOB.mkHS) {
        if (setting.sysInterface === 'true' && options.cloudServiceApi) {
          param.rduri = options.cloudServiceApi
        } else if (setting.sysInterface !== 'true') {
@@ -493,11 +502,7 @@
          }
          this.setState({
            BIDs: {
              ...BIDs,
              mainTable: primaryId,
              mainTabledata: data
            }
            BIDs: { ...BIDs, [this.props.MenuID]: primaryId, [this.props.MenuID + 'data']: data }
          })
        }
      })
@@ -517,21 +522,6 @@
      }
      MKEmitter.emit('closeTabView', this.props.MenuID)
    }
  }
  /**
   * @description 表格Id变化
   */
  handleTableId = (type, id, data) => {
    const { BIDs } = this.state
    this.setState({
      BIDs: {
        ...BIDs,
        [type]: id,
        [type + 'data']: data
      }
    })
  }
  /**
@@ -574,6 +564,14 @@
    this.loadmaindata()
  }
  changeTableLine = (ContainerId, tableId, id, data) => {
    if (this.state.ContainerId !== ContainerId) return
    this.setState({
      BIDs: {...this.state.BIDs, [tableId]: id, [tableId + 'data']: data}
    })
  }
  UNSAFE_componentWillMount () {
    // 组件加载时,获取菜单数据
    this.loadconfig()
@@ -584,8 +582,9 @@
  }
  componentDidMount () {
    MKEmitter.addListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.addListener('reloadData', this.reloadData)
    MKEmitter.addListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.addListener('changeTableLine', this.changeTableLine)
  }
  /**
@@ -596,8 +595,9 @@
      return
    }
    MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.removeListener('reloadData', this.reloadData)
    MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.removeListener('changeTableLine', this.changeTableLine)
  }
  render() {
@@ -622,7 +622,6 @@
        }
        {hasform ?
          <FormAction
            menuType={this.props.menuType}
            setting={setting}
            actions={actions}
            dict={this.state.dict}
@@ -642,7 +641,7 @@
                  return (
                    <TabPane tab={
                      <span>
                        {_tab.icon ? <Icon type={_tab.icon} /> : null}
                        {_tab.icon ? <MkIcon type={_tab.icon} /> : null}
                        {_tab.label}
                      </span>
                    } key={`${index}`}>
@@ -653,7 +652,6 @@
                        ContainerId={this.state.ContainerId}
                        BID={this.state.BIDs[_tab.supMenu] || ''}
                        BData={this.state.BIDs[_tab.supMenu + 'data'] || ''}
                        handleTableId={this.handleTableId}
                      />
                    </TabPane>
                  )
@@ -662,7 +660,7 @@
            )
          })
        }
        {this.props.menuType !== 'HS' && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null}
        {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null}
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
      </div>
    )
@@ -671,7 +669,6 @@
const mapStateToProps = (state) => {
  return {
    menuType: state.editLevel,
    permAction: state.permAction
  }
}