// 核心库
import React from 'react'
import { connect } from 'dva'
// 组件库
import ListPage from '../../Table/ListPage'

class EDProductUnitSetPage extends React.Component {
  constructor (props) {
    super(props)
    this.refOfTable = null
  }

  componentDidMount () {
    const { data } = this.props
    const json = {
      rules: [
        {
          field: 'Parameter4',
          operator: 0,
          value: data.selectedNodes ? data.selectedNodes[0].node.id : null,
          isCustom: true,
          isSysParam: false
        }
      ]
    }
    this.refOfTable && this.refOfTable.loadData(json)
  }

  render () {
    const { data } = this.props
    return (
      <div className='scroll_page'>
        <ListPage
          preventDefaultSearch
          formCode='ED049'
          data={data}
          onRef={ref => this.refOfTable = ref}
        />
      </div>
    )
  }
}

export default connect(({ login }) => ({ login }))(EDProductUnitSetPage)
