king
2020-06-12 89e7167a83e0d8409ca87698e4c08651a37cc26e
src/tabviews/scriptmanage/index.jsx
@@ -11,10 +11,12 @@
import options from '@/store/options.js'
import { scriptMainTable, buttonConfig } from './config'
import MainTable from '@/tabviews/zshare/normalTable'
import asyncSpinComponent from '@/utils/asyncSpinComponent'
import TopSearch from './topSearch'
import MainAction from './actionList'
import './index.scss'
const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable'))
class ScriptTable extends Component {
  static propTpyes = {
@@ -34,6 +36,8 @@
    logcolumns: null,     // 日志中显示的列信息 (增加至全部列,除去合并列)
    setting: {},          // 页面全局设置:数据源、按钮及显示列固定、主键等
    data: [],             // 列表数据集
    selectedData: [],     // 已选表格数据
    resetTable: false,    // 表格重置,值在true与false之间切换,切换时表格重置
    total: 0,             // 总数
    loading: false,       // 列表数据加载中
    pageIndex: 1,         // 页码
@@ -188,12 +192,12 @@
   * 含有初始不加载的页面,修改设置
   */
  refreshbysearch = (searches) => {
    this.refs.mainTable.resetTable()
    this.setState({
      loading: true,
      pageIndex: 1,
      search: searches
      selectedData: [],
      search: searches,
      resetTable: !this.state.resetTable
    }, () => {
      this.loadmaindata()
    })
@@ -213,6 +217,7 @@
    this.setState({
      loading: true,
      selectedData: [],
      pageIndex: pagination.current,
      pageSize: pagination.pageSize,
      orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : ''
@@ -225,10 +230,11 @@
   * @description 表格刷新
   */
  reloadtable = () => {
    this.refs.mainTable.resetTable()
    this.setState({
      loading: true,
      pageIndex: 1
      pageIndex: 1,
      selectedData: [],
      resetTable: !this.state.resetTable
    }, () => {
      this.loadmaindata()
    })
@@ -238,21 +244,8 @@
   * @description 页面刷新,重新获取配置
   */
  reloadview = () => {
    this.setState({
      config: {},
      searchlist: [],
      actions: [],
      columns: [],
      arr_field: '',
      setting: {},
      data: [],
      total: 0,
      loading: false,
      pageIndex: 1,
      pageSize: 10,
      orderBy: '',
      search: '',
      pickup: false
    this.setState({ config: {}, searchlist: [], actions: [], columns: [], arr_field: '', setting: {}, data: [], total: 0,
      loading: false, pageIndex: 1, pageSize: 10, orderBy: '', search: '', pickup: false, selectedData: []
    }, () => {
      this.loadconfig()
    })
@@ -274,14 +267,10 @@
  }
  /**
   * @description 获取表格选择项
   * @description 表格选择项切换
   */
  gettableselected = () => {
    let data = []
    this.refs.mainTable.state.selectedRowKeys.forEach(item => {
      data.push(this.refs.mainTable.props.data[item])
    })
    return data
  changeSelectedData = (selectedData) => {
    this.setState({selectedData})
  }
  
  /**
@@ -313,7 +302,7 @@
  }
  render() {
    const { dict, searchlist, config, setting, actions, columns, pickup } = this.state
    const { dict, searchlist, config, setting, actions, columns, pickup, selectedData } = this.state
    return (
      <div className="veruptable pick-control" id={this.state.ContainerId}>
@@ -329,10 +318,10 @@
          actions={actions}
          dict={this.state.dict}
          MenuID={this.props.MenuID}
          selectedData={selectedData}
          logcolumns={this.state.logcolumns}
          ContainerId={this.state.ContainerId}
          refreshdata={this.refreshbyaction}
          gettableselected={this.gettableselected}
        />
        <div className="main-table-box">
          {this.state.data && this.state.data.length > 0 ?
@@ -341,8 +330,6 @@
            </div> : null
          }
          <MainTable
            ref="mainTable"
            menuType="HS"
            tableId="mainTable"
            pickup={pickup}
            config={config}
@@ -356,6 +343,8 @@
            refreshdata={this.refreshbytable}
            buttonTrigger={() => {}}
            handleTableId={() => {}}
            resetTable={this.state.resetTable}
            chgSelectData={this.changeSelectedData}
          />
        </div>
      </div>