Commit f0119342 by hulei

merge swift

parent fd5b4733
...@@ -60,14 +60,14 @@ export const mty=[ ...@@ -60,14 +60,14 @@ export const mty=[
{mty:"mt565",desp:"MT 565 Corporate Action Instruction"}, {mty:"mt565",desp:"MT 565 Corporate Action Instruction"},
{mty:"mt566",desp:"MT 566 Corporate Action Confirmation"}, {mty:"mt566",desp:"MT 566 Corporate Action Confirmation"},
{mty:"mt567",desp:"MT 567 Corporate Action Status and Processing Advice"}, {mty:"mt567",desp:"MT 567 Corporate Action Status and Processing Advice"},
*/
{mty:"mt592",desp:"MT 592 Request for Cancellation"}, {mty:"mt592",desp:"MT 592 Request for Cancellation"},
{mty:"mt595",desp:"MT 595 Queries"}, {mty:"mt595",desp:"MT 595 Queries"},
{mty:"mt596",desp:"MT 596 Answers"}, {mty:"mt596",desp:"MT 596 Answers"},
{mty:"mt598",desp:"MT 598 Proprietary Message"}, {mty:"mt598",desp:"MT 598 Proprietary Message"},
{mty:"mt599",desp:"MT 599 Free Format Message"}, {mty:"mt599",desp:"MT 599 Free Format Message"},
/*
{mty:"mt600",desp:"MT 600 Commodity Trade Confirmation"}, {mty:"mt600",desp:"MT 600 Commodity Trade Confirmation"},
{mty:"mt605",desp:"MT 605 Commodity Notice to Receive"}, {mty:"mt605",desp:"MT 605 Commodity Notice to Receive"},
{mty:"mt607",desp:"MT 607 Commodity Credit Advice"}, {mty:"mt607",desp:"MT 607 Commodity Credit Advice"},
......
import React,{Component} from 'react' import React,{Component} from 'react'
import {bindActionCreators} from 'redux'; import {bindActionCreators} from 'redux';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import { updateTreeValue,updateRcvBic,updateSndBic,updateGenTyp,initSwiftMessageTree ,updateSwiftMessage} from '../store/modules/swift/swift_action'; import { updateTreeValue,updateRcvBic,updateSndBic,initSwiftMessageTree ,updateSwiftMessage} from '../store/modules/swift/swift_action';
import ServiceAPI from './ServiceAPI' import ServiceAPI from './ServiceAPI'
import MessageValidater from './MessageValidater' import MessageValidater from './MessageValidater'
...@@ -37,7 +37,7 @@ export class SWFPage extends Component ...@@ -37,7 +37,7 @@ export class SWFPage extends Component
constructor(props) constructor(props)
{ {
super(props) super(props)
this.state = {rcv_bic:props.rcv_bic,rcv_bic_msg:'',gen_typ:props.gen_typ,gen_typ_msg:''} this.state = {rcv_bic:props.rcv_bic,rcv_bic_msg:''}
} }
...@@ -92,7 +92,6 @@ export class SWFPage extends Component ...@@ -92,7 +92,6 @@ export class SWFPage extends Component
this.validateAllMessage(tags,crs) this.validateAllMessage(tags,crs)
let rcv_bic_err_msg = validateRCV_BIC(this.props.rcv_bic_info.rcv_bic) let rcv_bic_err_msg = validateRCV_BIC(this.props.rcv_bic_info.rcv_bic)
let snd_bic_err_msg = validateRCV_BIC(this.props.snd_bic_info.snd_bic) let snd_bic_err_msg = validateRCV_BIC(this.props.snd_bic_info.snd_bic)
let gen_typ_err_msg = validateGEN_TYP(this.props.gen_typ_info.gen_typ)
if( rcv_bic_err_msg || crs.hasError) if( rcv_bic_err_msg || crs.hasError)
{ {
...@@ -100,7 +99,6 @@ export class SWFPage extends Component ...@@ -100,7 +99,6 @@ export class SWFPage extends Component
notification.error({description:'输入存在错误,请按照提示检查!',message:'错误'}) notification.error({description:'输入存在错误,请按照提示检查!',message:'错误'})
this.props.actions.updateSndBic({snd_bic:this.props.snd_bic_info.snd_bic,err_msg:snd_bic_err_msg?snd_bic_err_msg.replace("收","发"):''}) this.props.actions.updateSndBic({snd_bic:this.props.snd_bic_info.snd_bic,err_msg:snd_bic_err_msg?snd_bic_err_msg.replace("收","发"):''})
this.props.actions.updateRcvBic({rcv_bic:this.props.rcv_bic_info.rcv_bic,err_msg:rcv_bic_err_msg}) this.props.actions.updateRcvBic({rcv_bic:this.props.rcv_bic_info.rcv_bic,err_msg:rcv_bic_err_msg})
this.props.actions.updateGenTyp({gen_typ:this.props.gen_typ_info.gen_typ,err_msg:gen_typ_err_msg})
this.props.actions.updateTreeValue() this.props.actions.updateTreeValue()
//滚动至第一个错误位置 //滚动至第一个错误位置
setTimeout(()=>{ setTimeout(()=>{
...@@ -136,30 +134,18 @@ export class SWFPage extends Component ...@@ -136,30 +134,18 @@ export class SWFPage extends Component
else { else {
// message = `{1:${getLogicAdress(this.props.snd_bic_info.snd_bic)}0000000000}{2:I${this.props.params.key.substring(2)}${getLogicAdress(this.props.rcv_bic_info.rcv_bic)}N}{4:\r\n${message}\r\n}` // message = `{1:${getLogicAdress(this.props.snd_bic_info.snd_bic)}0000000000}{2:I${this.props.params.key.substring(2)}${getLogicAdress(this.props.rcv_bic_info.rcv_bic)}N}{4:\r\n${message}\r\n}`
let gpistr = ':121:ID for UUID generation: TRNPAY3\r\n' let gpistr = ':121:ID for UUID generation: TRNPAY3\r\n'
let gentyp = this.props.gen_typ_info.gen_typ
let mty = this.props.extra.msgtyp.substring(2) let mty = this.props.extra.msgtyp.substring(2)
mty = mty.toUpperCase() mty = mty.toUpperCase()
if(mty!='103'&& mty!='202' && mty!='202COV') if(mty!='103'&& mty!='202' && mty!='202COV')
gpistr= '' gpistr= ''
let s119 = '' let s119 = ''
let header3 = '' let header3 = ''
let header3_rtgs=''
if(mty=='202COV') if(mty=='202COV')
{ {
mty='202' mty='202'
//s119=':119:COV\r\n' 锦州 //s119=':119:COV\r\n' 锦州
s119 = '{119:COV}' s119 = '{119:COV}'
header3 = `{3:${s119}}`
}
if (gentyp=='RTGS')
{
header3_rtgs = `{103:HKT}`
}
if (s119||header3_rtgs){
header3 = `{3:${s119}${header3_rtgs}}`
} }
//锦州 message = `:MT:${mty}\r\n:IO:${this.props.rcv_bic_info.rcv_bic}\r\n:II:${this.props.snd_bic_info.snd_bic}\r\n:MP:N\r\n${s119}${gpistr}:EOH:\r\n${message}\r\n-\r\n` //锦州 message = `:MT:${mty}\r\n:IO:${this.props.rcv_bic_info.rcv_bic}\r\n:II:${this.props.snd_bic_info.snd_bic}\r\n:MP:N\r\n${s119}${gpistr}:EOH:\r\n${message}\r\n-\r\n`
//南商 //南商
...@@ -238,7 +224,6 @@ export class SWFPage extends Component ...@@ -238,7 +224,6 @@ export class SWFPage extends Component
data = JSON.parse(data) data = JSON.parse(data)
this.props.actions.updateRcvBic({rcv_bic:data.rcv_bic_info.rcv_bic}) this.props.actions.updateRcvBic({rcv_bic:data.rcv_bic_info.rcv_bic})
this.props.actions.updateGenTyp({gen_typ:data.gen_typ_info.gen_typ})
let tree = data.swift_message_tree let tree = data.swift_message_tree
this.props.actions.initSwiftMessageTree(tree); this.props.actions.initSwiftMessageTree(tree);
}).catch(err=>{ }).catch(err=>{
...@@ -277,9 +262,9 @@ export class SWFPage extends Component ...@@ -277,9 +262,9 @@ export class SWFPage extends Component
saveTemp=()=>{ saveTemp=()=>{
//存储报文模板 //存储报文模板
const {swift_message,rcv_bic_info,snd_bic_info,gen_typ_info,swift_message_tree,extra} = this.props const {swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra} = this.props
let json = { let json = {
swift_message,rcv_bic_info,snd_bic_info,gen_typ_info,swift_message_tree,extra swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra
} }
let jsonStr = JSON.stringify(json) let jsonStr = JSON.stringify(json)
return jsonStr return jsonStr
...@@ -330,13 +315,6 @@ export class SWFPage extends Component ...@@ -330,13 +315,6 @@ export class SWFPage extends Component
this.props.actions.updateSndBic({snd_bic:sndbic}) this.props.actions.updateSndBic({snd_bic:sndbic})
} }
let gentyp = this.props.params.gentyp
if(!gentyp || gentyp != 'NONE')
{
if(!this.props.swift_message_tree)
this.props.actions.updateGenTyp({gen_typ:gentyp})
}
this.isdirect = false this.isdirect = false
} }
else if(action == 'redit' || action == 'redit2') else if(action == 'redit' || action == 'redit2')
...@@ -352,21 +330,16 @@ export class SWFPage extends Component ...@@ -352,21 +330,16 @@ export class SWFPage extends Component
} }
render() render()
{ {
const {swift_message,rcv_bic_info,snd_bic_info,gen_typ_info,swift_message_tree} = this.props const {swift_message,rcv_bic_info,snd_bic_info,swift_message_tree} = this.props
if(!swift_message_tree) if(!swift_message_tree)
{ {
return <div style={{textAlign:'center'}}><Spin size="large" /></div> return <div style={{textAlign:'center'}}><Spin size="large" /></div>
} }
let tags = swift_message_tree.Tags; let tags = swift_message_tree.Tags;
let title = swift_message_tree.Title let title = swift_message_tree.Title
gen_typ_info.gen_typ=gen_typ_info.gen_typ?gen_typ_info.gen_typ:"SWIFT"
const mty = this.props.params.mty||this.props.extra.msgtyp const mty = this.props.params.mty||this.props.extra.msgtyp
let flag1 = (this.props.params.rcvbic && this.props.params.rcvbic!='NONE') || this.props.params.action=='redit' || this.props.params.action=='redit2' let flag1 = (this.props.params.rcvbic && this.props.params.rcvbic!='NONE') || this.props.params.action=='redit' || this.props.params.action=='redit2'
let flag2 = (this.props.params.sndbic && this.props.params.sndbic!='NONE') || this.props.params.action=='redit' || this.props.params.action=='redit2' let flag2 = (this.props.params.sndbic && this.props.params.sndbic!='NONE') || this.props.params.action=='redit' || this.props.params.action=='redit2'
let mty1 = this.props.extra.msgtyp.substring(2)
mty1 = mty1.toUpperCase()
return (<div> return (<div>
<Row style={{marginTop:'3em'}}> <Row style={{marginTop:'3em'}}>
<Col span={3}/> <Col span={3}/>
...@@ -393,16 +366,8 @@ export class SWFPage extends Component ...@@ -393,16 +366,8 @@ export class SWFPage extends Component
<Col span={3}> <Col span={3}>
</Col> </Col>
<Col span={8}> <Col span={8}>
<GENTYP disableflag={mty1=="103"||mty1=="202"?"":"disabled"} flag={false} gen_typ={gen_typ_info.gen_typ} err_msg={gen_typ_info.err_msg} onChange={(val,msg)=>{gen_typ_info.gen_typ=val;gen_typ_info.err_msg=msg}}/>
</Col> <SNDBIC flag={false} snd_bic={snd_bic_info.snd_bic} err_msg={null} onChange={(val,msg)=>{snd_bic_info.snd_bic=val;snd_bic_info.err_msg=msg}}/>
</Row>
<Row style={{}}>
<Col span={3}>
</Col>
<Col span={8}>
<SNDBIC flag={true} snd_bic={window.BANK_BIC} err_msg={null} onChange={(val,msg)=>{snd_bic_info.snd_bic=val;snd_bic_info.err_msg=msg}}/>
</Col> </Col>
</Row> </Row>
<Row style={{}}> <Row style={{}}>
...@@ -482,15 +447,15 @@ export class SWFPage extends Component ...@@ -482,15 +447,15 @@ export class SWFPage extends Component
} }
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const {swift_message,rcv_bic_info,snd_bic_info,gen_typ_info,swift_message_tree,extra} = state.swift; const {swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra} = state.swift;
return { return {
swift_message,rcv_bic_info,snd_bic_info,gen_typ_info,swift_message_tree,extra swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra
}; };
}; };
function mapDispatchToProps(dispatch) { function mapDispatchToProps(dispatch) {
return { return {
actions: bindActionCreators({ updateTreeValue,updateRcvBic,updateSndBic,updateGenTyp,initSwiftMessageTree,updateSwiftMessage }, dispatch) actions: bindActionCreators({ updateTreeValue,updateRcvBic,updateSndBic,initSwiftMessageTree,updateSwiftMessage }, dispatch)
}; };
} }
...@@ -508,61 +473,6 @@ function validateRCV_BIC(val) ...@@ -508,61 +473,6 @@ function validateRCV_BIC(val)
return err_msg return err_msg
} }
function validateGEN_TYP(val)
{
let err_msg = ""
if(!val)
err_msg ='请输入报文类型'
return err_msg
}
class GENTYP extends Component{
constructor(props)
{
super(props)
this.state = {gen_typ:props.gen_typ,err_msg:this.props.err_msg}
}
onChange = val=>{
if((!val && !this.state.gen_typ) || val == this.state.gen_typ)
return
let err_msg = validateGEN_TYP(val)
this.props.onChange(val,err_msg)
this.setState({gen_typ:val,err_msg})
}
componentWillReceiveProps(nextProps)
{
this.setState({gen_typ:nextProps.gen_typ,err_msg:nextProps.err_msg})
}
render()
{
return (<FormItem
help={this.state.err_msg}
validateStatus={this.state.err_msg ? 'error' : null}
label="报文类型" required {...formItemLayout}>
{
this.props.flag ?
<p style={{ fontWeight: 'bolder', fontSize: '1.2em', paddingBottom: '0em', paddingLeft: '1em', borderBottom: '1px solid #37b8f2' }}>{this.state.gen_typ}</p>
:
<Select
allowClear={false}
value={this.state.gen_typ}
style={{ width: "100%" }}
placeholder="报文类型"
onChange={this.onChange}
disabled={this.props.disableflag}
>
<Option value="SWIFT">SWIFT</Option>
<Option value="RTGS">RTGS</Option>
</Select>
}
</FormItem>)
}
}
class SNDBIC extends Component{ class SNDBIC extends Component{
constructor(props) constructor(props)
{ {
...@@ -591,7 +501,7 @@ class SNDBIC extends Component{ ...@@ -591,7 +501,7 @@ class SNDBIC extends Component{
this.props.flag ? this.props.flag ?
<p style={{fontWeight:'bolder',fontSize:'1.2em',paddingBottom:'0em',paddingLeft:'1em',borderBottom:'1px solid #37b8f2'}}>{this.state.snd_bic}</p> <p style={{fontWeight:'bolder',fontSize:'1.2em',paddingBottom:'0em',paddingLeft:'1em',borderBottom:'1px solid #37b8f2'}}>{this.state.snd_bic}</p>
: :
<Input addonAfter={ <YBIC pty="jz" onSelect={obj=>this.onChange(obj.bic)} /> } placeholder="发报行BIC" maxLength={11} value={this.state.snd_bic} onChange={e=>this.onChange(e.target.value)}/> <Input addonAfter={ <YBIC onSelect={obj=>this.onChange(obj.bic)} /> } placeholder="发报行BIC" maxLength={11} value={this.state.snd_bic} onChange={e=>this.onChange(e.target.value)}/>
} }
</FormItem> ) </FormItem> )
} }
...@@ -975,7 +885,7 @@ export class Tag extends MessageArea ...@@ -975,7 +885,7 @@ export class Tag extends MessageArea
} }
output() output()
{ {
let comp = TagSet("T"+this.props.pattern.tag,{action:this.props.action,enLock:this.props.enLock,mty:this.props.mty,status:this.props.pattern.status,value:this.props.pattern.tagValue,desp:this.props.pattern.label,seqlist:this.props.seqlist}, let comp = TagSet("T"+this.props.pattern.tag,{action:this.props.action,enLock:this.props.enLock,mty:this.props.mty,status:this.props.pattern.status,value:this.props.pattern.tagValue,desp:this.props.pattern.label},
val=>{ val=>{
this.props.pattern.tagValue = val this.props.pattern.tagValue = val
let {status} = this.props.pattern let {status} = this.props.pattern
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment