Commit 8bc2bb5d by gq777

'update'

parents 33c0200e 5c6a2a37
......@@ -133,7 +133,7 @@ export class LeadPage extends Component
<Col span={3}/>
<Col span={18}>
<Table columns={this.columns} dataSource={this.state.fil?mty.filter(item=>item.mty.startsWith('mt'+this.state.fil)):mty} />
<Table columns={this.columns} dataSource={this.state.fil?mty.filter(item=>item.mty.indexOf('mt'+this.state.fil)==0):mty} />
</Col>
<Col span={3}/>
......
......@@ -110,7 +110,7 @@ export default function MTFactory(mty)
return MT600
if(mty=="mt700")
return MT700
if(mty=="mt202COV")
if(mty=="mt202cov")
return MT202COV
if(mty=="mt305")
return MT305
......
......@@ -15,7 +15,7 @@ import TagSet from "./Tags"
import {DeepCopy,getLogicAdress} from './Utils'
import {TagV} from './TagValidater'
import {TagV,isTagValueEmpty} from './TagValidater'
import YBIC from './Tags/YBIC'
......@@ -47,7 +47,7 @@ export class SWFPage extends Component
console.log(msg)
}
validateAllMessage=(tags,rs)=>
validateAllMessage=(tags,rs,seqlist=[])=>
{
const mty = this.props.params.mty||this.props.extra.msgtyp
for(let item of tags)
......@@ -58,7 +58,7 @@ export class SWFPage extends Component
{
item.tagValue = [{},'',{}]
}
if(!TagV("T"+item.tag,item.status,item.tagValue,item.tno,mty))
if(!TagV("T"+item.tag,item.status,item.tagValue,item.tno,mty,seqlist,this.props.extra.countMap))
{
rs.hasError = true
console.log(item.tag)
......@@ -68,12 +68,12 @@ export class SWFPage extends Component
}else if(item.cyclist)
{
for(let cyc of item.cycs)
this.validateAllMessage(cyc,rs)
this.validateAllMessage(cyc,rs,seqlist)
}
else if(item.seqlist)
{
for(let seq of item.seqs)
this.validateAllMessage(seq,rs)
this.validateAllMessage(seq,rs,[...seqlist,{status:item.status,seqlist:item.seqlist}])
}
}
}
......@@ -155,17 +155,30 @@ export class SWFPage extends Component
this.props.actions.updateSwiftMessage(message)
let flag = (this.props.params.rcvbic && this.props.params.rcvbic!='NONE') || this.props.params.action=='redit'
// if(this.props.extra.countMap)
// this.props.extra.s_countMap = {...this.props.extra.countMap}
if(flag)
this.props.history.push("preview/0")
else
this.props.history.push("preview/1")
}
joinMessage(tags,arr)
joinMessage(tags,arr,seqlist)
{
for(let item of tags)
{
if(item.tag)
{
if(item.tag.indexOf('15')>-1)
{
//15系列字段
if(seqlist && this.props.extra.countMap && this.props.extra.countMap[seqlist])
{
arr.push(`:${item.tag}:`)
}
}
if(!item.tagValue)
continue
if(typeof item.tagValue =='string' && item.tagValue)
......@@ -183,7 +196,7 @@ export class SWFPage extends Component
else if(item.seqlist)
{
for(let seq of item.seqs)
this.joinMessage(seq,arr)
this.joinMessage(seq,arr,item.seqlist)
}
}
}
......@@ -262,6 +275,14 @@ export class SWFPage extends Component
let action = this.props.params.action
let mctid = this.props.params.mctid
this.props.extra.mctid = mctid
// if(!this.props.swift_message_tree)
// {
// //取出暂存countMap
// if(this.props.extra.s_countMap)
// this.props.extra.countMap = {...this.props.extra.s_countMap}
// }
if(action == 'edit')
{
......@@ -415,7 +436,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 action={this.props.params.action} extra={this.props.extra} 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>
......@@ -542,11 +563,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 extra={this.props.extra} action={this.props.action} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} seqlist={this.props.seqlist} 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 extra={this.props.extra} action={this.props.action} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} seqlist={this.props.seqlist} 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 extra={this.props.extra} action={this.props.action} enLock={this.props.enLock} updateTreeValue={this.props.updateTreeValue} pattern={item} seqlist={this.props.seqlist} key={item.seqlist+','+index} mty={this.props.mty}/>
return null
})
}
......@@ -655,7 +676,7 @@ export class CYCList extends MessageArea
{index==0?null:
<Button style={{position:'absolute',top:'0.35em',zIndex:99}} onClick={()=>this.removeItem(index)} size="small" shape="circle" icon="cross" title="Remove Cycle"/>
}
<Cyc action={this.props.action} updateTreeValue={this.props.updateTreeValue} pattern={cyc} mty={this.props.mty} />
<Cyc extra={this.props.extra} action={this.props.action} seqlist={this.props.seqlist} updateTreeValue={this.props.updateTreeValue} pattern={cyc} mty={this.props.mty} />
</div>)
})
}
......@@ -738,14 +759,14 @@ export class SEQList extends MessageArea
addItem=()=>{
let subtree = this.props.pattern
let obj = this.clonePO(subtree.pattern)
subtree.cycs.push(obj)
subtree.seqs.push(obj)
this.props.updateTreeValue()
}
removeItem=(index)=>{
let subtree = this.props.pattern
subtree.cycs.splice(index,1)
subtree.seqs.splice(index,1)
//通知刷新
this.props.updateTreeValue()
......@@ -759,6 +780,7 @@ export class SEQList extends MessageArea
output()
{
let subtree = this.props.pattern
let seqlist = this.props.seqlist?[...this.props.seqlist,{seqlist:subtree.seqlist,status:subtree.status}]:[{seqlist:subtree.seqlist,status:subtree.status}]
return (
<div>
<Row>
......@@ -782,14 +804,14 @@ export class SEQList extends MessageArea
{index==0 || subtree.cyccnt==0?null:
<Button style={{position:'absolute',top:'0.35em',zIndex:99}} onClick={()=>this.removeItem(index)} size="small" shape="circle" icon="cross" title="Remove Cycle"/>
}
<Seq action={this.props.action} updateTreeValue={this.props.updateTreeValue} pattern={seq} mty={this.props.mty} />
<Seq extra={this.props.extra} action={this.props.action} seqlist={seqlist} updateTreeValue={this.props.updateTreeValue} pattern={seq} mty={this.props.mty} />
</div>)
})
}
<Row>
<Col span={1}></Col>
<Col>
<p style={{paddingLeft:'2em',position:'relative',top:'-1.4em'}}><span style={{fontWeight:'bolder',fontSize:'1.5em'}}>{subtree.cyccnt==0?`End Of ${subtree.desp}`:subtree.desp.replace(/^[->]/,'------|')}</span></p>
<p style={{paddingLeft:'2em',position:'relative',top:'-1.4em'}}><span style={{fontWeight:'bolder',fontSize:'1.5em'}}>{subtree.cyccnt==0?`End Of ${subtree.desp}`:subtree.desp.replace(/^[-]+>/,'------|')}</span></p>
</Col>
</Row>
</div>
......@@ -802,6 +824,7 @@ export class SEQList extends MessageArea
}
export class Tag extends MessageArea
{
constructor(props)
......@@ -816,16 +839,92 @@ export class Tag extends MessageArea
// }else
// this.name = this.pattern.tag
// this.state = {name:this.name}
this.state={tagValue:this.props.pattern.tagValue}
this.state={tagValue:this.props.pattern.tagValue,isEmpty:this.isEmpty(this.props.pattern.tagValue)}
}
componentWillMount()
{
if(this.props.seqlist && !this.isEmpty(this.state.tagValue))
{
let {countMap={}} = this.props.extra
for(let seqlbl of this.props.seqlist )
{
let key = seqlbl.seqlist
if(!countMap[key])
countMap[key] = 1
else
countMap[key]++
}
this.props.extra.countMap = countMap
}
}
componentWillUnmount()
{
if(this.props.seqlist)
{
if(this.isEmpty(this.state.tagValue))
return
let {countMap} = this.props.extra
if(!countMap)
return
for(let seqlbl of this.props.seqlist )
{
let key = seqlbl.seqlist
if(countMap[key])
countMap[key]--
}
}
}
isEmpty(tagValue)
{
if(!tagValue)
return true
if(!tagValue.length || tagValue.length < 1)
return true
return isTagValueEmpty("T"+this.props.pattern.tag,tagValue)
}
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},
val=>{
this.props.pattern.tagValue = val
TagV("T"+this.props.pattern.tag,this.props.pattern.status,val,this.props.pattern.tno,this.props.mty)
this.setState({tagValue:this.props.pattern.tagValue})
let {status} = this.props.pattern
let {countMap} = this.props.extra
if(this.props.seqlist)
{
if(!countMap)
{
countMap = {}
this.props.extra.countMap = countMap
}
// let mval = val && val.length? val[1] : ''
let val_old = this.state.tagValue
// let mval_old = val_old && val_old.length? val_old[1] : ''
if(!this.state.isEmpty && this.isEmpty(val))
{
for(let seqlbl of this.props.seqlist ) //计数减1
{
let key = seqlbl.seqlist
if(countMap[key])
countMap[key]--
}
}
else if(this.state.isEmpty && !this.isEmpty(val))
{
for(let seqlbl of this.props.seqlist ) //计算加1
{
let key = seqlbl.seqlist
if(!countMap[key])
countMap[key]=1
else
countMap[key]++
}
}
}
TagV("T"+this.props.pattern.tag,status,val,this.props.pattern.tno,this.props.mty,this.props.seqlist,this.props.extra.countMap)
this.setState({tagValue:this.props.pattern.tagValue,isEmpty:this.isEmpty(this.props.pattern.tagValue)})
//this.props.updateTreeValue()
}
)
......
import {RegMap} from './TagRegMap'
export function TagV(tag,status,value,tno,mty)
export function isTagValueEmpty(tag,tagValue)
{
let obj = tagValue[0]
let regobj = RegMap[tag]
for(let key in regobj)
{
if(obj[key])
return false
}
return true
}
export function TagV(tag,status,value,tno,mty,seqlist,countMap={})
{
let regobj = RegMap[tag]
let obj = value[0]
let mval = value[1]
//计算状态 status,是否是必填的,要参考所在序列是否是必填,上一层序列计数,来决定当前序列是否必填
if(seqlist && seqlist.length && status == 'M' && isTagValueEmpty(tag,value))
{
let curseq = seqlist[seqlist.length - 1]
let curcnt = countMap[curseq.seqlist] || 0
if(curseq.status == 'O' && curcnt==0)
{
status = 'O'
}
else if(curseq.status == 'M' && curcnt==0)
{
//验证上层是否有计数为O,且上层计数
for(let i = seqlist.length - 2 ; i >=0;i--)
{
let itemseq = seqlist[i]
let itemcnt = countMap[itemseq.seqlist] || 0
if(itemcnt>0)
break
if(itemseq.status == 'O' && itemcnt == 0)
status = 'O'
}
}
}
let errmsg = null
if(value.length == 3)
errmsg = value[2] || {}
......
......@@ -13,7 +13,12 @@ export default class T15A extends Component
tno = -1
render(){
return (<Row></Row>)
return (<Row>
<FormItem
>
<h3 className="ant-form-text" >New Sequence</h3>
</FormItem>
</Row>)
}
}
\ No newline at end of file
......@@ -17,7 +17,10 @@ export default class T15B extends Component
render()
{
return (<Row>
<FormItem
>
<h3 className="ant-form-text" >New Sequence</h3>
</FormItem>
</Row>)
}
......
......@@ -18,7 +18,10 @@ export default class T15C extends Component
{
return (<Row>
<FormItem
>
<h3 className="ant-form-text" >New Sequence</h3>
</FormItem>
</Row>)
}
......
......@@ -18,7 +18,10 @@ export default class T15D extends Component
{
return (<Row>
<FormItem
>
<h3 className="ant-form-text" >New Sequence</h3>
</FormItem>
</Row>)
}
......
......@@ -17,7 +17,10 @@ export default class T15E extends Component
render()
{
return (<Row>
<FormItem
>
<h3 className="ant-form-text" >New Sequence</h3>
</FormItem>
</Row>)
}
......
......@@ -2,9 +2,13 @@ import React, { Component } from 'react'
import { Form, Input, DatePicker, Row, Col, Button, Icon, Select } from 'antd';
import { InputSize, Currency } from "./Utils"
import YBIC from './YBIC'
const FormItem = Form.Item;
const Option = Select.Option
export default class T17A extends Component {
name = '17A'
......
......@@ -12,9 +12,9 @@ const code2 = ["ISSUE","REQUEST"]
export default function(props)
{
let {mty} = props
if(mtys1.findIndex(m=>m==mty)>= 0)
if(mty=='mt752')
return <T23_1 {...props} SELCode={code1} />
if(mtys2.findIndex(m=>m==mty)>= 0)
if(mty== 'mt760' || mty == 'mt767')
return <T23_1 {...props} SELCode={code2} />
return <T23_d {...props} />
}
\ No newline at end of file
import React,{Component} from 'react'
import { Form, Input, DatePicker,Row, Col,Button,Icon ,Select} from 'antd';
import {InputSize,Currency,FormatAmount} from "./Utils"
const FormItem = Form.Item;
const Option = Select.Option
export default class T37K extends Component
{
name='37K'
desp = "(Currency)(Rate)"
pattern = "3!a12d"
tno = -1
keys=[1,2]
onChange=(index,value)=>
{
let obj = {};
if(!value)
value = ""
let objtemp =this.props.value
objtemp = objtemp && objtemp.length? objtemp[0] : {}
objtemp["s"+index] = value;
this.keys.forEach(i=>{
obj['s'+i] = objtemp['s'+i]
});
let temp = FormatAmount(obj.s2);
let mval = `${obj.s1}${temp}`.replace(/\//g,'')
this.props.onValue([obj,mval])
}
render()
{
let value =this.props.value
let mval = value && value.length? value[1] : ''
let errmsg = value && value.length==3?value[2]:{}
value = value && value.length? value[0] : {}
return (<Row>
<Col style={{"minWidth":'100px'}} span={3}>
<FormItem
label="Currency"
required={this.props.status=='M' || mval?'required':null}
help={errmsg.s2}
validateStatus={errmsg.s2?'error':null}
>
<Select
placeholder="Currency"
showSearch
allowClear={true}
optionFilterProp="children"
notFoundContent="Wrong Code"
style={{ width: "100%" }} value={value.s1} onChange={val=>this.onChange(1,val)} >
{
Currency.map(cur=><Option key={cur} value={cur}>{cur}</Option>)
}
</Select>
</FormItem>
</Col>
<Col span={12}>
<FormItem
label="Rate"
required={this.props.status=='M' || mval?'required':null}
help={errmsg.s2}
validateStatus={errmsg.s2?'error':null}
>
<Input value={value.s2} onChange={e=>this.onChange(2,e.target.value)} maxLength={12} style={{imeMode:'disabled'}} placeholder="Rate"/>
</FormItem>
</Col>
</Row>)
}
}
\ No newline at end of file
......@@ -155,6 +155,7 @@ import T14S from './T14S'
import T15A from './T15A'
import T94A from './T94A'
import T22C from './T22C'
import T17A from './T17A'
import T17E from './T17E'
import T17F from './T17F'
import T17H from './T17H'
......@@ -189,6 +190,8 @@ import T39M from './T39M'
import T21A from './T21A'
import T14E from './T14E'
import T15B from './T15B'
import T15C from './T15C'
import T15D from './T15D'
import T30T from './T30T'
import T30V from './T30V'
import T29A from './T29A'
......@@ -257,12 +260,12 @@ import T33G from './T33G';
import T71C from './T71C';
import T32F from './T32F';
import T26D from './T26D';
import T17R from './T17R';
import T32R from './T32R';
import T34J from './T34J';
import T33J from './T33J';
import T22Z from './T22Z';
import T37K from './T37K';
import T17R from './T17R';
export default function(tag,props,onValue){
......@@ -425,6 +428,9 @@ export default function(tag,props,onValue){
case "T21A" :return <T21A {...props} onValue={onValue} />;
case "T14E" :return <T14E {...props} onValue={onValue} />;
case "T15B" :return <T15B {...props} onValue={onValue} />;
case "T15C" :return <T15C {...props} onValue={onValue} />;
case "T15D" :return <T15D {...props} onValue={onValue} />;
case "T30T" :return <T30T {...props} onValue={onValue} />;
case "T30V" :return <T30V {...props} onValue={onValue} />;
case "T29A" :return <T29A {...props} onValue={onValue} />;
......@@ -441,6 +447,7 @@ export default function(tag,props,onValue){
case "T15A" :return <T15A {...props} onValue={onValue} />;
case "T94A" :return <T94A {...props} onValue={onValue} />;
case "T22C" :return <T22C {...props} onValue={onValue} />;
case "T17A" :return <T17A {...props} onValue={onValue} />;
case "T17E" :return <T17E {...props} onValue={onValue} />;
case "T17F" :return <T17F {...props} onValue={onValue} />;
case "T17H" :return <T17H {...props} onValue={onValue} />;
......@@ -527,11 +534,13 @@ export default function(tag,props,onValue){
case "T71C" :return <T71C {...props} onValue={onValue} />;
case "T32F" :return <T32F {...props} onValue={onValue} />;
case "T26D" :return <T26D {...props} onValue={onValue} />;
case "T17R" :return <T17R {...props} onValue={onValue} />;
case "T32R" :return <T32R {...props} onValue={onValue} />;
case "T34J" :return <T34J {...props} onValue={onValue} />;
case "T33J" :return <T33J {...props} onValue={onValue} />;
case "T22Z" :return <T22Z {...props} onValue={onValue} />;
case "T37K" :return <T37K {...props} onValue={onValue} />;
case "T17R" :return <T17R {...props} onValue={onValue} />;
}
}
\ No newline at end of file
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