king
2022-11-21 f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89
src/tabviews/commontable/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { notification, Spin, Tabs, Switch, Row, Col } from 'antd'
import { notification, Spin, Tabs, Switch, Row, Col, Modal } from 'antd'
import Api from '@/api'
import zhCN from '@/locales/zh-CN/main.js'
@@ -36,7 +36,8 @@
    param: PropTypes.any,        // 其他页面传递的搜索条件等参数
    MenuID: PropTypes.string,    // 菜单Id
    MenuNo: PropTypes.string,    // 菜单参数
    MenuName: PropTypes.string   // 菜单名称
    MenuName: PropTypes.string,  // 菜单名称
    changeTemp: PropTypes.func
  }
  state = {
@@ -91,13 +92,34 @@
      try { // 配置信息解析
        config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
        config.MenuID = MenuID
        config.MenuName = MenuName
        config.setting.MenuName = MenuName
        config.setting.$name = MenuName
      } catch (e) {
        console.warn('Parse Failure')
        config = ''
      }
      // 页面配置解析错误时提示
      if (!config) {
        this.setState({
          loadingview: false,
          viewlost: true
        })
        return
      }
      // 页面未启用时,显示未启用页面
      if (!config.enabled) {
        this.setState({
          loadingview: false,
          viewlost: true,
          lostmsg: this.state.dict['main.view.unenabled']
        })
        return
      }
      // 模板错误
      if (config.Template === 'BaseTable' || config.Template === 'CustomPage') {
        this.props.changeTemp(MenuID, config.Template)
        return
      }
      
      // HS不使用自定义设置
@@ -136,24 +158,11 @@
        }
      }
      // 页面配置解析错误时提示
      if (!config) {
        this.setState({
          loadingview: false,
          viewlost: true
        })
        return
      }
      // 页面未启用时,显示未启用页面
      if (!config.enabled) {
        this.setState({
          loadingview: false,
          viewlost: true,
          lostmsg: this.state.dict['main.view.unenabled']
        })
        return
      }
      // 信息初始化赋值
      config.MenuID = MenuID
      config.MenuName = MenuName
      config.setting.MenuName = MenuName
      config.setting.$name = MenuName
      // 版本兼容
      config = updateCommonTable(config)
@@ -166,6 +175,8 @@
            if (tab.supMenu === 'mainTable') {
              tab.supMenu = MenuID
            }
            tab.ContainerId = this.state.ContainerId
            return window.GLOB.mkActions[tab.linkTab]
          })
        })
@@ -176,6 +187,8 @@
            if (tab.supMenu === 'mainTable') {
              tab.supMenu = MenuID
            }
            tab.ContainerId = this.state.ContainerId
            return tab
          })
        })
@@ -228,6 +241,7 @@
      // 标记主页面,用于按钮固定及表单挂载设置
      config.setting.tabType = 'main'
      config.setting.ContainerId = this.state.ContainerId
      // 数据源信息预处理
      config.setting.laypage = config.setting.laypage !== 'false'     // 是否分页,转为boolean 统一格式
@@ -305,6 +319,7 @@
      config.action.forEach(item => {
        item.logLabel = MenuName + '-' + item.label // 用于sPC_TableData_InUpDe记录操作按钮
        item.$menuId = this.props.MenuID
        item.ContainerId = this.state.ContainerId
        if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 打印机设置
          let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid)
@@ -785,11 +800,18 @@
      if (autoMatic) {
        MKEmitter.emit('autoMaticError', this.props.MenuID)
      }
      if (result.ErrCode === 'N') {
        Modal.error({
          title: result.message,
        })
      } else {
      notification.error({
        top: 92,
        message: result.message,
        duration: 10
      })
      }
    }
  }
@@ -1169,7 +1191,6 @@
                      dict={this.state.dict}
                      MenuID={MenuID}
                      selectedData={selectedData}
                      ContainerId={this.state.ContainerId}
                    />
                  </div>
                  <div className="main-table-box">
@@ -1188,7 +1209,6 @@
                      total={this.state.total}
                      loading={this.state.loading}
                      statFValue={this.state.statFValue}
                      ContainerId={this.state.ContainerId}
                      refreshdata={this.refreshbytable}
                      chgSelectData={this.changeSelectedData}
                    />
@@ -1207,7 +1227,6 @@
                    columns={columns}
                    data={this.state.data}
                    loading={this.state.loading}
                    ContainerId={this.state.ContainerId}
                  />
                </Col>
              )
@@ -1236,7 +1255,6 @@
              dict={this.state.dict}
              MenuID={MenuID}
              selectedData={selectedData}
              ContainerId={this.state.ContainerId}
            />
          </div>
          <div className="main-table-box">
@@ -1255,7 +1273,6 @@
              total={this.state.total}
              loading={this.state.loading}
              statFValue={this.state.statFValue}
              ContainerId={this.state.ContainerId}
              refreshdata={this.refreshbytable}
              chgSelectData={this.changeSelectedData}
            />
@@ -1276,7 +1293,6 @@
                    SupMenuID={MenuID}
                    MenuID={_tab.linkTab}
                    mainSearch={_tab.searchPass === 'true' ? search : null}
                    ContainerId={this.state.ContainerId}
                    BID={this.state.BIDs[_tab.supMenu] || ''}
                    BData={this.state.BIDs[_tab.supMenu + 'data'] || ''}
                  />