import React, {
	Component
} from 'react';
import {
	observer
} from 'mobx-react';
import {
	WeaInput
} from 'ecCom';
import {
	WeaTableNew
} from 'comsMobx';
import {
	message
} from 'antd';
import findIndex from 'lodash/findIndex';
const WeaTable = WeaTableNew.WeaTable;

@observer
export default class DataList extends Component {
	constructor(props) {
		super(props);
	}

	componentDidMount() {}

	componentWillReceiveProps(nextProps) {}

	renderCol = (cols) => {
		const {
			store
		} = this.props;
		const {
			onPSLdayBlur,
			filter
		} = store;
		const colKey1 = 'PSLdays';
		let idx = findIndex(cols, item => item.dataIndex === colKey1);
		idx != -1 && (cols[idx].render = (text, record) => {
			return <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@k9zwzj`} value={record.PSLdaysspan} onBlur={(val) => onPSLdayBlur(record.id, val) } />
		});
	}

	render() {
		const {
			store
		} = this.props;
		const {
			table
		} = store;
		return (
			<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@87my2q`} comsWeaTableStore={table} needScroll={true} hasOrder={true}
				getColumns={cols => this.renderCol(cols)}
                onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}/>
		)
	}
}