king
2021-01-08 da7068bd48791cdee966c786ce0dfd46f6e03df9
src/tabviews/commontable/index.jsx
@@ -2,10 +2,9 @@
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { notification, Spin, Tabs, Icon, Switch, Modal, Button, message, Tree, Typography, Row, Col } from 'antd'
import { notification, Spin, Tabs, Icon, Switch, Modal, Button, message, Typography, Row, Col } from 'antd'
import Api from '@/api'
import options from '@/store/options.js'
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import Utils from '@/utils/utils.js'
@@ -27,7 +26,6 @@
const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent'))
const { TabPane } = Tabs
const { TreeNode } = Tree
const { Paragraph } = Typography
class NormalTable extends Component {
@@ -68,7 +66,6 @@
    statFields: [],       // 合计字段
    statFValue: [],       // 合计值
    absFields: [],        // 绝对值字段
    debug: sessionStorage.getItem('debug') === 'true'
  }
  /**
@@ -513,6 +510,9 @@
          }
          item.key = index
          item.$$uuid = item[setting.primaryKey] || ''
          item.$$BID = BID || ''
          return item
        }),
        total: result.total,
@@ -567,6 +567,9 @@
          data = data.map(item => {
            if (item[setting.primaryKey] === _data[setting.primaryKey]) {
              _data.key = item.key
              _data.$$uuid = _data[setting.primaryKey] || ''
              _data.$$BID = BID || ''
              return _data
            } else {
              return item
@@ -727,15 +730,6 @@
  }
  /**
   * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项
   */
  refreshbyaction = (position, btn) => {
    if (position === 'grid' || position === 'view') {
      this.reloadtable(btn)
    }
  }
  /**
   * @description 导出Excel时,获取页面搜索排序等参数
   */
  getexceloutparam = (menuId, btnId) => {
@@ -831,15 +825,7 @@
      if (_others) {
        _title = _title + ': ' + _others
      }
      if (item.subfuncs && item.subfuncs.length > 0) {
        return (
          <TreeNode title={_title} key={item.uuid} dataRef={item} selectable={false}>
            {this.getTreeNode(item.subfuncs)}
          </TreeNode>
        )
      }
      return <TreeNode key={item.uuid} title={_title} isLeaf selectable={false} />
      return <p key={item.uuid}>{_title}</p>
    })
  }
@@ -884,6 +870,20 @@
    this.setShortcut()
  }
  /**
   * @description 按钮执行完成后页面刷新
   * @param {*} menuId     // 菜单Id
   * @param {*} position   // 刷新位置
   * @param {*} btn        // 执行的按钮
   */
  refreshByButtonResult = (menuId, position, btn) => {
    const { MenuID } = this.props
    if (MenuID !== menuId) return
    this.reloadtable(btn)
  }
  UNSAFE_componentWillMount () {
    // 组件加载时,获取菜单数据
    this.loadconfig()
@@ -915,6 +915,7 @@
    MKEmitter.addListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu)
    MKEmitter.addListener('getexceloutparam', this.getexceloutparam)
    MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
  }
  /**
@@ -929,11 +930,12 @@
    MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu)
    MKEmitter.removeListener('getexceloutparam', this.getexceloutparam)
    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
  }
  render() {
    const { menuType, MenuName } = this.props
    const { debug, BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state
    const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state
    return (
      <div className="commontable" id={this.state.ContainerId}>
@@ -965,7 +967,6 @@
                      MenuID={this.props.MenuID}
                      selectedData={selectedData}
                      ContainerId={this.state.ContainerId}
                      refreshdata={this.refreshbyaction}
                    />
                  </div>
                  <div className="main-table-box">
@@ -984,7 +985,6 @@
                    }
                    <MainTable
                      tableId="mainTable"
                      BID={BID}
                      pickup={pickup}
                      setting={setting}
                      columns={columns}
@@ -994,11 +994,10 @@
                      total={this.state.total}
                      MenuID={this.props.MenuID}
                      loading={this.state.loading}
                      refreshdata={this.refreshbytable}
                      statFValue={this.state.statFValue}
                      handleTableId={this.handleTableId}
                      ContainerId={this.state.ContainerId}
                      refreshbyaction={this.refreshbyaction}
                      refreshdata={this.refreshbytable}
                      handleTableId={this.handleTableId}
                      chgSelectData={this.changeSelectedData}
                    />
                  </div>
@@ -1017,7 +1016,6 @@
                    MenuID={this.props.MenuID}
                    loading={this.state.loading}
                    ContainerId={this.state.ContainerId}
                    refreshdata={this.refreshbyaction}
                    handleTableId={this.handleTableId}
                  />
                </Col>
@@ -1061,10 +1059,9 @@
                  </TabPane>
                )
              })}
            </Tabs>)
          )
          </Tabs>))
        }
        {debug && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button
        {menuType !== 'HS' ? <Button
          icon="copy"
          shape="circle"
          className="common-table-copy"
@@ -1072,7 +1069,7 @@
        /> : null}
        <Modal
          className="menu-tree-modal"
          title={'菜单结构树'}
          title={'菜单信息'}
          width={'650px'}
          maskClosable={false}
          visible={this.state.treevisible}
@@ -1086,9 +1083,7 @@
            <span>菜单名称:{this.props.MenuName}</span>
            <span>菜单参数:{<Paragraph copyable>{this.props.MenuNo}</Paragraph>}</span>
          </div>
          {this.state.treevisible ? <Tree defaultExpandAll showLine={true}>
            {this.getTreeNode(config.funcs)}
          </Tree> : null}
          {this.state.treevisible ? this.getTreeNode(config.funcs) : null}
        </Modal>
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
      </div>