Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OKR
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hanfeng zhang
OKR
Commits
cf23efb6
Commit
cf23efb6
authored
Sep 07, 2021
by
hanfeng zhang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of gitlab.33.cn:HF_web/OKR
parents
6db0a524
e423219f
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
354 additions
and
60 deletions
+354
-60
input-cell.vue
src/components/common/input-cell.vue
+27
-4
service.dto.ts
src/service/moudles/service.dto.ts
+1
-1
index.ts
src/store/index.ts
+0
-10
index.ts
src/util/Contact/index.ts
+9
-0
add-member.vue
src/views/team/add-member.vue
+3
-2
contact-selector.vue
src/views/team/components/contact-selector.vue
+138
-0
member-selector.vue
src/views/team/components/member-selector.vue
+10
-12
team-contacts.vue
src/views/team/components/team-contacts.vue
+5
-1
department-management.vue
src/views/team/department-management.vue
+157
-9
team-detail.vue
src/views/team/team-detail.vue
+1
-1
team-frame.vue
src/views/team/team-frame.vue
+3
-20
No files found.
src/components/common/input-cell.vue
View file @
cf23efb6
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
:placeholder=
"placeholder"
:placeholder=
"placeholder"
@
input=
"handleInput"
@
input=
"handleInput"
@
blur=
"handleChange"
@
blur=
"handleChange"
@
compositionstart=
"onCompositionStart"
@
compositionend=
"onCompositionEnd"
>
>
<textarea
<textarea
v-else
v-else
...
@@ -50,6 +52,8 @@
...
@@ -50,6 +52,8 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
Vue
from
'vue'
import
{
Field
}
from
'vant'
Vue
.
use
(
Field
)
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
components
:{
components
:{
...
@@ -90,18 +94,32 @@ export default Vue.extend({
...
@@ -90,18 +94,32 @@ export default Vue.extend({
return
{
return
{
// value: '',
// value: '',
length
:
0
,
length
:
0
,
showError
:
false
showError
:
false
,
compsitionCheck
:
true
}
}
},
},
created
()
{
this
.
length
=
this
.
value
?.
length
||
0
},
methods
:
{
methods
:
{
onCompositionStart
()
{
this
.
compsitionCheck
=
false
},
onCompositionEnd
(
e
:
InputEvent
)
{
this
.
compsitionCheck
=
true
const
value
=
(
e
.
target
as
HTMLInputElement
).
value
this
.
showError
=
this
.
showError
?
!
this
.
checkIfEmpty
(
value
)
:
this
.
showError
this
.
length
=
value
.
length
if
(
this
.
limit
>
0
&&
this
.
length
>=
this
.
limit
)
{
this
.
$emit
(
'input'
,
value
.
slice
(
0
,
this
.
limit
))
this
.
length
=
this
.
limit
}
else
{
this
.
$emit
(
'input'
,
value
)
}
},
checkIfEmpty
(
string
:
string
)
{
checkIfEmpty
(
string
:
string
)
{
if
(
typeof
string
===
'undefined'
)
return
false
if
(
typeof
string
===
'undefined'
)
return
false
return
string
.
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
''
)
!==
''
return
string
.
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
''
)
!==
''
},
},
handleInput
(
e
:
InputEvent
)
{
handleInput
(
e
:
InputEvent
)
{
if
(
!
this
.
compsitionCheck
)
return
const
value
=
(
e
.
target
as
HTMLInputElement
).
value
const
value
=
(
e
.
target
as
HTMLInputElement
).
value
this
.
showError
=
this
.
showError
?
!
this
.
checkIfEmpty
(
value
)
:
this
.
showError
this
.
showError
=
this
.
showError
?
!
this
.
checkIfEmpty
(
value
)
:
this
.
showError
this
.
length
=
value
.
length
this
.
length
=
value
.
length
...
@@ -118,6 +136,11 @@ export default Vue.extend({
...
@@ -118,6 +136,11 @@ export default Vue.extend({
this
.
showError
=
true
this
.
showError
=
true
}
}
}
}
},
watch
:
{
value
(
val
)
{
this
.
length
=
val
.
length
}
}
}
})
})
</
script
>
</
script
>
...
...
src/service/moudles/service.dto.ts
View file @
cf23efb6
...
@@ -81,7 +81,7 @@ export interface GetDepDTO {
...
@@ -81,7 +81,7 @@ export interface GetDepDTO {
export
interface
UpdateDepDTO
{
export
interface
UpdateDepDTO
{
"name"
:
string
,
"name"
:
string
,
"parentId"
:
string
,
//
"parentId": string,
"entId"
:
string
,
"entId"
:
string
,
"id"
:
string
,
"id"
:
string
,
"leaderId"
:
string
"leaderId"
:
string
...
...
src/store/index.ts
View file @
cf23efb6
...
@@ -7,22 +7,12 @@ Vue.use(Vuex)
...
@@ -7,22 +7,12 @@ Vue.use(Vuex)
export
default
new
Vuex
.
Store
({
export
default
new
Vuex
.
Store
({
state
:
{
state
:
{
enterpriseInfo
:
undefined
,
acceptJoin
:
undefined
,
acceptJoin
:
undefined
,
addDep
:
undefined
,
addDep
:
undefined
,
selectedStaff
:
undefined
,
selectedStaff
:
undefined
,
selectedDep
:
undefined
selectedDep
:
undefined
},
},
mutations
:
{
mutations
:
{
setEnterpriseInfo
(
state
,
payload
)
{
state
.
enterpriseInfo
=
payload
},
setAcceptJoin
(
state
,
payload
)
{
state
.
acceptJoin
=
payload
},
setAddDep
(
state
,
payload
)
{
state
.
addDep
=
payload
},
setSelectedStaff
(
state
,
payload
)
{
setSelectedStaff
(
state
,
payload
)
{
state
.
selectedStaff
=
payload
state
.
selectedStaff
=
payload
},
},
...
...
src/util/Contact/index.ts
View file @
cf23efb6
...
@@ -91,11 +91,20 @@ export function getContacts(arr: Array<Staff>) {
...
@@ -91,11 +91,20 @@ export function getContacts(arr: Array<Staff>) {
const
contacts
:
Contact
=
{}
const
contacts
:
Contact
=
{}
arr
.
forEach
(
item
=>
{
arr
.
forEach
(
item
=>
{
const
firstPy
=
makePy
(
item
.
name
)[
0
].
slice
(
0
,
1
).
toUpperCase
()
const
firstPy
=
makePy
(
item
.
name
)[
0
].
slice
(
0
,
1
).
toUpperCase
()
const
test
=
/
[
0-9`~!@#$%^&*()_
\-
+=<>?:"{}|,.
\/
;'
\\
[
\]
·~!@#¥%……&*()——
\-
+={}|《》?:“”【】、;‘',。、
]
/
if
(
test
.
test
(
firstPy
))
{
if
(
typeof
contacts
[
'#'
]
===
'undefined'
)
{
contacts
[
'#'
]
=
[
item
]
}
else
{
contacts
[
'#'
].
push
(
item
)
}
}
else
{
if
(
typeof
contacts
[
firstPy
]
===
'undefined'
)
{
if
(
typeof
contacts
[
firstPy
]
===
'undefined'
)
{
contacts
[
firstPy
]
=
[
item
]
contacts
[
firstPy
]
=
[
item
]
}
else
{
}
else
{
contacts
[
firstPy
].
push
(
item
)
contacts
[
firstPy
].
push
(
item
)
}
}
}
})
})
return
contacts
return
contacts
}
}
src/views/team/add-member.vue
View file @
cf23efb6
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
@
confirm=
"selectJoinTime"
@
confirm=
"selectJoinTime"
/>
/>
<!-- 选择部门 -->
<!-- 选择部门 -->
<group-cell
dot
required
class=
"mt-4"
title=
"所属部门"
@
click=
"selectDep"
>
<group-cell
dot
required
class=
"mt-4"
title=
"所属部门"
@
click
.
native
=
"selectDep"
>
<c-cell
:title=
"currentDep.name"
/>
<c-cell
:title=
"currentDep.name"
/>
</group-cell>
</group-cell>
<!--按钮-->
<!--按钮-->
...
@@ -122,7 +122,7 @@ export default Vue.extend({
...
@@ -122,7 +122,7 @@ export default Vue.extend({
depId
:
''
,
depId
:
''
,
entId
:
''
,
entId
:
''
,
hash
:
'mock-hash'
,
hash
:
'mock-hash'
,
joinTime
:
0
,
joinTime
:
new
Date
().
getTime
()
,
phone
:
''
,
phone
:
''
,
position
:
''
position
:
''
}
}
...
@@ -146,6 +146,7 @@ export default Vue.extend({
...
@@ -146,6 +146,7 @@ export default Vue.extend({
// this.acceptJoin = Object.assign(this.acceptJoin, this.$store.state.acceptJoin)
// this.acceptJoin = Object.assign(this.acceptJoin, this.$store.state.acceptJoin)
const
dep
=
await
this
.
getSub
(
this
.
depId
)
const
dep
=
await
this
.
getSub
(
this
.
depId
)
this
.
currentDep
=
dep
.
dep
this
.
currentDep
=
dep
.
dep
this
.
date
=
this
.
formatDate
(
new
Date
())
},
},
methods
:
{
methods
:
{
async
selectDep
()
{
async
selectDep
()
{
...
...
src/views/team/components/contact-selector.vue
0 → 100644
View file @
cf23efb6
<
template
>
<!-- 选择成员 -->
<van-overlay
:show=
"show"
z-index=
"2000"
>
<div
class=
"select-team w-screen h-screen overflow-auto"
>
<main-page
main-bg=
"bg-white"
header-bg=
"bg-white"
:title=
"title"
:loading=
"loading"
left-arrow
@
click-left=
"goBack"
>
<div
class=
"px-4 pt-14"
>
<!--
<div
class=
"py-2"
>
{{
currentDep
.
name
}}
</div>
-->
<!-- 通讯录 -->
<div
class=
"py-2 font-medium"
>
{{
dep
.
name
}}
</div>
<div
class=
"pb-16"
>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
<team-contacts
:radio=
"true"
:multiple=
"multiple"
:checked
.
sync=
"checkedMember"
:contacts=
"contacts"
/>
</div>
<!-- 底部操作 -->
<div
class=
"py-2 px-4 bg-white w-screen fixed bottom-0 left-0 z-30"
>
<c-button
round
@
click=
"confirm"
>
确定
</c-button>
</div>
</div>
</main-page>
</div>
</van-overlay>
</
template
>
<
script
lang=
"ts"
>
import
Vue
,
{
PropType
}
from
'vue'
import
{
Department
,
Staff
}
from
'@/Interface'
export
default
Vue
.
extend
({
name
:
'ContactSelector'
,
components
:
{
'main-page'
:
()
=>
import
(
'@/layout/main-page.vue'
),
'app-icon'
:
()
=>
import
(
'@/components/common/Icon.vue'
),
'team-tree'
:
()
=>
import
(
'@/views/team/components/team-tree.vue'
),
'team-contacts'
:
()
=>
import
(
'@/views/team/components/team-contacts.vue'
),
'c-button'
:
()
=>
import
(
'@/components/common/c-button.vue'
),
'switch-cell'
:
()
=>
import
(
'@/components/common/switch-cell.vue'
)
},
props
:
{
show
:
Boolean
,
entId
:
String
,
dep
:
Object
,
multiple
:
{
type
:
Boolean
,
default
:
false
},
checkedMemberId
:
{
type
:
Array
as
PropType
<
Array
<
String
>>
},
title
:
{
type
:
String
,
default
:
'团队成员'
},
contacts
:
Object
,
actionType
:
String
},
data
()
{
let
changedVal
:
Array
<
string
>
=
[]
return
{
loading
:
false
,
changed
:
false
,
changedVal
}
},
computed
:
{
checkedMember
:
{
get
():
Array
<
String
>
{
if
(
!
this
.
changed
)
{
return
this
.
checkedMemberId
}
else
{
return
this
.
changedVal
}
},
set
(
val
:
Array
<
string
>
)
{
this
.
changed
=
true
this
.
changedVal
=
val
}
}
},
methods
:
{
// 确认选择
confirm
()
{
if
(
typeof
this
.
checkedMember
===
'undefined'
||
this
.
checkedMember
.
length
===
0
)
{
this
.
$toast
(
'请选择成员'
)
return
}
this
.
loading
=
true
const
data
=
{
entId
:
this
.
entId
,
depId
:
''
,
ids
:
this
.
checkedMember
as
Array
<
string
>
}
if
(
this
.
actionType
===
'add'
)
{
data
.
depId
=
this
.
dep
.
id
}
if
(
this
.
actionType
===
'remove'
)
{
const
rootDepId
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
||
'{}'
).
rootDepId
data
.
depId
=
rootDepId
}
this
.
$service
.
staff
.
changeDep
(
data
).
then
((
res
:
any
)
=>
{
this
.
loading
=
false
const
{
data
}
=
res
if
(
data
.
code
===
this
.
$global
.
success
)
{
if
(
this
.
actionType
===
'remove'
)
{
this
.
$toast
(
'移除成功'
)
}
else
{
this
.
$toast
(
'添加成功'
)
}
}
else
{
this
.
$toast
(
data
.
msg
)
}
})
this
.
$emit
(
'update:checkedMemberId'
,
this
.
checkedMember
)
this
.
$emit
(
'update:show'
,
false
)
this
.
checkedMember
=
[]
},
goBack
(){
this
.
$emit
(
'update:show'
,
false
)
}
}
})
</
script
>
<
style
lang=
"less"
>
</
style
>
\ No newline at end of file
src/views/team/components/member-selector.vue
View file @
cf23efb6
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<main-page
<main-page
main-bg=
"bg-white"
main-bg=
"bg-white"
header-bg=
"bg-white"
header-bg=
"bg-white"
title=
"选择主管
"
:title=
"title
"
:loading=
"loading"
:loading=
"loading"
left-arrow
left-arrow
@
click-left=
"goBack"
@
click-left=
"goBack"
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
:checked
.
sync=
"ifContainChildDep"
:checked
.
sync=
"ifContainChildDep"
@
change=
"handleSwitchChange"
@
change=
"handleSwitchChange"
/>
/>
<!-- <div class="py-2">{{currentDep.name}}</div> -->
<!-- 通讯录 -->
<!-- 通讯录 -->
<div
class=
"pb-16"
>
<div
class=
"pb-16"
>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
...
@@ -41,7 +42,6 @@
...
@@ -41,7 +42,6 @@
:multiple=
"multiple"
:multiple=
"multiple"
:checked
.
sync=
"checkedMember"
:checked
.
sync=
"checkedMember"
:contacts=
"contacts"
:contacts=
"contacts"
@
click-member=
"clickMember"
/>
/>
</div>
</div>
<!-- 底部操作 -->
<!-- 底部操作 -->
...
@@ -84,6 +84,10 @@ export default Vue.extend({
...
@@ -84,6 +84,10 @@ export default Vue.extend({
},
},
checkedMemberId
:
{
checkedMemberId
:
{
type
:
Array
as
PropType
<
Array
<
String
>>
type
:
Array
as
PropType
<
Array
<
String
>>
},
title
:
{
type
:
String
,
default
:
'选择主管'
}
}
},
},
data
()
{
data
()
{
...
@@ -97,13 +101,12 @@ export default Vue.extend({
...
@@ -97,13 +101,12 @@ export default Vue.extend({
}
}
let
changedVal
:
Array
<
string
>
=
[]
let
changedVal
:
Array
<
string
>
=
[]
return
{
return
{
title
:
'导航'
,
team
,
team
,
loading
:
false
,
loading
:
false
,
contacts
:
{},
contacts
:
{},
parentId
:
''
,
parentId
:
''
,
entId
:
'
166961152260050944
'
,
entId
:
''
,
ifContainChildDep
:
tru
e
,
ifContainChildDep
:
fals
e
,
enterpriseInfo
:
{},
enterpriseInfo
:
{},
currentDep
,
currentDep
,
preDep
:
{},
preDep
:
{},
...
@@ -115,6 +118,7 @@ export default Vue.extend({
...
@@ -115,6 +118,7 @@ export default Vue.extend({
}
}
},
},
mounted
()
{
mounted
()
{
this
.
entId
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
||
'{}'
).
id
this
.
getEntInfo
()
this
.
getEntInfo
()
},
},
computed
:
{
computed
:
{
...
@@ -130,7 +134,6 @@ export default Vue.extend({
...
@@ -130,7 +134,6 @@ export default Vue.extend({
}
}
},
},
set
(
val
:
Array
<
string
>
)
{
set
(
val
:
Array
<
string
>
)
{
console
.
log
(
val
,
'val'
)
this
.
changed
=
true
this
.
changed
=
true
this
.
changedVal
=
val
this
.
changedVal
=
val
}
}
...
@@ -143,7 +146,6 @@ export default Vue.extend({
...
@@ -143,7 +146,6 @@ export default Vue.extend({
},
},
// 确认选择
// 确认选择
confirmSelect
()
{
confirmSelect
()
{
// this.$store.commit('setAddDepLeader', this.checkedMemberId)
this
.
$emit
(
'update:checkedMemberId'
,
this
.
checkedMember
)
this
.
$emit
(
'update:checkedMemberId'
,
this
.
checkedMember
)
this
.
$emit
(
'update:show'
,
false
)
this
.
$emit
(
'update:show'
,
false
)
},
},
...
@@ -188,7 +190,7 @@ export default Vue.extend({
...
@@ -188,7 +190,7 @@ export default Vue.extend({
parentId
:
this
.
parentId
,
parentId
:
this
.
parentId
,
entId
:
this
.
entId
,
entId
:
this
.
entId
,
hasStaff
:
true
,
hasStaff
:
true
,
isDirect
:
this
.
ifContainChildDep
isDirect
:
!
this
.
ifContainChildDep
}).
then
((
res
:
any
)
=>
{
}).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
const
{
data
}
=
res
this
.
loading
=
false
this
.
loading
=
false
...
@@ -205,10 +207,6 @@ export default Vue.extend({
...
@@ -205,10 +207,6 @@ export default Vue.extend({
}
}
})
})
},
},
clickMember
(
member
:
Staff
)
{
// openCompanyUserInfo(JSON.stringify(member))
// this.$router.push(`/team/team-member/${member.id}`)
},
clickItem
(
val
:
Department
)
{
clickItem
(
val
:
Department
)
{
this
.
parentId
=
val
.
id
this
.
parentId
=
val
.
id
this
.
getStaff
()
this
.
getStaff
()
...
...
src/views/team/components/team-contacts.vue
View file @
cf23efb6
...
@@ -147,9 +147,13 @@ export default Vue.extend({
...
@@ -147,9 +147,13 @@ export default Vue.extend({
navs
()
{
navs
()
{
let
arr
:
Array
<
string
>
=
[]
let
arr
:
Array
<
string
>
=
[]
for
(
let
key
in
this
.
contacts
)
{
for
(
let
key
in
this
.
contacts
)
{
if
(
key
!==
'#'
){
arr
.
push
(
key
)
arr
.
push
(
key
)
}
else
{
arr
.
sort
().
push
(
'#'
)
}
}
}
return
arr
.
sort
()
return
arr
},
},
list
()
{
list
()
{
const
obj
:
Contacts
=
{}
const
obj
:
Contacts
=
{}
...
...
src/views/team/department-management.vue
View file @
cf23efb6
...
@@ -5,6 +5,21 @@
...
@@ -5,6 +5,21 @@
:loading=
"loading"
:loading=
"loading"
@
click-left=
"$router.go(-1)"
@
click-left=
"$router.go(-1)"
>
>
<member-selector
:title=
"memberSelectorTitle"
:show
.
sync=
"showMemberSelector"
:multiple=
"multiple"
:checked-member-id
.
sync=
"selectedMemberId"
/>
<contact-selector
:ent-id=
"entId"
:dep=
"depInfo"
:title=
"contactSelectorTitle"
:show
.
sync=
"showContactSelector"
:multiple=
"multiple"
:action-type=
"actionType"
:contacts=
"contacts"
/>
<div
class=
"pt-14 px-4"
>
<div
class=
"pt-14 px-4"
>
<input-cell
<input-cell
v-model=
"depInfo.name"
v-model=
"depInfo.name"
...
@@ -17,30 +32,39 @@
...
@@ -17,30 +32,39 @@
<c-cell
<c-cell
dot
dot
title=
"部门主管"
title=
"部门主管"
content=
"部门主管名称
"
:content=
"leaderInfo.name
"
class=
"mt-4"
class=
"mt-4"
@
click=
"selectLeader"
/>
/>
<c-cell
<c-cell
dot
dot
title=
"上级部门"
title=
"上级部门"
content=
"产品设计部"
content=
"产品设计部"
class=
"mt-4"
/>
/>
<
switch-cell
title=
"该部门包含子部门成员"
:checked
.
sync=
"check"
/
>
<
!--
<switch-cell
title=
"该部门包含子部门成员"
:checked
.
sync=
"check"
/>
--
>
<c-cell
<c-cell
dot
dot
title=
"添加成员"
title=
"添加成员"
class=
"mt-4"
class=
"mt-4"
@
click=
"
$router.push('/team/add-member')
"
@
click=
"
addMember
"
/>
/>
<c-cell
<c-cell
dot
dot
title=
"删除成员"
title=
"移除成员"
@
click=
"removeMember"
/>
/>
<c-button
<c-button
round
round
type=
"secondary"
class=
"mt-10"
class=
"mt-10"
@
click=
"save"
>
保存
</c-button>
<c-button
round
type=
"secondary"
class=
"mt-2.5"
@
click=
"deleteDep"
>
>
删除部门
删除部门
</c-button>
</c-button>
...
@@ -49,7 +73,9 @@
...
@@ -49,7 +73,9 @@
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Department
,
Staff
}
from
'@/Interface'
import
Vue
from
'vue'
import
Vue
from
'vue'
import
{
getContacts
}
from
'@/util/Contact'
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
name
:
'DepartmentManagement'
,
name
:
'DepartmentManagement'
,
...
@@ -59,16 +85,30 @@ export default Vue.extend({
...
@@ -59,16 +85,30 @@ export default Vue.extend({
'input-cell'
:
()
=>
import
(
'@/components/common/input-cell.vue'
),
'input-cell'
:
()
=>
import
(
'@/components/common/input-cell.vue'
),
'c-cell'
:
()
=>
import
(
'@/components/common/c-cell.vue'
),
'c-cell'
:
()
=>
import
(
'@/components/common/c-cell.vue'
),
'c-button'
:
()
=>
import
(
'@/components/common/c-button.vue'
),
'c-button'
:
()
=>
import
(
'@/components/common/c-button.vue'
),
'switch-cell'
:
()
=>
import
(
'@/components/common/switch-cell.vue'
)
'switch-cell'
:
()
=>
import
(
'@/components/common/switch-cell.vue'
),
'member-selector'
:
()
=>
import
(
'@/views/team/components/member-selector.vue'
),
'contact-selector'
:
()
=>
import
(
'@/views/team/components/contact-selector.vue'
)
},
},
data
()
{
data
()
{
const
selectedMemberId
:
Array
<
string
>
=
[]
return
{
return
{
name
:
'产品部'
,
name
:
'产品部'
,
check
:
false
,
loading
:
false
,
loading
:
false
,
depId
:
''
,
depId
:
''
,
entId
:
''
,
entId
:
''
,
depInfo
:
{}
depInfo
:
{}
as
Department
,
leaderInfo
:
{}
as
Staff
,
showMemberSelector
:
false
,
containChild
:
true
,
selectedMemberId
,
memberSelectorTitle
:
''
,
multiple
:
false
,
contacts
:
{},
showContactSelector
:
false
,
contactSelectorTitle
:
''
,
actionType
:
'add'
}
}
},
},
created
()
{
created
()
{
...
@@ -87,10 +127,118 @@ export default Vue.extend({
...
@@ -87,10 +127,118 @@ export default Vue.extend({
this
.
loading
=
false
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
if
(
data
.
code
===
this
.
$global
.
success
)
{
this
.
depInfo
=
data
.
data
this
.
depInfo
=
data
.
data
this
.
selectedMemberId
=
[
this
.
depInfo
.
leaderId
]
this
.
getStaffInfo
(
this
.
depInfo
.
leaderId
)
}
else
{
this
.
$toast
(
data
.
msg
)
}
})
},
getStaffInfo
(
id
:
string
)
{
this
.
loading
=
true
this
.
$service
.
staff
.
getInfo
({
entId
:
this
.
entId
,
id
}).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
this
.
leaderInfo
=
data
.
data
}
else
{
this
.
$toast
(
data
.
msg
)
}
})
},
// 获取通讯录
getStaff
(
id
:
string
,
isDirect
:
boolean
)
{
this
.
loading
=
true
this
.
$service
.
department
.
getSub
({
parentId
:
id
,
entId
:
this
.
entId
,
hasStaff
:
true
,
isDirect
:
isDirect
}).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
// 通讯录
this
.
contacts
=
getContacts
(
data
.
data
.
staffList
||
[])
console
.
log
(
this
.
contacts
,
data
.
data
.
staffList
,
'this.contacts'
)
// 部门树
}
else
{
}
else
{
this
.
$toast
(
data
.
msg
)
this
.
$toast
(
data
.
msg
)
}
}
})
})
},
selectLeader
()
{
this
.
showMemberSelector
=
true
this
.
multiple
=
false
this
.
selectedMemberId
=
[
this
.
leaderInfo
.
id
]
},
addMember
()
{
this
.
showContactSelector
=
true
this
.
actionType
=
"add"
this
.
contactSelectorTitle
=
'添加成员'
this
.
multiple
=
true
const
rootDepId
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
||
'{}'
).
rootDepId
this
.
getStaff
(
rootDepId
,
false
)
},
removeMember
()
{
this
.
showContactSelector
=
true
this
.
actionType
=
"remove"
this
.
contactSelectorTitle
=
'移除成员'
this
.
multiple
=
true
this
.
getStaff
(
this
.
depInfo
.
id
,
true
)
},
deleteDep
()
{
this
.
$dialog
.
confirm
({
title
:
'提示'
,
message
:
'确定要删除当前部门吗?'
// confirmButtonText: '解散'
}).
then
(()
=>
{
const
data
=
{
entId
:
this
.
entId
,
id
:
this
.
depInfo
.
id
}
this
.
loading
=
true
this
.
$service
.
department
.
deleteDep
(
data
).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
this
.
$toast
(
'删除成功'
)
this
.
$router
.
go
(
-
1
)
}
else
{
this
.
$toast
(
data
.
msg
)
}
})
}).
catch
(()
=>
{
console
.
log
(
'取消解散'
)
})
},
save
()
{
this
.
loading
=
true
const
dep
=
this
.
depInfo
const
data
=
{
name
:
dep
.
name
,
id
:
dep
.
id
,
leaderId
:
this
.
leaderInfo
.
id
,
entId
:
this
.
entId
}
this
.
$service
.
department
.
updateDep
(
data
).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
this
.
$toast
(
'保存成功'
)
this
.
$router
.
push
(
'/team/team-frame'
)
}
else
{
this
.
$toast
(
data
.
msg
)
}
})
}
},
watch
:
{
selectedMemberId
(
newVal
)
{
this
.
getStaffInfo
(
newVal
[
0
])
}
}
}
}
})
})
...
...
src/views/team/team-detail.vue
View file @
cf23efb6
...
@@ -116,7 +116,7 @@ export default Vue.extend({
...
@@ -116,7 +116,7 @@ export default Vue.extend({
parentId
:
id
,
parentId
:
id
,
entId
:
this
.
entId
,
entId
:
this
.
entId
,
hasStaff
:
true
,
hasStaff
:
true
,
isDirect
:
this
.
ifContainChildDep
isDirect
:
!
this
.
ifContainChildDep
}).
then
((
res
:
any
)
=>
{
}).
then
((
res
:
any
)
=>
{
this
.
loading
=
false
this
.
loading
=
false
const
{
data
}
=
res
const
{
data
}
=
res
...
...
src/views/team/team-frame.vue
View file @
cf23efb6
...
@@ -34,8 +34,6 @@
...
@@ -34,8 +34,6 @@
<div
class=
"pb-16"
>
<div
class=
"pb-16"
>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
<team-contacts
<team-contacts
:radio=
"showRadio"
:multiple=
"multiple"
:checked
.
sync=
"checkedMemberId"
:checked
.
sync=
"checkedMemberId"
:contacts=
"contacts"
:contacts=
"contacts"
@
click-member=
"clickMember"
@
click-member=
"clickMember"
...
@@ -43,16 +41,11 @@
...
@@ -43,16 +41,11 @@
</div>
</div>
<!-- 底部操作 -->
<!-- 底部操作 -->
<div
class=
"py-2 px-4 bg-white w-screen fixed bottom-0 left-0 z-30"
>
<div
class=
"py-2 px-4 bg-white w-screen fixed bottom-0 left-0 z-30"
>
<
template
v-if=
"showRadio"
>
<c-button
round
@
click=
"confirmSelect"
>
确定
</c-button>
</
template
>
<
template
v-else
>
<div
class=
"grid grid-cols-3 gap-2.5"
>
<div
class=
"grid grid-cols-3 gap-2.5"
>
<c-button
round
@
click=
"addMember"
>
添加成员
</c-button>
<c-button
round
@
click=
"addMember"
>
添加成员
</c-button>
<c-button
round
@
click=
"addDep"
>
添加部门
</c-button>
<c-button
round
@
click=
"addDep"
>
添加部门
</c-button>
<c-button
round
@
click=
"setDepartment"
>
部门设置
</c-button>
<c-button
round
@
click=
"setDepartment"
>
部门设置
</c-button>
</div>
</div>
</
template
>
</div>
</div>
</div>
</div>
</main-page>
</main-page>
...
@@ -104,14 +97,9 @@ export default Vue.extend({
...
@@ -104,14 +97,9 @@ export default Vue.extend({
preDep
:
{},
preDep
:
{},
// 是否显示check
// 是否显示check
checkedMemberId
:
[],
checkedMemberId
:
[],
showRadio
:
false
,
fromPath
:
''
fromPath
:
''
,
multiple
:
false
}
}
},
},
created
()
{
this
.
showRadio
=
this
.
$route
.
query
.
showRadio
===
'1'
},
mounted
()
{
mounted
()
{
// useLocalStorageState('USER_INFO',getUserInfo())
// useLocalStorageState('USER_INFO',getUserInfo())
this
.
getEntInfo
()
this
.
getEntInfo
()
...
@@ -126,11 +114,6 @@ export default Vue.extend({
...
@@ -126,11 +114,6 @@ export default Vue.extend({
this
.
parentId
=
dep
.
id
this
.
parentId
=
dep
.
id
this
.
getStaff
()
this
.
getStaff
()
},
},
// 确认选择
confirmSelect
()
{
this
.
$store
.
commit
(
'setAddDepLeader'
,
this
.
checkedMemberId
)
this
.
$router
.
push
(
this
.
fromPath
)
},
appNavBack
(){
appNavBack
(){
this
.
$router
.
go
(
-
1
)
this
.
$router
.
go
(
-
1
)
// appNavBack()
// appNavBack()
...
@@ -174,7 +157,7 @@ export default Vue.extend({
...
@@ -174,7 +157,7 @@ export default Vue.extend({
parentId
:
this
.
parentId
,
parentId
:
this
.
parentId
,
entId
:
this
.
entId
,
entId
:
this
.
entId
,
hasStaff
:
true
,
hasStaff
:
true
,
isDirect
:
this
.
ifContainChildDep
isDirect
:
!
this
.
ifContainChildDep
}).
then
((
res
:
any
)
=>
{
}).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
const
{
data
}
=
res
this
.
loading
=
false
this
.
loading
=
false
...
@@ -207,7 +190,7 @@ export default Vue.extend({
...
@@ -207,7 +190,7 @@ export default Vue.extend({
},
},
// 部门设置
// 部门设置
setDepartment
()
{
setDepartment
()
{
const
id
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
||
'{}'
).
rootDepI
d
const
id
=
this
.
currentDep
.
i
d
this
.
$router
.
push
(
`/team/department-management/
${
id
}
`
)
this
.
$router
.
push
(
`/team/department-management/
${
id
}
`
)
},
},
// 添加成员
// 添加成员
...
...
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