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
bb5a4d96
Commit
bb5a4d96
authored
Dec 10, 2023
by
覃振观
👶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JS 属性映射
parent
55069726
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
11 deletions
+78
-11
productDetail.js
...un-xt/src/main/webapp/biz/topsun/product/productDetail.js
+77
-11
ProductApplicationImpl.java
...psun/product/application/impl/ProductApplicationImpl.java
+1
-0
No files found.
topsun-xt/src/main/webapp/biz/topsun/product/productDetail.js
View file @
bb5a4d96
...
@@ -43,6 +43,58 @@ function loadDataTest() {
...
@@ -43,6 +43,58 @@ function loadDataTest() {
inputEventListener
();
inputEventListener
();
});
});
}
}
// 数据映射配置
var
dataMapping
=
{
"productDetail"
:
[
"factoryName"
,
{
"productLayout"
:
"productLayout"
}
],
"ProductLooked"
:
[
"productLength"
,
"productWidth"
]
}
// 构建映射关系。
function
mapping
(
dataMapping
,
rawData
)
{
let
entitySet
=
Object
.
entries
(
dataMapping
);
entitySet
.
tryForEach
((
entity
,
index
)
=>
{
let
beanName
=
entity
[
0
];
let
propertyNames
=
entity
[
1
];
let
entityData
=
isExist
(
rawData
,
beanName
)
?
rawData
[
beanName
]
:
throw
{};
propertyNames
.
tryForEach
((
item
,
index
)
=>
{
if
(
typeof
item
===
"string"
)
{
let
value
=
isExist
(
entityData
,
item
,
item
)
?
entityData
[
item
]
:
throw
{};
dataMapping
.
item
=
beanName
;
console
.
log
(
item
);
return
;
}
if
(
item
instanceof
Object
)
{
let
entry
=
Object
.
entries
(
item
);
let
property
=
entry
[
0
];
let
value
=
isExist
(
entityData
,
property
,
property
)
?
entityData
[
property
]
:
throw
{};
let
alias
=
entry
[
1
];
dataMapping
.
alias
=
{
beanName
:
property
};
}
})
})
}
Array
.
prototype
.
tryForEach
=
function
(
callback
,
thisArg
)
{
try
{
this
.
forEach
(
callback
,
thisArg
);
}
catch
{
}
}
function
isExist
(
obj
,
property
)
{
this
.
isExist
(
bj
,
property
,
'rawData'
)
}
function
isExist
(
obj
,
property
,
objName
)
{
if
(
!
obj
[
property
])
{
console
.
error
(
'No data for name of '
+
entity
[
0
]
+
' in '
+
objName
+
' !'
);
return
false
;
}
return
true
;
}
function
faceGrid
(
elId
,
data
)
{
function
faceGrid
(
elId
,
data
)
{
var
toolbarOptions
=
UICtrl
.
getDefaultToolbarOptions
({
var
toolbarOptions
=
UICtrl
.
getDefaultToolbarOptions
({
...
@@ -126,23 +178,37 @@ function inputEventListener() {
...
@@ -126,23 +178,37 @@ function inputEventListener() {
});
});
}
}
function
getHashCode
(
str
,
caseSensitive
){
// 用于判断字符串是否更改。
if
(
!
caseSensitive
){
function
getHashCode
(
str
)
{
getHashCode
(
getHashCode
,
true
);
}
function
getHashCode
(
str
,
caseSensitive
)
{
if
(
!
caseSensitive
)
{
str
=
str
.
toLowerCase
();
str
=
str
.
toLowerCase
();
}
}
// 1315423911=b'1001110011001111100011010100111'
if
(
str
.
length
===
0
)
return
0
;
var
hash
=
1315423911
,
i
,
ch
;
var
len
=
str
.
length
;
for
(
i
=
str
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
hash
=
1315423911
,
i
,
ch
;
for
(
i
=
len
-
1
;
i
>=
0
;
i
--
)
{
ch
=
str
.
charCodeAt
(
i
);
ch
=
str
.
charCodeAt
(
i
);
hash
^=
((
hash
<<
5
)
+
ch
+
(
hash
>>
2
));
hash
=
(
hash
<<
5
)
+
ch
+
(
hash
>>
2
);
}
var
hash2
=
hash
^
(
hash
<<
7
)
^
(
hash
>>
6
);
var
hash3
=
hash2
^
(
hash2
<<
1
)
^
(
hash2
>>
13
);
if
(
len
<
50
)
{
var
hash4
=
this
.
getHashCode
(
str
+
str
+
str
,
caseSensitive
);
return
(
hash
^
hash2
^
hash3
^
hash4
)
&
0x7FFFFFFF
;
}
else
{
return
(
hash
^
hash2
^
hash3
>>
3
)
&
0x7FFFFFFF
;
}
}
var
hash2
=
hash
^
(
hash
<<
10
)
^
(
hash
>>
6
);
var
str2
=
str
+
str
+
str
;
var
hash3
=
this
.
getHashCode
(
str2
,
caseSensitive
);
return
(
hash
&
0x7FFFFFFF
)
^
hash2
^
hash3
;
}
}
// if(!isExist(rawData, entity[0])) {
// throw {};
// }
// let entityData = rawData[entity[0]];
// checkbox: true,
// checkbox: true,
// enabledSort: false,
// enabledSort: false,
// autoAddRowByKeydown:false,
// autoAddRowByKeydown:false,
...
...
topsun/src/main/java/com/huigou/topsun/product/application/impl/ProductApplicationImpl.java
View file @
bb5a4d96
...
@@ -88,6 +88,7 @@ public class ProductApplicationImpl implements ProductApplication {
...
@@ -88,6 +88,7 @@ public class ProductApplicationImpl implements ProductApplication {
entitys
.
add
(
publishedConfRepository
.
findByProductId
(
strProductId
));
entitys
.
add
(
publishedConfRepository
.
findByProductId
(
strProductId
));
entitys
.
add
(
productDetail
);
entitys
.
add
(
productDetail
);
HashMap
<
String
,
Object
>
listMaps
=
new
HashMap
<>(
100
);
HashMap
<
String
,
Object
>
listMaps
=
new
HashMap
<>(
100
);
resultMap
.
putAll
(
assembleResultOfForm
(
entitys
));
resultMap
.
putAll
(
assembleResultOfForm
(
entitys
));
listMaps
.
put
(
"loss"
,
loss
);
listMaps
.
put
(
"loss"
,
loss
);
...
...
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