明树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
d7880b9d
Commit
d7880b9d
authored
Dec 04, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ac73ce5a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
96 deletions
+107
-96
projectController.js
controller/projectController.js
+7
-91
project.js
db/model/jt/project.js
+1
-1
projectModule.js
module/projectModule.js
+99
-4
No files found.
controller/projectController.js
View file @
d7880b9d
...
@@ -282,11 +282,16 @@ async function saveProjectPreLixiang(req, res, next) {
...
@@ -282,11 +282,16 @@ async function saveProjectPreLixiang(req, res, next) {
*/
*/
async
function
queryLixiangResult
(
req
,
res
,
next
)
{
async
function
queryLixiangResult
(
req
,
res
,
next
)
{
try
{
try
{
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
)
}
//请求能建提供接口
//请求能建提供接口
let
result
=
{
success
:
true
};
let
result
=
{
success
:
true
};
//成功
//成功
if
(
result
.
success
)
{
if
(
result
.
success
)
{
let
proInfo
=
await
projectModule
.
getProjectInfo
(
body
);
//1. 更新项目状态
await
DB
.
Project
.
update
({
projectLzType
:
5
},
{
where
:
{
id
}});
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
@@ -745,96 +750,7 @@ async function getProjectInfo(req, res, next) {
...
@@ -745,96 +750,7 @@ async function getProjectInfo(req, res, next) {
if
(
!
req
.
body
.
id
)
{
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
}
}
let
project
=
await
DB
.
Project
.
findOne
({
let
ret
=
await
projectModule
.
getProjectInfo
(
req
.
body
);
where
:
{
id
:
req
.
body
.
id
},
// raw: true,
include
:
[
{
model
:
DB
.
ProjectBjtj
,
as
:
'projectBjtjs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectCwpjzb
,
as
:
'projectCwpjzbs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectFxgl
,
as
:
'projectFxgls'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectGdxx
,
as
:
'projectGdxxs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectJczt
,
as
:
'projectJczts'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectJsgm
,
as
:
'projectJsgms'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectLcbjd
,
as
:
'projectLcbjds'
,
},
{
model
:
DB
.
ProjectSpyj
,
as
:
'projectSpyjs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectTzzjll
,
as
:
'projectTzzjlls'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectTzzt
,
as
:
'projectTzzts'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectXmtzze
,
as
:
'projectXmtzzes'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
File
,
as
:
'files'
,
// where: { del: 0 },
// attributes: [],
through
:
{
attributes
:
[
'proFieldKey'
]
},
}
],
// raw: true
});
project
=
project
.
toJSON
();
project
.
projectXmtzzes
=
utils
.
buildTree2
(
project
.
projectXmtzzes
,
'xh'
,
'parentXh'
);
//处理文件 还原成项目各个字段拥有的文件
let
files
=
project
.
files
||
[];
files
=
files
.
map
(
o
=>
{
o
.
proFieldKey
=
o
.
jt_project_file
&&
o
.
jt_project_file
.
proFieldKey
;
delete
o
.
jt_project_file
;
return
o
;
});
let
keyFiles
=
_
.
groupBy
(
files
,
'proFieldKey'
);
delete
project
.
files
;
let
ret
=
{
...
project
,
...
keyFiles
}
return
res
.
sendData
(
ret
);
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
}
catch
(
error
)
{
next
(
error
);
next
(
error
);
...
...
db/model/jt/project.js
View file @
d7880b9d
...
@@ -25,7 +25,7 @@ const Project = sequelize.define('Project', {
...
@@ -25,7 +25,7 @@ const Project = sequelize.define('Project', {
},
},
projectLzType
:
{
projectLzType
:
{
type
:
DataTypes
.
INTEGER
,
type
:
DataTypes
.
INTEGER
,
comment
:
"项目流转状态:
1. 待立项(保存), 3. 立项审批中, 5. 已立项, 7. 决策审批中, 9. 已决策
"
,
comment
:
"项目流转状态:
状态1 - 待立项 状态 3 -- 立项审批中 5 已立项 7 -- 决策审批中
"
,
},
},
del
:
{
del
:
{
type
:
DataTypes
.
INTEGER
,
type
:
DataTypes
.
INTEGER
,
...
...
module/projectModule.js
View file @
d7880b9d
...
@@ -31,10 +31,10 @@ async function handleProjectData(ret, queryAttrs) {
...
@@ -31,10 +31,10 @@ 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
)
{
if
(
!
_
.
isEmpty
(
resources
[
key
]))
{
if
(
!
_
.
isEmpty
(
resources
[
key
]))
{
element
[
key
]
=
resources
[
key
][
element
[
key
]]
element
[
key
]
=
resources
[
key
][
element
[
key
]]
}
}
}
}
newRet
.
push
(
element
);
newRet
.
push
(
element
);
}
}
...
@@ -49,7 +49,7 @@ async function getResourceByKeys(keys) {
...
@@ -49,7 +49,7 @@ async function getResourceByKeys(keys) {
return
{};
return
{};
}
}
let
ret
=
await
DB
.
Resources
.
findAll
({
let
ret
=
await
DB
.
Resources
.
findAll
({
where
:
{
key
:
{
[
Op
.
in
]:
keys
}
,
del
:
0
},
where
:
{
key
:
{
[
Op
.
in
]:
keys
}
,
del
:
0
},
include
:
[
include
:
[
{
{
model
:
DB
.
ResourcesInfo
,
model
:
DB
.
ResourcesInfo
,
...
@@ -71,6 +71,100 @@ async function getResourceByKeys(keys) {
...
@@ -71,6 +71,100 @@ async function getResourceByKeys(keys) {
return
obj
;
return
obj
;
}
}
async
function
getProjectInfo
({
id
})
{
let
project
=
await
DB
.
Project
.
findOne
({
where
:
{
id
:
id
},
// raw: true,
include
:
[
{
model
:
DB
.
ProjectBjtj
,
as
:
'projectBjtjs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectCwpjzb
,
as
:
'projectCwpjzbs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectFxgl
,
as
:
'projectFxgls'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectGdxx
,
as
:
'projectGdxxs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectJczt
,
as
:
'projectJczts'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectJsgm
,
as
:
'projectJsgms'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectLcbjd
,
as
:
'projectLcbjds'
,
},
{
model
:
DB
.
ProjectSpyj
,
as
:
'projectSpyjs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectTzzjll
,
as
:
'projectTzzjlls'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectTzzt
,
as
:
'projectTzzts'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectXmtzze
,
as
:
'projectXmtzzes'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
File
,
as
:
'files'
,
// where: { del: 0 },
// attributes: [],
through
:
{
attributes
:
[
'proFieldKey'
]
},
}
],
// raw: true
});
project
=
project
.
toJSON
();
project
.
projectXmtzzes
=
utils
.
buildTree2
(
project
.
projectXmtzzes
,
'xh'
,
'parentXh'
);
//处理文件 还原成项目各个字段拥有的文件
let
files
=
project
.
files
||
[];
files
=
files
.
map
(
o
=>
{
o
.
proFieldKey
=
o
.
jt_project_file
&&
o
.
jt_project_file
.
proFieldKey
;
delete
o
.
jt_project_file
;
return
o
;
});
let
keyFiles
=
_
.
groupBy
(
files
,
'proFieldKey'
);
delete
project
.
files
;
let
ret
=
{
...
project
,
...
keyFiles
}
return
ret
;
}
...
@@ -91,5 +185,6 @@ async function getResourceByKeys(keys) {
...
@@ -91,5 +185,6 @@ async function getResourceByKeys(keys) {
module
.
exports
=
{
module
.
exports
=
{
handleProjectData
handleProjectData
,
getProjectInfo
,
}
}
\ No newline at end of file
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