import React, { Component, Fragment } from 'react'
import {
	Page, Validator, Notification, FormItem, BottomBtn,
	InputItem, Input, Bind, SelectItem, Button, Label, DatePickerItem, Section, Table, TextArea, ConfirmButton, Steps,AmountLabel
} from '@/components/Common-Library'
import Api from '@/service/api'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable } from 'mobx'
import { Row, Col, Popconfirm, Modal,Spin } from 'antd';
import { ButtonModal, ModalTest } from '@/components/Business-Library'
import { Link, withRouter } from 'react-router-dom'
import { height } from 'window-size';
import Business from '@/views/Public/Business'
import { TableExpansion } from '@/components/Business-Library'
import mFresel from '../model'
const { Pre, Next, StepWrapper } = Steps
const CodeTable = CodeTableFactory.getInstance()
const confirm = Modal.confirm
@withRouter
@inject('UserContext')
@inject('i18n')
@observer
export default class Chakancreen extends Page
{

    constructor(props) {
		super(props)
        // this.model = props.model
        this.model = new mFresel()
		this.bind = Bind.bind(this)
    }
   
    recp_smhlstHeader=[
        {
          title:<Label itext="收发报类型" />, 
          dataIndex:"dir",
          key:"dir",
          width:100,
          sorter: (r1,r2)=>ColSorter(r1.dir,r2.dir),
        },
        {
          title:<Label itext="报文类型" />, 
          dataIndex:"msgtyp",
          key:"msgtyp",
          width:100,
          sorter: (r1,r2)=>ColSorter(r1.msgtyp,r2.msgtyp),
        },
        {
          title:<Label itext="创建时间" />, 
          dataIndex:"credattim",
          key:"credattim",
          width:100,
          sorter: (r1,r2)=>ColSorter(r1.credattim,r2.credattim),
        },
        {
          title:<Label itext="报文路径" />, 
          dataIndex:"docpth",
          key:"docpth",
          width:100,
          sorter: (r1,r2)=>ColSorter(r1.docpth,r2.docpth),
        },
      ]
      onSel = () => {
        this.formBlur = true  //已触发表单提交处理
        Validator.validate(this.model, this.model.descriptor, async (errors, values) => {
            if (errors)
                return
            const rtnmsg = await Api.post('fresel/sel', { data: this.model })
            if (rtnmsg.retcod == SUCCESS) {
                //Notification.success({message:'数据提交成功!'})
                this.model.recp_smhlst = rtnmsg.data['recp_smhlst'];
                console.log(this.model)
            }
            else {
                Notification.error({ message: '查询失败!' })
            }
            //余下逻辑处理
      
        })
      }
    renderPage() {
        const bind = this.bind
        const { i18n } = this.props
        return (	<div style={{ position: 'relative' }}>
        <Business wrappedComponentRef={ref => (this.com = ref)}  extra={this.props.extra} model={this.model} />
        {/* 第一行 */}
        <Row>
                    <Col span={24}>

                        <Row>
                            <Col span={12}>
                                <Row className='row'>
                                    <Col span={5} offset={2}>
                                    <Label   itext="开始日期"/>
                                    </Col>
                                    <Col span={14}>
                                    <DatePickerItem InputProps={bind("strdat")}  desp="开始日期" path="/strdat" />
                                    </Col>
                                </Row>
                            </Col>
                            <Col span={12}>
                                <Row className='row'>
                                    <Col span={5} offset={2}>
                                    <Label itext="结束日期" trn="fresel" />	
                                    </Col>
                                    <Col span={14}>
                                    <DatePickerItem InputProps={bind("enddat")}  desp="结束日期" path="/enddat" />
                                    </Col>
                                    
                                </Row>
                            </Col>
                        </Row>


                    </Col>
                </Row>

                <div className='button0'>
                    <div className='button2'>
                        <Button type="primary" icon="search" onClick={this.onSel}>
                            <Label i18nId="MTABUT_BT000022" />
                        </Button>
                    </div>
    
                </div>
                <Row >
                    <Col span={23} style={{marginLeft:40}}>
                        <Table pagination={{ pageSize: 10, hideOnSinglePage: true }} columns={this.recp_smhlstHeader} dataSource={this.model.recp_smhlst}  />
                    </Col>
                </Row>

    </div >)
    }
}