Commit 2eb06b57 authored by sixiaofeng's avatar sixiaofeng

Merge branch 'mian_20210904_sxf'

parents 75dc9b12 1f44c191
src/assets/icons/radio-checked.png

513 Bytes | W: | H:

src/assets/icons/radio-checked.png

1.42 KB | W: | H:

src/assets/icons/radio-checked.png
src/assets/icons/radio-checked.png
src/assets/icons/radio-checked.png
src/assets/icons/radio-checked.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/icons/radio.png

497 Bytes | W: | H:

src/assets/icons/radio.png

1.49 KB | W: | H:

src/assets/icons/radio.png
src/assets/icons/radio.png
src/assets/icons/radio.png
src/assets/icons/radio.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/icons/tree.png

560 Bytes | W: | H:

src/assets/icons/tree.png

575 Bytes | W: | H:

src/assets/icons/tree.png
src/assets/icons/tree.png
src/assets/icons/tree.png
src/assets/icons/tree.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<div <div
class="mb-px flex text-text-primary items-center justify-between bg-white px-4 py-3 rounded" class="mb-px flex text-text-primary items-center justify-between px-4 py-3 rounded"
:class="className"
> >
<div class="flex items-center justify-between flex-1 mr-1.5"> <div class="flex items-center justify-between flex-1 mr-1.5">
<div class="title flex-shrink-0 mr-4">{{ title }}</div> <div class="title flex-shrink-0 mr-4">{{ title }}</div>
</div> </div>
<van-switch :value="checked" size="20px" @change='change' /> <van-switch
active-color="#4F62C1"
:value="checked"
size="20px"
@change='change'
/>
</div> </div>
</template> </template>
...@@ -24,6 +30,10 @@ export default Vue.extend({ ...@@ -24,6 +30,10 @@ export default Vue.extend({
checked: { checked: {
type: Boolean, type: Boolean,
default: false default: false
},
className: {
type: String,
default: 'bg-white'
} }
}, },
name: 'SwitchCell', name: 'SwitchCell',
......
...@@ -139,7 +139,7 @@ export const teamRoutes: Array<RouteConfig> = [ ...@@ -139,7 +139,7 @@ export const teamRoutes: Array<RouteConfig> = [
name: 'SelectTeam', name: 'SelectTeam',
component: () => import('@/views/team/select-team.vue'), component: () => import('@/views/team/select-team.vue'),
meta:{ meta:{
title:'选择团队' title:'选择部门'
} }
}, },
{ {
...@@ -147,7 +147,7 @@ export const teamRoutes: Array<RouteConfig> = [ ...@@ -147,7 +147,7 @@ export const teamRoutes: Array<RouteConfig> = [
name: 'SelectTeamDetail', name: 'SelectTeamDetail',
component: () => import('@/views/team/select-team.vue'), component: () => import('@/views/team/select-team.vue'),
meta:{ meta:{
title:'选择团队' title:'选择部门'
} }
}, },
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!-- 添加部门 --> <!-- 添加部门 -->
<main-page <main-page
left-arrow left-arrow
@click-left="$router.go(-1)" @click-left="$router.push('/team')"
> >
<div class="pt-14 px-4"> <div class="pt-14 px-4">
<input-cell <input-cell
...@@ -14,7 +14,11 @@ ...@@ -14,7 +14,11 @@
error-msg="名称不能为空" error-msg="名称不能为空"
/> />
<group-cell class="mt-4" title="部门主管"> <group-cell class="mt-4" title="部门主管">
<c-cell dot title="默认为添加的人,主管即为群主" /> <c-cell
dot
title="默认为添加的人,主管即为群主"
@click="selectCharger"
/>
</group-cell> </group-cell>
<group-cell class="mt-4" title="所属团队"> <group-cell class="mt-4" title="所属团队">
<c-cell dot title="杭州复杂美科技有限公司" /> <c-cell dot title="杭州复杂美科技有限公司" />
...@@ -39,12 +43,22 @@ export default Vue.extend({ ...@@ -39,12 +43,22 @@ export default Vue.extend({
// 'switch-cell': () => import('./components/switch-cell.vue'), // 'switch-cell': () => import('./components/switch-cell.vue'),
'group-cell': () => import('@/components/common/group-cell.vue') 'group-cell': () => import('@/components/common/group-cell.vue')
}, },
name: 'DepartmentManagement', name: 'AddDepartment',
data() { data() {
return { return {
name: '产品部', name: '产品部',
check: false check: false
} }
},
methods: {
selectCharger() {
this.$router.push({
path: '/team/team-frame',
query: {
showRadio: '1'
}
})
}
} }
}) })
</script> </script>
......
...@@ -41,15 +41,21 @@ ...@@ -41,15 +41,21 @@
:content="date" :content="date"
@click="show = true" @click="show = true"
/> />
<van-calendar v-model="show" :round="false" color="#61C7FF" @confirm="onConfirm" :show-confirm="false" :style="{ height:'100%'}" /> <van-calendar
v-model="show"
:round="false"
color="#4F62C1"
@confirm="onConfirm"
:show-confirm="false"
:style="{ height:'100%'}"
/>
<!-- 选择部门 --> <!-- 选择部门 -->
<group-cell <group-cell
dot dot
class="mt-4" title="所属部门" class="mt-4" title="所属部门"
@click="$router.push('/team/select-team')" @click="$router.push('/team/select-team')"
> >
<c-cell title="产品设计部(主要部门)" /> <c-cell title="产品设计部" />
<c-cell title="设计部(子部门)" />
</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">
...@@ -68,7 +74,7 @@ import Vue from 'vue' ...@@ -68,7 +74,7 @@ import Vue from 'vue'
import { Calendar } from 'vant'; import { Calendar } from 'vant';
Vue.use(Calendar); Vue.use(Calendar);
export default Vue.extend({ export default Vue.extend({
name: 'File', name: 'AddMember',
components: { components: {
'main-page': () => import('@/layout/main-page.vue'), 'main-page': () => import('@/layout/main-page.vue'),
'input-cell': () => import('@/components/common/input-cell.vue'), 'input-cell': () => import('@/components/common/input-cell.vue'),
...@@ -77,7 +83,7 @@ export default Vue.extend({ ...@@ -77,7 +83,7 @@ export default Vue.extend({
'group-cell': () => import('@/components/common/group-cell.vue') 'group-cell': () => import('@/components/common/group-cell.vue')
}, },
created() { created() {
// console.log(Mock, 'mock') this.depId = (this.$route.query.teamId || '') as string
}, },
data() { data() {
return { return {
...@@ -86,7 +92,8 @@ export default Vue.extend({ ...@@ -86,7 +92,8 @@ export default Vue.extend({
tel: '',//电话号码 tel: '',//电话号码
digit: '',//员工编号 digit: '',//员工编号
date: '请选择入职时间',//入职时间 date: '请选择入职时间',//入职时间
show:false,//日期弹窗 show:false,//日期弹窗
depId: ''
} }
}, },
methods: { methods: {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div class="ml-3">{{ member.name }}</div> <div class="ml-3">{{ member.name }}</div>
<div <div
v-if="member.isDirector || member.isLeader" v-if="member.isDirector || member.isLeader"
class="tag ml-1.5 text-xs text-white px-1 py-0.5 bg-color-primary-lighter rounded" class="tag ml-1.5 text-xs text-white px-1 py-0.5 bg-color-primary rounded"
> >
{{ member.isLeader ? '负责人' : '主管'}} {{ member.isLeader ? '负责人' : '主管'}}
</div> </div>
......
<template> <template>
<!-- 通讯录 --> <!-- 通讯录 -->
<div class="team-contacts relative"> <div class="team-contacts relative">
<!-- 右侧导航 -->
<div class="nav-wrapper fixed top-1/2 transform -translate-y-1/2 right-0 w-6 z-20"> <div class="nav-wrapper fixed top-1/2 transform -translate-y-1/2 right-0 w-6 z-20">
<div <div
v-for="(nav, index) in navs" v-for="(nav, index) in navs"
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
{{ nav }} {{ nav }}
</div> </div>
</div> </div>
<!-- 主管负责人 -->
<div class="leaders"> <div class="leaders">
<div <div
v-for="(leader, index) in leaders" v-for="(leader, index) in leaders"
...@@ -40,13 +42,14 @@ ...@@ -40,13 +42,14 @@
<contact-member :member="leader" @click="clickMember"/> <contact-member :member="leader" @click="clickMember"/>
</div> </div>
</div> </div>
<!-- 成员 -->
<div class="members"> <div class="members">
<div <div
v-for="(value, key) in contacts" v-for="(value, key) in contacts"
:key="key" :key="key"
:ref="key" :ref="key"
> >
<div class="text-text-secondary py-1 sticky top-12 bg-common-bg z-10">{{ key }}</div> <div class="text-text-secondary py-1 sticky top-12 bg-white z-10">{{ key }}</div>
<div <div
v-for="(member, index) in contacts[key]" v-for="(member, index) in contacts[key]"
:key="index" :key="index"
......
<template> <template>
<!-- 选择团队 --> <!-- 选择部门 -->
<div class="select-team"> <div class="select-team">
<main-page left-arrow @click-left="$router.go(-1)"> <main-page left-arrow @click-left="$router.push('/team')">
<template slot="right"> <template slot="right">
<app-icon <app-icon
type="png" type="png"
...@@ -25,33 +25,6 @@ ...@@ -25,33 +25,6 @@
</template> </template>
</div> </div>
<!-- 标签 -->
<div class="tag-wrapper mt-1 flex flex-wrap text-text-secondary text-sm">
<div
v-if="tags.length < 1"
class="empty"
>
暂未选择部门
</div>
<template v-else>
<div
v-for="tag in tags"
:key="tag.id"
class="tag text-sm px-2.5 py-1 border border-color-primary rounded-full text-color-primary relative mr-5 my-2"
>
<div
class="absolute -left-2 -top-0.5"
@click="removeTag(tag)"
>
<app-icon
icon-name="close-tag"
class-name="w-4 h-4"
/>
</div>
{{ tag.name }}
</div>
</template>
</div>
<!-- 部门列表 --> <!-- 部门列表 -->
<div class="list mt-1.5"> <div class="list mt-1.5">
<div <div
...@@ -92,7 +65,11 @@ ...@@ -92,7 +65,11 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="showConfirmBtn" class="action fixed bottom-0 left-0 w-full px-4 py-2 z-10 bg-common-bg"> <div
v-if="checked !== 0"
class="action fixed bottom-0 left-0 w-full px-4 py-2 z-10 bg-common-bg"
@click="confirm"
>
<c-button round>确定</c-button> <c-button round>确定</c-button>
</div> </div>
</div> </div>
...@@ -111,6 +88,12 @@ export default Vue.extend({ ...@@ -111,6 +88,12 @@ export default Vue.extend({
'app-icon': () => import('@/components/common/Icon.vue'), 'app-icon': () => import('@/components/common/Icon.vue'),
'c-button': () => import('@/components/common/c-button.vue') 'c-button': () => import('@/components/common/c-button.vue')
}, },
beforeRouteEnter(to, from, next) {
console.log(to, from)
next((vm: any) => {
vm.fromPath = from.path
})
},
created() { created() {
// console.log(this.team, 'team') // console.log(this.team, 'team')
}, },
...@@ -121,7 +104,8 @@ export default Vue.extend({ ...@@ -121,7 +104,8 @@ export default Vue.extend({
flatTeams, flatTeams,
checked: 0, checked: 0,
selectedIds, selectedIds,
currentTeamId: 0 currentTeamId: 0,
fromPath: ''
} }
}, },
computed: { computed: {
...@@ -138,101 +122,37 @@ export default Vue.extend({ ...@@ -138,101 +122,37 @@ export default Vue.extend({
currentTeam(): Member { currentTeam(): Member {
// return this.flatTeams.find(team => team.id === this.currentTeamId) // return this.flatTeams.find(team => team.id === this.currentTeamId)
return this.findTeamById(this.currentTeamId, this.flatTeams) as Member return this.findTeamById(this.currentTeamId, this.flatTeams) as Member
},
showConfirmBtn() {
let check = false
// const team = this.flatTeams.find(item => item.id === this.checked)
const team = this.findTeamById(this.checked, this.flatTeams) as Member
if (typeof team.children === 'undefined' || team.children.length < 1) {
check = true
}
return check
} }
}, },
methods: { methods: {
// 下一级 // 下一级
goNext(team: Member) { goNext(team: Member) {
if (team.id !== this.checked) return
this.currentTeamId = team.id this.currentTeamId = team.id
this.setChecked()
}, },
// 所有部门 // 所有部门
goPre() { goPre() {
this.currentTeamId = this.currentTeam.parentId || 0 this.currentTeamId = this.currentTeam.parentId || 0
this.setChecked() this.checked = 0
},
setChecked() {
this.currentTeam.children?.forEach(child => {
if (this.selectedIds.indexOf(child.id) > -1) {
this.checked = child.id
}
})
}, },
// 选择 // 选择
selectTeam(team: Member) { selectTeam(team: Member) {
if (this.checked === team.id) return if (this.checked === team.id) {
if (this.currentTeamId === 0) { this.checked = 0
this.selectedIds = [] return
} }
this.checked = team.id this.checked = team.id
// const index = this.selectedIds.findIndex(id => id === team.id)
const index = this.findIndexById(team.id, this.selectedIds)
if (index < 0) {
this.selectedIds.push(team.id)
}
},
findIndexById(id: number | string, target: Array<string | number>) {
return target.findIndex(item => item === id)
}, },
findTeamById(id: number | string, teamArr: Array<Member>) { findTeamById(id: number | string, teamArr: Array<Member>) {
return teamArr.find(team => team.id === id) return teamArr.find(team => team.id === id)
}, },
// 移除 // 确认选择
removeTag(tag: Member) { confirm() {
// const index = this.selectedIds.findIndex(id => id === tag.id) this.$router.push({
const index = this.findIndexById(tag.id, this.selectedIds) path: this.fromPath,
this.selectedIds.splice(index, 1) query: {
this.checked = 0 teamId: String(this.checked)
// const removeTeam = this.findTeamById(tag.id, this.flatTeams)
// if (typeof removeTeam !== 'undefined' && removeTeam.children && removeTeam.children.length > 0) {
// removeTeam.children.forEach((item: Member) => {
// // const index = this.selectedIds.findIndex(id => id === item.id)
// const index = this.findIndexById(item.id, this.selectedIds)
// if (index > -1) {
// this.selectedIds.splice(index, 1)
// }
// })
// }
this.removeTags(tag.id, this.selectedIds, this.flatTeams)
this.checked = tag.parentId || 0
this.currentTeamId = tag.parentId || 0
},
// 递归删除选择的子部门
removeTags(id: number | string, idArr: Array<number | string>, teams: Array<Member>) {
const removeTeam = this.findTeamById(id, this.flatTeams)
if (typeof removeTeam !== 'undefined' && removeTeam.children && removeTeam.children.length > 0) {
removeTeam.children.forEach((child: Member) => {
const index = this.findIndexById(child.id, this.selectedIds)
if (index > -1) {
this.selectedIds.splice(index, 1)
}
if (child.children && child.children.length) {
this.removeTags(child.id, idArr, teams)
}
})
}
}
},
watch: {
checked(newVal, oldVal) {
const check = this.currentTeam.children?.find(item => item.id === oldVal)
if (typeof check !== 'undefined') {
const index = this.findIndexById(oldVal, this.selectedIds)
if (index > -1) {
this.selectedIds.splice(index, 1)
} }
} })
} }
} }
}) })
......
<template> <template>
<!-- 团队详情 --> <!-- 团队详情 -->
<main-page left-arrow @click-left="$router.go(-1)"> <main-page
main-bg="bg-white"
header-bg="bg-white"
left-arrow
@click-left="$router.go(-1)"
>
<template slot="right"> <template slot="right">
<app-icon <app-icon
type="png" type="png"
...@@ -16,6 +21,11 @@ ...@@ -16,6 +21,11 @@
:pre-team="parentTeam.name" :pre-team="parentTeam.name"
@click-child="clickItem" @click-child="clickItem"
/> />
<!-- 显示成员是否包含子部门成员 -->
<switch-cell
title="部门包含子部门成员"
:checked.sync="ifContainChildDep"
/>
<!-- 通讯录 --> <!-- 通讯录 -->
<div class="pb-16"> <div class="pb-16">
<div class="text-text-secondary py-1">成员</div> <div class="text-text-secondary py-1">成员</div>
...@@ -27,7 +37,7 @@ ...@@ -27,7 +37,7 @@
/> />
</div> </div>
<!-- 底部操作 --> <!-- 底部操作 -->
<div class="py-2 px-4 bg-common-bg 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"> <template v-if="showRadio">
<c-button round @click="$router.push('/team/team-management')">确定</c-button> <c-button round @click="$router.push('/team/team-management')">确定</c-button>
</template> </template>
...@@ -55,7 +65,8 @@ export default Vue.extend({ ...@@ -55,7 +65,8 @@ export default Vue.extend({
'app-icon': () => import('@/components/common/Icon.vue'), 'app-icon': () => import('@/components/common/Icon.vue'),
'team-tree': () => import('@/views/team/components/team-tree.vue'), 'team-tree': () => import('@/views/team/components/team-tree.vue'),
'team-contacts': () => import('@/views/team/components/team-contacts.vue'), 'team-contacts': () => import('@/views/team/components/team-contacts.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')
}, },
created() { created() {
this.showRadio = this.$route.query.transfer === '1' this.showRadio = this.$route.query.transfer === '1'
...@@ -74,7 +85,8 @@ export default Vue.extend({ ...@@ -74,7 +85,8 @@ export default Vue.extend({
currentTeam, currentTeam,
flatTeams, flatTeams,
checkedMemberId: [], checkedMemberId: [],
showRadio: false showRadio: false,
ifContainChildDep: true
// newTeams: [] // newTeams: []
} }
}, },
......
<template> <template>
<!-- 团队架构 --> <!-- 团队架构 -->
<div class="team-frame"> <div class="team-frame">
<main-page left-arrow @click-left="$router.go(-1)"> <main-page
main-bg="bg-white"
header-bg="bg-white"
left-arrow
@click-left="$router.go(-1)"
>
<template slot="right"> <template slot="right">
<app-icon <app-icon
type="png" type="png"
...@@ -15,6 +20,11 @@ ...@@ -15,6 +20,11 @@
:tree-data="team" :tree-data="team"
@click-child="clickItem" @click-child="clickItem"
/> />
<!-- 显示成员是否包含子部门成员 -->
<switch-cell
title="部门包含子部门成员"
:checked.sync="ifContainChildDep"
/>
<!-- 通讯录 --> <!-- 通讯录 -->
<div class="pb-16"> <div class="pb-16">
<div class="text-text-secondary py-1">成员</div> <div class="text-text-secondary py-1">成员</div>
...@@ -26,7 +36,7 @@ ...@@ -26,7 +36,7 @@
/> />
</div> </div>
<!-- 底部操作 --> <!-- 底部操作 -->
<div class="py-2 px-4 bg-common-bg 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"> <template v-if="showRadio">
<c-button round @click="$router.go(-1)">确定</c-button> <c-button round @click="$router.go(-1)">确定</c-button>
</template> </template>
...@@ -55,11 +65,12 @@ export default Vue.extend({ ...@@ -55,11 +65,12 @@ export default Vue.extend({
'app-icon': () => import('@/components/common/Icon.vue'), 'app-icon': () => import('@/components/common/Icon.vue'),
'team-tree': () => import('@/views/team/components/team-tree.vue'), 'team-tree': () => import('@/views/team/components/team-tree.vue'),
'team-contacts': () => import('@/views/team/components/team-contacts.vue'), 'team-contacts': () => import('@/views/team/components/team-contacts.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')
}, },
created() { created() {
// console.log(Mock, 'mock') // console.log(Mock, 'mock')
this.showRadio = this.$route.query.transfer === '1' this.showRadio = this.$route.query.showRadio === '1'
}, },
mounted(){ mounted(){
let res = this.$service.department.getSub({ let res = this.$service.department.getSub({
...@@ -75,7 +86,8 @@ export default Vue.extend({ ...@@ -75,7 +86,8 @@ export default Vue.extend({
team, team,
contacts, contacts,
checkedMemberId: [], checkedMemberId: [],
showRadio: false showRadio: false,
ifContainChildDep: true
} }
}, },
methods: { methods: {
......
...@@ -93,7 +93,7 @@ export default Vue.extend({ ...@@ -93,7 +93,7 @@ export default Vue.extend({
this.$router.push({ this.$router.push({
path: '/team/team-frame', path: '/team/team-frame',
query: { query: {
transfer: '1' showRadio: '1'
} }
}) })
}, },
......
...@@ -67,7 +67,7 @@ export default Vue.extend({ ...@@ -67,7 +67,7 @@ export default Vue.extend({
}, },
methods: { methods: {
handleClickLeft() { handleClickLeft() {
this.$router.go(-1) this.$router.push('/team')
}, },
} }
......
...@@ -8,7 +8,7 @@ module.exports = { ...@@ -8,7 +8,7 @@ module.exports = {
extend: { extend: {
colors:{ colors:{
'common-bg': '#F6F7F8', 'common-bg': '#F6F7F8',
'color-primary': '#32B2F7', 'color-primary': '#4F62C1',
'color-primary-lighter': '#61C7FF', 'color-primary-lighter': '#61C7FF',
'text-primary': '#24374E', 'text-primary': '#24374E',
'text-primary-dark': '#0D73AD', 'text-primary-dark': '#0D73AD',
......
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