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,TextAreaItem
} 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 Ptspta1 from '@/views/Public/Ptspta1'
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 Fasongcreen extends Page
{

    constructor(props) {
		super(props)
        // this.model = props.model
        this.model = new mFresel()
		this.bind = Bind.bind(this)
    }
    onSend= ()=>{
        this.formBlur=true  //已触发表单提交处理
        Validator.validate(this.model,this.model.descriptor,async(errors,values)=>{
                if(errors)
                    return 
                const rtnmsg = await Api.post('fresel/send',{data:this.model})
                if(rtnmsg.retcod == SUCCESS)
                {
                    Notification.success({message:'数据提交成功!'})
                    
                }
                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={12}>
                    <Row className="row" >
                        <Col span={5} offset={2}>

                            <Label itext="报文内容" />
                        </Col>

                    </Row>
                </Col>

            </Row>

            <Row>
                <Col span={12}>

                    <Col span={24}>
                        <Row className="row">

                            <Col span={20} offset={2}>
                                <TextAreaItem rows={6} style={{ resize: "none" }} InputProps={bind("fremsg_fretxt")} desp="Narrative" path="/recp/fremsg/fretxt" />
                            </Col>
                        </Row>
                    </Col>

                </Col>
                <Col span={12}>
                    <Ptspta1 model={this.model} argArr={{ desc: "收报行", prefix: 'pts', url: 'ditopn/advp_ptysel', flg: 'B', datakey: '\\fmcp\\ptap2\\ptslst' }} formBlur={this.formBlur} />
                </Col>

            </Row>
<br/>
        <Row type="flex" justify="center">
              <Col>
                <div className='button2'>
                  <ConfirmButton
                    type="primary"
                    onOK={this.onSend}
                    message="确定发送？"
                  >
                    <Label i18nId="发送" />
                  </ConfirmButton>
                </div>
           
              </Col>
            </Row>

    </div >)
    }
}