Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
Project
Project
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
鲁鑫
topsun-bpm
Commits
a847a051
Commit
a847a051
authored
Dec 22, 2023
by
覃振观
👶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
666
parent
13f1bc9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
32 deletions
+20
-32
listeningFromData.js
...xt/src/main/webapp/biz/topsun/common/listeningFromData.js
+19
-31
productDetail.js
...un-xt/src/main/webapp/biz/topsun/product/productDetail.js
+1
-1
No files found.
topsun-xt/src/main/webapp/biz/topsun/common/listeningFromData.js
View file @
a847a051
...
...
@@ -7,7 +7,8 @@
function
mapping
(
dataMapping
,
rawData
)
{
window
.
dataSet
=
{};
window
.
dataSet
.
tempId
=
950366
;
if
(
!
rawData
)
{
debugger
;
if
(
Object
.
entries
(
rawData
).
length
/
Object
.
entries
(
window
.
dataMapping
).
length
<
0.5
)
{
window
.
dataSet
.
isInsert
=
true
;
var
rawData
=
{};
}
else
{
...
...
@@ -52,19 +53,7 @@ function mapping(dataMapping, rawData) {
rowData
[
'rowIndex'
]
=
rowId
;
listMap
[
rowId
]
=
rowData
;
ids
.
push
(
rowId
);
settingGridMapper
(
propertyNames
.
columns
,
mapper
,
rowId
,
beanName
);
// propertyNames.columns.forEach(property => {
// if(!mapper[property]) {
// mapper[property] = {};
// }
// if(!mapper[property][beanName]) {
// mapper[property][beanName] = {};
// }
// let mapperData = {};
// mapperData[rowId] = {};
// mapper[property][beanName].push(mapperData);
// });
})
rawData
[
beanName
]
=
{};
rawData
[
beanName
].
raw
=
entityData
;
...
...
@@ -83,6 +72,14 @@ function mapping(dataMapping, rawData) {
return
returnData
;
}
/**
* 设置 Grid 映射关系,若是添加行,则需要构建属性
* @param propertyNames
* @param mapper
* @param rowId
* @param beanName
* @param data 若是添加行,需要传入 data 构建属性
*/
function
settingGridMapper
(
propertyNames
,
mapper
,
rowId
,
beanName
,
data
)
{
propertyNames
.
forEach
(
property
=>
{
if
(
!
mapper
[
property
])
{
...
...
@@ -178,7 +175,7 @@ function checkArrayMapper(str) {
function
listeningGrid
(
elId
,
options
)
{
let
currentMapper
=
checkArrayMapper
(
elId
);
if
(
!
currentMapper
.
property
.
id
)
{
if
(
!
currentMapper
.
property
)
{
console
.
error
(
"若需要监听 GridData ,必须在映射配置指定 ID !请检查。"
);
return
;
}
...
...
@@ -214,16 +211,8 @@ function listeningGrid(elId, options) {
let
rowId
=
window
.
dataSet
.
tempId
+=
1
let
data
=
{},
mapperData
=
{};
// ------------- 设置 mapper -------------
settingGridMapper
(
currentMapper
.
property
.
columns
,
mapper
,
rowId
,
beanName
);
settingGridMapper
(
currentMapper
.
property
.
columns
,
mapper
,
rowId
,
beanName
,
data
);
// currentMapper.property.columns.forEach(property => {
// mapperData[rowId] = {};
// if(!mapper[property]) {
// mapper[property] = {};
// }
// mapper[property][beanName] = mapperData;
//
// });
data
[
idProperty
]
=
rowId
;
data
[
'rowIndex'
]
=
rowId
// ------------- 设置 compares -------------
...
...
@@ -251,15 +240,15 @@ function listeningGrid(elId, options) {
let
beanName
=
currentMapper
.
beanName
;
let
currentData
=
window
.
dataSet
.
newData
[
beanName
];
let
propertyId
=
window
.
dataMapping
[
beanName
].
id
;
let
currentId
=
selectRow
[
propertyId
];
let
currentId
=
selectRow
[
propertyId
]
+
''
;
delete
currentData
.
compares
[
currentId
];
currentData
.
ids
.
pop
(
currentId
);
currentData
.
ids
=
currentData
.
ids
.
filter
(
x
=>
!
currentId
.
includes
(
x
)
);
// window.dataMapping[beanName]
.columns.forEach(property => {
// window.dataMapping.mapper[property][beanName]
//
});
currentMapper
.
property
.
columns
.
forEach
(
property
=>
{
delete
window
.
dataMapping
.
mapper
[
'productFaceColorId'
][
beanName
][
currentId
];
});
gridManager
.
deleteSelectedRow
();
debugger
;
originalOnClick
.
call
(
this
,
selectRow
);
}
}
...
...
@@ -326,7 +315,7 @@ function listenerContent(event) {
let
control
;
let
inputIds
=
event
.
target
.
id
.
split
(
'_'
);
let
currentMapper
=
checkArrayMapper
(
inputIds
[
0
]);
if
(
currentMapper
.
property
.
id
)
{
if
(
currentMapper
.
property
)
{
control
=
'grid'
;
}
else
{
control
=
'form'
;
...
...
@@ -435,7 +424,6 @@ function checkUpdata() {
if
(
!
rawCompares
)
{
rawCompares
=
{};
}
if
(
!
nowCompares
)
{
nowCompares
=
{};
}
if
(
!
(
getHashCode
(
JSON
.
stringify
(
rawCompares
))
===
getHashCode
(
JSON
.
stringify
(
nowCompares
))))
{
debugger
;
let
rawIds
=
raw
.
ids
,
nowIds
=
now
.
ids
;
dataSet
.
upData
[
beanName
]
=
{};
dataSet
.
upData
[
beanName
].
del
=
[];
...
...
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.js
View file @
a847a051
...
...
@@ -153,7 +153,7 @@ function faceGrid(elId, data) {
updateHandler
();
},
deleteHandler
:
(
rowData
)
=>
{
console
.
log
(
r
awData
);
console
.
log
(
r
owData
.
rowIndex
);
},
});
var
gridManager
=
listeningGrid
(
elId
,
{
...
...
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