明树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
37d30c98
Commit
37d30c98
authored
May 14, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
70349c89
Pipeline
#111308
passed with stage
in 3 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
46 deletions
+134
-46
projectController.js
controller/projectController.js
+50
-9
project.js
db/model/jt/project.js
+18
-14
userModule.js
module/userModule.js
+65
-22
projectRouter.js
router/projectRouter.js
+1
-1
No files found.
controller/projectController.js
View file @
37d30c98
...
@@ -289,8 +289,11 @@ async function startLixiang(req, res, next) {
...
@@ -289,8 +289,11 @@ async function startLixiang(req, res, next) {
* 此处需要判断当前项目是从哪一个节点回来的,依次往下
* 此处需要判断当前项目是从哪一个节点回来的,依次往下
* 1. 初审退回
* 1. 初审退回
* 2. 核准退回
* 2. 核准退回
* 3. 首次提交
* 3. 终审核退回
* 4. 首次提交
*
*/
*/
req
.
body
.
projectLxTjUser
=
req
.
user
.
id
;
//立项提交人
if
(
req
.
body
.
projectLxjbrUser
)
{
if
(
req
.
body
.
projectLxjbrUser
)
{
//更新信息和状态
//更新信息和状态
req
.
body
.
daibanUsers
=
[
req
.
body
.
projectLxjbrUser
];
req
.
body
.
daibanUsers
=
[
req
.
body
.
projectLxjbrUser
];
...
@@ -333,15 +336,47 @@ async function startLixiang(req, res, next) {
...
@@ -333,15 +336,47 @@ async function startLixiang(req, res, next) {
projectCode
:
req
.
body
.
projectCode
,
projectCode
:
req
.
body
.
projectCode
,
});
});
return
res
.
sendData
(
ret
);
return
res
.
sendData
(
ret
);
}
else
{
}
else
if
(
req
.
body
.
projectLxzsUser
)
{
// 如果没有走初审、核准但是又有终审用户,则是终审退回
req
.
body
.
daibanUsers
=
[
req
.
body
.
projectLxzsUser
];
let
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"4"
);
//状态 2 -- 立项核准中
// 记录流程节点操作
await
DB
.
FlowRecord
.
create
({
userId
:
req
.
user
.
id
,
actionName
:
'发起项目立项终审'
,
projectId
:
req
.
body
.
id
,
projectName
:
req
.
body
.
projectName
,
projectCode
:
req
.
body
.
projectCode
,
});
await
DB
.
Message
.
create
({
projectId
:
req
.
body
.
id
,
creator
:
req
.
user
.
id
,
receivers
:
approvers
.
map
(
o
=>
o
.
id
),
type
:
2
,
title
:
`项目【
${
req
.
body
.
projectName
}
】已发起立项终审,请尽快处理!`
,
content
:
`项目【
${
req
.
body
.
projectName
}
】已发起立项终审,请尽快处理!`
});
return
res
.
sendData
(
ret
);
}
else
{
// 项目公司所属单位员工发起,发送消息给项目单位部门长核准
// 项目公司所属单位员工发起,发送消息给项目单位部门长核准
let
approvers
=
await
userModule
.
getCompanyProjectApprover
(
req
.
user
.
id
);
let
rett
=
await
userModule
.
getCompanyProjectApprover
(
req
.
user
.
id
);
if
(
!
(
approvers
&&
approvers
.
length
>
0
))
{
if
(
!
(
_
.
isEmpty
(
rett
)
))
{
return
res
.
sendError
({
code
:
'60001'
,
message
:
'项目已保存,请联系管理员为本公司添加【项目立项核准】角色人员'
});
return
res
.
sendError
({
code
:
'60001'
,
message
:
'项目已保存,请联系管理员为本公司添加【项目立项核准】角色人员'
});
}
}
//更新信息和状态
//更新信息和状态
req
.
body
.
daibanUsers
=
approvers
.
map
(
o
=>
o
.
id
);
req
.
body
.
daibanUsers
=
approvers
.
map
(
o
=>
o
.
id
);
let
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"2"
);
//状态 2 -- 立项核准中
let
ret
;
if
(
rett
.
type
==
1
)
{
//投管
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"4"
);
//状态 2 -- 立项核准中
}
else
{
//部门长
ret
=
await
xiangmulixianggengxin
(
req
.
body
,
"2"
);
//状态 2 -- 立项核准中
}
// 记录流程节点操作
// 记录流程节点操作
await
DB
.
FlowRecord
.
create
({
await
DB
.
FlowRecord
.
create
({
userId
:
req
.
user
.
id
,
userId
:
req
.
user
.
id
,
...
@@ -411,7 +446,7 @@ async function approvalLixiangByDepartHeader(req, res, next) {
...
@@ -411,7 +446,7 @@ async function approvalLixiangByDepartHeader(req, res, next) {
}
}
else
{
else
{
//部门长核准不通过,更新项目信息和状态--退回到草稿
//部门长核准不通过,更新项目信息和状态--退回到草稿
req
.
body
.
daibanUsers
=
[
body
.
project
Creato
r
];
req
.
body
.
daibanUsers
=
[
body
.
project
LxTjUse
r
];
ret
=
await
xiangmulixianggengxin
(
body
,
"1"
);
ret
=
await
xiangmulixianggengxin
(
body
,
"1"
);
//记录操作
//记录操作
await
DB
.
FlowRecord
.
create
({
await
DB
.
FlowRecord
.
create
({
...
@@ -425,7 +460,7 @@ async function approvalLixiangByDepartHeader(req, res, next) {
...
@@ -425,7 +460,7 @@ async function approvalLixiangByDepartHeader(req, res, next) {
await
DB
.
Message
.
create
({
await
DB
.
Message
.
create
({
projectId
:
body
.
id
,
projectId
:
body
.
id
,
creator
:
req
.
user
.
id
,
creator
:
req
.
user
.
id
,
receivers
:
[
body
.
project
Creato
r
],
receivers
:
[
body
.
project
LxTjUse
r
],
type
:
6
,
type
:
6
,
title
:
`项目【
${
body
.
projectName
}
】未通过部门长核准,请检查后重新提交!`
,
title
:
`项目【
${
body
.
projectName
}
】未通过部门长核准,请检查后重新提交!`
,
content
:
req
.
body
.
approvalMessage
||
`项目【
${
body
.
projectName
}
】未通过部门长核准,请检查后重新提交!`
content
:
req
.
body
.
approvalMessage
||
`项目【
${
body
.
projectName
}
】未通过部门长核准,请检查后重新提交!`
...
@@ -479,13 +514,13 @@ async function approvalLixiangByTouGuanJbr(req, res, next) {
...
@@ -479,13 +514,13 @@ async function approvalLixiangByTouGuanJbr(req, res, next) {
}
}
else
{
else
{
//投管部经办人审批不通过,更新项目信息和状态--直接回到项目提交人
//投管部经办人审批不通过,更新项目信息和状态--直接回到项目提交人
req
.
body
.
daibanUsers
=
[
body
.
project
Creato
r
];
req
.
body
.
daibanUsers
=
[
body
.
project
LxTjUse
r
];
ret
=
await
xiangmulixianggengxin
(
body
,
"1"
);
ret
=
await
xiangmulixianggengxin
(
body
,
"1"
);
// 给项目提交人发消息
// 给项目提交人发消息
await
DB
.
Message
.
create
({
await
DB
.
Message
.
create
({
projectId
:
body
.
id
,
projectId
:
body
.
id
,
creator
:
req
.
user
.
id
,
creator
:
req
.
user
.
id
,
receivers
:
[
body
.
project
Creato
r
],
receivers
:
[
body
.
project
LxTjUse
r
],
type
:
8
,
// 初审不通过消息
type
:
8
,
// 初审不通过消息
title
:
`项目【
${
body
.
projectName
}
】未通过投管部经办人审批,请检查后重新提交!`
,
title
:
`项目【
${
body
.
projectName
}
】未通过投管部经办人审批,请检查后重新提交!`
,
content
:
req
.
body
.
approvalMessage
||
`项目【
${
body
.
projectName
}
】未通过投管部经办人审批,请检查后重新提交!`
content
:
req
.
body
.
approvalMessage
||
`项目【
${
body
.
projectName
}
】未通过投管部经办人审批,请检查后重新提交!`
...
@@ -1501,6 +1536,11 @@ async function approvalZaiJuece(req, res, next) {
...
@@ -1501,6 +1536,11 @@ async function approvalZaiJuece(req, res, next) {
}
}
}
}
async
function
getCompanyProjectApprover
(
req
,
res
,
next
)
{
let
ret
=
await
userModule
.
getCompanyProjectApprover
(
46
);
return
res
.
sendData
(
ret
);
}
module
.
exports
=
{
module
.
exports
=
{
getProjectFields
,
getProjectFields
,
createProject
,
createProject
,
...
@@ -1526,4 +1566,5 @@ module.exports = {
...
@@ -1526,4 +1566,5 @@ module.exports = {
saveZaiJuece
,
saveZaiJuece
,
startZaiJuece
,
startZaiJuece
,
approvalZaiJuece
,
approvalZaiJuece
,
getCompanyProjectApprover
,
}
}
\ No newline at end of file
db/model/jt/project.js
View file @
37d30c98
...
@@ -36,6 +36,10 @@ const Project = sequelize.define('Project', {
...
@@ -36,6 +36,10 @@ const Project = sequelize.define('Project', {
defaultValue
:
0
,
defaultValue
:
0
,
comment1
:
"0 正常 1 删除"
,
comment1
:
"0 正常 1 删除"
,
},
},
projectLxTjUser
:
{
type
:
DataTypes
.
INTEGER
,
comment
:
"立项提交人"
,
},
projectHzUser
:
{
projectHzUser
:
{
type
:
DataTypes
.
INTEGER
,
type
:
DataTypes
.
INTEGER
,
comment
:
"项目核准人ID"
,
comment
:
"项目核准人ID"
,
...
@@ -330,7 +334,7 @@ const Project = sequelize.define('Project', {
...
@@ -330,7 +334,7 @@ const Project = sequelize.define('Project', {
//再决策
//再决策
jcspdw
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"决策审批单位"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
,
},
jcspdw
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
true
,
comment
:
"决策审批单位"
,
_mark
:
'juece'
,
zjType
:
'danxuan'
,
},
yykssj
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
comment
:
"运营开始时间"
,
_mark
:
"juece"
},
yykssj
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
comment
:
"运营开始时间"
,
_mark
:
"juece"
},
yyjssj
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
comment
:
"运营结束时间"
,
_mark
:
"juece"
},
yyjssj
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
comment
:
"运营结束时间"
,
_mark
:
"juece"
},
tzwcqk
:
{
type
:
DataTypes
.
TEXT
,
allowNull
:
true
,
comment
:
"投资完成情况"
,
_mark
:
"juece"
},
tzwcqk
:
{
type
:
DataTypes
.
TEXT
,
allowNull
:
true
,
comment
:
"投资完成情况"
,
_mark
:
"juece"
},
...
...
module/userModule.js
View file @
37d30c98
...
@@ -105,7 +105,7 @@ async function setUserPosition(userId, positionIds, positions) {
...
@@ -105,7 +105,7 @@ async function setUserPosition(userId, positionIds, positions) {
* @param {*} rolemenus 角色已有的菜单
* @param {*} rolemenus 角色已有的菜单
*/
*/
async
function
setRoleMenu
(
roleId
,
menuIds
,
rolemenus
)
{
async
function
setRoleMenu
(
roleId
,
menuIds
,
rolemenus
)
{
menuIds
=
menuIds
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
menuIds
=
menuIds
.
map
(
o
=>
{
return
o
&&
o
.
id
||
o
});
let
needAddIds
=
[],
needDelIds
=
[],
dbMenuIds
=
[];
let
needAddIds
=
[],
needDelIds
=
[],
dbMenuIds
=
[];
for
(
let
index
=
0
;
index
<
rolemenus
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
rolemenus
.
length
;
index
++
)
{
const
element
=
rolemenus
[
index
];
const
element
=
rolemenus
[
index
];
...
@@ -133,43 +133,86 @@ async function setRoleMenu(roleId, menuIds, rolemenus) {
...
@@ -133,43 +133,86 @@ async function setRoleMenu(roleId, menuIds, rolemenus) {
async
function
getCompanyProjectApprover
(
userId
,
roleCode
)
{
async
function
getCompanyProjectApprover
(
userId
,
roleCode
)
{
roleCode
=
roleCode
||
"xmssdwbmz"
;
//暂时
roleCode
=
roleCode
||
"xmssdwbmz"
;
//暂时
let
users
=
[];
// 获取投管部正副职tgbzfz的用户列表
// 获取投管部正副职tgbzfz的用户列表
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
let
userDepart
=
await
DB
.
UserDepart
.
findOne
({
where
:
{
userId
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
if
(
!
(
userDepart
&&
userDepart
.
departId
))
{
return
[];
return
{};
}
}
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
let
departId
=
userDepart
.
departId
;
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
curentDepart
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
departId
},
raw
:
true
});
console
.
log
(
"curentDepart"
,
curentDepart
)
//部门信息
if
(
!
(
curentDepart
&&
curentDepart
.
id
))
{
return
{};
}
let
parentIds
=
curentDepart
.
parentIds
?
curentDepart
.
parentIds
.
split
(
","
)
:
[];
console
.
log
(
"parentIds"
,
parentIds
)
//部门父级信息
if
(
departId
==
41
||
parentIds
.
includes
(
41
)
||
parentIds
.
includes
(
'41'
))
{
//写死 投管部
users
=
await
getTouGuanZfzProjectApprover
(
userId
);
return
{
users
,
type
:
1
};
}
else
if
(
parentIds
.
includes
(
86
)
||
parentIds
.
includes
(
'86'
))
{
//项目公司
let
pidStr
=
""
;
if
(
curentDepart
.
parentId
==
86
)
{
//项目公司
pidStr
=
curentDepart
.
parentIds
+
curentDepart
.
id
;
// 为了查询currentDepart.id所有部门
}
else
{
// 项目公司下属部门
const
index
=
parentIds
.
indexOf
(
86
);
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
userIds
}
}
});
const
result
=
index
!==
-
1
return
users
;
?
parentIds
.
slice
(
0
,
index
+
1
)
:
parentIds
;
pidStr
=
result
.
join
(
","
);
}
console
.
log
(
"pidStr"
,
pidStr
)
//项目公司部门id字符串
let
departs
=
await
DB
.
Depart
.
findAll
({
where
:
{
parentIds
:
{
[
Op
.
like
]:
`%
${
pidStr
}
%`
}
},
raw
:
true
});
departs
.
push
(
curentDepart
);
//加上当前部门
console
.
log
(
"departs"
,
departs
)
//项目公司下属部门信息
let
departIds
=
departs
.
map
(
o
=>
{
return
o
.
id
});
let
userDeparts
=
await
DB
.
UserDepart
.
findAll
({
where
:
{
departId
:
{
[
Op
.
in
]:
departIds
}
},
raw
:
true
});
let
userIds
=
userDeparts
.
map
(
o
=>
{
return
o
.
userId
});
console
.
log
(
"userIds"
,
userIds
)
//部门用户信息
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
userIds
}
},
include
:
[{
model
:
DB
.
Role
,
as
:
'roles'
,
where
:
{
del
:
0
,
key
:
roleCode
},
attributes
:
[
"id"
,
"name"
],
},]
});
return
{
users
,
type
:
1
};
}
}
}
async
function
getTouGuanJbrProjectApprover
(
userId
,
roleCode
)
{
async
function
getTouGuanJbrProjectApprover
(
userId
,
roleCode
)
{
roleCode
=
roleCode
||
"tgbjbr"
;
roleCode
=
roleCode
||
"tgbjbr"
;
// 获取投管部正副职tgbzfz的用户列表
// 获取投管部正副职tgbzfz的用户列表
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
if
(
!
(
role
&&
role
.
id
))
{
return
[];
return
[];
}
}
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
userIds
}
}
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
userIds
}
}
});
return
users
;
return
users
;
}
}
async
function
getTouGuanZfzProjectApprover
(
userId
,
roleCode
)
{
async
function
getTouGuanZfzProjectApprover
(
userId
,
roleCode
)
{
roleCode
=
roleCode
||
"tgbzfz"
;
roleCode
=
roleCode
||
"tgbzfz"
;
// 获取投管部正副职tgbzfz的用户列表
// 获取投管部正副职tgbzfz的用户列表
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
let
role
=
await
DB
.
Role
.
findOne
({
where
:
{
key
:
roleCode
},
raw
:
true
});
if
(
!
(
role
&&
role
.
id
))
{
if
(
!
(
role
&&
role
.
id
))
{
return
[];
return
[];
}
}
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
let
userIds
=
await
DB
.
UserRole
.
findAll
({
where
:
{
roleId
:
role
.
id
},
raw
:
true
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
userIds
=
(
userIds
||
[]).
map
(
o
=>
{
return
o
.
userId
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{[
Op
.
in
]:
userIds
}
}
});
let
users
=
await
DB
.
User
.
findAll
({
where
:
{
id
:
{
[
Op
.
in
]:
userIds
}
}
});
return
users
;
return
users
;
}
}
...
...
router/projectRouter.js
View file @
37d30c98
...
@@ -47,7 +47,7 @@ router.post('/listProject', projectController.listProject);
...
@@ -47,7 +47,7 @@ router.post('/listProject', projectController.listProject);
// router.post('/preJugProject', projectController.preJugProject); //初审
// router.post('/preJugProject', projectController.preJugProject); //初审
// router.post('/finalJugProject', projectController.finalJugProject); //终审 --暂时没有
// router.post('/finalJugProject', projectController.finalJugProject); //终审 --暂时没有
// router.post('/getOwnProjects', projectController.getOwnProjects
);
router
.
post
(
'/getCompanyProjectApprover'
,
projectController
.
getCompanyProjectApprover
);
router
.
post
(
'/getProFlowRecord'
,
projectController
.
getProFlowRecord
)
router
.
post
(
'/getProFlowRecord'
,
projectController
.
getProFlowRecord
)
...
...
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