Commit 3d59efbf by fukai

提交79场校验

parent 92fd234c
const config = {
mt103:{
t111:{visible:true,value:'',read:false,required:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt202:{
t111:{visible:true,value:'',read:false,required:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt202cov:{
t111:{visible:true,value:'',read:false,required:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
// mt199:{
// t111:{visible:true,value:'001',read:true},
// t121:{visible:true,value:'',read:false,required:true},
// title:''
// },
mt199_fk:{
t111:{visible:true,value:'001',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
// mt299:{
// t111:{visible:true,value:'001',read:true},
// t121:{visible:true,value:'',read:false,required:true},
// title:''
// },
mt299_fk:{
t111:{visible:true,value:'001',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
// mt192:{
// t111:{visible:true,value:'001',read:true},
// t121:{visible:true,value:'',read:false,required:true},
// title:''
// },
mt192_zf:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt192_fk:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:''
},
mt199_zf:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:'MT 199止付'
},
mt199_zffk:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:'MT 199止付反馈'
},
mt196_zffk:{
t111:{visible:true,value:'002',read:true},
t121:{visible:true,value:'',read:false,required:true},
title:'MT 196止付反馈'
},
}
export default function (mty,subflag)
{
let key = mty
if(subflag && subflag!='NONE')
key = `${mty}_${subflag}`
return config[key]
}
\ No newline at end of file
......@@ -32,6 +32,9 @@ const Routes = ({ history }) =>
<Route path="swift/:action/:mctid/:key" component={SWFPage}/>
<Route path="swift/:action/:mctid/:key/:rcvbic" component={SWFPage}/>
<Route path="swift/:action/:mctid/:key/:sndbic/:rcvbic" component={SWFPage}/>
<Route path="swift/:action/:t111/:mctid/:key/:sndbic/:rcvbic" component={SWFPage}/>
<Route path="app" component={App}/>
<Route path="preview/:kind" component={Preview}/>
<Route path="result/:kind" component={Result}/>
......
......@@ -22,4 +22,9 @@ export function initSwiftMessageTree(tree)
export function updateSwiftMessage(swift_message)
{
return {type:types.SWIFT_UPDATE_SWIFT_MESSAGE,payload:{swift_message}}
}
export function initGpiConf(conf)
{
return {type:types.SWIFT_INIT_GPI_CONF,payload:{conf}}
}
\ No newline at end of file
......@@ -26,6 +26,8 @@ export default createReducer(initialState, {
[`${types.SWIFT_UPDATE_SWIFT_MESSAGE}`]: (state,{swift_message})=>{
return objectAssign({},state,{swift_message})
},
[`${types.SWIFT_INIT_GPI_CONF}`]: (state,{conf})=>{
return objectAssign({},state,{gpi:conf})
},
})
\ No newline at end of file
const InitState = {
gpi:{
inited:false,
t111:{visible:false,value:'',err_msg:'',read:true},
t121:{visible:false,value:'',err_msg:'',read:true},
title:''
},
swift_message:"",
rcv_bic_info:{rcv_bic:'',err_msg:''},
snd_bic_info:{snd_bic:'',err_msg:''},
......
......@@ -31,5 +31,5 @@ export default keyMirror({
SWIFT_UPDATE_SND_BIC:null,
SWIFT_INIT_TREE_VALUE:null,
SWIFT_UPDATE_SWIFT_MESSAGE:null,
SWIFT_INIT_GPI_CONF:null
})
......@@ -3,7 +3,7 @@ import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Table,Steps,Row,Col} from 'antd'
import { updateTreeValue,updateRcvBic,initSwiftMessageTree ,updateSwiftMessage} from '../store/modules/swift/swift_action';
import { updateTreeValue,updateRcvBic,initSwiftMessageTree ,updateSwiftMessage,initGpiConf} from '../store/modules/swift/swift_action';
const Step = Steps.Step;
......@@ -11,6 +11,7 @@ const Step = Steps.Step;
export const mty=[
{mty:"mt103",desp:"MT 103 Single Customer Credit Transfer"},
{mty:"mt192",desp:"MT 192 Request for Cancellation"},
{mty:"mt195",desp:"MT 195 Queries"},
{mty:"mt196",desp:"MT 196 Answers"},
{mty:"mt199",desp:"MT 199 Free Format Message"},
......@@ -62,6 +63,7 @@ export class LeadPage extends Component
render:(text,record)=>{
return <a href="javascript:void(0);" onClick={()=>{
this.props.actions.initSwiftMessageTree(null) //清空
this.props.actions.initGpiConf({inited:false})
this.props.history.push(`swift/edit/${this.props.params.mctid||'NONE'}/${record.mty}/NONE`)
}
}>Create {record.desp}</a>
......@@ -107,7 +109,7 @@ const mapStateToProps = (state) => {
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({ initSwiftMessageTree }, dispatch)
actions: bindActionCreators({ initSwiftMessageTree,initGpiConf }, dispatch)
};
}
......
const Tags = [
{"tag":"20","status":"M","tno":1,"letter":[],"label":"Transaction Reference Number","tagValue":[{},null]},
{"tag":"21","status":"M","tno":2,"letter":[],"label":"Related Reference","tagValue":[{},null]},
{"tag":"11S","status":"M","tno":3,"letter":[],"label":"MT and Date of the Original Message","tagValue":[{},null]},
{"tag":"79","status":"O","tno":4,"letter":[],"label":"Narrative Description of the Original Message","tagValue":[{},null]},
{"tag":"","status":"O","tno":5,"letter":[],"label":"Copy of at least the Mandatory Fields of the Original Message","tagValue":[{},null]}
]
const Title="Request for Cancellation"
export default { Tags,Title}
\ No newline at end of file
import MTn96 from './MTn96'
import MTn95 from './MTn95'
import MTn92 from './MTn92'
import MTn99 from './MTn99'
import MT760 from './MT760'
import MT420 from './MT420'
......@@ -83,4 +84,6 @@ export default function MTFactory(mty)
return MTn95
if(/mt\d99/.test(mty))
return MTn99
if(/mt\d92/.test(mty))
return MTn92
}
\ No newline at end of file
......@@ -32,4 +32,17 @@ function mt707({Tags}){
return `45B,46B,47B,49M,49N总长度不得超过63400个字符`
}
const FUNC_SET={mt700,mt707}
\ No newline at end of file
function mt199(tree){
console.log(tree)
}
function mt192(tree){
console.log(tree)
}
function mt196(tree){
console.log(tree)
}
function mt299(tree){
console.log(tree)
}
const FUNC_SET={mt700,mt707,mt192,mt196,mt199,mt299}
\ No newline at end of file
import React,{Component} from 'react'
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import { updateTreeValue,updateRcvBic,updateSndBic,initSwiftMessageTree ,updateSwiftMessage} from '../store/modules/swift/swift_action';
import { updateTreeValue,updateRcvBic,updateSndBic,initSwiftMessageTree ,updateSwiftMessage,initGpiConf} from '../store/modules/swift/swift_action';
import ServiceAPI from './ServiceAPI'
import MessageValidater from './MessageValidater'
......@@ -16,6 +16,7 @@ import TagSet from "./Tags"
import {DeepCopy,getLogicAdress} from './Utils'
import {TagV} from './TagValidater'
import GPIConfig from '../constants/GPIConfig'
import YBIC from './Tags/YBIC'
......@@ -75,6 +76,19 @@ export class SWFPage extends Component
}
}
}
scrollError(){
setTimeout(()=>{
let obj = document.getElementsByClassName("has-error")
obj = obj.length?obj[0]:undefined
if(obj)
{
// let oPos = obj.offsetTop - 50
// document.documentElement.scrollTop = oPos
// document.body.scrollTop = oPos
obj.scrollIntoView()
}
},100)
}
toSwiftMessage=()=>{
//
......@@ -83,7 +97,30 @@ export class SWFPage extends Component
let str = `{4:\r\n${msg.map(item=>`${item.name}:${item.value}\r\n`).join('')}}`
console.log(str)
//写循环添加
const {swift_message_tree} = this.props
const {swift_message_tree,gpi} = this.props
//判断gpi 信息
let t111_errmsg = ""
let t121_errmsg = ""
if(gpi.inited)
{
if(!gpi.t111.value && gpi.t111.required)
{
t111_errmsg = '请选择GPI标识类型'
}
if(!gpi.t121.value && gpi.t121.required)
{
t121_errmsg = '请填写UETR!'
}
if(gpi.t121.value)
{
let val = gpi.t121.value
if(val !=autogenerate && !/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{16}$/.test(val))
{
t121_errmsg = "xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx(8-4-4-16)"
}
}
}
let tags = swift_message_tree.Tags;
let arr = []
let crs = {}
......@@ -91,25 +128,20 @@ export class SWFPage extends Component
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)
if(snd_bic_err_msg || rcv_bic_err_msg || crs.hasError)
if(snd_bic_err_msg || rcv_bic_err_msg || crs.hasError || t121_errmsg || t111_errmsg)
{
//更新整个树
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.updateRcvBic({rcv_bic:this.props.rcv_bic_info.rcv_bic,err_msg:rcv_bic_err_msg})
gpi.inited && this.props.actions.initGpiConf({ //有gpi 才初始化
inited:true,
t111:{...gpi.t111,err_msg:t111_errmsg},
t121:{...gpi.t121,err_msg:t121_errmsg}
})
this.props.actions.updateTreeValue()
//滚动至第一个错误位置
setTimeout(()=>{
let obj = document.getElementsByClassName("has-error")
obj = obj.length?obj[0]:undefined
if(obj)
{
// let oPos = obj.offsetTop - 50
// document.documentElement.scrollTop = oPos
// document.body.scrollTop = oPos
obj.scrollIntoView()
}
},100)
this.scrollError()
return
}
//做整体关联检查
......@@ -141,8 +173,16 @@ export class SWFPage extends Component
{
mty='202'
s119=':119:COV\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`
}
if(gpi.t121.value )
{
gpistr = ':121:'+gpi.t121.value +"\r\n"
}
let t111str = ""
if(gpi.t111.value )
t111str = ':111:'+gpi.t111.value +"\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${t111str}${s119}${gpistr}:EOH:\r\n${message}\r\n-\r\n`
}
console.log(message)
this.props.actions.updateSwiftMessage(message)
......@@ -153,7 +193,19 @@ export class SWFPage extends Component
else
this.props.history.push("preview/1")
}
joinMessage(tags,arr)
getTagValue(item)
{
if(typeof item.tagValue =='string' && item.tagValue)
return item.tagValue
else if(typeof item.tagValue[1] =='string' && item.tagValue[1])
{
let tagValue = item.tagValue[1]
return tagValue
}
return ""
}
joinMessage(tags,arr,deep=0)
{
for(let item of tags)
{
......@@ -167,16 +219,47 @@ export class SWFPage extends Component
{
let tagValue = item.tagValue[1]
arr.push(`:${item.tag}:${tagValue}`)
}else if(this.props.extra.msgtyp == 'mt103')
{
if(deep == 0)
{
let tag19value = this.getTagValue(tags[18])
if(tag19value == 'BEN' || tag19value == 'SHA')
{
if(item.tno == "7" && item.tag=='33B' && !this.getTagValue(item))
{
arr.push(`:33B:`)
}
}
}
}
if( item.tno=='2' && (this.props.extra.msgtyp == 'mt199' || this.props.extra.msgtyp == 'mt299'))
{
let tag21value = this.getTagValue(item)
if(!tag21value)
arr.push(`:21:NONREF`)
}
}else if(item.cyclist)
{
let beginLength = arr.length
for(let cyc of item.cycs)
this.joinMessage(cyc,arr)
this.joinMessage(cyc,arr,deep+1)
let endLength = arr.length
if(deep==0 && endLength == beginLength && this.props.extra.msgtyp == 'mt103' && item.cyclist == '20')
{
let tag19value = this.getTagValue(tags[18])
if(tag19value == 'BEN' || tag19value == 'SHA')
{
arr.push(':71F:')
}
}
}
else if(item.seqlist)
{
for(let seq of item.seqs)
this.joinMessage(seq,arr)
this.joinMessage(seq,arr,deep+1)
}
}
}
......@@ -207,6 +290,24 @@ export class SWFPage extends Component
this.props.extra.tdheaders=data.tdheaders
this.props.extra.headers=data.headers
let tree = JSON.parse(data.swift_message)
let gpiconf = {
inited:false,
t111:{visible:false,value:'',err_msg:'',read:true},
t121:{visible:false,value:'',err_msg:'',read:true},
title:''
}
if(data.t111)
{
gpiconf.inited = true
gpiconf.t111.value = data.t111
}
if(data.t121)
{
gpiconf.inited = true
gpiconf.t121.value = data.t121
}
if(gpiconf.inited)
this.props.actions.initGpiConf(gpiconf)
this.props.actions.initSwiftMessageTree({Tags:tree,Title:data.title});
}).catch(err=>{
console.log(err)
......@@ -218,6 +319,7 @@ export class SWFPage extends Component
let action = this.props.params.action
let mctid = this.props.params.mctid
this.props.extra.mctid = mctid
if(action == 'edit')
{
......@@ -225,6 +327,8 @@ export class SWFPage extends Component
mty = mty.toLowerCase()
if(mty.substring(0,2)!='mt')
mty = 'mt'+mty
if(!this.props.swift_message_tree)
{
let mt_config = MTFactory(mty);
......@@ -233,6 +337,16 @@ export class SWFPage extends Component
this.props.extra.msgtyp=mty
this.props.actions.initSwiftMessageTree(mt_config);
}
let t111 = this.props.params.t111
let gpiconf = GPIConfig(mty,t111)
if(!this.props.gpi.inited && gpiconf)
{
this.props.actions.initGpiConf({inited:true,
t111:{...gpiconf.t111,err_msg:''},
t121:{...gpiconf.t121,err_msg:''},
title:gpiconf.title
}) // 初始化gpiinf
}
//取BIC
let rcvbic = this.props.params.rcvbic
if(!rcvbic || rcvbic != 'NONE')
......@@ -263,7 +377,7 @@ export class SWFPage extends Component
}
render()
{
const {swift_message,rcv_bic_info,snd_bic_info,swift_message_tree} = this.props
const {swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,gpi} = this.props
if(!swift_message_tree)
{
return <div style={{textAlign:'center'}}><Spin size="large" /></div>
......@@ -346,8 +460,25 @@ export class SWFPage extends Component
</Affix>
</Col>
</Row>
{
gpi.inited?
<Row>
<Row>
<Col span={8} offset={3}>
<T111 {...gpi.t111} action={this.props.params.action} mty={mty} onChange={(val,err_msg)=>{gpi.t111.value=val;gpi.t111.err_msg=err_msg}}/>
</Col>
</Row>
<Row>
<Col span={16} offset={3}>
<T121 {...gpi.t121} action={this.props.params.action} mty={mty} onChange={(val,err_msg)=>{gpi.t121.value=val;gpi.t121.err_msg=err_msg}}/>
</Col>
</Row>
</Row>
:null
}
<h2 style={{textAlign:'center'}}>
{title.indexOf("MT")==0?title:`${mty.toUpperCase()} ${title}`}
{gpi.inited && gpi.title ? gpi.title:
title.indexOf("MT")==0?title:`${mty.toUpperCase()} ${title}`}
</h2>
<Row >
<Col span={3}></Col>
......@@ -364,7 +495,7 @@ export class SWFPage extends Component
</Col>
<Col span={1} style={{textAlign:'center'}}><span style={{fontWeight:'bolder'}}>{"NO."}</span></Col>
</Row>
<SWFMessage action={this.props.params.action} enLock={this.props.params.action=='redit'} updateTreeValue={this.props.actions.updateTreeValue} pattern={tags} ref={ref=>this.swfmsg = ref} mty={mty}/>
<SWFMessage t111={this.props.params.t111} action={this.props.params.action} enLock={this.props.params.action=='redit'} updateTreeValue={this.props.actions.updateTreeValue} pattern={tags} ref={ref=>this.swfmsg = ref} mty={mty}/>
</Col>
<Col span={3}></Col>
......@@ -375,15 +506,15 @@ export class SWFPage extends Component
}
const mapStateToProps = (state) => {
const {swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra} = state.swift;
const {swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra,gpi} = state.swift;
return {
swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra
swift_message,rcv_bic_info,snd_bic_info,swift_message_tree,extra,gpi
};
};
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({ updateTreeValue,updateRcvBic,updateSndBic,initSwiftMessageTree,updateSwiftMessage }, dispatch)
actions: bindActionCreators({ updateTreeValue,updateRcvBic,updateSndBic,initSwiftMessageTree,updateSwiftMessage,initGpiConf }, dispatch)
};
}
......@@ -470,6 +601,88 @@ class RCVBIC extends Component{
}
}
class T111 extends Component{
constructor(props)
{
super(props)
this.state = {value:props.value,err_msg:props.err_msg}
}
componentWillReceiveProps(nextProps)
{
this.setState({value:nextProps.value,err_msg:nextProps.err_msg})
}
onChange = val=>{
if((!val && !this.state.rcv_bic) || val == this.state.rcv_bic)
return
let err_msg = ''
if(!val && this.props.required)
err_msg = '请选择GPI标识类型'
this.props.onChange(val,err_msg)
this.setState({value:val,err_msg})
}
render()
{
return <FormItem help={this.state.err_msg}
validateStatus={this.state.err_msg?'error':null}
label="GPI" required={this.props.required} {...formItemLayout}>
<Select size="large" placeholder="选择GPI标识" disabled={this.props.read} value={this.state.value||undefined} style={{ width: '100%' }} onChange={this.onChange}>
<Option value="001">001</Option>
<Option value="002">002</Option>
</Select>
</FormItem>
}
}
const autogenerate = "ID for UUID generation: TRNPAY3"
class T121 extends Component{
constructor(props)
{
super(props)
this.state = {value:props.value,err_msg:props.err_msg}
}
componentWillReceiveProps(nextProps)
{
this.setState({value:nextProps.value,err_msg:nextProps.err_msg})
}
onChange = e=>{
let val = e.target.value
if((!val && !this.state.value) || val == this.state.value)
return
let err_msg = ""
if(!val && this.props.required )
{
err_msg = "请填写UETR!"
}
if(val && val != autogenerate && !/^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{16}$/.test(val))
{
err_msg = "xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx(8-4-4-16)"
}
this.props.onChange(val,err_msg)
this.setState({value:val,err_msg})
}
autoClick = e=>{
let val = autogenerate
let err_msg = ""
this.props.onChange(val,err_msg)
this.setState({value:val,err_msg})
}
render()
{
let sty = {}
if(this.state.value == autogenerate)
{
sty = {color:'blue'}
}
return <FormItem labelCol={{span:3}} wrapperCol={{span:12}}
help={this.state.err_msg||"点击右侧按钮,可由系统自动生成UETR"}
validateStatus={this.state.err_msg?'error':"tip"}
label="UETR" required={this.props.required} >
<Input style={sty} addonAfter={<Button type="primary" size="small" icon="circle-o-down" title="系统自动生成" onClick={this.autoClick}/>} readOnly={this.props.read} placeholder="UETR:xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx(8-4-4-16)" maxLength={35} onChange={this.onChange} value={this.state.value} />
</FormItem>
}
}
export class MessageArea extends Component{
fields=[]
type=-1
......@@ -491,11 +704,11 @@ export class MessageArea extends Component{
{
fields.map((item,index)=>{
if(item.tag)
return <Tag action={this.props.action} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} key={item.tno} mty={this.props.mty}/>
return <Tag action={this.props.action} t111={this.props.t111} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} key={item.tno} mty={this.props.mty}/>
if(item.cyclist)
return <CYCList action={this.props.action} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} key={item.cyclist+','+index} mty={this.props.mty}/>
return <CYCList action={this.props.action} t111={this.props.t111} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} key={item.cyclist+','+index} mty={this.props.mty}/>
if(item.seqlist)
return <SEQList action={this.props.action} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} key={item.seq+','+index} mty={this.props.mty}/>
return <SEQList action={this.props.action} t111={this.props.t111} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} key={item.seq+','+index} mty={this.props.mty}/>
return null
})
}
......@@ -769,13 +982,13 @@ export class Tag extends MessageArea
}
onValue = val=>{
this.props.pattern.tagValue = val
TagV("T"+this.props.pattern.tag,this.props.pattern.status,val,this.props.pattern.tno,this.props.mty)
TagV("T"+this.props.pattern.tag,this.props.pattern.status,val,this.props.pattern.tno,this.props.mty,this.props.t111)
this.setState({tagValue:this.props.pattern.tagValue})
//this.props.updateTreeValue()
}
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},
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,t111:this.props.t111},
this.onValue
)
if(!comp)
......
import {RegMap} from './TagRegMap'
export function TagV(tag,status,value,tno,mty)
export function TagV(tag,status,value,tno,mty,t111)
{
let regobj = RegMap[tag]
let obj = value[0]
......@@ -135,6 +135,9 @@ export function TagV(tag,status,value,tno,mty)
if(errmsg[ek])
return false
}
let msg = gpiValidate(mty,t111,tag,tno,value)
if(msg)
return false
return true
}
......@@ -291,4 +294,310 @@ function TestAdr(adr,reg,line,length)
if(linemsg)
msg.push(linemsg)
return msg.join(';')
}
\ No newline at end of file
}
function gpiValidate(mty,t111,tag,tno,value){
let mval = value[1]
let errors = value[2]
if(!mval)
return
let lines = mval.split(/[\r\n]{1,2}/g)
let msg = undefined
if(tag=='T79' && t111=='fk' && mty=='mt199')
{
if(lines.length < 4)
{
msg = '至少有4行文字'
errors.s1 = msg
return msg
}
for(let i=0;i<lines.length;i++)
{
if(!lines[i].startsWith("//"))
{
msg = '每行必须以\"//\"起头'
errors.s1 = msg
return msg
}
if(i == 0 && !/^\/\/\d{10}\+\d{4}$/.test(lines[i]))
{
msg = '第一行请填写固定的日期和时间偏量'
errors.s1 = msg
return msg
}
if(i==3 && (lines[i].indexOf("/SHA") > -1 || lines[i].indexOf("/BEN") > -1))
{
if(lines.length ==4)
{
msg = '用承担方式为shaben时,请在第五行补充//:71F:明细'
errors.s1 = msg
return msg
}else{
if(!lines[i+1].startsWith("//:71F:"))
{
msg = '用承担方式为shaben时后续必须跟//:71F:明细'
errors.s1 = msg
return msg
}
}
}
}
//暂时屏蔽
// let first = lines[1]
// if(!/^\/[A-Z]{4}\/([A-Z0-9]{4})?$/.test(first))
// {
// msg = '请在第二行填写正确的状态码——"/状态码/子状态码"'
// errors.s1 = msg
// return msg
// }
// let firstCode = first.substring(1,5)
// let subCode = first.substring(6)
// if(mt199_299.indexOf(firstCode) > -1)
// {
// if(firstCode == 'ACSP')
// {
// if( subCode && ACSP.indexOf(subCode)< 0)
// {
// msg = '状态码为"ACSP"时,子状态码请填写:'+ACSP.join(',')
// errors.s1 = msg
// return msg
// }
// }
// else if(firstCode == 'RJCT')
// {
// if(subCode && PDCR.indexOf(subCode)< 0 )
// {
// msg = '状态码为"RJCT"时,子状态码请填写:'+RJCT.join(',')
// errors.s1 = msg
// return msg
// }
// }
// }
// else
// {
// msg = '请在第二行填写以下状态码:'+mt196_199.join(',')
// errors.s1 = msg
// return msg
// }
}
else if(tag=='T79' && t111=='fk' && mty=='mt299')
{
if(lines.length < 4)
{
msg = '至少有4行文字'
errors.s1 = msg
return msg
}
for(let i=0;i<lines.length;i++)
{
if(!lines[i].startsWith("//"))
{
msg = '每行必须以\"//\"起头'
errors.s1 = msg
return msg
}
if(i == 0 && /^\d{10}\+\d{4}/.test(lines[i]))
{
msg = '第一行请填写固定的日期和时间偏量'
errors.s1 = msg
return msg
}
}
//判断码表
//暂时屏蔽
// let first = lines[1]
// if(!/^\/[A-Z]{4}\/([A-Z0-9]{4})?$/.test(first))
// {
// msg = '请在第二行填写正确的状态码——"/状态码/子状态码"'
// errors.s1 = msg
// return msg
// }
// let firstCode = first.substring(1,5)
// let subCode = first.substring(6)
// if(mt199_299.indexOf(firstCode) > -1)
// {
// if(firstCode == 'ACSP')
// {
// if( subCode && ACSP.indexOf(subCode)< 0)
// {
// msg = '状态码为"ACSP"时,子状态码请填写:'+ACSP.join(',')
// errors.s1 = msg
// return msg
// }
// }
// else if(firstCode == 'RJCT')
// {
// if(subCode && PDCR.indexOf(subCode)< 0 )
// {
// msg = '状态码为"RJCT"时,子状态码请填写:'+RJCT.join(',')
// errors.s1 = msg
// return msg
// }
// }
// }
// else
// {
// msg = '请在第二行填写以下状态码:'+mt196_199.join(',')
// errors.s1 = msg
// return msg
// }
}
else if((tag=='T79' && t111=='zf' && mty=='mt199')
||
(tag=='T79' && t111=='zf' && mty=='mt192')
) //校验状态码
{
let first = lines[0]
if(!/^\/[A-Z]{4}\/([A-Z]{4})?$/.test(first))
{
msg = '请在第一行填写正确的状态码——"状态码/子状态码"'
errors.s1 = msg
return msg
}
let firstCode = first.substring(1,5)
let subCode = first.substring(6)
if(mt192_199.indexOf(firstCode) > -1)
{
if(subCode && subCode != INDM)
{
msg = '子状态码请填写:'+INDM
errors.s1 = msg
return msg
}
}
else
{
msg = '请在第一行填写以下状态码:'+mt192_199.join(',')
errors.s1 = msg
return msg
}
}else if(
(tag=='T76' && t111=='zffk' && mty=='mt196')
||
(tag=='T79' && t111=='zffk' && mty=='mt199')
)//校验状态码
{
let first = lines[0]
if(!/^\/[A-Z]{4}\/([A-Z]{4})?$/.test(first))
{
msg = '请在第一行填写正确的状态码——"/状态码/子状态码"'
errors.s1 = msg
return msg
}
let firstCode = first.substring(1,5)
let subCode = first.substring(6)
if(mt196_199.indexOf(firstCode) > -1)
{
if(firstCode == 'RJCR')
{
if( subCode && RJCR.indexOf(subCode)< 0)
{
msg = '状态码为"RJCR"时,子状态码请填写:'+RJCR.join(',')
errors.s1 = msg
return msg
}
}
else if(firstCode == 'PDCR')
{
if(subCode && PDCR.indexOf(subCode)< 0 )
{
msg = '状态码为"PDCR"时,子状态码请填写:'+PDCR.join(',')
errors.s1 = msg
return msg
}
}
}
else
{
msg = '请在第一行填写以下状态码:'+mt196_199.join(',')
errors.s1 = msg
return msg
}
}
}
const mt199_299 =[
"ACCC",
"ACSP",
"RJCT",
"RETN",
]
const ACSP = [
"G000",
"G001",
"G002",
"G003",
"G004",
]
const RJCT = [
"AC01",
"AC04",
"AC06",
"BE01",
"NOAS",
"RR03",
"FF07",
"RC01",
"G004",
"RC08",
"FOCR",
"DUPL",
"RR05",
"AM06",
"CUST",
"MS03",
]
const mt192_199=[ //支付发起
"DUPL",
"AGNT",
"CURR",
"CUST",
"UPAY",
"CUTA",
"TECH",
"FRAD",
"COVR",
"AM09",
]
const INDM ="INDM"
const mt196_199=[ //支付反馈
"PDCR",
"CNCL",
"RJCR",
]
const RJCR = [
"LEGL",
"AGNT",
"CUST",
"ARDT",
"NOAS",
"NOOR",
"AC04",
"AM04",
"INDM",
"FRNA",
]
const PDCR = [
"PTNA",
"RQDA",
"INDM",
]
\ No newline at end of file
......@@ -35,7 +35,7 @@ export default class T77A extends Component
validateStatus={errmsg.s1?'error':null}
>
<TextArea type= "textarea" maxLength={20*35} cols={35} rows={10} style={{imeMode:'disabled'}} placeholder="Narrative" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/>
<TextArea disabled={this.props.mty=='mt196' && this.props.t111=='zffk'} type= "textarea" maxLength={20*35} cols={35} rows={10} style={{imeMode:'disabled'}} placeholder="Narrative" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/>
</FormItem>
</Col>
......
......@@ -29,6 +29,9 @@ export default class T79 extends Component
let errmsg = value && value.length==3?value[2]:{}
value = value && value.length? value[0] : {}
return (<Row>
<Col>
<FormItem
......@@ -36,7 +39,7 @@ export default class T79 extends Component
validateStatus={errmsg.s1?'error':null}
>
<TextArea wrap="physical" type= "textarea" maxLength={1750} cols={50} rows={35} style={{imeMode:'disabled'}} placeholder="Narrative Description of the Original Message to Which the Answer Relates" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/>
<TextArea wrap="physical" disabled={this.props.mty=='mt196' && this.props.t111=='zffk'} type= "textarea" maxLength={1750} cols={50} rows={35} style={{imeMode:'disabled'}} placeholder="Narrative Description of the Original Message to Which the Answer Relates" value={value.s1} onChange={(e)=>this.onChange(e.target.value)}/>
</FormItem>
</Col>
......
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