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
9633375d
Commit
9633375d
authored
Sep 09, 2021
by
sixiaofeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ff695904
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
164 additions
and
80 deletions
+164
-80
index.ts
src/Interface/index.ts
+30
-8
index.ts
src/util/Common/index.ts
+2
-4
index.ts
src/util/Contact/index.ts
+1
-1
add-member.vue
src/views/team/add-member.vue
+1
-1
contact-member.vue
src/views/team/components/contact-member.vue
+12
-0
contact-selector.vue
src/views/team/components/contact-selector.vue
+21
-5
dep-selector.vue
src/views/team/components/dep-selector.vue
+11
-3
member-selector.vue
src/views/team/components/member-selector.vue
+9
-7
team-contacts.vue
src/views/team/components/team-contacts.vue
+35
-16
department-management.vue
src/views/team/department-management.vue
+13
-6
team-frame.vue
src/views/team/team-frame.vue
+29
-29
No files found.
src/Interface/index.ts
View file @
9633375d
...
...
@@ -33,13 +33,34 @@ export interface Department {
}
export
interface
LocalStore
{
export
interface
LocalStore
Ent
{
avatar
:
string
description
:
string
id
:
string
imServer
:
string
name
:
string
nodeServer
:
string
oaServer
:
string
rootDepId
:
string
description
:
string
id
:
string
imServer
:
string
name
:
string
nodeServer
:
string
oaServer
:
string
rootDepId
:
string
}
export
interface
LocalStoreUsr
{
entId
:
string
,
depId
:
string
,
id
:
string
,
joinTime
:
number
,
name
:
string
,
phone
:
string
,
position
:
string
,
role
:
number
,
company
?:
{
avator
:
string
,
description
:
string
,
id
:
string
,
imServer
:
string
,
name
:
string
,
nodeServer
:
string
,
oaServer
:
string
,
rootDepId
:
string
}
}
\ No newline at end of file
src/util/Common/index.ts
View file @
9633375d
import
{
LocalStoreEnt
,
LocalStoreUsr
}
from
"@/Interface"
export
function
trim
(
str
:
string
)
{
return
str
.
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
''
)
}
export
function
generateTree
(
arr
:
Array
<
any
>
,
rootId
:
string
)
{
console
.
log
(
arr
,
rootId
)
}
export
function
formatFileSize
(
size
:
number
)
{
const
kb
=
size
/
1024
const
mb
=
kb
/
1024
...
...
src/util/Contact/index.ts
View file @
9633375d
...
...
@@ -115,7 +115,7 @@ export function getLeaders(arr: Array<Staff>) {
return
arr
.
filter
((
item
:
Staff
)
=>
item
.
role
!==
Role
.
COMMON_MEMBER
).
sort
((
a
,
b
)
=>
a
.
role
-
b
.
role
)
}
export
function
uniqueArr
(
arr
:
Array
<
Staff
>
)
{
export
function
uniqueArr
(
arr
:
Staff
[]
)
{
if
(
typeof
arr
===
'undefined'
||
arr
.
length
===
0
)
return
[]
const
res
=
new
Map
()
return
arr
.
filter
(
item
=>
{
...
...
src/views/team/add-member.vue
View file @
9633375d
...
...
@@ -82,7 +82,7 @@ import Vue from 'vue'
import
{
Calendar
,
Overlay
}
from
'vant'
import
{
AcceptJoinDTO
}
from
'@/service/moudles/service.dto'
import
{
trim
}
from
'@/util/Contact'
import
{
Department
,
LocalStore
}
from
'@/Interface'
import
{
Department
}
from
'@/Interface'
import
{
useLocalStorageState
}
from
'ahooks-vue'
import
{
formatDate
}
from
'@/util/FormatDate'
import
DepSelector
from
'@/views/team/components/dep-selector.vue'
...
...
src/views/team/components/contact-member.vue
View file @
9633375d
...
...
@@ -13,6 +13,12 @@
>
{{
tagName
(
member
)
}}
</div>
<div
v-if=
"showTitle"
class=
"tag ml-1.5 text-xs text-white px-1 py-0.5 bg-color-primary rounded"
>
{{
title
}}
</div>
</div>
</
template
>
...
...
@@ -32,6 +38,12 @@ export default Vue.extend({
default
()
{
return
{}
}
},
title
:
String
},
computed
:
{
showTitle
():
boolean
{
return
typeof
this
.
title
!==
'undefined'
&&
this
.
title
!==
''
}
},
methods
:
{
...
...
src/views/team/components/contact-selector.vue
View file @
9633375d
<
template
>
<!-- 选择成员 -->
<van-overlay
:show=
"show"
z-index=
"2000"
:lock-scroll=
"false"
>
<div
class=
"select-team w-screen h-screen overflow-auto"
>
<div
class=
"select-team w-screen h-screen overflow-auto"
id=
"contact-selector"
>
<main-page
main-bg=
"bg-white"
header-bg=
"bg-white"
...
...
@@ -13,10 +13,12 @@
<div
class=
"px-4 pt-14"
>
<!--
<div
class=
"py-2"
>
{{
currentDep
.
name
}}
</div>
-->
<!-- 通讯录 -->
<div
class=
"py-2 font-medium"
>
{{
dep
.
name
}}
</div>
<div
class=
"py-2 font-medium"
>
{{
contactTitle
?
contactTitle
:
dep
.
name
}}
</div>
<div
class=
"pb-16"
>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
<team-contacts
container-id=
"contact-selector"
:leader=
"leader"
:radio=
"true"
:multiple=
"multiple"
:checked
.
sync=
"checkedMember"
...
...
@@ -37,6 +39,11 @@
import
Vue
,
{
PropType
}
from
'vue'
import
{
Department
,
Staff
}
from
'@/Interface'
interface
Leader
{
list
:
Staff
[],
title
?:
string
}
export
default
Vue
.
extend
({
name
:
'ContactSelector'
,
components
:
{
...
...
@@ -68,7 +75,16 @@ export default Vue.extend({
return
[]
}
},
actionType
:
String
leader
:
{
type
:
Object
as
PropType
<
Leader
>
,
default
()
{
return
{
list
:
[]
}
}
},
actionType
:
String
,
contactTitle
:
String
},
data
()
{
let
changedVal
:
Array
<
string
>
=
[]
...
...
@@ -80,14 +96,14 @@ export default Vue.extend({
},
computed
:
{
checkedMember
:
{
get
():
Array
<
String
>
{
get
():
string
[]
{
if
(
!
this
.
changed
)
{
return
this
.
checkedMemberId
}
else
{
return
this
.
changedVal
}
},
set
(
val
:
Array
<
string
>
)
{
set
(
val
:
string
[]
)
{
this
.
changed
=
true
this
.
changedVal
=
val
}
...
...
src/views/team/components/dep-selector.vue
View file @
9633375d
...
...
@@ -114,7 +114,7 @@ export default Vue.extend({
},
methods
:
{
showChecked
(
dep
:
Department
):
boolean
{
return
(
!
this
.
checked
&&
this
.
selected
===
dep
.
id
)
||
this
.
checked
===
dep
.
id
return
this
.
checked
===
dep
.
id
},
goBack
()
{
this
.
$emit
(
'update:show'
,
false
)
...
...
@@ -145,7 +145,7 @@ export default Vue.extend({
// 所有部门
goPre
()
{
this
.
depId
=
this
.
currentDep
.
parentId
this
.
checked
=
''
this
.
checked
=
this
.
selected
this
.
getSub
()
},
// 选择
...
...
@@ -157,7 +157,6 @@ export default Vue.extend({
},
// 确认选择
confirm
()
{
console
.
log
(
this
.
checked
,
'ched'
)
if
(
this
.
checked
===
''
)
{
this
.
$toast
(
'请选择部门'
)
return
...
...
@@ -165,6 +164,15 @@ export default Vue.extend({
this
.
$emit
(
'update:selected'
,
this
.
checked
)
this
.
$emit
(
'update:show'
,
false
)
}
},
watch
:
{
show
(
val
:
boolean
)
{
if
(
val
)
{
this
.
checked
=
this
.
selected
}
else
{
this
.
checked
=
''
}
}
}
})
</
script
>
...
...
src/views/team/components/member-selector.vue
View file @
9633375d
<
template
>
<!-- 选择成员 -->
<van-overlay
:show=
"show"
z-index=
"2000"
:lock-scroll=
"false"
>
<div
class=
"select-team w-screen h-screen overflow-auto"
>
<div
class=
"select-team w-screen h-screen overflow-auto"
id=
"member-selector"
>
<main-page
main-bg=
"bg-white"
header-bg=
"bg-white"
...
...
@@ -38,6 +38,8 @@
<div
class=
"pb-16"
>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
<team-contacts
container-id=
"member-selector"
:leader=
"leaders"
:radio=
"true"
:multiple=
"multiple"
:checked
.
sync=
"checkedMember"
...
...
@@ -114,7 +116,8 @@ export default Vue.extend({
// checkedMember: [],
showRadio
:
true
,
changed
:
false
,
changedVal
changedVal
,
leaders
:
{}
as
{
list
:
Staff
[],
title
?:
string
},
}
},
mounted
()
{
...
...
@@ -196,11 +199,10 @@ export default Vue.extend({
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
this
.
currentDep
=
data
.
data
.
dep
// 通讯录
this
.
contacts
=
data
.
data
.
staffList
||
[]
if
(
typeof
data
.
data
.
leader
!==
'undefined'
)
{
this
.
contacts
.
push
(
data
.
data
.
leader
)
}
// 负责人/管理员
this
.
leaders
.
list
=
data
.
data
.
staffList
.
filter
((
i
:
Staff
)
=>
i
.
role
!==
3
)
// 普通成员
this
.
contacts
=
data
.
data
.
staffList
.
filter
((
i
:
Staff
)
=>
i
.
role
===
3
)
// 部门树
const
depTree
=
data
.
data
.
dep
depTree
.
children
=
data
.
data
.
subDepList
...
...
src/views/team/components/team-contacts.vue
View file @
9633375d
...
...
@@ -13,18 +13,18 @@
{{
nav
}}
</div>
</div>
<template
v-if=
"Object.keys(list).length > 0 || leader
s
.length > 0"
>
<template
v-if=
"Object.keys(list).length > 0 || leader
.list && leader.list
.length > 0"
>
<!-- 主管负责人 -->
<div
class=
"leaders"
v-if=
"leader
s
.length > 0"
>
<div
class=
"leaders"
v-if=
"leader
.list
.length > 0"
>
<div
v-for=
"(l
eader, index) in leaders
"
v-for=
"(l
, index) in leader.list
"
:key=
"index"
class=
"flex items-center color-color-primary font-normal"
>
<!-- 设置radio -->
<template
v-if=
"radio"
>
<div
class=
"w-8 h-8 flex items-center justify-start"
@
click=
"handleCheck(l
eader
)"
>
<template
v-if=
"checked.indexOf(l
eader
.id) > -1"
>
<div
class=
"w-8 h-8 flex items-center justify-start"
@
click=
"handleCheck(l)"
>
<template
v-if=
"checked.indexOf(l.id) > -1"
>
<app-icon
type=
"png"
icon-name=
"radio-checked"
...
...
@@ -40,7 +40,7 @@
</
template
>
</div>
</template>
<contact-member
:member=
"l
eader"
@
click=
"clickMember"
/>
<contact-member
:member=
"l
"
@
click=
"clickMember"
:title=
"leader.title"
/>
</div>
</div>
<!-- 成员 -->
...
...
@@ -98,8 +98,14 @@ import { getContacts, getLeaders, uniqueArr } from '@/util/Contact'
export
default
Vue
.
extend
({
props
:
{
leader
:
{
type
:
Object
,
default
(){
return
{}
}
},
contactList
:
{
type
:
Array
as
PropType
<
Array
<
Staff
>
>
,
type
:
Array
as
PropType
<
Staff
[]
>
,
default
()
{
return
[]
}
...
...
@@ -117,7 +123,8 @@ export default Vue.extend({
multiple
:
{
type
:
Boolean
,
default
:
false
}
},
containerId
:
String
},
components
:{
'app-icon'
:()
=>
import
(
'@/components/common/Icon.vue'
),
...
...
@@ -132,20 +139,32 @@ export default Vue.extend({
}
},
mounted
()
{
if
(
typeof
this
.
containerId
!==
'undefined'
)
{
this
.
container
.
addEventListener
(
'scroll'
,
this
.
scrollHandler
)
}
else
{
window
.
addEventListener
(
'scroll'
,
this
.
scrollHandler
)
}
},
beforeDestroy
()
{
if
(
typeof
this
.
containerId
!==
'undefined'
)
{
this
.
container
.
removeEventListener
(
'scroll'
,
this
.
scrollHandler
)
}
else
{
window
.
removeEventListener
(
'scroll'
,
this
.
scrollHandler
)
}
},
computed
:
{
leaders
()
{
return
getLeaders
(
uniqueArr
(
this
.
contactList
))
container
():
HTMLElement
{
if
(
typeof
this
.
containerId
!==
'undefined'
&&
this
.
containerId
!==
''
)
{
return
document
.
getElementById
(
this
.
containerId
)
as
HTMLDivElement
}
else
{
return
document
.
documentElement
}
},
filteredContacts
()
{
return
getContacts
(
uniqueArr
(
this
.
contactList
).
filter
((
staff
:
Staff
)
=>
staff
.
role
===
Role
.
COMMON_MEMBER
)
||
[]
)
filteredContacts
()
:{[
key
:
string
]:
Staff
[]}
{
return
getContacts
(
this
.
contactList
.
filter
((
c
:
Staff
)
=>
this
.
leader
.
list
.
findIndex
((
l
:
Staff
)
=>
l
.
id
===
c
.
id
)
<
0
)
)
},
navs
()
{
let
arr
:
Array
<
string
>
=
[]
navs
()
:
string
[]
{
let
arr
=
[]
for
(
let
key
in
this
.
filteredContacts
)
{
if
(
key
!==
'#'
){
arr
.
push
(
key
)
...
...
@@ -173,7 +192,7 @@ export default Vue.extend({
}
},
scrollHandler
()
{
const
top
=
document
.
documentElement
.
scrollTop
const
top
=
this
.
container
.
scrollTop
this
.
scrollTop
=
top
this
.
navs
.
forEach
(
nav
=>
{
if
((
this
.
$refs
[
nav
]
as
Array
<
HTMLDivElement
>
).
length
>
0
)
{
...
...
@@ -188,7 +207,7 @@ export default Vue.extend({
this
.
currentNav
=
nav
const
div
=
(
this
.
$refs
[
nav
]
as
Array
<
HTMLDivElement
>
)[
0
]
const
top
=
div
.
getBoundingClientRect
().
top
document
.
documentElement
.
scrollTop
=
this
.
scrollTop
+
top
-
48
this
.
container
.
scrollTop
=
this
.
scrollTop
+
top
-
48
},
clickMember
(
member
:
Staff
)
{
if
(
this
.
radio
)
{
...
...
src/views/team/department-management.vue
View file @
9633375d
...
...
@@ -6,12 +6,14 @@
@
click-left=
"$router.go(-1)"
>
<member-selector
:show-team=
"true"
:title=
"memberSelectorTitle"
:show
.
sync=
"showMemberSelector"
:multiple=
"multiple"
:checked-member-id
.
sync=
"selectedMemberId"
/>
<contact-selector
:contact-title=
"contactTitle"
:ent-id=
"entId"
:dep=
"depInfo"
:title=
"contactSelectorTitle"
...
...
@@ -19,7 +21,7 @@
:multiple=
"multiple"
:action-type=
"actionType"
:contacts=
"contacts"
:leader
s=
"leaders
"
:leader
=
"leader
"
/>
<div
class=
"pt-14 px-4"
>
<input-cell
...
...
@@ -106,11 +108,12 @@ export default Vue.extend({
multiple
:
false
,
contacts
:
[]
as
Array
<
Staff
>
,
leader
s
:
[]
as
Array
<
Staff
>
,
leader
:
{}
as
{
list
:
Staff
[],
title
?:
string
}
,
showContactSelector
:
false
,
contactSelectorTitle
:
''
,
actionType
:
'add'
,
parentDepName
:
''
parentDepName
:
''
,
contactTitle
:
''
}
},
async
created
()
{
...
...
@@ -172,10 +175,14 @@ export default Vue.extend({
if
(
data
.
code
===
this
.
$global
.
success
)
{
// 通讯录
this
.
contacts
=
data
.
data
.
staffList
||
[]
if
(
typeof
data
.
data
.
leader
!==
'undefined'
)
{
this
.
contacts
.
push
(
data
.
data
.
leader
)
if
(
this
.
actionType
===
'add'
)
{
this
.
leader
.
list
=
data
.
data
.
staffList
.
filter
((
i
:
Staff
)
=>
i
.
role
!==
3
)
this
.
leader
.
title
=
''
this
.
contactTitle
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
as
string
).
name
}
else
{
this
.
leader
.
list
=
typeof
data
.
data
.
leader
===
'undefined'
?
[]
:
[
data
.
data
.
leader
]
this
.
leader
.
title
=
'主管'
}
// 部门树
}
else
{
this
.
$toast
(
data
.
msg
)
}
...
...
src/views/team/team-frame.vue
View file @
9633375d
...
...
@@ -34,17 +34,18 @@
<div
class=
"pb-16"
>
<div
class=
"text-text-secondary py-1"
>
成员
</div>
<team-contacts
:leader=
"leaders"
:checked
.
sync=
"checkedMemberId"
:contact-list=
"co
ntacts
"
:contact-list=
"co
mmonMember
"
@
click-member=
"clickMember"
/>
</div>
<!-- 底部操作 -->
<div
class=
"py-2 px-4 bg-white w-screen fixed bottom-0 left-0 z-30"
v-if=
"
role !=3
"
>
<div
class=
"grid gap-2.5"
:class=
"
currentDep.parentId !== '-1'
? 'grid-cols-3' : 'grid-cols-2'"
>
<div
class=
"py-2 px-4 bg-white w-screen fixed bottom-0 left-0 z-30"
v-if=
"
showBottomBtn
"
>
<div
class=
"grid gap-2.5"
:class=
"
isNotDepRoot
? 'grid-cols-3' : 'grid-cols-2'"
>
<c-button
round
@
click=
"addMember"
>
添加成员
</c-button>
<c-button
round
@
click=
"addDep"
>
添加部门
</c-button>
<c-button
round
@
click=
"setDepartment"
v-if=
"
currentDep.parentId !== '-1'
"
>
部门设置
</c-button>
<c-button
round
@
click=
"setDepartment"
v-if=
"
isNotDepRoot
"
>
部门设置
</c-button>
</div>
</div>
</div>
...
...
@@ -54,9 +55,9 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
{
useLocalStorageState
}
from
'ahooks-vue'
import
{
appNavBack
,
getUserInfo
,
goBack
,
openCompanyUserInfo
}
from
'@/util/Bridge'
import
{
Department
,
Staff
}
from
'@/Interface'
import
{
Department
,
LocalStoreUsr
,
Staff
}
from
'@/Interface'
import
{
Role
}
from
'@/service/moudles/service.dto'
// import {openCompanyUserInfo} from '@/util/Bridge'
export
default
Vue
.
extend
({
...
...
@@ -69,11 +70,6 @@ export default Vue.extend({
'c-button'
:
()
=>
import
(
'@/components/common/c-button.vue'
),
'switch-cell'
:
()
=>
import
(
'@/components/common/switch-cell.vue'
)
},
beforeRouteEnter
(
to
,
from
,
next
)
{
next
((
vm
:
any
)
=>
{
vm
.
fromPath
=
from
.
path
})
},
data
()
{
const
team
:
Department
[]
=
[]
const
currentDep
:
Department
=
{
...
...
@@ -96,32 +92,29 @@ export default Vue.extend({
preDep
:
{},
// 是否显示check
checkedMemberId
:
[],
fromPath
:
''
,
role
:
null
role
:
3
,
leaders
:
{}
as
{
list
:
Staff
[],
title
?:
string
},
commonMember
:
[]
as
Staff
[]
}
},
async
mounted
()
{
const
res
=
JSON
.
parse
(
getUserInfo
()
||
"{}"
)
this
.
role
=
process
.
env
.
NODE_ENV
===
'production'
&&
res
.
role
this
.
entId
=
process
.
env
.
NODE_ENV
===
'production'
?
res
.
entId
:
'168398222891421696'
localStorage
.
setItem
(
'USR_INFO'
,
getUserInfo
())
console
.
log
(
this
.
role
,
this
.
entId
,
'sdflokjsdklfjsdlkflsdjklfjsd;lkfjksld'
);
<<<<<<<
HEAD
await
this
.
getEntInfo
()
=======
this
.
entId
=
process
.
env
.
NODE_ENV
===
'production'
?
res
.
entId
:
'168398222891421696'
console
.
log
(
'这里出来了么?'
,
this
.
entId
,
getUserInfo
(),
'这里呢'
);
localStorage
.
setItem
(
'USR_INFO'
,
JSON
.
stringify
(
getUserInfo
()))
const
usrInfo
=
JSON
.
parse
(
getUserInfo
()
||
"{}"
)
this
.
role
=
usrInfo
.
role
this
.
entId
=
process
.
env
.
NODE_ENV
===
'production'
?
usrInfo
.
entId
:
'168398222891421696'
this
.
getEntInfo
()
>>>>>>>
12282
a6f1686f9876c0e8110a24cada261c108f6
},
computed
:
{
isDepDetail
():
boolean
{
return
this
.
currentDep
.
parentId
!==
'-1'
},
isNotDepRoot
():
boolean
{
return
this
.
currentDep
.
parentId
!==
'-1'
},
showBottomBtn
():
boolean
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
return
true
return
this
.
role
===
Role
.
SUPER_ADMIN
||
this
.
role
===
Role
.
LEADER
}
},
methods
:
{
goPre
(
dep
:
Department
)
{
...
...
@@ -176,9 +169,16 @@ export default Vue.extend({
this
.
currentDep
=
data
.
data
.
dep
// 通讯录
this
.
contacts
=
data
.
data
.
staffList
||
[]
if
(
typeof
data
.
data
.
leader
!==
'undefined'
)
{
this
.
contacts
.
push
(
data
.
data
.
leader
)
// 负责人/管理员
if
(
this
.
isNotDepRoot
)
{
this
.
leaders
.
list
=
typeof
data
.
data
.
leader
===
'undefined'
?
[]
:
[
data
.
data
.
leader
]
this
.
leaders
.
title
=
'主管'
}
else
{
this
.
leaders
.
list
=
data
.
data
.
staffList
.
filter
((
i
:
Staff
)
=>
i
.
role
!==
3
)
this
.
leaders
.
title
=
''
}
// 普通成员
this
.
commonMember
=
data
.
data
.
staffList
.
filter
((
i
:
Staff
)
=>
i
.
role
===
3
)
// 部门树
const
depTree
=
data
.
data
.
dep
depTree
.
children
=
data
.
data
.
subDepList
...
...
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