Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
胡锦波
/
org-manager-web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
67b186ec
authored
Apr 13, 2022
by
胡锦波
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1. init interface处理
parent
4ff1d9a6
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
161 additions
and
63 deletions
src/api/company-service.ts
src/api/sdk-service.ts
src/views/pages/employ-management/address-book/address-book.vue
src/views/pages/employ-management/address-book/aside.vue
src/views/pages/employ-management/address-book/components/search-list.vue
src/views/pages/employ-management/address-book/employ-list.vue
src/views/service/department-controller.ts
src/views/service/emp-tree.ts
src/api/company-service.ts
View file @
67b186ec
import
BaseService
from
"@/api/core"
;
import
BaseService
from
"@/api/core"
;
/* eslint-disable */
export
interface
OldDepartmentItem
{
deep
:
string
;
id
:
string
;
is_main
:
boolean
;
name
:
string
;
name_pinyin
:
string
;
order
:
number
;
parentid
:
string
;
}
/* eslint-enable */
interface
CompanyDepTree
{
comid
:
string
;
departments
:
OldDepartmentItem
[];
ver
:
string
;
}
class
CompanyService
extends
BaseService
{
class
CompanyService
extends
BaseService
{
public
constructor
()
{
public
constructor
()
{
...
@@ -6,7 +23,7 @@ class CompanyService extends BaseService {
...
@@ -6,7 +23,7 @@ class CompanyService extends BaseService {
}
}
public
getDepartment
(
comid
:
string
)
{
public
getDepartment
(
comid
:
string
)
{
return
this
.
getWithCompanyToken
(
`/v1/companies/
${
comid
}
/departments/all`
);
return
this
.
getWithCompanyToken
<
CompanyDepTree
>
(
`/v1/companies/
${
comid
}
/departments/all`
);
}
}
}
}
...
...
src/api/sdk-service.ts
View file @
67b186ec
...
@@ -49,17 +49,42 @@ class SdkCoreService {
...
@@ -49,17 +49,42 @@ class SdkCoreService {
});
});
}
}
protected
async
get
(
url
:
string
)
{
protected
async
get
<
T
>
(
url
:
string
)
{
const
config
=
await
this
.
buildSdkHeaders
();
const
config
=
await
this
.
buildSdkHeaders
();
return
this
.
invokeGet
(
url
,
config
);
return
this
.
invokeGet
(
url
,
config
)
as
Promise
<
T
>
;
}
}
protected
async
post
(
url
:
string
,
body
:
any
)
{
protected
async
post
<
T
>
(
url
:
string
,
body
:
any
)
{
const
config
=
await
this
.
buildSdkHeaders
();
const
config
=
await
this
.
buildSdkHeaders
();
return
this
.
invokePost
(
url
,
body
,
config
);
return
this
.
invokePost
(
url
,
body
,
config
)
as
Promise
<
T
>
;
}
}
}
}
export
interface
BaseOrgMemberItem
{
display
:
string
;
emp
:
boolean
;
id
:
string
;
name
:
string
;
}
export
interface
OrgMemberItem
extends
BaseOrgMemberItem
{
active
:
number
;
joined
:
boolean
;
enable
:
number
;
bound
:
boolean
;
email
:
string
;
mobile
:
string
;
peid
:
string
;
permitted
:
boolean
;
puid
:
string
;
uid
:
string
;
avatarUrl
:
string
;
}
export
interface
OrgDepartmentItem
extends
BaseOrgMemberItem
{
pdid
:
string
;
children
?:
OrgDepartmentItem
[]
|
OrgMemberItem
[];
}
class
SdkService
extends
SdkCoreService
{
class
SdkService
extends
SdkCoreService
{
getJoinedList
()
{
getJoinedList
()
{
return
this
.
get
(
`/system/org/joined/list`
);
return
this
.
get
(
`/system/org/joined/list`
);
...
@@ -71,7 +96,7 @@ class SdkService extends SdkCoreService {
...
@@ -71,7 +96,7 @@ class SdkService extends SdkCoreService {
getOrgTree
()
{
getOrgTree
()
{
const
oid
=
EnterpriseHost
.
getOid
();
const
oid
=
EnterpriseHost
.
getOid
();
return
this
.
get
(
`/system/org/
${
oid
}
/emptree`
);
return
this
.
get
<
OrgDepartmentItem
[]
>
(
`/system/org/
${
oid
}
/emptree`
);
}
}
}
}
...
...
src/views/pages/employ-management/address-book/address-book.vue
View file @
67b186ec
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
<EmployList
<EmployList
:pdid2Members=
"pdid2Members"
:pdid2Members=
"pdid2Members"
:curDepId=
"curDepId"
:curDepId=
"curDepId"
:init=
"init"
class=
"flex-fill"
class=
"flex-fill"
></EmployList>
></EmployList>
</div>
</div>
...
@@ -13,13 +14,15 @@
...
@@ -13,13 +14,15 @@
import
{
Component
,
Vue
}
from
"vue-property-decorator"
;
import
{
Component
,
Vue
}
from
"vue-property-decorator"
;
import
Aside
from
"@/views/pages/employ-management/address-book/aside.vue"
;
import
Aside
from
"@/views/pages/employ-management/address-book/aside.vue"
;
import
EmployList
from
"@/views/pages/employ-management/address-book/employ-list.vue"
;
import
EmployList
from
"@/views/pages/employ-management/address-book/employ-list.vue"
;
import
{
empTreeController
}
from
"@/views/service/emp-tree"
;
import
{
empTreeController
,
OrgMemberItem2Map
}
from
"@/views/service/emp-tree"
;
@
Component
({
components
:
{
Aside
,
EmployList
}
})
@
Component
({
components
:
{
Aside
,
EmployList
}
})
export
default
class
AddressBook
extends
Vue
{
export
default
class
AddressBook
extends
Vue
{
private
pdid2Members
:
{
[
key
:
string
]:
any
}
=
{};
private
pdid2Members
:
{
[
key
:
string
]:
OrgMemberItem2Map
}
=
{};
private
curDepId
=
""
;
private
curDepId
=
""
;
private
init
=
false
;
created
()
{
created
()
{
this
.
initOrgTree
();
this
.
initOrgTree
();
}
}
...
@@ -29,8 +32,13 @@
...
@@ -29,8 +32,13 @@
}
}
private
initOrgTree
()
{
private
initOrgTree
()
{
empTreeController
.
initTree
(
this
).
then
(()
=>
{
empTreeController
.
initTree
(
this
)
.
then
(()
=>
{
this
.
pdid2Members
=
empTreeController
.
getPdid2Members
();
this
.
pdid2Members
=
empTreeController
.
getPdid2Members
();
})
.
finally
(()
=>
{
this
.
init
=
true
;
});
});
}
}
}
}
...
...
src/views/pages/employ-management/address-book/aside.vue
View file @
67b186ec
...
@@ -44,7 +44,10 @@
...
@@ -44,7 +44,10 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Component
,
Vue
,
Ref
}
from
"vue-property-decorator"
;
import
{
Component
,
Vue
,
Ref
}
from
"vue-property-decorator"
;
import
{
departmentController
}
from
"@/views/service/department-controller"
;
import
{
departmentController
,
OldDepartment4Tree
,
}
from
"@/views/service/department-controller"
;
import
{
popupService
}
from
"@/apppackage/element-upgrades/popup"
;
import
{
popupService
}
from
"@/apppackage/element-upgrades/popup"
;
import
SearchList
from
"@/views/pages/employ-management/address-book/components/search-list.vue"
;
import
SearchList
from
"@/views/pages/employ-management/address-book/components/search-list.vue"
;
import
{
Direction
}
from
"@/router"
;
import
{
Direction
}
from
"@/router"
;
...
@@ -57,7 +60,7 @@
...
@@ -57,7 +60,7 @@
value
:
"id"
,
value
:
"id"
,
};
};
private
departments
=
[];
private
departments
:
OldDepartment4Tree
[]
=
[];
private
searchVal
=
""
;
private
searchVal
=
""
;
private
defaultExpandedKeys
:
string
[]
=
[];
private
defaultExpandedKeys
:
string
[]
=
[];
private
defaultCheckedKeys
:
string
[]
=
[];
private
defaultCheckedKeys
:
string
[]
=
[];
...
@@ -72,9 +75,10 @@
...
@@ -72,9 +75,10 @@
private
getDepartmentInfo
()
{
private
getDepartmentInfo
()
{
departmentController
departmentController
.
getDepartments
()
.
getDepartments
()
.
then
((
r
:
any
)
=>
{
.
then
((
r
)
=>
{
this
.
departments
=
r
.
departments4tree
;
this
.
departments
=
r
.
departments4tree
;
const
curPdid
=
this
.
$route
.
query
.
pdid
||
r
.
departments
[
0
].
id
;
const
curPdid
=
(
this
.
$route
.
query
.
pdid
as
string
)
||
r
.
departments
[
0
].
id
;
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
tree
.
setCurrentKey
(
curPdid
);
this
.
tree
.
setCurrentKey
(
curPdid
);
});
});
...
@@ -100,7 +104,7 @@
...
@@ -100,7 +104,7 @@
});
});
}
}
private
handleNodeClick
(
data
:
any
)
{
private
handleNodeClick
(
data
:
OldDepartment4Tree
)
{
this
.
onEmpChange
(
data
.
id
);
this
.
onEmpChange
(
data
.
id
);
}
}
...
@@ -108,11 +112,11 @@
...
@@ -108,11 +112,11 @@
return
""
;
return
""
;
}
}
private
isChecked
(
value
:
any
,
chk
:
any
)
{
private
isChecked
(
value
:
OldDepartment4Tree
,
chk
:
any
)
{
chk
.
checked
=
false
;
chk
.
checked
=
false
;
}
}
private
filterNode
(
value
:
any
,
data
:
any
)
{
private
filterNode
(
value
:
OldDepartment4Tree
,
data
:
any
)
{
if
(
!
value
)
return
true
;
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
}
}
...
...
src/views/pages/employ-management/address-book/components/search-list.vue
View file @
67b186ec
...
@@ -15,16 +15,17 @@
...
@@ -15,16 +15,17 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
departmentController
}
from
"@/views/service/department-controller"
;
import
{
departmentController
}
from
"@/views/service/department-controller"
;
import
{
Component
,
Vue
,
Prop
,
Watch
}
from
"vue-property-decorator"
;
import
{
Component
,
Vue
,
Prop
,
Watch
}
from
"vue-property-decorator"
;
import
{
empTreeController
}
from
"@/views/service/emp-tree"
;
import
{
empTreeController
,
OrgMemberItem2Map
}
from
"@/views/service/emp-tree"
;
import
{
popupService
}
from
"@/apppackage/element-upgrades/popup"
;
import
{
popupService
}
from
"@/apppackage/element-upgrades/popup"
;
import
{
OldDepartmentItem
}
from
"@/api/company-service"
;
@
Component
({
components
:
{}
})
@
Component
({
components
:
{}
})
export
default
class
SearchList
extends
Vue
{
export
default
class
SearchList
extends
Vue
{
@
Prop
()
@
Prop
()
private
val
!
:
string
;
private
val
!
:
string
;
private
emps
:
any
[]
=
[];
private
emps
:
OrgMemberItem2Map
[]
=
[];
private
depts
:
any
[]
=
[];
private
depts
:
OldDepartmentItem
[]
=
[];
@
Watch
(
"val"
,
{
immediate
:
true
})
@
Watch
(
"val"
,
{
immediate
:
true
})
private
onValChange
()
{
private
onValChange
()
{
...
@@ -33,7 +34,7 @@
...
@@ -33,7 +34,7 @@
departmentController
.
getDepartments
(),
departmentController
.
getDepartments
(),
empTreeController
.
initTree
(),
empTreeController
.
initTree
(),
])
])
.
then
((
r
:
any
)
=>
{
.
then
((
r
)
=>
{
if
(
this
.
val
!==
curVal
)
{
if
(
this
.
val
!==
curVal
)
{
return
;
return
;
}
}
...
@@ -43,7 +44,7 @@
...
@@ -43,7 +44,7 @@
const
cacheMember
:
string
[]
=
[];
const
cacheMember
:
string
[]
=
[];
this
.
depts
=
[];
this
.
depts
=
[];
this
.
emps
=
[];
this
.
emps
=
[];
members
.
forEach
((
m
:
any
)
=>
{
members
.
forEach
((
m
)
=>
{
if
(
if
(
m
.
name
&&
m
.
name
&&
m
.
name
.
includes
(
curVal
)
&&
m
.
name
.
includes
(
curVal
)
&&
...
@@ -55,7 +56,7 @@
...
@@ -55,7 +56,7 @@
}
}
});
});
departments
.
forEach
((
d
:
any
)
=>
{
departments
.
forEach
((
d
)
=>
{
if
(
d
.
name
&&
d
.
name
.
includes
(
curVal
))
{
if
(
d
.
name
&&
d
.
name
.
includes
(
curVal
))
{
cacheMember
.
push
(
d
.
id
);
cacheMember
.
push
(
d
.
id
);
const
params
=
JSON
.
parse
(
JSON
.
stringify
(
d
));
const
params
=
JSON
.
parse
(
JSON
.
stringify
(
d
));
...
...
src/views/pages/employ-management/address-book/employ-list.vue
View file @
67b186ec
...
@@ -90,14 +90,14 @@
...
@@ -90,14 +90,14 @@
align=
"center"
align=
"center"
>
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<
com
-button
<
mg
-button
@
click=
"handleClick(scope.row.peid)"
@
click=
"handleClick(scope.row.peid)"
type=
"text"
type=
"text"
size=
"small"
size=
"small"
class=
"act-btn"
class=
"act-btn"
>
>
详情
详情
</
com
-button>
</
mg
-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -116,20 +116,24 @@
...
@@ -116,20 +116,24 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
departmentController
}
from
"@/views/service/department-controller"
;
import
{
departmentController
}
from
"@/views/service/department-controller"
;
import
{
OrgMemberItem2Map
}
from
"@/views/service/emp-tree"
;
import
{
Component
,
Vue
,
Prop
,
Watch
}
from
"vue-property-decorator"
;
import
{
Component
,
Vue
,
Prop
,
Watch
}
from
"vue-property-decorator"
;
@
Component
({
components
:
{}
})
@
Component
({
components
:
{}
})
export
default
class
EmployList
extends
Vue
{
export
default
class
EmployList
extends
Vue
{
@
Prop
({
default
:
{}
})
@
Prop
({
default
:
{}
})
private
pdid2Members
!
:
{
[
key
:
string
]:
any
};
private
pdid2Members
!
:
{
[
key
:
string
]:
OrgMemberItem2Map
[]
};
@
Prop
({
default
:
""
})
@
Prop
({
default
:
""
})
private
curDepId
!
:
string
;
private
curDepId
!
:
string
;
private
list
=
[];
@
Prop
({
default
:
false
})
private
init
!
:
boolean
;
private
list
:
OrgMemberItem2Map
[]
=
[];
private
totalCount
=
0
;
private
totalCount
=
0
;
private
pageIndex
=
1
;
private
pageIndex
=
1
;
private
tableData
:
any
[]
=
[];
private
tableData
:
OrgMemberItem2Map
[]
=
[];
private
size
=
10
;
private
size
=
10
;
private
listTotal
=
0
;
private
listTotal
=
0
;
...
@@ -141,9 +145,19 @@
...
@@ -141,9 +145,19 @@
@
Watch
(
"curDepId"
,
{
immediate
:
true
})
@
Watch
(
"curDepId"
,
{
immediate
:
true
})
private
onCurDepIdChange
()
{
private
onCurDepIdChange
()
{
if
(
this
.
init
)
{
this
.
getPageList
(
1
);
this
.
getDeptName
(
this
.
curDepId
);
}
}
@
Watch
(
"init"
,
{
immediate
:
true
})
private
onInitChange
()
{
if
(
this
.
curDepId
)
{
this
.
getPageList
(
1
);
this
.
getPageList
(
1
);
this
.
getDeptName
(
this
.
curDepId
);
this
.
getDeptName
(
this
.
curDepId
);
}
}
}
private
getPageList
(
page
?:
number
)
{
private
getPageList
(
page
?:
number
)
{
this
.
list
=
this
.
pdid2Members
[
this
.
curDepId
||
0
]
||
[];
this
.
list
=
this
.
pdid2Members
[
this
.
curDepId
||
0
]
||
[];
...
@@ -155,9 +169,9 @@
...
@@ -155,9 +169,9 @@
}
}
private
getDeptName
(
depId
:
string
)
{
private
getDeptName
(
depId
:
string
)
{
departmentController
.
getDepartments
().
then
((
r
:
any
)
=>
{
departmentController
.
getDepartments
().
then
((
r
)
=>
{
const
departments
=
r
.
departments
;
const
departments
=
r
.
departments
;
const
result
=
departments
.
find
((
i
:
any
)
=>
i
.
id
===
depId
);
const
result
=
departments
.
find
((
i
)
=>
i
.
id
===
depId
);
if
(
result
)
{
if
(
result
)
{
this
.
name
=
result
.
name
;
this
.
name
=
result
.
name
;
}
}
...
...
src/views/service/department-controller.ts
View file @
67b186ec
import
companyService
from
"@/api/company-service"
;
import
companyService
,
{
OldDepartmentItem
}
from
"@/api/company-service"
;
import
EnterpriseHost
from
"./enterprise-host"
;
import
EnterpriseHost
from
"./enterprise-host"
;
/* eslint-disable */
export
interface
OldDepartment4Tree
{
id
:
string
;
name
:
string
;
name_pinyin
:
string
;
parentid
:
string
;
order
:
number
;
children
?:
OldDepartment4Tree
[],
}
/* eslint-enable */
export
interface
OldDepartmentsData
{
departments4tree
:
OldDepartment4Tree
[],
departments
:
OldDepartmentItem
[]
}
class
DepartmentController
{
class
DepartmentController
{
private
curPoid
=
""
;
private
curPoid
=
""
;
private
departments4tree
=
[];
private
departments4tree
:
OldDepartment4Tree
[]
=
[];
private
departments
=
[]
private
departments
:
OldDepartmentItem
[]
=
[]
public
getDepartments
(
reload
=
false
)
{
public
getDepartments
(
reload
=
false
)
{
const
poid
=
EnterpriseHost
.
getPoid
();
const
poid
=
EnterpriseHost
.
getPoid
();
...
@@ -16,9 +32,9 @@ class DepartmentController {
...
@@ -16,9 +32,9 @@ class DepartmentController {
};
};
return
Promise
.
resolve
(
p
);
return
Promise
.
resolve
(
p
);
}
}
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
<
OldDepartmentsData
>
((
resolve
,
reject
)
=>
{
this
.
curPoid
=
poid
;
this
.
curPoid
=
poid
;
companyService
.
getDepartment
(
poid
).
then
((
res
:
any
)
=>
{
companyService
.
getDepartment
(
poid
).
then
((
res
)
=>
{
const
ary
=
res
.
departments
;
const
ary
=
res
.
departments
;
this
.
departments
=
res
.
departments
;
this
.
departments
=
res
.
departments
;
const
r
=
this
.
parseMarksTree
(
ary
);
const
r
=
this
.
parseMarksTree
(
ary
);
...
@@ -36,9 +52,9 @@ class DepartmentController {
...
@@ -36,9 +52,9 @@ class DepartmentController {
this
.
getDepartments
(
true
);
this
.
getDepartments
(
true
);
}
}
private
parseMarksTree
(
ary
:
any
[],
pid
=
'0'
):
any
{
private
parseMarksTree
(
ary
:
OldDepartmentItem
[],
pid
=
'0'
):
OldDepartment4Tree
[]
{
if
(
!
Array
.
isArray
(
ary
))
{
if
(
!
Array
.
isArray
(
ary
))
{
return
null
;
return
[]
;
}
}
const
marks
=
ary
.
filter
(
item
=>
item
.
parentid
===
pid
);
const
marks
=
ary
.
filter
(
item
=>
item
.
parentid
===
pid
);
...
@@ -52,7 +68,7 @@ class DepartmentController {
...
@@ -52,7 +68,7 @@ class DepartmentController {
parentid
:
item
.
parentid
,
parentid
:
item
.
parentid
,
order
:
item
.
order
,
order
:
item
.
order
,
children
:
children
children
:
children
};
}
as
OldDepartment4Tree
;
}
else
{
}
else
{
return
{
return
{
id
:
item
.
id
,
id
:
item
.
id
,
...
@@ -60,7 +76,7 @@ class DepartmentController {
...
@@ -60,7 +76,7 @@ class DepartmentController {
name_pinyin
:
item
.
name_pinyin
,
name_pinyin
:
item
.
name_pinyin
,
order
:
item
.
order
,
order
:
item
.
order
,
parentid
:
item
.
parentid
,
parentid
:
item
.
parentid
,
};
}
as
OldDepartment4Tree
;
}
}
});
});
}
}
...
...
src/views/service/emp-tree.ts
View file @
67b186ec
import
{
sdkService
}
from
"@/api/sdk-service"
;
import
{
OrgDepartmentItem
,
OrgMemberItem
,
sdkService
}
from
"@/api/sdk-service"
;
import
Vue
from
"vue"
;
import
Vue
from
"vue"
;
export
interface
OrgMemberItem2Map
extends
OrgMemberItem
{
empid
:
string
;
depNames
:
string
[];
depIds
:
string
[];
}
class
EmpTreeController
{
class
EmpTreeController
{
private
tree
:
any
[]
=
[];
private
tree
:
OrgDepartmentItem
[]
=
[];
private
pdid2Members
:
{
[
key
:
string
]:
any
}
=
{}
private
pdid2Members
:
{
[
key
:
string
]:
OrgMemberItem2Map
[]
}
=
{}
private
roleList
:
any
[]
=
[];
private
roleList
:
OrgMemberItem2Map
[]
=
[];
private
roleMap4PeidOrEid
:
{
[
key
:
string
]:
any
}
=
{}
private
roleMap4PeidOrEid
:
{
[
key
:
string
]:
OrgMemberItem2Map
}
=
{}
private
success
=
false
private
success
=
false
private
busy
=
false
;
private
busy
=
false
;
private
action
:
any
[]
=
[];
private
action
:
any
[]
=
[];
...
@@ -22,7 +28,7 @@ class EmpTreeController {
...
@@ -22,7 +28,7 @@ class EmpTreeController {
});
});
this
.
busy
=
true
;
this
.
busy
=
true
;
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
sdkService
.
getOrgTree
().
then
((
r
:
any
)
=>
{
sdkService
.
getOrgTree
().
then
((
r
)
=>
{
this
.
tree
=
r
;
this
.
tree
=
r
;
this
.
success
=
true
;
this
.
success
=
true
;
this
.
handlerAction
();
this
.
handlerAction
();
...
@@ -57,10 +63,10 @@ class EmpTreeController {
...
@@ -57,10 +63,10 @@ class EmpTreeController {
this
.
action
=
[];
this
.
action
=
[];
}
}
filterData2Use
(
tree
:
any
)
{
filterData2Use
(
tree
:
OrgDepartmentItem
[]
)
{
if
(
tree
)
{
if
(
tree
)
{
this
.
pdid2Members
=
{};
this
.
pdid2Members
=
{};
this
.
buildPdid2Members
(
tree
[
0
]);
this
.
buildPdid2Members
(
tree
[
0
]
,
""
,
""
,
true
);
this
.
roleList
=
[];
this
.
roleList
=
[];
Object
.
keys
(
this
.
pdid2Members
).
forEach
((
i
)
=>
{
Object
.
keys
(
this
.
pdid2Members
).
forEach
((
i
)
=>
{
this
.
roleList
=
this
.
roleList
.
concat
(
this
.
roleList
=
this
.
roleList
.
concat
(
...
@@ -80,7 +86,7 @@ class EmpTreeController {
...
@@ -80,7 +86,7 @@ class EmpTreeController {
}
}
getRoleList
()
{
getRoleList
()
{
return
JSON
.
parse
(
JSON
.
stringify
(
this
.
roleList
));
return
JSON
.
parse
(
JSON
.
stringify
(
this
.
roleList
))
as
OrgMemberItem2Map
[]
;
}
}
getPdid2Members
()
{
getPdid2Members
()
{
...
@@ -91,18 +97,23 @@ class EmpTreeController {
...
@@ -91,18 +97,23 @@ class EmpTreeController {
return
this
.
roleMap4PeidOrEid
[
pidOrId
].
id
;
return
this
.
roleMap4PeidOrEid
[
pidOrId
].
id
;
}
}
buildPdid2Members
(
tree
:
any
)
{
buildPdid2Members
(
tree
:
OrgDepartmentItem
|
OrgMemberItem
,
depName
=
""
,
depId
=
""
,
root
=
false
)
{
if
(
tree
&&
tree
.
pdid
)
{
const
pTree
:
OrgDepartmentItem
|
null
=
tree
as
OrgDepartmentItem
;
this
.
pdid2Members
[
tree
.
pdid
]
=
const
mTree
:
OrgMemberItem
|
null
=
tree
as
OrgMemberItem
;
this
.
pdid2Members
[
tree
.
pdid
]
||
[];
if
(
pTree
&&
pTree
.
pdid
)
{
if
(
!
tree
.
children
.
length
)
{
this
.
pdid2Members
[
pTree
.
pdid
]
=
this
.
pdid2Members
[
pTree
.
pdid
]
||
[];
const
chilren
=
pTree
.
children
;
if
(
!
chilren
||
!
chilren
.
length
)
{
return
{
return
{
_last
:
true
,
_last
:
true
,
};
};
}
}
let
users
:
any
[]
=
[];
let
users
:
OrgMemberItem2Map
[]
=
[];
for
(
let
i
=
0
;
i
<
tree
.
children
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
chilren
.
length
;
i
++
)
{
const
user
=
this
.
buildPdid2Members
(
tree
.
children
[
i
]);
const
user
=
this
.
buildPdid2Members
(
chilren
[
i
],
root
?
""
:
pTree
.
name
,
root
?
""
:
pTree
.
pdid
);
if
(
user
.
_last
)
{
if
(
user
.
_last
)
{
continue
;
continue
;
}
}
...
@@ -115,20 +126,22 @@ class EmpTreeController {
...
@@ -115,20 +126,22 @@ class EmpTreeController {
}
}
users
.
push
(
user
);
users
.
push
(
user
);
}
}
this
.
pdid2Members
[
t
ree
.
pdid
]
=
this
.
quchong
(
this
.
pdid2Members
[
pT
ree
.
pdid
]
=
this
.
quchong
(
this
.
pdid2Members
[
t
ree
.
pdid
].
concat
(
users
)
this
.
pdid2Members
[
pT
ree
.
pdid
].
concat
(
users
)
);
);
return
{
return
{
_isPid
:
JSON
.
parse
(
_isPid
:
JSON
.
parse
(
JSON
.
stringify
(
this
.
pdid2Members
[
t
ree
.
pdid
])
JSON
.
stringify
(
this
.
pdid2Members
[
pT
ree
.
pdid
])
),
),
};
};
}
else
{
}
else
{
Object
.
assign
(
tree
,
{
Object
.
assign
(
tree
,
{
empid
:
tree
.
peid
,
empid
:
mTree
.
peid
,
depNames
:
depName
?
[
depName
]
:
[],
depIds
:
depId
?
[
depId
]
:
[],
});
});
if
([
0
,
1
,
"0"
,
"1"
].
includes
(
t
ree
.
enable
))
{
if
([
0
,
1
,
"0"
,
"1"
].
includes
(
mT
ree
.
enable
))
{
return
JSON
.
parse
(
JSON
.
stringify
(
tree
));
return
JSON
.
parse
(
JSON
.
stringify
(
tree
));
}
}
return
{
return
{
...
@@ -137,10 +150,10 @@ class EmpTreeController {
...
@@ -137,10 +150,10 @@ class EmpTreeController {
}
}
}
}
quchong
(
arr
:
any
[])
{
quchong
(
arr
:
OrgMemberItem2Map
[])
{
const
result
=
[];
const
result
=
[];
const
obj
:
{
[
key
:
string
]:
any
}
=
{};
const
obj
:
{
[
key
:
string
]:
boolean
}
=
{};
const
objIndex
:
{
[
key
:
string
]:
any
}
=
{};
const
objIndex
:
{
[
key
:
string
]:
number
}
=
{};
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
!
obj
[
arr
[
i
].
id
])
{
if
(
!
obj
[
arr
[
i
].
id
])
{
result
.
push
(
arr
[
i
]);
result
.
push
(
arr
[
i
]);
...
...
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