明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jt_backend
Project
Project
Details
Activity
Releases
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
zengfanpei
jt_backend
Commits
74edf28a
Commit
74edf28a
authored
Dec 10, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1a47eb90
Pipeline
#104419
passed with stage
in 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
projectController.js
controller/projectController.js
+1
-1
projectModule.js
module/projectModule.js
+18
-12
No files found.
controller/projectController.js
View file @
74edf28a
...
@@ -895,7 +895,7 @@ async function listProject(req, res, next) {
...
@@ -895,7 +895,7 @@ async function listProject(req, res, next) {
console
.
log
(
search
)
console
.
log
(
search
)
search
.
raw
=
true
search
.
raw
=
true
let
ret
=
await
DB
.
Project
.
findAndCountAll
(
search
);
let
ret
=
await
DB
.
Project
.
findAndCountAll
(
search
);
//
ret = await projectModule.handleProjectData(ret, search.attributes);
ret
=
await
projectModule
.
handleProjectData
(
ret
,
search
.
attributes
);
return
res
.
sendData
(
ret
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
...
module/projectModule.js
View file @
74edf28a
...
@@ -13,7 +13,7 @@ const moment = require('moment');
...
@@ -13,7 +13,7 @@ const moment = require('moment');
async
function
handleProjectData
(
ret
,
queryAttrs
)
{
async
function
handleProjectData
(
ret
,
queryAttrs
)
{
let
rawAttributes
=
_
.
cloneDeep
(
DB
.
Project
.
rawAttributes
);
let
rawAttributes
=
_
.
cloneDeep
(
DB
.
Project
.
rawAttributes
);
// console.log(r
et
, "====")
// console.log(r
awAttributes
, "====")
// let queryRawAtr = [], resourceKeys = [];
// let queryRawAtr = [], resourceKeys = [];
// for (let index = 0; index < queryAttrs.length; index++) {
// for (let index = 0; index < queryAttrs.length; index++) {
// const element = queryAttrs[index];
// const element = queryAttrs[index];
...
@@ -34,26 +34,32 @@ async function handleProjectData(ret, queryAttrs) {
...
@@ -34,26 +34,32 @@ async function handleProjectData(ret, queryAttrs) {
const
element
=
ret
.
rows
[
index
];
const
element
=
ret
.
rows
[
index
];
// console.log(element);
// console.log(element);
for
(
const
key
in
element
)
{
for
(
const
key
in
element
)
{
console
.
log
(
key
)
console
.
log
(
rawAttributes
[
key
].
zjType
,
element
[
key
],
"======="
,
!
_
.
isNumber
(
element
[
key
]))
if
(
!
_
.
isEmpty
(
element
[
key
])
&&
rawAttributes
[
key
].
zjType
)
{
if
((
_
.
isNumber
(
element
[
key
]))
&&
rawAttributes
[
key
].
zjType
)
{
if
(
rawAttributes
[
element
].
zjType
==
"danxuan"
)
{
if
(
rawAttributes
[
key
].
zjType
==
"danxuan"
)
{
console
.
log
(
rawAttributes
[
key
].
zjType
,
element
[
key
],
"===111===="
)
resouInfoIds
.
push
(
element
[
key
]);
resouInfoIds
.
push
(
element
[
key
]);
}
else
if
(
rawAttributes
[
element
].
zjType
==
"duoxuan"
)
{
}
else
if
((
!
_
.
isEmpty
(
element
[
key
]))
&&
rawAttributes
[
element
].
zjType
==
"duoxuan"
)
{
resouInfoIds
=
resouInfoIds
.
concat
(
element
[
key
])
resouInfoIds
=
resouInfoIds
.
concat
(
element
[
key
])
}
}
}
}
}
}
}
}
console
.
log
(
resouInfoIds
,
",,,,,"
)
let
resMap
=
await
getResourceInfoByIds
(
resouInfoIds
);
let
resMap
=
await
getResourceInfoByIds
(
resouInfoIds
);
console
.
log
(
resMap
)
for
(
let
index
=
0
;
index
<
ret
.
rows
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
ret
.
rows
.
length
;
index
++
)
{
const
element
=
ret
.
rows
[
index
];
const
element
=
ret
.
rows
[
index
];
// console.log(element);
for
(
const
key
in
element
)
{
for
(
const
key
in
element
)
{
if
(
!
_
.
isEmpty
(
element
[
key
])
&&
rawAttributes
[
element
].
zjType
)
{
console
.
log
(
element
,
element
[
key
],
rawAttributes
[
key
].
zjType
);
if
(
rawAttributes
[
element
].
zjType
==
"danxuan"
)
{
if
(
_
.
isNumber
(
element
[
key
])
&&
rawAttributes
[
key
].
zjType
)
{
element
[
key
]
=
resMap
[
element
[
key
]];
if
(
rawAttributes
[
key
].
zjType
==
"danxuan"
)
{
}
else
if
(
rawAttributes
[
element
].
zjType
==
"duoxuan"
)
{
console
.
log
(
resMap
[
String
(
element
[
key
])],
String
(
element
[
key
]),
"========================="
)
element
[
key
]
=
resMap
[
String
(
element
[
key
])];
}
else
if
(
rawAttributes
[
key
].
zjType
==
"duoxuan"
)
{
if
(
_
.
isArray
(
element
[
key
])
&&
element
[
key
].
length
>
0
)
{
if
(
_
.
isArray
(
element
[
key
])
&&
element
[
key
].
length
>
0
)
{
element
[
key
].
map
(
o
=>
{
return
resMap
[
o
]});
element
[
key
].
map
(
o
=>
{
return
resMap
[
o
]});
element
[
key
]
=
element
[
key
].
join
(
','
)
element
[
key
]
=
element
[
key
].
join
(
','
)
...
@@ -72,14 +78,14 @@ async function handleProjectData(ret, queryAttrs) {
...
@@ -72,14 +78,14 @@ async function handleProjectData(ret, queryAttrs) {
async
function
getResourceInfoByIds
(
resouInfoIds
)
{
async
function
getResourceInfoByIds
(
resouInfoIds
)
{
let
ris
=
await
DB
.
ResourcesInfo
.
findAll
({
let
ris
=
await
DB
.
ResourcesInfo
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
resouInfoIds
}},
where
:
{
id
:
{[
Op
.
in
]:
resouInfoIds
}},
raw
:
true
,
//
raw: true,
});
});
let
risMap
=
{};
let
risMap
=
{};
for
(
let
index
=
0
;
index
<
ris
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
ris
.
length
;
index
++
)
{
const
element
=
ris
[
index
];
const
element
=
ris
[
index
];
risMap
[
element
.
id
]
=
element
.
value
;
risMap
[
element
.
id
]
=
element
.
value
;
risMap
[
String
(
element
.
id
)]
=
element
.
value
;
}
}
console
.
log
(
risMap
)
return
risMap
;
return
risMap
;
}
}
...
...
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