明树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
b5546376
Commit
b5546376
authored
Dec 04, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
55112b3b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
12 deletions
+103
-12
projectController.js
controller/projectController.js
+32
-11
projectModule.js
module/projectModule.js
+68
-0
projectRouter.js
router/projectRouter.js
+3
-1
No files found.
controller/projectController.js
View file @
b5546376
...
...
@@ -313,7 +313,7 @@ async function queryLixiangResult(req, res, next) {
let
result
=
{
success
:
true
};
//成功
if
(
result
.
success
)
{
let
proInfo
=
await
projectModule
.
getProjectInfo
(
req
.
body
);
let
proInfo
=
await
projectModule
.
getProjectInfo
ByLixiang
(
req
.
body
);
//1. 更新项目状态
await
DB
.
Project
.
update
({
projectLzType
:
5
},
{
where
:
{
id
:
req
.
body
.
id
}});
//2. 存储快照 关联关系太多 全部建立快照表工程过大,暂时存储形式
...
...
@@ -459,15 +459,14 @@ async function xiangmujuecegengxin(body, projectLzType) {
/**
* 决策保存
* 决策
填报
保存
*/
async
function
saveJuece
(
req
,
res
,
next
)
{
try
{
let
body
=
req
.
body
;
if
(
!
body
.
id
)
{
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
)
}
await
xiangmujuecegengxin
(
body
);
let
ret
=
await
xiangmujuecegengxin
(
req
.
body
,
7
);
//决策填报中
return
res
.
sendData
(
ret
);
}
catch
(
error
)
{
next
(
error
);
...
...
@@ -476,22 +475,43 @@ async function saveJuece(req, res, next) {
async
function
startJuece
(
req
,
res
,
next
)
{
try
{
let
body
=
req
.
body
;
if
(
!
body
.
id
)
{
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
)
}
await
DB
.
FlowRecord
.
create
({
userId
:
req
.
user
.
id
,
actionName
:
'发起项目决策审批'
,
projectId
:
project
.
id
,
projectId
:
req
.
body
.
id
,
});
let
ret
=
await
xiangmujuecegengxin
(
body
,
7
);
return
re
t
;
let
ret
=
await
xiangmujuecegengxin
(
req
.
body
,
8
);
//决策审批中
return
re
s
.
sendData
(
ret
)
;
}
catch
(
error
)
{
next
(
error
);
}
}
/**
* 主动查询决策审批结果
*/
async
function
queryJueceResult
(
req
,
res
,
next
)
{
try
{
if
(
!
req
.
body
.
id
)
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
)
}
//请求能建提供接口
let
result
=
{
success
:
true
};
//成功
if
(
result
.
success
)
{
//1. 更新项目状态
await
DB
.
Project
.
update
({
projectLzType
:
9
},
{
where
:
{
id
:
req
.
body
.
id
}});
//已经决策成功
return
res
.
sendData
();
}
else
{
return
res
.
sendError
(
errorMessage
.
resourceNotFound
);
//暂时
}
}
catch
(
error
)
{
next
(
error
);
}
}
/**
...
...
@@ -761,7 +781,7 @@ async function getProjectInfo(req, res, next) {
if
(
lixiang
&&
lixiang
.
id
)
{
obj
.
lixiang
=
lixiang
.
lixiang
;
//快照
//当项目状态 进入决策信息填报时候
if
([].
includes
(
ret
&&
ret
.
projectLzType
))
{
if
([
7
,
8
,
9
].
includes
(
ret
&&
ret
.
projectLzType
))
{
obj
.
juece
=
ret
;
}
}
else
{
...
...
@@ -968,4 +988,5 @@ module.exports = {
startJuece
,
saveProjectPreLixiang
,
queryLixiangResult
,
queryJueceResult
,
}
\ No newline at end of file
module/projectModule.js
View file @
b5546376
...
...
@@ -166,6 +166,73 @@ async function getProjectInfo({id}) {
}
async
function
getProjectInfoByLixiang
({
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
.
ProjectGdxx
,
as
:
'projectGdxxs'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectJsgm
,
as
:
'projectJsgms'
,
// where: { del: 0 },
// attributes: [],
},
{
model
:
DB
.
ProjectSpyj
,
as
:
'projectSpyjs'
,
// 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
;
}
...
...
@@ -187,4 +254,5 @@ async function getProjectInfo({id}) {
module
.
exports
=
{
handleProjectData
,
getProjectInfo
,
getProjectInfoByLixiang
,
}
\ No newline at end of file
router/projectRouter.js
View file @
b5546376
...
...
@@ -22,12 +22,14 @@ router.post('/queryLixiangResult', projectController.queryLixiangResult);
router
.
post
(
'/saveJuece'
,
projectController
.
saveJuece
);
//决策保存
router
.
post
(
'/startJuece'
,
projectController
.
startJuece
);
router
.
post
(
'/queryJueceResult'
,
projectController
.
queryJueceResult
);
router
.
post
(
'/getProjectInfo'
,
projectController
.
getProjectInfo
);
router
.
post
(
'/updateProject'
,
projectController
.
updateProject
);
router
.
post
(
'/deleteProject'
,
projectController
.
deleteProject
);
router
.
post
(
'/listProject'
,
projectController
.
listProject
);
router
.
post
(
'/getProjectInfo'
,
projectController
.
getProjectInfo
);
router
.
post
(
'/exportExcel'
,
projectController
.
exportExcel
);
...
...
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