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
2b22189e
Commit
2b22189e
authored
Mar 17, 2022
by
fengjiansheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(@gms/gms-plugin-billexpand): 增加子表赋值公式
parent
f436e92a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
0 deletions
+130
-0
emcon.js
develop/@gms/gms-plugin-billexpand/src/emcon.js
+16
-0
FormulaConstants.js
...gms/gms-plugin-billexpand/src/formula/FormulaConstants.js
+17
-0
SetSubFieldsByBaseData.js
...s-plugin-billexpand/src/formula/SetSubFieldsByBaseData.js
+95
-0
mcon.js
develop/@gms/gms-plugin-billexpand/src/mcon.js
+2
-0
No files found.
develop/@gms/gms-plugin-billexpand/src/emcon.js
View file @
2b22189e
...
...
@@ -4307,6 +4307,22 @@ export default {
"extends"
:
{
"info"
:
{
"param"
:
[],
"name"
:
"SetSubFieldsByBaseData"
,
"description"
:
"从子表基础数据带出数据到子表同行的其他字段中,支持带出基础数据/普通数据 SetSubFieldsByBaseData(HJ_YSXXZB_I.YSXM,
\"
jfly#MD_JFLY
\"
,HJ_YSXXZB_I.JFLY,
\"
zclb#MD_ZCLB
\"
,HJ_YSXXZB_I.ZCLB,
\"
ysje#
\"
,HJ_YSXXZB_I.YSJE)"
,
"title"
:
"子表赋值公式:根据子表基础数据给子表其他字段赋值"
,
"return"
:
0
}
},
"description"
:
""
,
"title"
:
"子表赋值公式:根据子表基础数据给子表其他字段赋值"
,
"value"
:
"SetSubFieldsByBaseData"
},
{
"discard"
:
false
,
"path"
:
"通用"
,
"extends"
:
{
"info"
:
{
"param"
:
[],
"name"
:
"ApplyTemplateString"
,
"description"
:
"1.基础数据字段,2.赋值的字段,3.模板字符串4.field+对应基础数据table5.分隔符"
,
"title"
:
"基础数据赋值模板字符串"
,
...
...
develop/@gms/gms-plugin-billexpand/src/formula/FormulaConstants.js
View file @
2b22189e
...
...
@@ -51,5 +51,22 @@ export default {
}
return
obj
},
isValidString
(
s
)
{
return
_
.
isString
(
s
)
&&
s
.
length
>
0
}
}
export
{
BaseDataParam
,
_
}
class
BaseDataParam
{
tableName
;
objectcode
;
constructor
(
tableName
,
objectcode
)
{
this
.
objectcode
=
objectcode
;
this
.
tableName
=
tableName
;
this
.
queryDataStructure
=
"ALL"
this
.
limit
=
1
;
this
.
offset
=
0
;
this
.
pagination
=
true
}
}
develop/@gms/gms-plugin-billexpand/src/formula/SetSubFieldsByBaseData.js
0 → 100644
View file @
2b22189e
import
FormulaConstants
,
{
BaseDataParam
,
_
}
from
"./FormulaConstants"
/**
* 子表赋值公式 处理子表基础数据带出基础数据/标准金额/其他字段时 给同行其他字段赋值的问题
* @author fengjiansheng
* @date 2022-03-17
*/
export
default
{
execute
:
function
()
{
let
formulaName
=
"SetSubFieldsByBaseData"
let
delimiter
=
"#"
;
if
(
arguments
&&
arguments
[
0
]
&&
arguments
[
0
].
length
>
1
)
{
let
context
=
arguments
[
1
]
debugger
let
sourceBaseDataField
=
arguments
[
0
][
0
]
let
sourceBaseData
=
FormulaConstants
.
getFormulaParamValue
(
sourceBaseDataField
)
let
oldIndex
=
context
.
getSubFocus
()
let
subTableObject
=
null
let
focusData
=
null
let
baseDataParamArrayList
=
[]
let
targetSubTableFieldList
=
[]
let
sourceCommonValueList
=
[]
let
targetSubTableCommonFieldList
=
[]
for
(
let
i
=
1
;
i
<
arguments
[
0
].
length
;
i
+=
2
)
{
let
tempTargetSubTableField
=
arguments
[
0
][
i
+
1
]
let
combString
=
FormulaConstants
.
getFormulaParamValue
(
arguments
[
0
][
i
])
let
sourceBaseDataFieldName
=
combString
.
split
(
delimiter
)[
0
]
let
targetBaseDataTableName
=
combString
.
split
(
delimiter
)[
1
]
let
targetBaseDataValueObjectcode
=
sourceBaseData
[
sourceBaseDataFieldName
]
if
(
subTableObject
==
null
)
{
subTableObject
=
context
.
getTableType
(
tempTargetSubTableField
.
FieldTableCode
)
}
if
(
focusData
==
null
)
{
focusData
=
context
.
getAllSubData
()[
subTableObject
.
title
][
oldIndex
].
getData
()
}
if
(
!
(
_
.
isEqual
(
focusData
[
sourceBaseDataField
.
FieldCode
].
_field_old_value_
,
focusData
[
sourceBaseDataField
.
FieldCode
].
value
)))
{
if
(
FormulaConstants
.
isValidString
(
targetBaseDataTableName
)
&&
targetBaseDataTableName
.
indexOf
(
"MD_"
)
===
0
&&
FormulaConstants
.
isValidString
(
targetBaseDataValueObjectcode
))
{
let
baseDataParam
=
new
BaseDataParam
(
targetBaseDataTableName
,
targetBaseDataValueObjectcode
);
baseDataParamArrayList
.
push
(
baseDataParam
)
targetSubTableFieldList
.
push
(
tempTargetSubTableField
)
}
else
{
sourceCommonValueList
.
push
(
targetBaseDataValueObjectcode
)
targetSubTableCommonFieldList
.
push
(
tempTargetSubTableField
)
}
}
}
if
(
sourceCommonValueList
.
length
===
targetSubTableCommonFieldList
.
length
&&
targetSubTableCommonFieldList
.
length
>
0
)
{
focusData
[
sourceBaseDataField
.
FieldCode
].
_field_old_value_
=
focusData
[
sourceBaseDataField
.
FieldCode
].
value
for
(
let
i
=
0
;
i
<
targetSubTableCommonFieldList
.
length
;
i
++
)
{
focusData
[
targetSubTableCommonFieldList
[
i
].
FieldCode
].
_field_old_value_
=
focusData
[
targetSubTableCommonFieldList
[
i
].
FieldCode
].
value
=
sourceCommonValueList
[
i
]
}
if
(
baseDataParamArrayList
.
length
===
0
)
{
context
.
refreshSubDataRow
(
subTableObject
.
title
)
}
}
if
(
baseDataParamArrayList
.
length
===
targetSubTableFieldList
.
length
&&
targetSubTableFieldList
.
length
>
0
)
{
this
.
getCombBaseDataList
(
baseDataParamArrayList
,
(
baseDataList
)
=>
{
let
newIndex
=
context
.
getSubFocus
()
if
(
oldIndex
!==
newIndex
)
{
context
.
setSubFocus
(
oldIndex
)
}
focusData
[
sourceBaseDataField
.
FieldCode
].
_field_old_value_
=
focusData
[
sourceBaseDataField
.
FieldCode
].
value
for
(
let
i
=
0
;
i
<
targetSubTableFieldList
.
length
;
i
++
)
{
focusData
[
targetSubTableFieldList
[
i
].
FieldCode
].
_field_old_value_
=
focusData
[
targetSubTableFieldList
[
i
].
FieldCode
].
value
=
baseDataList
[
i
]
}
context
.
refreshSubDataRow
(
subTableObject
.
title
)
},
(
resp
)
=>
{
console
.
error
(
resp
)
})
}
}
},
getCombBaseDataList
(
param
,
callBack
,
errorCallBack
)
{
GMS
.
$http
.
post
(
"/rbcfunc/getCombBaseDataList"
,
param
).
then
(
data
=>
{
let
baseDataList
=
data
.
data
.
data
let
res
=
[]
baseDataList
.
forEach
(
e
=>
{
if
(
e
instanceof
Array
)
{
if
(
e
.
length
>
0
)
{
res
.
push
(
e
[
0
])
}
else
{
res
.
push
(
null
)
}
}
else
{
res
.
push
(
e
)
}
})
callBack
(
res
)
}).
catch
((
resp
)
=>
{
errorCallBack
(
resp
)
});
},
getResultType
:
function
()
{
return
FormulaConstants
.
resultType
.
anyType
},
}
develop/@gms/gms-plugin-billexpand/src/mcon.js
View file @
2b22189e
...
...
@@ -183,6 +183,7 @@ import EqualsMasterAndSubField from "./formula/EqualsMasterAndSubField";
import
SubTableHasContainField
from
"./formula/SubTableHasContainField"
;
import
GetUserStaffInfo
from
"./formula/GetUserStaffInfo"
;
import
MdFilterInfiniteValue
from
"./formula/MdFilterInfiniteValue"
;
import
SetSubFieldsByBaseData
from
"./formula/SetSubFieldsByBaseData"
;
export
default
{
actions
:
{
updateFieldAction
,
...
...
@@ -274,6 +275,7 @@ export default {
formula
:
{
MdFilterInfiniteValue
,
SubTableSetBaseData
,
SetSubFieldsByBaseData
,
LoginUserIsContianRole
,
SubTableJointString
,
GetSubTableRows
,
...
...
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