import React, { Component, Fragment } from 'react'
import {
    Page, Validator, Notification, FormItem,
    InputItem, Input, Bind, SelectItem, Button, Label, DatePickerItem, Section, Table, TextAreaItem, ConfirmButton, Steps
} 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 } from 'antd';
import { PtyPicker } from '@/components/Business-Library'
import { Link, withRouter } from 'react-router-dom'
import Ptspta from '@/views/Public/Ptspta'
import Business from '@/views/Public/Business'

const { Pre, Next, StepWrapper } = Steps
const CodeTable = CodeTableFactory.getInstance()
const confirm = Modal.confirm

@withRouter
@inject('UserContext')
@inject('i18n')
@observer
export default class N99baowenScreen extends Page {
    @observable
    formBlur = false

    constructor(props) {
        super(props)
        this.model = props.model
        this.bind = Bind.bind(this)
    }

    async componentWillMount() {
    }

    componentWillUnmount() {
    }

    // 退出按钮
    onRtn = async () => {
        this.com.wrappedInstance.wrappedInstance.onRtn();
    }
    // 暂存按钮
    onPed = async () => {
        this.com.wrappedInstance.wrappedInstance.onPed();
    }
    // 校验 按钮
    onChk = () => {
        this.com.wrappedInstance.wrappedInstance.onChk();
    }
    goNext = () => {
        this.formBlur = true  //已触发表单提交处理
        Validator.validate(this.model, this.model.descriptor, (errors, values) => {
            if (!errors) {
                console.log("goNext")
                console.log(this.props);
                this.props.steps.go(1)
                this.onRecal()
                return
            }
            for (let item of errors) {
                if (this.bindSet.has(item.field))
                    return;
            }
            this.props.steps.go(1)
        })
    }
    //交易内实现
    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框 */}
                                <Label i18nId={"CPTP_LT000066"} />
                            </Col>
                            <Col span={14}>
                                <SelectItem InputProps={bind("trndoc_swftyp")} code={CodeTable.swftyp} desp="报文类型" path="/trnmod/trndoc/swftyp" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                {/* 第二行 */}
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={22} offset={2}>
                                <Label value="Content of tag 79. Please correct input of one of the in " />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                {/* 第三行 */}
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={22} offset={2}>
                                <Label value="uses a non SWIFT-conform entry in the first line." />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                {/* 第四行 */}
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={22} offset={2}>
                                {/* <TextAreaItem rows={8} style={{ resize: "none" }} InputProps={bind('bas_actiondesc')} /> */}
                                <TextAreaItem rows={8} style={{ resize: "none" }} InputProps={bind("trndoc_tag79txt")} desp="Content of tag 79" path="/trnmod/trndoc/tag79txt" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                {/* 第五行 */}
                <Row>
                    <Col span={12}>
                        <Row className='row' type="flex" justify="center">
                            <Col>
                                <Button>
                                    <Label value="OK" />
                                </Button>
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row type="flex" justify="center">
                    <Col>
                        <div className='button0'>
                            <div className='button2'>
                                {/* 退出按钮 */}
                                <ConfirmButton
                                    onOK={this.onRtn}
                                    title=""
                                    message="确定退出？"
                                >
                                    <Label i18nId="MTABUT_BT000464" />
                                </ConfirmButton>
                            </div>
                            <div className='button2'>
                                {/* 暂存按钮 */}
                                <ConfirmButton
                                    onOK={this.onPed}
                                    title=""
                                    message="确定暂存？"
                                >
                                    <Label i18nId="MTABUT_BT000398" />
                                </ConfirmButton>
                            </div>
                            <div className='button2'>
                                {/* 检核按钮 */}
                                <Button type="primary" onClick={this.onChk}>
                                    <Label i18nId="MTABUT_BT000180" />
                                </Button>
                            </div>
                        </div>
                    </Col>
                </Row>
            </div >
        )
    }
}
