Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rbc-demo
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
王衍超
rbc-demo
Commits
d11a979e
Commit
d11a979e
authored
Mar 18, 2022
by
Joey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(@gms/gms-plugin-billexpand): 公式applyTemplateString
- 进入单据编辑状态时字段被清空 - 对比子表前后变化避免多次执行
parent
18d1af9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
ApplyTemplateString.js
.../gms-plugin-billexpand/src/formula/ApplyTemplateString.js
+24
-6
No files found.
develop/@gms/gms-plugin-billexpand/src/formula/ApplyTemplateString.js
View file @
d11a979e
// 子表根据基础数据带出基础数据
// 子表根据基础数据带出基础数据
export
default
{
export
default
{
execute
:
function
()
{
execute
:
function
()
{
const
GLOBAL_PARAM_KEY
=
'applyTemplateStringData'
if
(
arguments
&&
arguments
[
0
]
&&
arguments
[
1
])
{
if
(
arguments
&&
arguments
[
0
]
&&
arguments
[
1
])
{
const
context
=
arguments
[
1
]
const
context
=
arguments
[
1
]
if
(
!
context
.
getGlobalParam
(
GLOBAL_PARAM_KEY
))
{
context
.
setGlobalParam
(
GLOBAL_PARAM_KEY
,
{})
}
const
originField
=
arguments
[
0
][
0
]
const
originField
=
arguments
[
0
][
0
]
const
targetField
=
arguments
[
0
][
1
]
const
targetField
=
arguments
[
0
][
1
]
let
templateString
=
arguments
[
0
][
2
].
StaticValue
let
templateString
=
arguments
[
0
][
2
].
StaticValue
...
@@ -12,6 +17,18 @@ export default {
...
@@ -12,6 +17,18 @@ export default {
const
argList
=
args
.
split
(
','
)
const
argList
=
args
.
split
(
','
)
const
originTableType
=
context
.
getTableType
(
originField
.
FieldTableCode
)
const
originTableType
=
context
.
getTableType
(
originField
.
FieldTableCode
)
const
originTableObject
=
context
.
getSubData
(
originTableType
.
title
)
const
originTableObject
=
context
.
getSubData
(
originTableType
.
title
)
const
oldValue
=
context
.
getGlobalParam
(
GLOBAL_PARAM_KEY
)[
originTableType
.
title
]
if
(
originTableObject
instanceof
Array
)
{
const
newValue
=
originTableObject
.
map
((
o
)
=>
o
.
getValue
(
originField
.
FieldCode
))
.
filter
((
o
)
=>
o
&&
o
.
code
)
.
map
((
o
)
=>
o
.
code
)
.
join
(
','
)
if
(
oldValue
!=
newValue
)
{
context
.
getGlobalParam
(
GLOBAL_PARAM_KEY
)[
originTableType
.
title
]
=
newValue
}
else
return
}
const
requestParam
=
{
const
requestParam
=
{
pagination
:
false
,
pagination
:
false
,
searchKey
:
""
,
searchKey
:
""
,
...
@@ -19,11 +36,7 @@ export default {
...
@@ -19,11 +36,7 @@ export default {
stopflag
:
-
1
,
stopflag
:
-
1
,
authType
:
"NONE"
authType
:
"NONE"
}
}
const
replaceMap
=
new
Map
()
const
replaceTemplatePart
=
templateString
.
match
(
/{{.+
?
}}/g
)
replaceTemplatePart
.
forEach
((
part
)
=>
{
replaceMap
.
set
(
part
,
[])
})
const
getBaseDataList
=
(
originFieldValue
)
=>
{
const
getBaseDataList
=
(
originFieldValue
)
=>
{
const
promistList
=
[]
const
promistList
=
[]
for
(
let
i
=
0
;
i
<
argList
.
length
;
i
+=
2
)
{
for
(
let
i
=
0
;
i
<
argList
.
length
;
i
+=
2
)
{
...
@@ -63,12 +76,17 @@ export default {
...
@@ -63,12 +76,17 @@ export default {
return
templateString
return
templateString
}
}
if
(
originTableObject
instanceof
Array
)
{
if
(
originTableObject
instanceof
Array
)
{
const
replaceMap
=
new
Map
()
const
replaceTemplatePart
=
templateString
.
match
(
/{{.+
?
}}/g
)
replaceTemplatePart
.
forEach
((
part
)
=>
{
replaceMap
.
set
(
part
,
[])
})
const
getBasedataPromiseList
=
[]
const
getBasedataPromiseList
=
[]
let
count
=
0
let
count
=
0
for
(
let
i
=
0
;
i
<
originTableObject
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
originTableObject
.
length
;
++
i
)
{
const
originObject
=
originTableObject
[
i
]
const
originObject
=
originTableObject
[
i
]
const
curOriginFieldValue
=
originObject
.
getValue
(
originField
.
FieldCode
)
const
curOriginFieldValue
=
originObject
.
getValue
(
originField
.
FieldCode
)
if
(
!
curOriginFieldValue
||
!
curOriginFieldValue
.
object
code
)
{
if
(
!
curOriginFieldValue
||
!
curOriginFieldValue
.
code
)
{
continue
continue
}
}
getBasedataPromiseList
.
push
(
getBaseDataList
(
curOriginFieldValue
).
then
((
basedataObjectList
)
=>
{
getBasedataPromiseList
.
push
(
getBaseDataList
(
curOriginFieldValue
).
then
((
basedataObjectList
)
=>
{
...
...
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