明树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
3bb0ae93
Commit
3bb0ae93
authored
May 15, 2026
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
0d859b9a
Pipeline
#111384
passed with stage
in 5 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
55 deletions
+44
-55
a.js
a.js
+12
-38
projectController.js
controller/projectController.js
+16
-8
userModule.js
module/userModule.js
+16
-9
No files found.
a.js
View file @
3bb0ae93
const
itclfiMap
=
{
"655d4e5247323defddafcf1b"
:
{
let
parentIds
=
[
1
,
86
,
10
]
isPromise
:
1
,
promiseType
:
2
,
console
.
log
(
parentIds
.
slice
(
0
,
3
))
approvalType
:
2
let
index
=
parentIds
.
indexOf
(
86
);
},
console
.
log
(
index
)
"6218b527cebadc014222e863"
:
{
// const result = index !== -1
isPromise
:
1
,
// ? parentIds.slice(0, index + 1)
promiseType
:
2
,
// : parentIds;
approvalType
:
2
// pidStr = result.join(",");
},
// console.log("pidStr", pidStr) //项目公司部门id字符串
"622c56d3672bb1f158cf6d25"
:
{
isPromise
:
1
,
\ No newline at end of file
promiseType
:
1
,
promiseDay
:
20
,
approvalType
:
2
},
"622c56dd672bb1f158cf6d26"
:
{
isPromise
:
1
,
promiseType
:
1
,
promiseDay
:
20
,
approvalType
:
2
},
"6218b500cebadc014222e6ea"
:
{
isPromise
:
1
,
promiseType
:
1
,
promiseDay
:
7
,
approvalType
:
2
}
}
let
b
=
{
// key : "6218b500cebadc014222e6ea"
}
let
a
=
{
a
:
1
,
...(
itclfiMap
[
b
.
key
]
||
{})
}
console
.
log
(
a
);
\ No newline at end of file
controller/projectController.js
View file @
3bb0ae93
...
@@ -1287,6 +1287,9 @@ async function listProject(req, res, next) {
...
@@ -1287,6 +1287,9 @@ async function listProject(req, res, next) {
if
(
xmCompanyUser
.
type
==
2
)
{
if
(
xmCompanyUser
.
type
==
2
)
{
search
.
where
.
projectCreator
=
{
[
Op
.
in
]:
xmCompanyUser
.
userIds
};
search
.
where
.
projectCreator
=
{
[
Op
.
in
]:
xmCompanyUser
.
userIds
};
}
}
if
(
xmCompanyUser
.
type
==
0
)
{
search
.
where
.
projectCreator
=
req
.
user
.
id
;
}
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
);
...
@@ -1301,35 +1304,40 @@ async function listProject(req, res, next) {
...
@@ -1301,35 +1304,40 @@ async function listProject(req, res, next) {
async
function
getXmCompanyUser
(
req
,
res
,
next
)
{
async
function
getXmCompanyUser
(
req
,
res
,
next
)
{
let
userDepart
=
await
DB
.
UserDepart
.
findOne
({
where
:
{
userId
:
req
.
user
.
id
},
raw
:
true
});
let
userDepart
=
await
DB
.
UserDepart
.
findOne
({
where
:
{
userId
:
req
.
user
.
id
},
raw
:
true
});
if
(
!
(
userDepart
&&
userDepart
.
departId
))
{
if
(
!
(
userDepart
&&
userDepart
.
departId
))
{
return
res
.
sendError
(
errorMessage
.
noUserDepart
);
return
{
type
:
0
}
}
}
let
curentDepart
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
userDepart
.
departId
},
raw
:
true
});
let
curentDepart
=
await
DB
.
Depart
.
findOne
({
where
:
{
id
:
userDepart
.
departId
},
raw
:
true
});
if
(
!
(
curentDepart
&&
curentDepart
.
id
))
{
if
(
!
(
curentDepart
&&
curentDepart
.
id
))
{
return
res
.
sendError
(
errorMessage
.
noUserDepart
);
return
{
type
:
0
}
}
}
let
parentIds
=
curentDepart
.
parentIds
?
curentDepart
.
parentIds
.
split
(
","
)
:
[];
let
parentIds
=
curentDepart
.
parentIds
?
curentDepart
.
parentIds
.
split
(
","
)
:
[];
if
(
parentIds
.
includes
(
86
)
||
parentIds
.
includes
(
'86'
)
||
curentDepart
.
id
==
86
)
{
if
(
parentIds
.
includes
(
86
)
||
parentIds
.
includes
(
'86'
)
||
curentDepart
.
id
==
86
)
{
let
pidStr
=
""
;
let
pidStr
=
""
;
if
(
curentDepart
.
id
==
86
)
{
if
(
curentDepart
.
id
==
86
)
{
pidStr
=
curentDepart
.
parentIds
+
curentDepart
.
id
;
pidStr
=
curentDepart
.
parentIds
+
","
+
curentDepart
.
id
;
}
else
}
else
if
(
curentDepart
.
parentId
==
86
)
{
//项目公司
if
(
curentDepart
.
parentId
==
86
)
{
//项目公司
pidStr
=
curentDepart
.
parentIds
+
curentDepart
.
id
;
// 为了查询currentDepart.id所有部门
pidStr
=
curentDepart
.
parentIds
+
","
+
curentDepart
.
id
;
// 为了查询currentDepart.id所有部门
}
else
{
}
else
{
// 项目公司下属部门
// 项目公司下属部门
const
index
=
parentIds
.
indexOf
(
86
);
const
index
=
parentIds
.
indexOf
(
'86'
);
const
result
=
index
!==
-
1
const
result
=
index
!==
-
1
?
parentIds
.
slice
(
0
,
index
+
1
)
?
parentIds
.
slice
(
0
,
index
+
2
)
:
parentIds
;
:
parentIds
;
pidStr
=
result
.
join
(
","
);
pidStr
=
result
.
join
(
","
);
}
}
console
.
log
(
"pidStr"
,
pidStr
)
//项目公司部门id字符串
console
.
log
(
"pidStr"
,
pidStr
)
//项目公司部门id字符串
let
departs
=
await
DB
.
Depart
.
findAll
({
let
departs
=
await
DB
.
Depart
.
findAll
({
where
:
{
where
:
{
parentIds
:
{
[
Op
.
like
]:
`%
${
pidStr
}
%`
}
[
Op
.
or
]:
[
},
raw
:
true
{
parentIds
:
pidStr
},
{
parentIds
:
{
[
Op
.
startsWith
]:
`
${
pidStr
}
,`
}
}
]
},
raw
:
true
});
});
departs
.
push
(
curentDepart
);
//加上当前部门
departs
.
push
(
curentDepart
);
//加上当前部门
console
.
log
(
"departs"
,
departs
)
//项目公司下属部门信息
console
.
log
(
"departs"
,
departs
)
//项目公司下属部门信息
let
departIds
=
departs
.
map
(
o
=>
{
return
o
.
id
});
let
departIds
=
departs
.
map
(
o
=>
{
return
o
.
id
});
...
...
module/userModule.js
View file @
3bb0ae93
...
@@ -149,24 +149,31 @@ async function getCompanyProjectApprover(userId, roleCode) {
...
@@ -149,24 +149,31 @@ async function getCompanyProjectApprover(userId, roleCode) {
console
.
log
(
"parentIds"
,
parentIds
)
//部门父级信息
console
.
log
(
"parentIds"
,
parentIds
)
//部门父级信息
if
(
departId
==
41
||
parentIds
.
includes
(
41
)
||
parentIds
.
includes
(
'41'
))
{
//写死 投管部
if
(
departId
==
41
||
parentIds
.
includes
(
41
)
||
parentIds
.
includes
(
'41'
))
{
//写死 投管部
users
=
await
getTouGuanZfzProjectApprover
(
userId
);
users
=
await
getTouGuanZfzProjectApprover
(
userId
);
return
{
users
,
type
:
1
};
return
{
users
,
type
:
1
};
}
else
if
(
parentIds
.
includes
(
86
)
||
parentIds
.
includes
(
'86'
))
{
//项目公司
}
else
if
(
parentIds
.
includes
(
86
)
||
parentIds
.
includes
(
'86'
))
{
//项目公司
let
pidStr
=
""
;
let
pidStr
=
""
;
if
(
curentDepart
.
parentId
==
86
)
{
//项目公司
if
(
curentDepart
.
parentId
==
86
)
{
//项目公司
pidStr
=
curentDepart
.
parentIds
+
curentDepart
.
id
;
// 为了查询currentDepart.id所有部门
pidStr
=
curentDepart
.
parentIds
+
","
+
curentDepart
.
id
;
// 为了查询currentDepart.id所有部门
}
else
{
}
else
{
// 项目公司下属部门
// 项目公司下属部门
const
index
=
parentIds
.
indexOf
(
86
);
const
index
=
parentIds
.
indexOf
(
'86'
);
const
result
=
index
!==
-
1
const
result
=
index
!==
-
1
?
parentIds
.
slice
(
0
,
index
+
1
)
?
parentIds
.
slice
(
0
,
index
+
2
)
:
parentIds
;
:
parentIds
;
pidStr
=
result
.
join
(
","
);
pidStr
=
result
.
join
(
","
);
}
}
console
.
log
(
"pidStr"
,
pidStr
)
//项目公司部门id字符串
console
.
log
(
"pidStr"
,
pidStr
)
//项目公司部门id字符串
let
departs
=
await
DB
.
Depart
.
findAll
({
let
departs
=
await
DB
.
Depart
.
findAll
({
where
:
{
parentIds
:
{
[
Op
.
like
]:
`%
${
pidStr
}
%`
}
where
:
{
},
raw
:
true
});
[
Op
.
or
]:
[
{
parentIds
:
pidStr
},
{
parentIds
:
{
[
Op
.
startsWith
]:
`
${
pidStr
}
,`
}
}
]
},
raw
:
true
});
departs
.
push
(
curentDepart
);
//加上当前部门
departs
.
push
(
curentDepart
);
//加上当前部门
console
.
log
(
"departs"
,
departs
)
//项目公司下属部门信息
console
.
log
(
"departs"
,
departs
)
//项目公司下属部门信息
let
departIds
=
departs
.
map
(
o
=>
{
return
o
.
id
});
let
departIds
=
departs
.
map
(
o
=>
{
return
o
.
id
});
...
@@ -180,13 +187,13 @@ async function getCompanyProjectApprover(userId, roleCode) {
...
@@ -180,13 +187,13 @@ async function getCompanyProjectApprover(userId, roleCode) {
include
:
[{
include
:
[{
model
:
DB
.
Role
,
model
:
DB
.
Role
,
as
:
'roles'
,
as
:
'roles'
,
where
:
{
del
:
0
,
key
:
roleCode
},
where
:
{
del
:
0
,
key
:
roleCode
},
attributes
:
[
"id"
,
"name"
],
attributes
:
[
"id"
,
"name"
],
},],
},],
raw
:
true
raw
:
true
});
});
console
.
log
(
"users"
,
users
)
//部门用户项目信息
console
.
log
(
"users"
,
users
)
//部门用户项目信息
return
{
users
,
type
:
2
};
return
{
users
,
type
:
2
};
}
}
}
}
...
...
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