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
b56807a9
Commit
b56807a9
authored
Sep 16, 2021
by
sixiaofeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
24154def
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
216 additions
and
217 deletions
+216
-217
okr.rar
okr.rar
+0
-0
App.vue
src/App.vue
+14
-3
index.ts
src/Interface/index.ts
+3
-0
js.png
src/assets/icons/js.png
+0
-0
photo.png
src/assets/icons/photo.png
+0
-0
base.ts
src/service/base.ts
+0
-1
index.ts
src/util/Bridge/index.ts
+1
-1
index.ts
src/util/PostMessage/index.ts
+2
-5
index.ts
src/util/TransferFile/index.ts
+16
-0
add-department.vue
src/views/team/add-department.vue
+1
-15
add-member.vue
src/views/team/add-member.vue
+3
-17
auth-management.vue
src/views/team/auth-management.vue
+4
-15
avator-editor.vue
src/views/team/components/avator-editor.vue
+23
-39
contact-selector.vue
src/views/team/components/contact-selector.vue
+1
-1
dep-selector.vue
src/views/team/components/dep-selector.vue
+4
-12
member-selector.vue
src/views/team/components/member-selector.vue
+12
-16
team-contacts.vue
src/views/team/components/team-contacts.vue
+10
-3
team-tree.vue
src/views/team/components/team-tree.vue
+1
-1
create-team.vue
src/views/team/create-team/create-team.vue
+32
-4
department-management.vue
src/views/team/department-management.vue
+46
-21
select-team.vue
src/views/team/select-team.vue
+1
-9
team-frame.vue
src/views/team/team-frame.vue
+10
-12
team-info.vue
src/views/team/team-info/team-info.vue
+11
-33
team-management.vue
src/views/team/team-management.vue
+1
-1
two-code.vue
src/views/team/two-code.vue
+11
-7
vue.config.js
vue.config.js
+9
-1
No files found.
okr.rar
0 → 100644
View file @
b56807a9
File added
src/App.vue
View file @
b56807a9
...
...
@@ -6,7 +6,7 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
{
isAppEnv
}
from
'./util/Bridge'
import
{
isAppEnv
,
close
}
from
'./util/Bridge'
import
{
postMessage
}
from
'@/util/PostMessage'
import
{
PostMsg
}
from
'./Interface'
...
...
@@ -22,22 +22,33 @@ export default Vue.extend({
}
},
created
()
{
console
.
log
(
isAppEnv
(),
'env'
)
if
(
!
isAppEnv
())
{
this
.
intervalHandler
()
this
.
timer
=
setInterval
(
this
.
intervalHandler
,
60
*
1000
)
}
if
(
window
.
history
)
{
window
.
addEventListener
(
'popstate'
,
this
.
handler
)
}
},
beforeDestroy
()
{
if
(
!
isAppEnv
())
{
clearInterval
(
this
.
timer
)
}
window
.
removeEventListener
(
'popstate'
,
this
.
handler
)
},
methods
:
{
handler
(
e
:
PopStateEvent
)
{
if
(
this
.
$route
.
path
===
'/team/team-frame'
)
{
close
()
}
if
(
this
.
$route
.
path
===
'/team/two-code'
)
{
console
.
log
(
'two-code'
)
window
.
history
.
pushState
(
null
,
''
,
window
.
origin
+
'/team/team-frame'
)
}
},
intervalHandler
()
{
postMessage
(
PostMsg
.
GET_AUTH
).
then
((
data
:
any
)
=>
{
if
(
data
.
method
===
PostMsg
.
GET_AUTH
)
{
console
.
log
(
data
,
'getAuth'
)
this
.
$global
.
sig
=
data
.
data
}
})
...
...
src/Interface/index.ts
View file @
b56807a9
...
...
@@ -37,8 +37,11 @@ export interface Department {
entId
:
string
,
id
:
string
,
leaderId
:
string
,
leaderName
?:
string
,
name
:
string
,
parentId
:
string
,
hasSubDep
:
boolean
,
staffNum
:
number
,
children
?:
Array
<
Department
>
}
...
...
src/assets/icons/js.png
0 → 100644
View file @
b56807a9
6.29 KB
src/assets/icons/photo.png
0 → 100644
View file @
b56807a9
1.97 KB
src/service/base.ts
View file @
b56807a9
...
...
@@ -30,7 +30,6 @@ export default class BaseService {
(
res
)
=>
{
if
(
!
isAppEnv
())
{
// from pc
console
.
log
(
'request'
)
res
.
headers
[
'FZM-SIGNATURE'
]
=
global
.
sig
||
'MOCK'
}
return
res
...
...
src/util/Bridge/index.ts
View file @
b56807a9
...
...
@@ -42,6 +42,7 @@ enum BridgeMethods {
export
function
isAppEnv
()
{
const
env
=
window
.
navigator
.
userAgent
||
navigator
.
userAgent
console
.
log
(
env
,
env
.
includes
(
';FZM-3SYXIN;'
),
'appEnv'
)
if
(
env
.
includes
(
';FZM-3SYXIN;'
))
{
return
true
}
else
{
...
...
@@ -51,7 +52,6 @@ export function isAppEnv() {
export
function
appNavBack
()
{
const
appEnv
=
isAppEnv
()
console
.
log
(
111
,
appEnv
)
if
(
appEnv
)
{
goBack
()
}
else
{
...
...
src/util/PostMessage/index.ts
View file @
b56807a9
export
function
postMessage
(
method
:
string
,
body
?:
any
):
Promise
<
any
>
{
console
.
log
(
method
,
'post message'
)
export
function
postMessage
(
method
:
string
,
body
?:
any
):
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
window
.
parent
.
postMessage
({
appId
:
'3syxin'
,
...
...
@@ -7,10 +6,8 @@ export function postMessage(method: string, body?: any ): Promise<any> {
body
},
'*'
)
window
.
addEventListener
(
'message'
,
handler
)
function
handler
(
e
:
MessageEvent
)
{
const
{
data
}
=
e
console
.
log
(
data
.
body
,
'message body'
)
const
{
data
}
=
e
resolve
({
method
,
data
:
data
.
body
...
...
src/util/TransferFile/index.ts
0 → 100644
View file @
b56807a9
export
function
transferFile
(
base64Str
:
string
,
fileName
:
string
)
{
let
arr
=
base64Str
.
split
(
','
),
mime
=
(
arr
[
0
].
match
(
/:
(
.*
?)
;/
)
as
any
)[
1
],
//base64解析出来的图片类型
bstr
=
atob
(
arr
[
1
])
,
//对base64串进行操作,去掉url头,并转换为byte atob为window内置方法
len
=
bstr
.
length
,
ab
=
new
ArrayBuffer
(
len
),
//将ASCII码小于0的转换为大于0
u8arr
=
new
Uint8Array
(
ab
)
//
while
(
len
--
)
{
u8arr
[
len
]
=
bstr
.
charCodeAt
(
len
)
}
// 创建新的 File 对象实例[utf-8内容,文件名称或者路径,[可选参数,type:文件中的内容mime类型]]
return
new
File
([
u8arr
],
fileName
,
{
type
:
mime
})
}
\ No newline at end of file
src/views/team/add-department.vue
View file @
b56807a9
...
...
@@ -75,20 +75,6 @@ export default Vue.extend({
name
:
''
,
parentId
:
''
}
const
depTree
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
}
const
currentDep
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
}
return
{
name
:
''
,
check
:
false
,
...
...
@@ -103,7 +89,7 @@ export default Vue.extend({
selectedLeaderId
:
[]
as
Array
<
string
>
,
showMemberSelector
:
false
,
entId
:
''
,
depTree
,
depTree
:
{}
as
Department
,
selectedDepId
:
''
,
contacts
:
{},
loading
:
false
,
...
...
src/views/team/add-member.vue
View file @
b56807a9
...
...
@@ -71,7 +71,7 @@
color=
"#4F62C1"
:show-confirm=
"true"
:style=
"{ height: '100%' }"
:min-date=
"new Date(19
00
,1,1)"
:min-date=
"new Date(19
71
,1,1)"
@
confirm=
"selectJoinTime"
/>
<!-- 选择部门 -->
...
...
@@ -130,20 +130,6 @@ export default Vue.extend({
})
},
data
()
{
const
currentDep
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
,
}
const
depTree
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
}
const
acceptJoin
:
AcceptJoinDTO
=
{
expiration
:
0
,
inviterId
:
''
,
...
...
@@ -164,12 +150,12 @@ export default Vue.extend({
depId
:
''
,
entId
:
''
,
selectedDepId
:
''
,
currentDep
,
currentDep
:
{}
as
Department
,
loading
:
false
,
acceptJoin
,
updateStaff
:
{}
as
UpdateStaffDTO
,
showDepSelector
:
false
,
depTree
,
depTree
:
{}
as
Department
,
pageTitle
:
'添加成员'
,
isEdit
:
false
,
usrId
:
''
,
...
...
src/views/team/auth-management.vue
View file @
b56807a9
...
...
@@ -114,9 +114,9 @@ export default Vue.extend({
// 添加管理员
confirm
(
arr
:
string
[])
{
if
(
arr
.
length
===
0
)
return
this
.
changeRole
(
arr
[
0
],
1
)
this
.
changeRole
(
arr
[
0
],
1
,
'add'
)
},
changeRole
(
id
:
string
,
role
:
number
)
{
changeRole
(
id
:
string
,
role
:
number
,
action
:
string
)
{
this
.
loading
=
true
return
this
.
$service
.
staff
.
changeRole
({
entId
:
this
.
entInfo
.
id
,
...
...
@@ -126,7 +126,7 @@ export default Vue.extend({
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
this
.
$toast
(
'添加成功'
)
this
.
$toast
(
action
===
'remove'
?
'删除成功'
:
'添加成功'
)
// this.getSub()
this
.
$router
.
push
(
'/team/team-management'
)
}
else
{
...
...
@@ -156,18 +156,7 @@ export default Vue.extend({
removeManager
(
id
:
string
)
{
// this.list = this.list.filter(item => item.id !== id)
this
.
loading
=
true
this
.
changeRole
(
id
,
3
).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
// 移除成功
this
.
$toast
(
'删除成功'
)
// this.getSub()
this
.
$router
.
push
(
'/team/team-management'
)
}
else
{
this
.
$toast
(
data
.
msg
)
}
}).
catch
(()
=>
this
.
loading
=
false
)
this
.
changeRole
(
id
,
3
,
'remove'
)
},
addManager
()
{
this
.
selectedLeaderId
=
[]
...
...
src/views/team/components/avator-editor.vue
View file @
b56807a9
<
template
>
<!-- 头像 -->
<div
v-if=
"show"
class=
"w-full h-screen overflow-y-scroll relative z-2001 bg-black pb-4"
>
<van-action-sheet
v-model=
"showActionSheet"
cancel-text=
"取消"
close-on-click-action
>
<div
class=
"header w-full px-4 bg-black fixed top-0 left-0 z-2001 h-12 flex items-center justify-between"
>
<app-icon
class-name=
"w-6.5 h-6.5"
icon-name=
"left-arrow-white"
@
click=
"goBack"
/>
<div
class=
"text-white"
>
团队头像
</div>
<div
class=
""
>
<!--
<div
class=
"px-4 py-3 text-center"
>
拍照
</div>
-->
<div
class=
"px-4 py-3 text-center"
@
click=
"uploadFile"
>
<div>
从手机相册中选择
</div>
<div
@
click=
"uploadFile"
>
<app-icon
class-name=
"w-6.5 h-6.5"
icon-name=
"photo"
/>
<input
type=
"file"
id=
"uploadFile"
...
...
@@ -20,19 +25,11 @@
/>
</div>
</div>
</van-action-sheet>
<div
class=
"header w-full px-4 bg-black fixed top-0 left-0 z-2001 h-12 flex items-center justify-between"
>
<app-icon
class-name=
"w-6.5 h-6.5"
icon-name=
"left-arrow-white"
@
click=
"goBack"
/>
<div
class=
"text-white"
>
团队头像
</div>
<app-icon
<!--
<app-icon
class-name=
"w-5 h-1"
icon-name=
"dot-h"
@
click=
"showActionSheet=true"
/>
/>
-->
</div>
<div
class=
"py-16 px-6"
>
<!-- 默认头像 -->
...
...
@@ -87,16 +84,11 @@ export default Vue.extend({
cameraHeight
:
0
,
stream
:
{}
as
any
,
myCropper
:
{}
as
Cropper
,
showActionSheet
:
false
,
// showVideo: false,
showCropper
:
false
,
showCamera
:
false
,
showDefault
:
true
,
img
:
''
,
actions
:
[
// {name: '拍照', action: 'photo'},
{
name
:
'从手机相册选择'
,
action
:
'file'
}
],
defaultImg
:
''
}
},
...
...
@@ -118,32 +110,22 @@ export default Vue.extend({
reader
.
readAsDataURL
(
file
)
reader
.
onloadend
=
()
=>
{
this
.
img
=
reader
.
result
as
string
this
.
showCropper
=
true
this
.
showDefault
=
false
this
.
$nextTick
(()
=>
{
this
.
initCropper
()
})
this
.
defaultImg
=
reader
.
result
as
string
// this.showCropper = true
// this.showDefault = false
// this.$nextTick(() => {
// this.initCropper()
// })
}
}
},
uploadFile
()
{
const
fileInput
=
this
.
$refs
.
uploadFile
as
HTMLInputElement
fileInput
.
click
()
this
.
showActionSheet
=
false
},
goBack
()
{
this
.
$emit
(
'update:show'
,
false
)
},
onSelect
(
item
:
{
name
:
string
,
action
:
string
})
{
if
(
item
.
action
===
'photo'
)
{
this
.
showCamera
=
true
this
.
showDefault
=
false
// this.showVideo=true
this
.
$nextTick
(()
=>
{
this
.
openCamera
()
})
}
},
// 保存头像
saveImage
()
{
this
.
showCropper
=
false
...
...
@@ -173,6 +155,7 @@ export default Vue.extend({
alert
(
"你的浏览器不支持访问用户媒体设备"
)
}
},
// 图片裁剪
initCropper
()
{
this
.
myCropper
.
destroy
&&
this
.
myCropper
.
destroy
()
this
.
myCropper
=
new
Cropper
(
this
.
$refs
.
image
as
HTMLImageElement
,
{
...
...
@@ -243,7 +226,7 @@ export default Vue.extend({
this
.
showCropper
=
false
this
.
myCropper
.
destroy
()
},
// 摄像头读取头像
//
保存
摄像头读取头像
saveImg
()
{
this
.
readImg
()
this
.
stream
.
getTracks
().
forEach
(
function
(
track
:
any
){
...
...
@@ -255,6 +238,7 @@ export default Vue.extend({
this
.
initCropper
()
})
},
// 摄像头拍照
readImg
()
{
let
video
=
this
.
$refs
.
video
as
HTMLVideoElement
,
canvas
=
this
.
$refs
.
canvas
as
HTMLCanvasElement
,
...
...
src/views/team/components/contact-selector.vue
View file @
b56807a9
...
...
@@ -92,7 +92,7 @@ export default Vue.extend({
loading
:
false
,
changed
:
false
,
changedVal
,
checkedMember
:
[]
as
string
[]
,
checkedMember
:
[]
as
string
[]
}
},
watch
:
{
...
...
src/views/team/components/dep-selector.vue
View file @
b56807a9
...
...
@@ -39,10 +39,11 @@
/>
</div>
<div
class=
"title flex-1 truncate py-3 ml-6"
>
{{
t
.
name
}}{{
t
.
children
&&
t
.
children
.
length
>
0
?
` (${t.children.length
}
) `
:
''
}}
{{
t
.
name
}}{{
t
.
staffNum
?
` (${t.staffNum
}
) `
:
''
}}
<
/div
>
<
/div
>
<
div
v
-
if
=
"t.hasSubDep"
class
=
"flex-shrink-0 flex items-center text-color-primary py-3"
@
click
=
"goNext(t)"
>
...
...
@@ -86,21 +87,13 @@ export default Vue.extend({
selected
:
String
,
}
,
data
()
{
// const selectedIds: Array<Department> = []
const
currentDep
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
,
children
:
[]
}
// const selectedIds: Array<Department> = []
}
return
{
checked
:
''
,
loading
:
false
,
entId
:
''
,
depId
:
''
,
currentDep
,
currentDep
:
{
}
as
Department
,
teams
:
[]
as
Department
[],
depList
:
[]
as
Department
[]
}
...
...
@@ -140,7 +133,6 @@ export default Vue.extend({
this
.
currentDep
.
children
=
data
.
data
.
subDepList
const
index
=
this
.
teams
.
findIndex
(
d
=>
d
.
id
===
this
.
depId
)
this
.
depList
=
data
.
data
.
subDepList
||
[]
console
.
log
(
index
,
'idex'
)
if
(
index
<
0
)
{
this
.
teams
.
push
(
data
.
data
.
dep
)
}
else
{
...
...
src/views/team/components/member-selector.vue
View file @
b56807a9
...
...
@@ -57,10 +57,8 @@
<
script
lang=
"ts"
>
import
Vue
,
{
PropType
}
from
'vue'
import
{
useLocalStorageState
}
from
'ahooks-vue'
import
{
getUserInfo
,
openCompanyUserInfo
}
from
'@/util/Bridge'
import
{
getContacts
}
from
'@/util/Contact'
import
{
Department
,
Staff
}
from
'@/Interface'
import
{
Role
}
from
'@/service/moudles/service.dto'
// import {openCompanyUserInfo} from '@/util/Bridge'
export
default
Vue
.
extend
({
...
...
@@ -98,13 +96,6 @@ export default Vue.extend({
},
data
()
{
const
tree
:
Array
<
Department
>
=
[]
const
currentDep
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
}
return
{
tree
,
teamArr
:
[]
as
Department
[],
...
...
@@ -113,11 +104,11 @@ export default Vue.extend({
parentId
:
''
,
entId
:
''
,
ifContainChildDep
:
true
,
currentDep
,
currentDep
:
{}
as
Department
,
checkedMember
:
[]
as
string
[],
showRadio
:
true
,
leaders
:
{}
as
{
list
:
Staff
[],
title
?:
string
}
,
leaders
:
{}
as
{
list
:
Staff
[],
title
?:
string
}
}
},
mounted
()
{
...
...
@@ -215,13 +206,18 @@ export default Vue.extend({
// 负责人/管理员
if
(
this
.
isNotDepRoot
)
{
// 不在架构根目录
const
leader
=
{...
data
.
data
.
leader
,
isDepAdmin
:
true
}
this
.
leaders
.
list
=
[
leader
]
const
leader
=
data
.
data
.
leader
if
(
typeof
leader
!==
'undefined'
&&
leader
.
id
!==
''
)
{
const
staff
=
{...
data
.
data
.
leader
,
isDepAdmin
:
true
}
this
.
leaders
.
list
=
[
staff
]
}
else
{
this
.
leaders
.
list
=
[]
}
}
else
{
this
.
leaders
.
list
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
!==
3
)
this
.
leaders
.
list
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
!==
Role
.
COMMON_MEMBER
).
sort
((
a
:
Staff
,
b
:
Staff
)
=>
a
.
role
-
b
.
role
)
}
// 普通成员
this
.
contacts
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
===
3
)
this
.
contacts
=
data
.
data
.
staffList
||
[]
// 部门树
const
depTree
=
data
.
data
.
dep
const
index
=
this
.
teamArr
.
findIndex
(
d
=>
d
.
id
===
this
.
parentId
)
...
...
src/views/team/components/team-contacts.vue
View file @
b56807a9
...
...
@@ -16,14 +16,14 @@
<template
v-if=
"Object.keys(list).length > 0 || (leader.list && leader.list.length > 0)"
>
<!-- 主管负责人 -->
<div
class=
"leaders"
v-if=
"leader.list.length > 0"
>
<div
class=
"text-text-secondary py-1"
>
管理员
</div>
<div
class=
"text-text-secondary py-1"
>
{{
sectionTitleLeader
}}
</div>
<div
v-for=
"(l, index) in leader.list"
:key=
"index"
class=
"flex items-center color-color-primary font-normal"
>
<!-- 设置radio -->
<template
v-if=
"radio"
>
<template
v-if=
"radio
&& canSelectLeader(l)
"
>
<div
class=
"w-8 h-8 flex items-center justify-start"
@
click=
"handleCheck(l)"
>
<template
v-if=
"checked.indexOf(l.id) > -1"
>
<app-icon
...
...
@@ -126,7 +126,11 @@ export default Vue.extend({
type
:
Boolean
,
default
:
false
},
containerId
:
String
containerId
:
String
,
sectionTitleLeader
:
{
type
:
String
,
default
:
'权限管理'
}
},
components
:{
'app-icon'
:()
=>
import
(
'@/components/common/Icon.vue'
),
...
...
@@ -190,6 +194,9 @@ export default Vue.extend({
}
},
methods
:
{
canSelectLeader
(
leader
:
Staff
)
{
return
this
.
contactList
.
findIndex
((
l
:
Staff
)
=>
l
.
id
===
leader
.
id
)
>
-
1
},
debounce
(
fn
:
()
=>
void
,
delay
:
number
)
{
let
timer
:
number
|
null
return
function
()
{
...
...
src/views/team/components/team-tree.vue
View file @
b56807a9
...
...
@@ -40,7 +40,7 @@
<!-- 横线 -->
<div
class=
"absolute w-3 h-0.5 left-3 bg-border-lighter top-1/2 transform -translate-y-1/2"
/>
<!-- 标题 -->
<div
class=
"title"
>
{{
t
.
name
}}
{{
t
.
children
&&
t
.
children
.
length
?
`(${t.children.length
}
)`
:
""
}}
<
/div
>
<div
class=
"title"
>
{{
t
.
name
}}
{{
t
.
staffNum
?
`(${t.staffNum
}
)`
:
""
}}
<
/div
>
<!--
右
icon
-->
<
div
class
=
"dot absolute right-3 top-1/2 transform -translate-y-1/2"
...
...
src/views/team/create-team/create-team.vue
View file @
b56807a9
...
...
@@ -68,8 +68,10 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
// import { Dialog } from 'vant'
import
{
getUserInfo
,
goBack
,
refreshCompanyState
}
from
'@/util/Bridge'
import
{
getUserInfo
,
goBack
,
isAppEnv
,
refreshCompanyState
}
from
'@/util/Bridge'
import
{
trim
}
from
'@/util/Common'
import
{
postMessage
}
from
'@/util/PostMessage'
import
{
PostMsg
}
from
'@/Interface'
export
default
Vue
.
extend
({
name
:
'Createteam'
,
...
...
@@ -94,7 +96,9 @@ export default Vue.extend({
IMServer
:
''
,
nodeServer
:
''
,
oaServer
:
'http://172.16.101.107:20000'
,
showServerList
:
false
// oaServer: '',
showServerList
:
false
,
entId
:
''
}
},
computed
:
{
...
...
@@ -106,8 +110,19 @@ export default Vue.extend({
}
}
},
created
()
{
console
.
log
(
getUserInfo
(),
'ss'
)
async
created
()
{
// if (process.env.NODE_ENV === 'production') {
// if (!isAppEnv()) {
// const usrData = await postMessage(PostMsg.GET_USER_INFO)
// this.entId = usrData.data.entId
// } else {
// this.entId = JSON.parse(getUserInfo() as string).entId
// }
// } else {
// this.entId = '168398222891421696'
// }
// console.log(JSON.parse(getUserInfo() as string), this.entId, 'entId')
// this.getEntInfo()
this
.
$service
.
common
.
getServer
().
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
if
(
data
.
code
===
0
)
{
...
...
@@ -119,6 +134,19 @@ export default Vue.extend({
})
},
methods
:
{
// getEntInfo() {
// this.$service.enterprise.getEnterpriseInfo({
// id: this.entId
// }).then((res: any) => {
// const { data } = res
// if (data.code === this.$global.success) {
// localStorage.setItem('ENT_INFO', JSON.stringify(data.data))
// this.oaServer=data.data.oaServer
// } else {
// this.$toast(data.msg)
// }
// })
// },
goBack
,
handleClickLeft
()
{
console
.
log
(
'click left'
)
...
...
src/views/team/department-management.vue
View file @
b56807a9
...
...
@@ -17,7 +17,7 @@
<contact-selector
:contact-title=
"contactTitle"
:ent-id=
"entId"
:dep=
"
depInfo
"
:dep=
"
currentDep
"
:title=
"contactSelectorTitle"
:show
.
sync=
"showContactSelector"
:multiple=
"multiple"
...
...
@@ -31,7 +31,7 @@
/>
<div
class=
"pt-14 px-4"
>
<input-cell
v-model=
"dep
Info.n
ame"
v-model=
"dep
N
ame"
required
:limit=
"20"
label=
"部门名称"
...
...
@@ -41,7 +41,7 @@
<c-cell
dot
title=
"部门主管"
:content=
"leaderInfo.
n
ame"
:content=
"leaderInfo.
leaderN
ame"
class=
"mt-4"
@
click=
"selectLeader"
/>
...
...
@@ -86,6 +86,7 @@
import
{
Department
,
Staff
}
from
'@/Interface'
import
Vue
from
'vue'
import
{
getContacts
,
getLeaders
}
from
'@/util/Contact'
import
{
Role
}
from
'@/service/moudles/service.dto'
export
default
Vue
.
extend
({
name
:
'DepartmentManagement'
,
...
...
@@ -108,8 +109,11 @@ export default Vue.extend({
depId
:
''
,
depName
:
''
,
entId
:
''
,
depInfo
:
{}
as
Department
,
leaderInfo
:
{}
as
Staff
,
depInfo
:
{}
as
Department
,
// 上级部门
leaderInfo
:
{
leaderName
:
''
,
leaderId
:
''
},
// 领导信息
showMemberSelector
:
false
,
containChild
:
true
,
...
...
@@ -118,7 +122,7 @@ export default Vue.extend({
multiple
:
false
,
contacts
:
[]
as
Array
<
Staff
>
,
leader
:
{}
as
{
list
:
Staff
[]
,
title
?:
string
},
leader
:
{}
as
{
list
:
Staff
[]},
showContactSelector
:
false
,
contactSelectorTitle
:
''
,
actionType
:
'add'
,
...
...
@@ -127,23 +131,29 @@ export default Vue.extend({
showDepSelector
:
false
,
selectedDepId
:
''
,
// currentDepId: '', // 当前部门id
currentDep
:
{}
as
Department
}
},
async
created
()
{
// 获取修改的部门id
this
.
depId
=
this
.
$route
.
params
.
id
this
.
entId
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
||
'{}'
).
id
this
.
depInfo
=
await
this
.
getDepInfo
(
this
.
depId
)
this
.
depName
=
this
.
depInfo
.
name
if
(
this
.
depInfo
.
parentId
===
'-1'
)
{
// 当前部门
this
.
currentDep
=
await
this
.
getDepInfo
(
this
.
depId
)
this
.
depName
=
this
.
currentDep
.
name
// 主管信息
this
.
leaderInfo
.
leaderName
=
this
.
currentDep
.
leaderName
!
this
.
leaderInfo
.
leaderId
=
this
.
currentDep
.
leaderId
// 上级部门信息
if
(
this
.
currentDep
.
parentId
===
'-1'
)
{
// 父级部门parentId -1 上级部门显示企业名称
this
.
depInfo
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
as
string
)
}
else
{
// 查询上级部门显示
this
.
depInfo
=
await
this
.
getDepInfo
(
this
.
depInfo
.
parentId
)
this
.
depInfo
=
await
this
.
getDepInfo
(
this
.
currentDep
.
parentId
)
}
this
.
selectedDepId
=
this
.
depInfo
.
id
// 获取成员信息
this
.
getStaffInfo
(
this
.
depInfo
.
leaderId
)
},
methods
:
{
selectParentDep
()
{
...
...
@@ -173,7 +183,8 @@ export default Vue.extend({
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
this
.
leaderInfo
=
data
.
data
this
.
leaderInfo
.
leaderId
=
data
.
data
.
id
this
.
leaderInfo
.
leaderName
=
data
.
data
.
name
}
else
{
this
.
$toast
(
data
.
msg
)
}
...
...
@@ -194,12 +205,16 @@ export default Vue.extend({
// 通讯录
this
.
contacts
=
data
.
data
.
staffList
||
[]
if
(
this
.
actionType
===
'add'
)
{
this
.
leader
.
list
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
!==
3
)
this
.
leader
.
title
=
''
this
.
leader
.
list
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
!==
Role
.
COMMON_MEMBER
).
sort
((
a
:
Staff
,
b
:
Staff
)
=>
a
.
role
-
b
.
role
)
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
=
'主管'
const
leader
=
data
.
data
.
leader
if
(
typeof
leader
===
'undefined'
||
leader
.
id
===
''
)
{
this
.
leader
.
list
=
[]
}
else
{
const
staff
=
{...
data
.
data
.
leader
,
isDepAdmin
:
true
}
this
.
leader
.
list
=
typeof
data
.
data
.
leader
===
'undefined'
?
[]
:
[
staff
]
}
}
}
else
{
this
.
$toast
(
data
.
msg
)
...
...
@@ -211,7 +226,7 @@ export default Vue.extend({
this
.
multiple
=
false
this
.
actionType
=
'select'
this
.
memberSelectorTitle
=
'选择主管'
this
.
selectedMemberId
=
[
this
.
leaderInfo
.
i
d
]
this
.
selectedMemberId
=
[
this
.
leaderInfo
.
leaderI
d
]
},
addMember
()
{
this
.
showMemberSelector
=
true
...
...
@@ -225,7 +240,8 @@ export default Vue.extend({
this
.
actionType
=
"remove"
this
.
contactSelectorTitle
=
'移除成员'
this
.
multiple
=
true
this
.
getStaff
(
this
.
depInfo
.
id
,
true
)
// 查询当前部门的成员
this
.
getStaff
(
this
.
currentDep
.
id
,
true
)
},
deleteDep
()
{
this
.
$dialog
.
confirm
({
...
...
@@ -235,7 +251,7 @@ export default Vue.extend({
}).
then
(()
=>
{
const
data
=
{
entId
:
this
.
entId
,
id
:
this
.
depInfo
.
id
id
:
this
.
currentDep
.
id
}
this
.
loading
=
true
this
.
$service
.
department
.
deleteDep
(
data
).
then
((
res
:
any
)
=>
{
...
...
@@ -261,7 +277,7 @@ export default Vue.extend({
const
data
=
{
name
:
this
.
depName
,
id
:
this
.
depId
,
leaderId
:
this
.
leaderInfo
.
i
d
,
leaderId
:
this
.
leaderInfo
.
leaderI
d
,
entId
:
this
.
entId
,
parentId
:
this
.
depInfo
.
id
}
...
...
@@ -284,8 +300,17 @@ export default Vue.extend({
}
},
async
selectedDepId
(
val
:
string
)
{
if
(
val
!==
this
.
depInfo
.
id
)
{
this
.
depInfo
=
await
this
.
getDepInfo
(
val
)
}
},
// async showContactSelector(val) {
// if (!val && this.actionType === 'remove') {
// const data = await this.getDepInfo(this.currentDep.id)
// this.leaderInfo.leaderName = data.leaderName!
// this.leaderInfo.leaderId = data.leaderId
// }
// }
}
})
</
script
>
...
...
src/views/team/select-team.vue
View file @
b56807a9
...
...
@@ -97,21 +97,13 @@ export default Vue.extend({
})
},
data
()
{
const
currentDep
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
,
children
:
[]
}
return
{
checked
:
''
,
fromPath
:
''
,
loading
:
false
,
entId
:
''
,
depId
:
''
,
currentDep
,
currentDep
:
{}
as
Department
,
entName
:
''
}
},
...
...
src/views/team/team-frame.vue
View file @
b56807a9
...
...
@@ -100,13 +100,6 @@ export default Vue.extend({
},
data
()
{
const
tree
:
Department
[]
=
[]
const
currentDep
:
Department
=
{
entId
:
''
,
id
:
''
,
leaderId
:
''
,
name
:
''
,
parentId
:
''
}
return
{
title
:
'导航'
,
tree
,
...
...
@@ -115,7 +108,7 @@ export default Vue.extend({
parentId
:
''
,
entId
:
''
,
ifContainChildDep
:
true
,
currentDep
,
currentDep
:
{}
as
Department
,
// 是否显示check
checkedMemberId
:
[],
role
:
3
,
...
...
@@ -280,13 +273,18 @@ export default Vue.extend({
// 负责人/管理员
if
(
this
.
isNotDepRoot
)
{
// 不在架构根目录
const
leader
=
{...
data
.
data
.
leader
,
isDepAdmin
:
true
}
this
.
leaders
.
list
=
[
leader
]
const
leader
=
data
.
data
.
leader
if
(
typeof
leader
!==
'undefined'
&&
leader
.
id
!==
''
)
{
const
staff
=
{...
data
.
data
.
leader
,
isDepAdmin
:
true
}
this
.
leaders
.
list
=
[
staff
]
}
else
{
this
.
leaders
.
list
=
[]
}
}
else
{
this
.
leaders
.
list
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
!==
3
)
this
.
leaders
.
list
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
!==
Role
.
COMMON_MEMBER
).
sort
((
a
:
Staff
,
b
:
Staff
)
=>
a
.
role
-
b
.
role
)
}
// 普通成员
this
.
commonMember
=
data
.
data
.
staffList
?.
filter
((
i
:
Staff
)
=>
i
.
role
===
3
)
this
.
commonMember
=
data
.
data
.
staffList
// 部门树
const
depTree
=
data
.
data
.
dep
const
index
=
this
.
teamArr
.
findIndex
(
d
=>
d
.
id
===
this
.
parentId
)
...
...
src/views/team/team-info/team-info.vue
View file @
b56807a9
...
...
@@ -34,7 +34,6 @@
class=
"mt-4"
v-model=
"updateInfo.description"
:limit=
"300"
required
type=
"textarea"
label=
"团队描述"
placeholder=
"请输入团队描述"
...
...
@@ -47,14 +46,10 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
{
updateEnterpriseDTO
}
from
'@/service/moudles/service.dto'
import
{
ActionSheet
}
from
'vant'
import
axios
from
'axios'
import
{
isAppEnv
,
signAuth
}
from
'@/util/Bridge'
import
{
isAppEnv
,
refreshCompanyState
,
signAuth
}
from
'@/util/Bridge'
import
{
EnterpriseInfo
}
from
'@/store/store.dto'
import
{
PostMsg
}
from
'@/Interface'
import
{
postMessage
}
from
'@/util/PostMessage'
Vue
.
use
(
ActionSheet
)
import
{
transferFile
}
from
'@/util/TransferFile'
export
default
Vue
.
extend
({
name
:
'TeamInfo'
,
...
...
@@ -69,7 +64,6 @@ export default Vue.extend({
data
()
{
return
{
updateInfo
:
{}
as
updateEnterpriseDTO
,
showActionSheet
:
false
,
defaultImg
:
require
(
'@/assets/qrcode.png'
),
showEditor
:
false
,
loading
:
false
,
...
...
@@ -80,7 +74,6 @@ export default Vue.extend({
// const service = new BaseService()
// service.useService
this
.
entInfo
=
{...
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
as
string
)}
console
.
log
(
this
.
entInfo
,
'inf'
)
const
{
id
,
avatar
,
description
,
name
}
=
this
.
entInfo
this
.
updateInfo
=
{
id
,
...
...
@@ -91,26 +84,10 @@ export default Vue.extend({
this
.
defaultImg
=
avatar
},
methods
:
{
// base64 转 file
transferFile
(
base64Str
:
string
,
fileName
:
string
)
{
let
arr
=
base64Str
.
split
(
','
),
mime
=
(
arr
[
0
].
match
(
/:
(
.*
?)
;/
)
as
any
)[
1
],
//base64解析出来的图片类型
bstr
=
atob
(
arr
[
1
])
,
//对base64串进行操作,去掉url头,并转换为byte atob为window内置方法
len
=
bstr
.
length
,
ab
=
new
ArrayBuffer
(
len
),
//将ASCII码小于0的转换为大于0
u8arr
=
new
Uint8Array
(
ab
)
//
while
(
len
--
)
{
u8arr
[
len
]
=
bstr
.
charCodeAt
(
len
)
}
// 创建新的 File 对象实例[utf-8内容,文件名称或者路径,[可选参数,type:文件中的内容mime类型]]
return
new
File
([
u8arr
],
fileName
,
{
type
:
mime
})
},
async
getImgUrl
()
{
const
imServer
=
JSON
.
parse
(
localStorage
.
getItem
(
'ENT_INFO'
)
as
string
).
imServer
let
token
=
''
if
(
process
.
env
.
NODE_ENV
)
{
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
if
(
!
isAppEnv
())
{
token
=
this
.
$global
.
sig
}
else
{
...
...
@@ -119,14 +96,14 @@ export default Vue.extend({
}
else
{
token
=
'MOCK'
}
const
file
=
t
his
.
t
ransferFile
(
this
.
defaultImg
,
'text'
)
const
file
=
transferFile
(
this
.
defaultImg
,
'text'
)
const
formData
=
new
FormData
()
formData
.
append
(
'appId'
,
'dtalk'
)
formData
.
append
(
'key'
,
`oa/
${
this
.
entInfo
.
id
}
`
)
formData
.
append
(
'key'
,
`oa/
${
this
.
entInfo
.
id
+
new
Date
().
getTime
()
}
`
)
formData
.
append
(
'file'
,
file
)
return
axios
({
method
:
'post'
,
url
:
`
${
imServer
}
/oss/upload`
,
url
:
`/oss/upload`
,
data
:
formData
,
headers
:
{
'content-type'
:
'multipart/form-data'
,
...
...
@@ -137,8 +114,7 @@ export default Vue.extend({
})
},
async
save
()
{
const
{
description
,
name
}
=
this
.
updateInfo
if
(
!
description
||
!
name
||
!
this
.
defaultImg
)
{
if
(
!
this
.
updateInfo
.
name
)
{
this
.
$toast
(
'请检查填写信息'
)
return
}
...
...
@@ -164,15 +140,16 @@ export default Vue.extend({
getEntInfo
(
id
:
string
)
{
this
.
loading
=
true
this
.
$service
.
enterprise
.
getEnterpriseInfo
({
id
})
.
then
((
res
:
any
)
=>
{
.
then
(
async
(
res
:
any
)
=>
{
const
{
data
}
=
res
this
.
loading
=
false
if
(
data
.
code
===
this
.
$global
.
success
)
{
localStorage
.
setItem
(
'ENT_INFO'
,
JSON
.
stringify
(
data
.
data
))
this
.
entInfo
=
data
.
data
this
.
defaultImg
=
data
.
data
.
avatar
// await refreshCompanyState()
}
})
})
.
catch
(()
=>
this
.
loading
=
false
)
}
}
})
...
...
@@ -188,3 +165,4 @@ export default Vue.extend({
// border: 1px solid red;
}
</
style
>
src/views/team/team-management.vue
View file @
b56807a9
...
...
@@ -216,7 +216,7 @@ export default Vue.extend({
if
(
arr
.
length
===
0
)
return
this
.
loading
=
true
const
newLeaderId
=
arr
[
0
]
const
id
=
JSON
.
parse
(
localStorage
.
getItem
(
'
USR
_INFO'
)
as
string
).
id
const
id
=
JSON
.
parse
(
localStorage
.
getItem
(
'
ENT
_INFO'
)
as
string
).
id
this
.
$service
.
enterprise
.
updateLeader
({
id
,
newLeaderId
...
...
src/views/team/two-code.vue
View file @
b56807a9
...
...
@@ -18,7 +18,7 @@
/>
-->
<div
class=
"w-32 h-32"
>
<vue-qr
:logoSrc=
"require('@/assets/icons/
ssyx
.png')"
:logoSrc=
"require('@/assets/icons/
js
.png')"
:text=
"qrCodeText"
:margin=
"2"
:size=
"400"
...
...
@@ -57,7 +57,7 @@
@
click=
"copy"
>
复制
</c-button>
</div>
</div>
<c-button
type=
"secondary"
class=
"mt-4"
@
click=
"handleClickLeft"
>
进入
团队工作台
</c-button>
<c-button
type=
"secondary"
class=
"mt-4"
@
click=
"handleClickLeft"
>
进入
组织架构
</c-button>
</div>
</main-page>
</div>
...
...
@@ -70,6 +70,7 @@ import { formatDate } from '@/util/FormatDate'
import
VueQr
from
'vue-qr'
import
html2canvas
from
'html2canvas'
import
{
Department
}
from
'@/Interface'
import
{
transferFile
}
from
'@/util/TransferFile'
interface
JoinInfoType
{
depId
:
string
entId
:
string
...
...
@@ -92,7 +93,8 @@ export default Vue.extend({
joinInfo
:
{}
as
JoinInfoType
,
qrCodeText
:
''
,
loading
:
false
,
depInfo
:
{}
as
Department
depInfo
:
{}
as
Department
,
imgUrl
:
''
}
},
components
:
{
...
...
@@ -119,7 +121,7 @@ export default Vue.extend({
},
computed
:
{
copyText
():
string
{
return
`我和
${
this
.
entName
}
的小伙伴都在
三生有信等你,用这个专属链接加入我们吧!
${
this
.
qrCodeText
}
`
return
`我和
${
this
.
entName
}
的小伙伴都在
警书等你,用这个专属链接加入我们吧!
${
this
.
qrCodeText
}
`
}
},
methods
:
{
...
...
@@ -133,13 +135,12 @@ export default Vue.extend({
}
else
{
string
=
`
${
i
[
0
]}
=
${
encodeURIComponent
(
i
[
1
])}
`
}
res
+=
string
})
return
res
},
handleClickLeft
()
{
this
.
$router
.
replace
(
'/team/team-frame'
)
this
.
$router
.
push
(
'/team/team-frame'
)
},
dpr
()
{
if
(
window
.
devicePixelRatio
&&
window
.
devicePixelRatio
>
1
)
{
...
...
@@ -148,6 +149,7 @@ export default Vue.extend({
return
1
},
async
drawCanvas
(
selector
:
string
)
{
this
.
imgUrl
=
''
// 获取节点
const
dom
=
document
.
getElementById
(
selector
)
as
HTMLDivElement
// 获取节点高度
...
...
@@ -164,6 +166,9 @@ export default Vue.extend({
// context?.scale(1, 1)
return
await
html2canvas
(
dom
,
{
canvas
}).
then
(()
=>
{
const
url
=
canvas
.
toDataURL
(
'image/png'
)
// const file = transferFile(url, 'file')
// const imgUrl = URL.createObjectURL(file)
this
.
imgUrl
=
url
const
a
=
document
.
createElement
(
'a'
)
const
event
=
new
MouseEvent
(
'click'
)
a
.
download
=
'邀请码'
...
...
@@ -192,7 +197,6 @@ export default Vue.extend({
this
.
loading
=
false
const
{
data
}
=
res
if
(
data
.
code
===
this
.
$global
.
success
)
{
console
.
log
(
'xxx'
)
this
.
depInfo
=
data
.
data
}
else
{
this
.
$toast
(
data
.
msg
)
...
...
vue.config.js
View file @
b56807a9
...
...
@@ -30,6 +30,14 @@ module.exports = {
pathRewrite
:
{
'^/proxyApi'
:
''
}
},
'/oss'
:
{
target
:
'http://172.16.101.107:8888'
,
// target: 'http://' + "124.71.183.184:8093",
changeOrigin
:
true
,
// pathRewrite: {
// '^/proxyApi': ''
// }
}
}
},
...
...
@@ -41,7 +49,7 @@ module.exports = {
parallel
:
true
,
terserOptions
:
{
compress
:
{
drop_console
:
fals
e
,
// 默认false -- 移除console.*(console.log、console.error等等)
drop_console
:
tru
e
,
// 默认false -- 移除console.*(console.log、console.error等等)
},
},
}),
...
...
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