import React, { PureComponent } from 'react'; import { Card, Button, Form, Icon, Col, Row, DatePicker, TimePicker, Input, Select, Popover, } from 'antd'; import { connect } from 'dva'; import FooterToolbar from 'components/FooterToolbar'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import TableForm from './TableForm'; import styles from './style.less'; const { Option } = Select; const { RangePicker } = DatePicker; const fieldLabels = { name: '仓库名', url: '仓库域名', owner: '仓库管理员', approver: '审批人', dateRange: '生效日期', type: '仓库类型', name2: '任务名', url2: '任务描述', owner2: '执行人', approver2: '责任人', dateRange2: '生效日期', type2: '任务类型', }; const tableData = [ { key: '1', workId: '00001', name: 'John Brown', department: 'New York No. 1 Lake Park', }, { key: '2', workId: '00002', name: 'Jim Green', department: 'London No. 1 Lake Park', }, { key: '3', workId: '00003', name: 'Joe Black', department: 'Sidney No. 1 Lake Park', }, ]; class AdvancedForm extends PureComponent { state = { width: '100%', }; componentDidMount() { window.addEventListener('resize', this.resizeFooterToolbar); } componentWillUnmount() { window.removeEventListener('resize', this.resizeFooterToolbar); } resizeFooterToolbar = () => { const sider = document.querySelectorAll('.ant-layout-sider')[0]; const width = `calc(100% - ${sider.style.width})`; if (this.state.width !== width) { this.setState({ width }); } }; render() { const { form, dispatch, submitting } = this.props; const { getFieldDecorator, validateFieldsAndScroll, getFieldsError } = form; const validate = () => { validateFieldsAndScroll((error, values) => { if (!error) { // submit the values dispatch({ type: 'form/submitAdvancedForm', payload: values, }); } }); }; const errors = getFieldsError(); const getErrorInfo = () => { const errorCount = Object.keys(errors).filter(key => errors[key]).length; if (!errors || errorCount === 0) { return null; } const scrollToField = fieldKey => { const labelNode = document.querySelector(`label[for="${fieldKey}"]`); if (labelNode) { labelNode.scrollIntoView(true); } }; const errorList = Object.keys(errors).map(key => { if (!errors[key]) { return null; } return (