Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swifteditor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
daixuan
swifteditor
Commits
e9cb8c77
Commit
e9cb8c77
authored
Aug 20, 2021
by
fukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持SEQ可选输入
parent
f622cba3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
18 deletions
+143
-18
SWFPage2.js
src/swift/SWFPage2.js
+104
-17
TagValidater.js
src/swift/TagValidater.js
+39
-1
No files found.
src/swift/SWFPage2.js
View file @
e9cb8c77
...
@@ -15,7 +15,7 @@ import TagSet from "./Tags"
...
@@ -15,7 +15,7 @@ import TagSet from "./Tags"
import
{
DeepCopy
,
getLogicAdress
}
from
'./Utils'
import
{
DeepCopy
,
getLogicAdress
}
from
'./Utils'
import
{
TagV
,
SwitchType
}
from
'./TagValidater'
import
{
TagV
,
SwitchType
,
isTagValueEmpty
}
from
'./TagValidater'
import
GPIConfig
from
'../constants/GPIConfig'
import
GPIConfig
from
'../constants/GPIConfig'
import
YBIC
from
'./Tags/YBIC'
import
YBIC
from
'./Tags/YBIC'
...
@@ -46,7 +46,7 @@ export class SWFPage extends Component
...
@@ -46,7 +46,7 @@ export class SWFPage extends Component
console
.
log
(
msg
)
console
.
log
(
msg
)
}
}
validateAllMessage
=
(
tags
,
rs
)
=>
validateAllMessage
=
(
tags
,
rs
,
seqlist
=
[]
)
=>
{
{
const
mty
=
this
.
props
.
params
.
mty
||
this
.
props
.
extra
.
msgtyp
const
mty
=
this
.
props
.
params
.
mty
||
this
.
props
.
extra
.
msgtyp
for
(
let
item
of
tags
)
for
(
let
item
of
tags
)
...
@@ -57,7 +57,7 @@ export class SWFPage extends Component
...
@@ -57,7 +57,7 @@ export class SWFPage extends Component
{
{
item
.
tagValue
=
[{},
''
,{}]
item
.
tagValue
=
[{},
''
,{}]
}
}
if
(
!
TagV
(
"T"
+
item
.
tag
,
item
.
status
,
item
.
tagValue
,
item
.
tno
,
mty
,
this
.
props
.
params
.
t111
||
this
.
props
.
extra
.
reload_t111
))
if
(
!
TagV
(
"T"
+
item
.
tag
,
item
.
status
,
item
.
tagValue
,
item
.
tno
,
mty
,
this
.
props
.
params
.
t111
||
this
.
props
.
extra
.
reload_t111
,
seqlist
,
this
.
props
.
extra
.
countMap
))
{
{
rs
.
hasError
=
true
rs
.
hasError
=
true
console
.
log
(
item
.
tag
)
console
.
log
(
item
.
tag
)
...
@@ -67,12 +67,12 @@ export class SWFPage extends Component
...
@@ -67,12 +67,12 @@ export class SWFPage extends Component
}
else
if
(
item
.
cyclist
)
}
else
if
(
item
.
cyclist
)
{
{
for
(
let
cyc
of
item
.
cycs
)
for
(
let
cyc
of
item
.
cycs
)
this
.
validateAllMessage
(
cyc
,
rs
)
this
.
validateAllMessage
(
cyc
,
rs
,
seqlist
)
}
}
else
if
(
item
.
seqlist
)
else
if
(
item
.
seqlist
)
{
{
for
(
let
seq
of
item
.
seqs
)
for
(
let
seq
of
item
.
seqs
)
this
.
validateAllMessage
(
seq
,
rs
)
this
.
validateAllMessage
(
seq
,
rs
,[...
seqlist
,{
status
:
item
.
status
,
seqlist
:
item
.
seqlist
}]
)
}
}
}
}
}
}
...
@@ -206,7 +206,7 @@ export class SWFPage extends Component
...
@@ -206,7 +206,7 @@ export class SWFPage extends Component
}
}
return
""
return
""
}
}
joinMessage
(
tags
,
arr
,
deep
=
0
)
joinMessage
(
tags
,
arr
,
seqlist
,
deep
=
0
)
{
{
for
(
let
item
of
tags
)
for
(
let
item
of
tags
)
{
{
...
@@ -214,6 +214,14 @@ export class SWFPage extends Component
...
@@ -214,6 +214,14 @@ export class SWFPage extends Component
{
{
if
(
!
item
.
tagValue
)
if
(
!
item
.
tagValue
)
continue
continue
if
(
item
.
tag
.
indexOf
(
'15'
)
>-
1
)
{
//15系列字段
if
(
seqlist
&&
this
.
props
.
extra
.
countMap
&&
this
.
props
.
extra
.
countMap
[
seqlist
])
{
arr
.
push
(
`:
${
item
.
tag
}
:`
)
}
}
if
(
typeof
item
.
tagValue
==
'string'
&&
item
.
tagValue
)
if
(
typeof
item
.
tagValue
==
'string'
&&
item
.
tagValue
)
arr
.
push
(
`:
${
item
.
tag
}
:
${
item
.
tagValue
}
`
)
arr
.
push
(
`:
${
item
.
tag
}
:
${
item
.
tagValue
}
`
)
else
if
(
typeof
item
.
tagValue
[
1
]
==
'string'
&&
item
.
tagValue
[
1
])
else
if
(
typeof
item
.
tagValue
[
1
]
==
'string'
&&
item
.
tagValue
[
1
])
...
@@ -245,7 +253,7 @@ export class SWFPage extends Component
...
@@ -245,7 +253,7 @@ export class SWFPage extends Component
{
{
let
beginLength
=
arr
.
length
let
beginLength
=
arr
.
length
for
(
let
cyc
of
item
.
cycs
)
for
(
let
cyc
of
item
.
cycs
)
this
.
joinMessage
(
cyc
,
arr
,
deep
+
1
)
this
.
joinMessage
(
cyc
,
arr
,
seqlist
,
deep
+
1
)
let
endLength
=
arr
.
length
let
endLength
=
arr
.
length
if
(
deep
==
0
&&
endLength
==
beginLength
&&
this
.
props
.
extra
.
msgtyp
==
'mt103'
&&
item
.
cyclist
==
'20'
)
if
(
deep
==
0
&&
endLength
==
beginLength
&&
this
.
props
.
extra
.
msgtyp
==
'mt103'
&&
item
.
cyclist
==
'20'
)
{
{
...
@@ -260,7 +268,7 @@ export class SWFPage extends Component
...
@@ -260,7 +268,7 @@ export class SWFPage extends Component
else
if
(
item
.
seqlist
)
else
if
(
item
.
seqlist
)
{
{
for
(
let
seq
of
item
.
seqs
)
for
(
let
seq
of
item
.
seqs
)
this
.
joinMessage
(
seq
,
arr
,
deep
+
1
)
this
.
joinMessage
(
seq
,
arr
,
item
.
seqlist
,
deep
+
1
)
}
}
}
}
}
}
...
@@ -575,7 +583,7 @@ export class SWFPage extends Component
...
@@ -575,7 +583,7 @@ export class SWFPage extends Component
<
/Col
>
<
/Col
>
<
Col
span
=
{
1
}
style
=
{{
textAlign
:
'center'
}}
><
span
style
=
{{
fontWeight
:
'bolder'
}}
>
{
"NO."
}
<
/span></
Col
>
<
Col
span
=
{
1
}
style
=
{{
textAlign
:
'center'
}}
><
span
style
=
{{
fontWeight
:
'bolder'
}}
>
{
"NO."
}
<
/span></
Col
>
<
/Row
>
<
/Row
>
<
SWFMessage
t111
=
{
this
.
props
.
params
.
t111
||
this
.
props
.
extra
.
reload_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
}
/
>
<
SWFMessage
t111
=
{
this
.
props
.
params
.
t111
||
this
.
props
.
extra
.
reload_t111
}
action
=
{
this
.
props
.
params
.
action
}
e
xtra
=
{
this
.
props
.
extra
}
e
nLock
=
{
this
.
props
.
params
.
action
==
'redit'
}
updateTreeValue
=
{
this
.
props
.
actions
.
updateTreeValue
}
pattern
=
{
tags
}
ref
=
{
ref
=>
this
.
swfmsg
=
ref
}
mty
=
{
mty
}
/
>
<
/Col
>
<
/Col
>
<
Col
span
=
{
3
}
><
/Col
>
<
Col
span
=
{
3
}
><
/Col
>
...
@@ -841,11 +849,11 @@ export class MessageArea extends Component{
...
@@ -841,11 +849,11 @@ export class MessageArea extends Component{
{
{
fields
.
map
((
item
,
index
)
=>
{
fields
.
map
((
item
,
index
)
=>
{
if
(
item
.
tag
)
if
(
item
.
tag
)
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
}
/
>
return
<
Tag
extra
=
{
this
.
props
.
extra
}
action
=
{
this
.
props
.
action
}
t111
=
{
this
.
props
.
t111
}
enLock
=
{
this
.
props
.
enLock
}
updateTreeValue
=
{
this
.
props
.
updateTreeValue
}
pattern
=
{
item
}
seqlist
=
{
this
.
props
.
seqlist
}
key
=
{
item
.
tno
}
mty
=
{
this
.
props
.
mty
}
/
>
if
(
item
.
cyclist
)
if
(
item
.
cyclist
)
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
}
/
>
return
<
CYCList
extra
=
{
this
.
props
.
extra
}
action
=
{
this
.
props
.
action
}
t111
=
{
this
.
props
.
t111
}
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
)
if
(
item
.
seqlist
)
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
<
SEQList
extra
=
{
this
.
props
.
extra
}
action
=
{
this
.
props
.
action
}
t111
=
{
this
.
props
.
t111
}
enLock
=
{
this
.
props
.
enLock
}
updateTreeValue
=
{
this
.
props
.
updateTreeValue
}
pattern
=
{
item
}
seqlist
=
{
this
.
props
.
seqlist
}
key
=
{
item
.
seq
+
','
+
index
}
mty
=
{
this
.
props
.
mty
}
/
>
return
null
return
null
})
})
}
}
...
@@ -954,7 +962,7 @@ export class CYCList extends MessageArea
...
@@ -954,7 +962,7 @@ export class CYCList extends MessageArea
{
index
==
0
?
null
:
{
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"
/>
<
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>
)
<
/div>
)
})
})
}
}
...
@@ -1058,6 +1066,7 @@ export class SEQList extends MessageArea
...
@@ -1058,6 +1066,7 @@ export class SEQList extends MessageArea
output
()
output
()
{
{
let
subtree
=
this
.
props
.
pattern
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
(
return
(
<
div
>
<
div
>
<
Row
>
<
Row
>
...
@@ -1081,7 +1090,7 @@ export class SEQList extends MessageArea
...
@@ -1081,7 +1090,7 @@ export class SEQList extends MessageArea
{
index
==
0
||
subtree
.
cyccnt
==
0
?
null
:
{
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"
/>
<
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>
)
<
/div>
)
})
})
}
}
...
@@ -1115,12 +1124,90 @@ export class Tag extends MessageArea
...
@@ -1115,12 +1124,90 @@ export class Tag extends MessageArea
// }else
// }else
// this.name = this.pattern.tag
// this.name = this.pattern.tag
// this.state = {name:this.name}
// 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
)
}
onValue
=
val
=>
{
onValue
=
val
=>
{
this
.
props
.
pattern
.
tagValue
=
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
.
props
.
t111
)
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
,
this
.
props
.
pattern
.
status
,
val
,
this
.
props
.
pattern
.
tno
,
this
.
props
.
mty
,
this
.
props
.
t111
,
this
.
props
.
seqlist
,
this
.
props
.
extra
.
countMap
)
this
.
setState
({
tagValue
:
this
.
props
.
pattern
.
tagValue
,
isEmpty
:
this
.
isEmpty
(
this
.
props
.
pattern
.
tagValue
)})
//this.props.updateTreeValue()
//this.props.updateTreeValue()
}
}
output
()
output
()
...
...
src/swift/TagValidater.js
View file @
e9cb8c77
import
{
RegMap
}
from
'./TagRegMap'
import
{
RegMap
}
from
'./TagRegMap'
export
function
TagV
(
tag
,
status
,
value
,
tno
,
mty
,
t111
)
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
,
t111
,
seqlist
,
countMap
=
{})
{
{
let
regobj
=
RegMap
[
tag
]
let
regobj
=
RegMap
[
tag
]
let
obj
=
value
[
0
]
let
obj
=
value
[
0
]
let
mval
=
value
[
1
]
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
let
errmsg
=
null
if
(
value
.
length
==
3
)
if
(
value
.
length
==
3
)
errmsg
=
value
[
2
]
||
{}
errmsg
=
value
[
2
]
||
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment