king
2019-12-23 d38dc481492878c04ddf2d6bc2e9bf7d44c57fd7
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 { BackTop, notification, Spin, Tabs} from 'antd'
import { BackTop, notification, Spin, Tabs, Icon} from 'antd'
import moment from 'moment'
import Api from '@/api'
import MainSearch from './mainSearch'
@@ -56,7 +56,7 @@
      MenuID: this.props.MenuID
    }
    let result = await Api.getSystemCacheConfig(param)
    if (result.status && result.LongParam) {
    if (result.status) {
      let config = ''
      try { // 配置信息解析
@@ -68,10 +68,9 @@
      // 页面配置解析错误时提示
      if (!config) {
        notification.warning({
          top: 92,
          message: this.state.dict['main.page.settingerror'],
          duration: 10
        this.setState({
          loadingview: false,
          viewlost: true
        })
        return
      }
@@ -147,7 +146,9 @@
        loading: true
      }, () => {
        this.improveSearch()
        this.loadmaindata()
        if (config.setting.onload !== 'false') {
          this.loadmaindata()
        }
      })
    } else {
      this.setState({
@@ -321,16 +322,29 @@
  }
  refreshbysearch = (searches) => {
    const { setting } = this.state
    // 搜索条件变化
    this.refs.mainTable.resetTable()
    this.setState({
      loading: true,
      pageIndex: 1,
      search: searches
    }, () => {
      this.loadmaindata()
    })
    if (setting.onload === 'false') {
      this.setState({
        loading: true,
        pageIndex: 1,
        search: searches,
        setting: {...setting, onload: 'true'}
      }, () => {
        this.loadmaindata()
      })
    } else {
      this.refs.mainTable.resetTable()
      this.setState({
        loading: true,
        pageIndex: 1,
        search: searches
      }, () => {
        this.loadmaindata()
      })
    }
  }
  refreshbytable = (pagination, filters, sorter) => {
@@ -474,7 +488,7 @@
  render() {
    const { setting, searchlist, actions, columns, loadingview, viewlost, tabviews } = this.state
    console.log(setting)
    return (
      <div className="commontable" id={'commontable' + this.props.MenuID}>
        {loadingview && <Spin size="large" />}
@@ -485,7 +499,7 @@
            dict={this.state.dict}
          /> : null
        }
        {actions &&
        {actions && setting.onload !== 'false' &&
          <MainAction
            ref="mainButton"
            MenuID={this.props.MenuID}
@@ -496,7 +510,7 @@
            dict={this.state.dict}
          />
        }
        {columns &&
        {columns && setting.onload !== 'false' &&
          <MainTable
            ref="mainTable"
            dict={this.state.dict}
@@ -510,11 +524,16 @@
            buttonTrigger={this.buttonTrigger}
          />
        }
        {setting && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 &&
        {setting && setting.onload !== 'false' && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 &&
          <Tabs defaultActiveKey="0" tabPosition="top">
            {tabviews.map((_tab, index) => (
              <TabPane tab={ _tab.label } key={`${index}`}>
                {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={this.props.MenuID} BID={this.state.BID} /> : null}
              <TabPane tab={
                <span>
                  {_tab.icon ? <Icon type={_tab.icon} /> : null}
                  {_tab.label}
                </span>
              } key={`${index}`}>
                {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={_tab.linkTab} BID={this.state.BID} /> : null}
              </TabPane>
            ))}
          </Tabs>