Commit c0c6084a authored by sixiaofeng's avatar sixiaofeng

1

parent 9633375d
...@@ -20,7 +20,7 @@ Vue.use(utils).use(service) ...@@ -20,7 +20,7 @@ Vue.use(utils).use(service)
Vue.prototype.$dsbridge = dsbridge Vue.prototype.$dsbridge = dsbridge
Vue.prototype.$global = global Vue.prototype.$global = global
// new VConsole() new VConsole()
new Vue({ new Vue({
router, router,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<main-page <main-page
left-arrow left-arrow
:loading="loading" :loading="loading"
@click-left="$router.replace('/team/team-frame')" @click-left="goBack"
> >
<member-selector <member-selector
:show.sync="showMemberSelector" :show.sync="showMemberSelector"
...@@ -117,6 +117,9 @@ export default Vue.extend({ ...@@ -117,6 +117,9 @@ export default Vue.extend({
this.getDepInfo(depId) this.getDepInfo(depId)
}, },
methods: { methods: {
goBack() {
this.$router.replace('/team/team-frame')
},
addDepConfirm(){ addDepConfirm(){
if (this.name === '') { if (this.name === '') {
this.$toast('请输入部门名称') this.$toast('请输入部门名称')
...@@ -132,7 +135,7 @@ export default Vue.extend({ ...@@ -132,7 +135,7 @@ export default Vue.extend({
const {data} = res const {data} = res
if (data.code === this.$global.success) { if (data.code === this.$global.success) {
this.$toast('添加成功') this.$toast('添加成功')
this.$router.push('/team/team-frame') this.goBack()
} else { } else {
this.$toast(data.msg) this.$toast(data.msg)
} }
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
/> />
<main-page left-arrow :loading="loading" @click-left="handleClickLeft"> <main-page left-arrow :loading="loading" @click-left="handleClickLeft">
<template #right> <template #right>
<div @click="$router.push({ name: 'Import' })"> <div class="text-color-primary" @click="$router.push({ name: 'Import' })">
<img class="w-6 h-6" src="@/assets/icons/add_many_people.png" alt /> 批量导入
</div> </div>
</template> </template>
<div class="px-4 pt-14 pb-16"> <div class="px-4 pt-14 pb-16">
...@@ -64,8 +64,8 @@ ...@@ -64,8 +64,8 @@
@confirm="selectJoinTime" @confirm="selectJoinTime"
/> />
<!-- 选择部门 --> <!-- 选择部门 -->
<group-cell dot required class="mt-4" title="所属部门" @click.native="selectDep"> <group-cell required class="mt-4" title="所属部门" @click.native="selectDep">
<c-cell :title="currentDep.name" /> <c-cell dot :title="currentDep.name" />
</group-cell> </group-cell>
<!--按钮--> <!--按钮-->
<div class="fixed bottom-0 left-0 w-full px-4 py-1.5 bg-common-bg"> <div class="fixed bottom-0 left-0 w-full px-4 py-1.5 bg-common-bg">
...@@ -142,7 +142,7 @@ export default Vue.extend({ ...@@ -142,7 +142,7 @@ export default Vue.extend({
}, },
async created() { async created() {
this.selectedDepId = this.depId = this.$route.query.id as string this.selectedDepId = this.depId = this.$route.query.id as string
this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id || '168398222891421696'
// 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
...@@ -196,7 +196,7 @@ export default Vue.extend({ ...@@ -196,7 +196,7 @@ export default Vue.extend({
} }
}, },
handleClickLeft() { handleClickLeft() {
this.$router.push('/team/team-frame') this.$router.replace('/team/team-frame')
}, },
// 入职日期 // 入职日期
selectJoinTime(date: Date) { selectJoinTime(date: Date) {
......
...@@ -83,7 +83,7 @@ export default Vue.extend({ ...@@ -83,7 +83,7 @@ export default Vue.extend({
} }
} }
}, },
actionType: String, action: String,
contactTitle: String contactTitle: String
}, },
data() { data() {
...@@ -91,22 +91,13 @@ export default Vue.extend({ ...@@ -91,22 +91,13 @@ export default Vue.extend({
return { return {
loading: false, loading: false,
changed: false, changed: false,
changedVal changedVal,
checkedMember: [] as string[],
} }
}, },
computed: { watch: {
checkedMember: { checkedMemberId(val: string[]) {
get(): string[] { this.checkedMember = val
if (!this.changed) {
return this.checkedMemberId
} else {
return this.changedVal
}
},
set(val:string[]) {
this.changed = true
this.changedVal = val
}
} }
}, },
methods: { methods: {
...@@ -116,35 +107,36 @@ export default Vue.extend({ ...@@ -116,35 +107,36 @@ export default Vue.extend({
this.$toast('请选择成员') this.$toast('请选择成员')
return return
} }
this.loading=true
const data = { const data = {
entId: this.entId, entId: this.entId,
depId: '', depId: '',
ids: this.checkedMember as Array<string> ids: this.checkedMember as Array<string>
} }
if (this.actionType === 'add') { if (this.action === 'remove') {
data.depId = this.dep.id
}
if (this.actionType === 'remove') {
const rootDepId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').rootDepId const rootDepId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').rootDepId
data.depId = rootDepId data.depId = rootDepId
this.$dialog.confirm({
title: '提示',
message: '移出成员后,将移出对应的部门群,若是主管,则对应部门群群主将随机抽取群管理员或群内成员临时担任,确定移出吗?'
// confirmButtonText: '解散'
}).then(() => {
this.loading=true
this.$service.staff.changeDep(data).then((res:any) => {
this.loading=false
const {data} = res
if (data.code===this.$global.success) {
if (this.action === 'remove') {
this.$toast('移除成功')
this.$emit('update:show', false)
this.$emit('update:checkedMemberId', this.checkedMember)
this.checkedMember=[]
}
} else {
this.$toast(data.msg)
}
})
}).catch(()=>{})
} }
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(){ goBack(){
this.$emit('update:show', false) this.$emit('update:show', false)
......
...@@ -21,11 +21,10 @@ ...@@ -21,11 +21,10 @@
<!-- 团队架构详情 --> <!-- 团队架构详情 -->
<team-tree <team-tree
v-if="showTeam" v-if="showTeam"
:is-detail="isDepDetail" :tree-data="tree"
:pre-team="preDep" :teams="teamArr"
:tree-data="team"
@click-child="clickItem" @click-child="clickItem"
@go-pre="goPre" @click-bread="goPre"
/> />
<!-- 显示成员是否包含子部门成员 --> <!-- 显示成员是否包含子部门成员 -->
<switch-cell <switch-cell
...@@ -90,10 +89,15 @@ export default Vue.extend({ ...@@ -90,10 +89,15 @@ export default Vue.extend({
title: { title: {
type: String, type: String,
default: '选择主管' default: '选择主管'
} },
action: {
type: String,
default: 'select'
},
depId: String
}, },
data() { data() {
const team: Array<Department> = [] const tree: Array<Department> = []
const currentDep: Department = { const currentDep: Department = {
entId: '', entId: '',
id: '', id: '',
...@@ -103,20 +107,17 @@ export default Vue.extend({ ...@@ -103,20 +107,17 @@ export default Vue.extend({
} }
let changedVal: Array<string> = [] let changedVal: Array<string> = []
return { return {
team, tree,
teamArr: [] as Department[],
loading: false, loading: false,
contacts: [] as Array<Staff>, contacts: [] as Array<Staff>,
parentId: '', parentId: '',
entId: '', entId: '',
ifContainChildDep: false, ifContainChildDep: true,
enterpriseInfo: {},
currentDep, currentDep,
preDep: {},
// 是否显示check checkedMember: [] as string[],
// checkedMember: [],
showRadio: true, showRadio: true,
changed: false,
changedVal,
leaders: {} as{list: Staff[], title?: string}, leaders: {} as{list: Staff[], title?: string},
} }
}, },
...@@ -124,24 +125,6 @@ export default Vue.extend({ ...@@ -124,24 +125,6 @@ export default Vue.extend({
this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id
this.getEntInfo() this.getEntInfo()
}, },
computed: {
isDepDetail(): boolean {
return this.currentDep.parentId !== '-1'
},
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: { methods: {
goPre(dep: Department) { goPre(dep: Department) {
this.parentId = dep.id this.parentId = dep.id
...@@ -149,8 +132,34 @@ export default Vue.extend({ ...@@ -149,8 +132,34 @@ export default Vue.extend({
}, },
// 确认选择 // 确认选择
confirmSelect() { confirmSelect() {
this.$emit('update:checkedMemberId', this.checkedMember) if (this.action === 'select') {
this.$emit('update:show', false) this.$emit('update:show', false)
this.$emit('update:checkedMemberId', this.checkedMember)
return
}
if (this.action === 'add') {
this.$dialog.confirm({
title: '提示',
message: `确定要添加选中的成员吗?`
// confirmButtonText: '解散'
}).then(() => {
this.loading=true
const data = {
entId: this.entId,
depId: this.depId,
ids: this.checkedMember as Array<string>
}
this.$service.staff.changeDep(data).then((res:any) => {
this.loading=false
const {data} = res
if (data.code===this.$global.success) {
this.$toast('添加成功')
} else {
this.$toast(data.msg)
}
}).catch(err=> this.loading = false)
}).catch(()=>{})
}
}, },
goBack(){ goBack(){
this.$emit('update:show', false) this.$emit('update:show', false)
...@@ -170,22 +179,6 @@ export default Vue.extend({ ...@@ -170,22 +179,6 @@ export default Vue.extend({
} }
}) })
}, },
// 获取部门信息
getDepInfo(depId: string) {
this.loading = true
this.$service.department.getDep({
entId: this.entId,
id: depId
}).then((res: any) => {
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
this.preDep = data.data
} else {
this.$toast(data.msg)
}
})
},
// 获取成员 // 获取成员
getStaff() { getStaff() {
this.loading = true this.loading = true
...@@ -193,20 +186,25 @@ export default Vue.extend({ ...@@ -193,20 +186,25 @@ 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
if (data.code === this.$global.success) { if (data.code === this.$global.success) {
this.currentDep = data.data.dep // this.currentDep = data.data.dep
// 负责人/管理员 // 负责人/管理员
this.leaders.list = data.data.staffList.filter((i: Staff) => i.role !== 3) this.leaders.list = data.data.staffList?.filter((i: Staff) => i.role !== 3)
// 普通成员 // 普通成员
this.contacts = 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 const depTree = data.data.dep
depTree.children = data.data.subDepList const index = this.teamArr.findIndex(d => d.id === this.parentId)
this.team = [depTree] if (index < 0) {
this.teamArr.push(depTree)
} else {
this.teamArr = this.teamArr.slice(0, index + 1)
}
this.tree = data.data.subDepList || []
} else { } else {
this.$toast(data.msg) this.$toast(data.msg)
} }
...@@ -223,12 +221,8 @@ export default Vue.extend({ ...@@ -223,12 +221,8 @@ export default Vue.extend({
} }
}, },
watch: { watch: {
currentDep: { checkedMemberId(val: string[]) {
handler(newDep) { this.checkedMember = val
if (newDep.parentId !== '-1') {
this.getDepInfo(newDep.parentId)
}
}
} }
}, },
}) })
......
<template> <template>
<!-- 团队架构树 --> <!-- 团队架构树 -->
<div class="tree text-text-primary"> <div class="tree text-text-primary">
<!-- 显示面包屑 -->
<div <div
v-for="(member, index) in treeData" class="bread py-3 flex items-center overflow-x-scroll"
:key="index"
class=""
> >
<!-- 显示标题 -->
<div <div
v-if="!isDetail" v-for="(d, index) in teams"
class="title font-medium py-3" :key="d.id"
> class="pre text-text-secondary flex items-center flex-shrink-0"
{{ member.name }} @click="goPre(d)">
</div> <div class="flex-shrink-0">{{ d.name }}</div>
<!-- 显示面包屑 --> <div v-if="index < teams.length - 1">
<app-icon
icon-name="left-arrow"
class-name="w-3 h-3 transform rotate-180 ml-1 mr-2"
/>
</div>
</div>
<!-- <div class="pre text-text-primary font-medium">{{ member.name }}</div> -->
</div>
<!-- 子部门 -->
<div v-if="treeData.length > 0" class="children">
<div <div
v-else v-for="(t, tIndex) in treeData"
class="bread py-3 flex items-center" :key="t.id"
class="child-wrapper py-3 relative pl-10"
@click="clickChild(t, t.name)"
> >
<div class="pre text-text-secondary" @click="goPre(preTeam)">{{ preTeam.name }}</div> <!-- 左边框 -->
<div class="text-xs text-text-secondary px-2">></div>
<div class="pre text-text-primary font-medium">{{ member.name }}</div>
</div>
<!-- 子部门 -->
<div v-if="member.children && member.children.length > 0" class="children">
<div <div
v-for="(child, childIndex) in member.children" class="left-border w-0.5 bg-border-lighter absolute left-3 top-0"
:key="child.id" :class="tIndex <treeData.length - 1
class="child-wrapper py-3 relative pl-10" ? 'h-full'
@click="clickChild(child, member.name)" : 'h-1/2'"
/>
<!-- 左icon -->
<div class="left absolute z-10 left-6 h-1.5 w-1.5 bg-color-primary rounded-sm top-1/2 transform -translate-y-1/2" />
<!-- 横线 -->
<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>
<!-- icon -->
<div
class="dot absolute right-3 top-1/2 transform -translate-y-1/2"
> >
<!-- 左边框 --> <app-icon
<div type="png"
class="left-border w-0.5 bg-border-lighter absolute left-3 top-0" :path="require('@/assets/icons/dot.png')"
:class="childIndex < member.children.length - 1 class-name="h-5 w-1"
? 'h-full'
: 'h-1/2'"
/> />
<!-- 左icon -->
<div class="left absolute z-10 left-6 h-1.5 w-1.5 bg-color-primary rounded-sm top-1/2 transform -translate-y-1/2" />
<!-- 横线 -->
<div class="absolute w-3 h-0.5 left-3 bg-border-lighter top-1/2 transform -translate-y-1/2" />
<!-- 标题 -->
<div class="title">{{ child.name }} {{ child.children && child.children.length ? `(${child.children.length})` : "" }}</div>
<!-- icon -->
<div
class="dot absolute right-3 top-1/2 transform -translate-y-1/2"
>
<app-icon
type="png"
:path="require('@/assets/icons/dot.png')"
class-name="h-5 w-1"
/>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -60,7 +57,7 @@ ...@@ -60,7 +57,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue, { PropType } from 'vue'
import { Department } from '@/Interface' import { Department } from '@/Interface'
export default Vue.extend({ export default Vue.extend({
...@@ -75,11 +72,12 @@ export default Vue.extend({ ...@@ -75,11 +72,12 @@ export default Vue.extend({
return [] return []
} }
}, },
isDetail: { teams: {
type: Boolean, type: Array as PropType<Department[]>,
default: false default() {
return []
}
}, },
preTeam: Object
}, },
methods: { methods: {
clickChild(team: Department, parentName: string) { clickChild(team: Department, parentName: string) {
...@@ -89,8 +87,8 @@ export default Vue.extend({ ...@@ -89,8 +87,8 @@ export default Vue.extend({
}) })
}, },
goPre(team: Department) { goPre(team: Department) {
this.$emit('go-pre', team) this.$emit('click-bread', team)
} },
} }
}) })
</script> </script>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
@click-left="handleClickLeft" @click-left="handleClickLeft"
> >
<div class="mx-4 pt-14 pb-2"> <div class="mx-4 pt-14 pb-2">
<div class="text-xs text-color-primary bg-color-primary-light px-4 py-3 rounded"> <div class="text-sm text-color-primary bg-color-primary-light px-4 py-3 rounded">
创建团队需选择或添加一台服务器为默认服务器,用于保存企业模块信息,聊天服务器和区块链节点自动配置。 创建团队需选择或添加一台服务器为默认服务器,用于保存企业模块信息,聊天服务器和区块链节点自动配置。
</div> </div>
<div class="mt-4"> <div class="mt-4">
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
> >
<member-selector <member-selector
:show-team="true" :show-team="true"
:dep-id="depId"
:title="memberSelectorTitle" :title="memberSelectorTitle"
:show.sync="showMemberSelector" :show.sync="showMemberSelector"
:multiple="multiple" :multiple="multiple"
:checked-member-id.sync="selectedMemberId" :checked-member-id.sync="selectedMemberId"
:action="actionType"
/> />
<contact-selector <contact-selector
:contact-title="contactTitle" :contact-title="contactTitle"
...@@ -19,7 +21,7 @@ ...@@ -19,7 +21,7 @@
:title="contactSelectorTitle" :title="contactSelectorTitle"
:show.sync="showContactSelector" :show.sync="showContactSelector"
:multiple="multiple" :multiple="multiple"
:action-type="actionType" :action="actionType"
:contacts="contacts" :contacts="contacts"
:leader="leader" :leader="leader"
/> />
...@@ -119,15 +121,16 @@ export default Vue.extend({ ...@@ -119,15 +121,16 @@ export default Vue.extend({
async created() { async created() {
this.depId = this.$route.params.id this.depId = this.$route.params.id
this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id
const dep = await this.getDepInfo(this.depId) this.depInfo = await this.getDepInfo(this.depId)
this.depInfo = dep
this.selectedMemberId = [this.depInfo.leaderId]
if (this.depInfo.parentId === '-1') { if (this.depInfo.parentId === '-1') {
// 父级部门parentId -1 上级部门显示企业名称
this.parentDepName = JSON.parse(localStorage.getItem('ENT_INFO') as string).name this.parentDepName = JSON.parse(localStorage.getItem('ENT_INFO') as string).name
} else { } else {
// 查询上级部门显示
const parentDep = await this.getDepInfo(this.depInfo.parentId) const parentDep = await this.getDepInfo(this.depInfo.parentId)
this.parentDepName = parentDep.name this.parentDepName = parentDep.name
} }
// 获取成员信息
this.getStaffInfo(this.depInfo.leaderId) this.getStaffInfo(this.depInfo.leaderId)
}, },
methods: { methods: {
...@@ -176,7 +179,7 @@ export default Vue.extend({ ...@@ -176,7 +179,7 @@ export default Vue.extend({
// 通讯录 // 通讯录
this.contacts = data.data.staffList || [] this.contacts = data.data.staffList || []
if (this.actionType === 'add') { if (this.actionType === 'add') {
this.leader.list = data.data.staffList.filter((i: Staff) => i.role !== 3) this.leader.list = data.data.staffList?.filter((i: Staff) => i.role !== 3)
this.leader.title = '' this.leader.title = ''
this.contactTitle = JSON.parse(localStorage.getItem('ENT_INFO') as string).name this.contactTitle = JSON.parse(localStorage.getItem('ENT_INFO') as string).name
} else { } else {
...@@ -191,15 +194,16 @@ export default Vue.extend({ ...@@ -191,15 +194,16 @@ export default Vue.extend({
selectLeader() { selectLeader() {
this.showMemberSelector = true this.showMemberSelector = true
this.multiple=false this.multiple=false
this.actionType='select'
this.memberSelectorTitle='选择主管'
this.selectedMemberId = [this.leaderInfo.id] this.selectedMemberId = [this.leaderInfo.id]
}, },
addMember() { addMember() {
this.showContactSelector = true this.showMemberSelector = true
this.actionType="add" this.actionType='add'
this.contactSelectorTitle = '添加成员' this.multiple=true
this.multiple = true this.memberSelectorTitle='添加成员'
const rootDepId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').rootDepId this.selectedMemberId = []
this.getStaff(rootDepId, false)
}, },
removeMember() { removeMember() {
this.showContactSelector = true this.showContactSelector = true
...@@ -211,7 +215,7 @@ export default Vue.extend({ ...@@ -211,7 +215,7 @@ export default Vue.extend({
deleteDep() { deleteDep() {
this.$dialog.confirm({ this.$dialog.confirm({
title: '提示', title: '提示',
message: '确定要删除当前部门吗?' message: '确定删除该部门吗?若该部门有子部门、部门群,则子部门和对应群消息、群文件都会删除!'
// confirmButtonText: '解散' // confirmButtonText: '解散'
}).then(() => { }).then(() => {
const data = { const data = {
...@@ -224,13 +228,13 @@ export default Vue.extend({ ...@@ -224,13 +228,13 @@ export default Vue.extend({
this.loading=false this.loading=false
if (data.code === this.$global.success) { if (data.code === this.$global.success) {
this.$toast('删除成功') this.$toast('删除成功')
this.$router.push('/team/team-frame') this.$router.replace('/team/team-frame')
} else { } else {
this.$toast(data.msg) this.$toast(data.msg)
} }
}) })
}).catch(() => { }).catch(() => {
console.log('取消解散') console.log('取消')
}) })
}, },
save() { save() {
...@@ -247,7 +251,7 @@ export default Vue.extend({ ...@@ -247,7 +251,7 @@ export default Vue.extend({
this.loading = false this.loading = false
if (data.code === this.$global.success) { if (data.code === this.$global.success) {
this.$toast('保存成功') this.$toast('保存成功')
this.$router.push('/team/team-frame') this.$router.replace('/team/team-frame')
} else { } else {
this.$toast(data.msg) this.$toast(data.msg)
} }
...@@ -256,7 +260,9 @@ export default Vue.extend({ ...@@ -256,7 +260,9 @@ export default Vue.extend({
}, },
watch: { watch: {
selectedMemberId(newVal) { selectedMemberId(newVal) {
this.getStaffInfo(newVal[0]) if(this.actionType === 'select') {
this.getStaffInfo(newVal[0])
}
} }
} }
}) })
......
...@@ -18,11 +18,10 @@ ...@@ -18,11 +18,10 @@
<div class="px-4 pt-14"> <div class="px-4 pt-14">
<!-- 团队架构详情 --> <!-- 团队架构详情 -->
<team-tree <team-tree
:is-detail="isDepDetail" :tree-data="tree"
:pre-team="preDep" :teams="teamArr"
:tree-data="team"
@click-child="clickItem" @click-child="clickItem"
@go-pre="goPre" @click-bread="goPre"
/> />
<!-- 显示成员是否包含子部门成员 --> <!-- 显示成员是否包含子部门成员 -->
<switch-cell <switch-cell
...@@ -71,7 +70,7 @@ export default Vue.extend({ ...@@ -71,7 +70,7 @@ export default Vue.extend({
'switch-cell': () => import('@/components/common/switch-cell.vue') 'switch-cell': () => import('@/components/common/switch-cell.vue')
}, },
data() { data() {
const team: Department[]= [] const tree: Department[]= []
const currentDep: Department = { const currentDep: Department = {
entId: '', entId: '',
id: '', id: '',
...@@ -81,7 +80,7 @@ export default Vue.extend({ ...@@ -81,7 +80,7 @@ export default Vue.extend({
} }
return { return {
title: '导航', title: '导航',
team, tree,
loading: false, loading: false,
contacts: [] as Staff[], contacts: [] as Staff[],
parentId: '', parentId: '',
...@@ -89,12 +88,12 @@ export default Vue.extend({ ...@@ -89,12 +88,12 @@ export default Vue.extend({
ifContainChildDep: true, ifContainChildDep: true,
enterpriseInfo: {}, enterpriseInfo: {},
currentDep, currentDep,
preDep: {},
// 是否显示check // 是否显示check
checkedMemberId: [], checkedMemberId: [],
role:3, role:3,
leaders: {} as{list: Staff[], title?: string}, leaders: {} as{list: Staff[], title?: string},
commonMember: [] as Staff[] commonMember: [] as Staff[],
teamArr: [] as Department[]
} }
}, },
async mounted() { async mounted() {
...@@ -105,9 +104,6 @@ export default Vue.extend({ ...@@ -105,9 +104,6 @@ export default Vue.extend({
this.getEntInfo() this.getEntInfo()
}, },
computed: { computed: {
isDepDetail(): boolean {
return this.currentDep.parentId !== '-1'
},
isNotDepRoot():boolean { isNotDepRoot():boolean {
return this.currentDep.parentId !== '-1' return this.currentDep.parentId !== '-1'
}, },
...@@ -138,22 +134,6 @@ export default Vue.extend({ ...@@ -138,22 +134,6 @@ export default Vue.extend({
} }
}) })
}, },
// 获取部门信息
getDepInfo(depId: string) {
this.loading = true
this.$service.department.getDep({
entId: this.entId,
id: depId
}).then((res: any) => {
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
this.preDep = data.data
} else {
this.$toast(data.msg)
}
})
},
// 获取成员 // 获取成员
getStaff() { getStaff() {
this.loading = true this.loading = true
...@@ -174,15 +154,21 @@ export default Vue.extend({ ...@@ -174,15 +154,21 @@ export default Vue.extend({
this.leaders.list = typeof data.data.leader === 'undefined' ? [] : [data.data.leader] this.leaders.list = typeof data.data.leader === 'undefined' ? [] : [data.data.leader]
this.leaders.title = '主管' this.leaders.title = '主管'
} else { } else {
this.leaders.list = data.data.staffList.filter((i: Staff) => i.role !== 3) this.leaders.list = data.data.staffList?.filter((i: Staff) => i.role !== 3)
this.leaders.title = '' this.leaders.title = ''
} }
// breadcrumds constructor
// 普通成员 // 普通成员
this.commonMember = data.data.staffList.filter((i: Staff) => i.role === 3) this.commonMember = data.data.staffList?.filter((i: Staff) => i.role === 3)
// 部门树 // 部门树
const depTree = data.data.dep const depTree = data.data.dep
depTree.children = data.data.subDepList const index = this.teamArr.findIndex(d => d.id === this.parentId)
this.team = [depTree] if (index < 0) {
this.teamArr.push(depTree)
} else {
this.teamArr = this.teamArr.slice(0, index + 1)
}
this.tree = data.data.subDepList || []
} else { } else {
this.$toast(data.msg) this.$toast(data.msg)
} }
...@@ -236,13 +222,6 @@ export default Vue.extend({ ...@@ -236,13 +222,6 @@ export default Vue.extend({
this.getStaff() this.getStaff()
}, },
immediate: false immediate: false
},
currentDep: {
handler(newDep) {
if (newDep.parentId !== '-1') {
this.getDepInfo(newDep.parentId)
}
}
} }
}, },
}) })
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
:loading="loading" :loading="loading"
@click-left="handleClickLeft" @click-left="handleClickLeft"
> >
<div class="mx-4 pt-14"> <div class="mx-4 pt-14 pb-4">
<div class="shadow-md rounded overflow-hidden" id="qrcode"> <div class="shadow-md rounded overflow-hidden" id="qrcode">
<div class="bg-color-primary text-center h-24 pt-6"> <div class="bg-color-primary text-center h-24 pt-6">
<div class="text-white flex-initial">{{entName}}</div> <div class="text-white flex-initial">{{entName}}</div>
...@@ -41,18 +41,20 @@ ...@@ -41,18 +41,20 @@
<div class=" text-center text-gray-400 pb-8 pt-4">扫描二维码加入{{entName}}</div> <div class=" text-center text-gray-400 pb-8 pt-4">扫描二维码加入{{entName}}</div>
</div> </div>
</div> </div>
<div class="flex justify-center pt-8 text-color-primary font-medium text-sm text-center px-7"> <div class="w-24 ml-auto mt-4">
<div class=" flex-initial mx-3"> <c-button @click="saveQrcode">保存</c-button>
<code-icon :path="require('@/assets/icons/y-chat33.png')" class-name="h-9 w-9"/> Chat33 </div>
</div> <div class="mt-4 border text-sm text-text-secondary border border-border rounded break-all p-2">
<!-- <div class="flex-initial mx-3"> {{copyText}}
<code-icon :path="require('@/assets/icons/y-weixin.png')" class-name="h-9 w-9"/>微信 </div>
</div> --> <div class="w-24 ml-auto mt-4">
<div class="flex-initial mx-3" @click="saveQrcode"> <c-button
<code-icon :path="require('@/assets/icons/y-downlode.png')" class-name="h-9 w-9"/>保存 id="copyBtn"
</div> :data-clipboard-text="qrCodeText"
data-clipboard-action="copy"
@click="copy">复制</c-button>
</div> </div>
<c-button type="secondary" class="mt-16" @click="handleClickLeft">进入团队工作台</c-button> <c-button type="secondary" class="mt-4" @click="handleClickLeft">进入团队工作台</c-button>
</div> </div>
</main-page> </main-page>
</div> </div>
...@@ -114,7 +116,11 @@ export default Vue.extend({ ...@@ -114,7 +116,11 @@ export default Vue.extend({
console.log(this.joinInfo, 'joinInfo') console.log(this.joinInfo, 'joinInfo')
this.getDepInfo(this.joinInfo.entId, this.joinInfo.depId) this.getDepInfo(this.joinInfo.entId, this.joinInfo.depId)
}, },
computed: {
copyText(): string {
return `我和${this.entName}的小伙伴都在三生有信等你,用这个专属链接加入我们吧!${this.qrCodeText}`
}
},
methods: { methods: {
outputUrl(item:Object){ outputUrl(item:Object){
let res ='' let res =''
...@@ -135,7 +141,6 @@ export default Vue.extend({ ...@@ -135,7 +141,6 @@ export default Vue.extend({
this.$router.replace('/team/team-frame') this.$router.replace('/team/team-frame')
}, },
dpr() { dpr() {
console.log(window.devicePixelRatio, 'pixel')
if (window.devicePixelRatio && window.devicePixelRatio > 1) { if (window.devicePixelRatio && window.devicePixelRatio > 1) {
return window.devicePixelRatio return window.devicePixelRatio
} }
...@@ -169,6 +174,15 @@ export default Vue.extend({ ...@@ -169,6 +174,15 @@ export default Vue.extend({
async saveQrcode() { async saveQrcode() {
await this.drawCanvas('qrcode') await this.drawCanvas('qrcode')
}, },
copy() {
const clipboard = new this.$util.clipboard('#copyBtn')
clipboard.on('success', () => {
this.$toast('已经复制到剪切板')
})
clipboard.on('error', () => {
this.$toast('复制失败')
})
},
getDepInfo(entId: string, depId: string) { getDepInfo(entId: string, depId: string) {
this.loading=true this.loading=true
this.$service.department.getDep({ this.$service.department.getDep({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment