Tctp.js 10.8 KB
Newer Older
qianyuheng committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
import React, { Component, Fragment } from 'react'
import {
    Page, Validator, Notification, FormItem, DatePickerItem, TextAreaItem, CheckboxItem,
    InputItem, Input, Bind, SelectItem, Button, Label, Image, Table
} from '@/components/Common-Library'
import Api from '@/service/api'
import mTctame from '../model'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable } from 'mobx'

import { Row, Col, Card } from 'antd'

const CodeTable = CodeTableFactory.getInstance()


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

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

    async componentWillMount() {
		/*
		*添加初始化代码
		*/
        //快照模式下,不必开启校验,否则,静默校验,和记录变动
        !this.loadDisplay() && this.model.openMonitor() //开启校验	
    }
    componentWillUnmount() {
        this.model.stopMonitor()//关闭校验
    }



    //按钮事件
    onSav = () => {
        this.formBlur = true  //已触发表单提交处理
        Validator.validate(this.model, this.model.descriptor, async (errors, values) => {
            if (errors)
                return
            const rtnmsg = await Api.post('tctame/sav', { data: this.model })
            if (rtnmsg.retcod == SUCCESS) {
                Notification.success({ message: '数据提交成功!' })

            }
            else {
                Notification.error({ message: '服务端请求失败!' })
            }
            //余下逻辑处理

        })
    }
    onGetref = () => {
        this.formBlur = true  //已触发表单提交处理
        Validator.validate(this.model, this.model.descriptor, async (errors, values) => {
            if (errors)
                return
            const rtnmsg = await Api.post('tctame/getref', { data: this.model })
            if (rtnmsg.retcod == SUCCESS) {
                Notification.success({ message: '数据提交成功!' })

            }
            else {
                Notification.error({ message: '服务端请求失败!' })
            }
            //余下逻辑处理

        })
    }
    onRtn = () => {
        this.formBlur = true  //已触发表单提交处理
        Validator.validate(this.model, this.model.descriptor, async (errors, values) => {
            if (errors)
                return
            const rtnmsg = await Api.post('tctame/rtn', { 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' }}>
                <Row >
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="头寸编号" />
                            </Col>
                            <Col span={11}>
                                <InputItem InputProps={bind("ownref")} maxLength={16} desp="头寸编号" path="/tcsgrp/rec/ownref" />
                            </Col>
                            <Col span={2} offset={1}>
                                <Button type="primary" onClick={this.onGetref} desp="Get Ref." path="/mtabut/getref">
                                    <Label itext="获取" />
                                </Button>
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="归属机构" />
                            </Col>
                            <Col span={14}>
                                <InputItem InputProps={bind("branch")} maxLength={8} desp="归属机构" path="/tcsgrp/rec/branch" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="机构名称" />
                            </Col>
                            <Col span={14}>
                                <InputItem InputProps={bind("branchnam")} maxLength={40} desp="机构名称" path="/tcsgrp/rec/branchnam" />
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="申请日期" />
                            </Col>
                            <Col span={14}>
                                <DatePickerItem InputProps={bind("credat")} desp="申请日期" path="/tcsgrp/rec/credat" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="币种" />
                                <Label itext="金额" />
                            </Col>
                            <Col span={6}>
                                <SelectItem InputProps={bind("cur")} code={CodeTable.curtxt} desp="币种" path="/tcsgrp/rec/cur" />
                            </Col>
                            <Col span={7} offset={1}>
                                <InputItem InputProps={bind("amt")} desp="金额" path="/tcsgrp/rec/amt" />
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="预算起息日" />
                            </Col>
                            <Col span={14}>
                                <DatePickerItem InputProps={bind("valdat")} desp="预算起息日" path="/tcsgrp/rec/valdat" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="审批通过日期" />
                            </Col>
                            <Col span={14}>
                                <DatePickerItem InputProps={bind("opndat")} desp="审批通过日期" path="/tcsgrp/rec/opndat" />
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="状态" />
                            </Col>
                            <Col span={14}>
                                <InputItem InputProps={bind("sta")} maxLength={1} desp="状态" path="/tcsgrp/rec/sta" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="账户行BIC" />
                            </Col>
                            <Col span={14}>
                                <InputItem InputProps={bind("actbnk")} maxLength={12} desp="账户行BIC" path="/tcsgrp/rec/actbnk" />
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="账户号名称" />
                            </Col>
                            <Col span={14}>
                                <InputItem InputProps={bind("actbnknam")} maxLength={40} desp="账户号名称" path="/tcsgrp/rec/actbnknam" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="客户名称" />
                            </Col>
                            <Col span={14}>
                                <InputItem InputProps={bind("cusnam")} maxLength={60} desp="客户名称" path="/tcsgrp/rec/cusnam" />
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="付汇原因" />
                            </Col>
                            <Col span={14}>
                                <TextAreaItem InputProps={bind("payinf")} desp="付汇原因" path="/tcsgrp/rec/payinf" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="款项来源" />
                            </Col>
                            <Col span={14}>
                                <TextAreaItem InputProps={bind("payifom")} desp="款项来源" path="/tcsgrp/rec/payifom" />
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Row className='row'>
                            <Col span={5} offset={2}>
                                <Label itext="退回原因" />
                            </Col>
                            <Col span={14}>
                                <TextAreaItem InputProps={bind("rtnmsg")} desp="退回原因" path="/tcsgrp/rec/rtnmsg" />
                            </Col>
                        </Row>
                    </Col>
                </Row>
            </div>
        )
    }
}