Commit 5366e2d6 authored by sixiaofeng's avatar sixiaofeng

1

parent 53045556
......@@ -8,7 +8,10 @@ Vue.use(Vuex)
export default new Vuex.Store({
state: {
enterpriseInfo: undefined,
acceptJoin: undefined
acceptJoin: undefined,
addDep: undefined,
selectedStaff: undefined,
selectedDep: undefined
},
mutations: {
setEnterpriseInfo(state, payload) {
......@@ -16,7 +19,16 @@ export default new Vuex.Store({
},
setAcceptJoin(state, payload) {
state.acceptJoin = payload
}
},
setAddDep(state, payload) {
state.addDep = payload
},
setSelectedStaff(state, payload) {
state.selectedStaff = payload
},
setSelectedDep(state, payload) {
state.selectedDep = payload
},
},
actions: {
},
......
......@@ -6,7 +6,7 @@
>
<div class="pt-14 px-4">
<input-cell
v-model="name"
v-model="addDep.name"
required
:limit="20"
label="部门名称"
......@@ -16,14 +16,14 @@
<group-cell class="mt-4" title="部门主管">
<c-cell
dot
title="默认为添加的人,主管即为群主"
:title="leader.name || '选择主管'"
@click="selectCharger"
/>
</group-cell>
<group-cell class="mt-4" title="所属团队">
<c-cell
dot
title="杭州复杂美科技有限公司"
:title="parentDep.name"
@click="$router.push('/team/select-team')"
/>
</group-cell>
......@@ -38,6 +38,7 @@
import { useRequest } from 'ahooks-vue'
import Vue from 'vue'
import {AddSubDTO} from '@/service/moudles/service.dto'
export default Vue.extend({
components:{
......@@ -51,6 +52,12 @@ export default Vue.extend({
},
name: 'AddDepartment',
data() {
const addDep:AddSubDTO = {
entId: '',
leaderId: '1FKxgaEh5fuSm7a35BfUnKYAmradowpiTR',
name: '',
parentId: ''
}
return {
name: '产品部',
check: false,
......@@ -59,21 +66,18 @@ export default Vue.extend({
data:null as any,
loading:true as any,
error:null as any
}
},
addDep,
parentDep: {},
leader: {}
}
},
async mounted(){
mounted(){
this.addDep = this.$store.state.addDep || this.addDep
this.parentDep = this.$store.state.addDepParent || {}
this.leader = this.$store.state.addDepLeader || {}
},
methods: {
// enterpriseInfo(){
// const { data, loading, error} =useRequest(this.$service.enterprise.getEnterpriseInfo({
// "id": "166961152260050944"
// }))
// this.enterpriseInfoObj.data = data
// this.enterpriseInfoObj.loading = loading
// this.enterpriseInfoObj.error = error
// },
addDepConfirm(){
const { data, loading, error, run} =useRequest(this.$service.department.addDep({
"entId": "entId",
......
......@@ -2,12 +2,13 @@
<div class="file">
<main-page
left-arrow
:loading="loading"
@click-left="handleClickLeft"
>
<div class="px-4 pt-14 pb-16">
<!-- 姓名/职位 -->
<input-cell
v-model="name"
v-model="acceptJoin.name"
required
:limit="10"
label="真实姓名"
......@@ -15,7 +16,7 @@
error-msg="姓名不能为空"
/>
<input-cell
v-model="position"
v-model="acceptJoin.position"
required
:limit="10"
label="职位"
......@@ -24,7 +25,7 @@
/>
<!-- 手机号/员工编号/入职时间 -->
<c-cell
v-model="phone"
v-model="acceptJoin.phone"
required
title="手机号"
placeholder="请输入手机号"
......@@ -33,18 +34,18 @@
type="input"
:validator="checkPhone"
/>
<c-cell
<!-- <c-cell
v-model="digit"
title="员工编号"
placeholder="请输入员工编号"
type="input"
/>
/> -->
<c-cell
v-model="date"
dot
required
title="入职时间"
:content="date"
:content="formatDate(acceptJoin.joinTime || new Date().getTime(), 'YYYY-MM-DD')"
@click="show = true"
/>
<van-calendar
......@@ -61,9 +62,9 @@
required
class="mt-4"
title="所属部门"
@click="$router.push('/team/select-team')"
@click="selectDep"
>
<c-cell title="产品设计部" />
<c-cell :title="currentDep.name" />
</group-cell>
<!--按钮-->
<div class="fixed bottom-0 left-0 w-full px-4 py-1.5 bg-common-bg">
......@@ -82,7 +83,9 @@ import Vue from 'vue'
import { Calendar } from 'vant'
import { AcceptJoinDTO } from '@/service/moudles/service.dto'
import { trim } from '@/util/Contact'
import {Department} from '@/Interface'
import { useLocalStorageState } from 'ahooks-vue'
import {formatDate} from '@/util/FormatDate'
Vue.use(Calendar)
export default Vue.extend({
......@@ -95,29 +98,67 @@ export default Vue.extend({
'group-cell': () => import('@/components/common/group-cell.vue')
},
data() {
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: '',
}
const acceptJoin: AcceptJoinDTO = {
expiration: 0,
inviterId: '17MTDNzwBXXKNzwdzEnQrehmSEPAy31sUS',
name: '',
oaServer: 'oaServer',
depId: '',
entId: '',
hash: 'mock-hash',
joinTime: 0,
phone: '',
position: ''
}
return {
// "expiration": number,
// "inviterId": string,
// "name": string,
// "oaServer": string,
// "depId": string,
// "entId": string,
// "hash": string,
joinTime: new Date().getTime(),
// "position": string
name: '', // 姓名
position: '',
phone: '', // 电话号码
digit: '', // 员工编号
formatDate,
// joinTime: new Date().getTime(),
// name: '', // 姓名
// position: '',
// phone: '', // 电话号码
// digit: '', // 员工编号
date: '请选择入职时间', // 入职时间
show: false, // 日期弹窗
depId: '123'
depId: '123',
entId: '',
currentDep,
loading: false,
acceptJoin,
}
},
created() {
// this.depId = (this.$route.query.teamId || '') as string
this.depId = this.$route.query.id as string
this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id
this.acceptJoin = Object.assign(this.acceptJoin, this.$store.state.acceptJoin)
this.getDep()
},
methods: {
selectDep() {
this.acceptJoin.expiration = this.acceptJoin.joinTime
this.acceptJoin.oaServer = 'http://172.16.101.107:20000'
this.$store.commit('setAcceptJoin', this.acceptJoin)
this.$router.push('/team/select-team')
},
getDep() {
this.loading = true
this.$service.department.getDep({
entId: this.entId,
id: this.depId
}).then((res: any) => {
const {data}=res
this.loading = false
if (data.code === this.$global.success) {
this.currentDep = data.data
}
})
},
validatePhone(val: string) {
const reg = /^1[3456789]\d{9}$/
return reg.test(val)
......@@ -132,18 +173,14 @@ export default Vue.extend({
handleClickLeft() {
this.$router.go(-1)
},
formatDate(date:Date) {
// 获取日期
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
},
// 入职日期
selectJoinTime(date:Date) {
this.joinTime = new Date(date).getTime()
this.acceptJoin.joinTime = new Date(date).getTime()
this.show = false
this.date = this.formatDate(date)
},
generateQrCode() {
if (!this.validatePhone(this.phone) || trim(this.name) === '' || trim(this.position) === '' || this.joinTime === 0 || trim(this.depId) === '') {
if (!this.validatePhone(this.acceptJoin.phone) || trim(this.acceptJoin.name) === '' || trim(this.acceptJoin.position) === '' || this.acceptJoin.joinTime === 0 || trim(this.depId) === '') {
this.$toast('请检查输入内容')
return
}
......@@ -152,19 +189,12 @@ export default Vue.extend({
message: '确定保存该成员信息,并生成成员信息二维码邀请该成员加入团队?'
// confirmButtonText: '解散'
}).then(() => {
const data = {
expiration: 1,
inviterId: 'inviterId',
name: this.name,
oaServer: 'oaServer',
depId: this.depId,
entId: 'entId',
hash: 'hash',
joinTime: this.joinTime,
phone: this.phone,
position: this.position
}
this.$store.commit('setAcceptJoin', data)
this.acceptJoin.entId = this.entId
this.acceptJoin.depId = this.depId
this.acceptJoin.expiration = this.acceptJoin.joinTime
this.acceptJoin.inviterId ="1FKxgaEh5fuSm7a35BfUnKYAmradowpiTR"
this.acceptJoin.oaServer = 'http://172.16.101.107:20000'
this.$store.commit('setAcceptJoin', this.acceptJoin)
this.$router.push('/team/two-code')
}).catch(() => {})
}
......
......@@ -112,6 +112,10 @@ export default Vue.extend({
default() {
return []
}
},
multiple: {
type: Boolean,
default: false
}
},
components:{
......@@ -190,14 +194,21 @@ export default Vue.extend({
this.$emit('click-member', member)
},
handleCheck(member: Staff) {
let arr = Array.from(this.checked)
const index = arr.findIndex(id => id === member.id)
if (index > -1) {
arr.splice(index, 1)
if (this.multiple) {
// 多选
let arr = Array.from(this.checked)
const index = arr.findIndex(id => id === member.id)
if (index > -1) {
arr.splice(index, 1)
} else {
arr.push(member.id)
}
this.$emit('update:checked', arr)
} else {
arr.push(member.id)
// 单选
const arr = [member.id]
this.$emit('update:checked', arr)
}
this.$emit('update:checked', arr)
}
}
})
......
......@@ -4,17 +4,15 @@
<main-page
header-bg="bg-transparent"
title-color="text-white"
@click-left="$router.go(-1)"
:loading="loading"
>
<!-- 顶部左侧插槽 -->
<template slot="left">
<app-icon
type="png"
class-name="w-6.5 w-6.5"
:path="require('@/assets/icons/left-arrow-white.png')"
@click="$router.go(-1)"
/>
</template>
<!-- <app-icon
slot="left"
class-name="w-6.5 w-6.5"
icon-name="left-arrow-white"
@click="$router.go(-1)"
/> -->
<div class="relative w-full h-40 bg-color-primary">
<!-- 背景图 -->
<!-- <img class="w-82 absolute top-0 right-0" src="@/assets/images/header-bg.png" alt=""> -->
......@@ -50,12 +48,25 @@
title="部门"
title-class="text-sm text-text-secondary"
>
<div slot="content" class="text-text-primary">{{info.name}}</div>
<div slot="content" class="text-text-primary">{{departName}}</div>
</c-cell>
<c-cell
title="入职时间"
title-class="text-sm text-text-secondary"
>
<div slot="content" class="text-text-primary">{{formatDate(info.joinTime, 'YYYY-MM-DD')}}</div>
</c-cell>
<c-cell
title="手机号"
title-class="text-sm text-text-secondary"
>
<div slot="content" class="text-text-primary">{{info.phone}}</div>
</c-cell>
</group-cell>
<!-- 底部操作 -->
<div class="py-2 px-4 bg-common-bg w-screen fixed bottom-0 left-0 z-30">
<c-button round @click="submit">提交申请</c-button>
<div class="pt-1 pb-3 px-4 bg-common-bg w-screen fixed bottom-0 left-0 z-30">
<c-button round @click="submit">同意加入团队</c-button>
<div class="px-6 info text-xs text-text-secondary mt-2.5 text-center">同意加入团队将绑定您的个人账号,若信息有误需修改,请联系团队管理员</div>
</div>
</div>
</main-page>
......@@ -64,6 +75,8 @@
<script lang="ts">
import Vue from 'vue'
import {formatDate} from '@/util/FormatDate'
import {AcceptJoinDTO} from '@/service/moudles/service.dto'
export default Vue.extend({
name: 'JoinTeam',
......@@ -76,23 +89,60 @@ export default Vue.extend({
'c-cell': () => import('@/components/common/c-cell.vue')
},
data() {
return {
const info: AcceptJoinDTO = {
expiration: 0,
inviterId: '',
name: '',
oaServer: '',
depId: '',
entId: '',
hash: '',
joinTime: 0,
phone: '',
validateNum: '',
reason: '',
info: {
name: '张三'
}
position: ''
}
return {
formatDate,
info,
departName: '',
loading: false
}
},
created() {
const query = this.$route.query.query || '{}'
const info = JSON.parse(query as string)
this.info = JSON.parse(query as string)
this.getDepInfo()
},
methods: {
submit() {
console.log('申请')
this.loading = true
this.$service.enterprise.acceptJoin(this.info)
.then((res: any) => {
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
this.$toast('加入成功')
this.$store.commit('acceptJoin', {})
}else {
this.$toast(data.msg)
}
})
},
getDepInfo() {
this.loading = true
this.$service.department.getDep({
entId: this.info.entId,
id: this.info.depId
}).then((res: any) => {
this.loading = false
const {data} = res
if (data.code === this.$global.success) {
console.log(data.data.name, 'depIndo')
this.departName = data.data.name
}
})
}
}
})
......
<template>
<!-- 选择部门 -->
<div class="select-team">
<main-page left-arrow @click-left="$router.go(-1)">
<main-page
left-arrow
:loading="loading"
@click-left="$router.go(-1)"
>
<template slot="right">
<app-icon
type="png"
......@@ -13,14 +17,14 @@
<div class="px-4 pt-14 pb-16">
<!-- 顶部 -->
<div class="bread">
<template v-if="currentTeamId === 0">
<div class="font-medium py-3.5">杭州复杂美科技有限公司</div>
<template v-if="currentDep.parentId === '-1'">
<div class="font-medium py-3.5">{{entName}}</div>
</template>
<template v-else>
<div class="flex items-center">
<div class="text-text-secondary font-medium py-3" @click="goPre">所有部门</div>
<div class="text-text-secondary py-3 text-xs mx-2">></div>
<div class="font-medium py-3">{{ currentTeam.name }}</div>
<div class="font-medium py-3">{{ currentDep.name }}</div>
</div>
</template>
......@@ -28,7 +32,7 @@
<!-- 部门列表 -->
<div class="list mt-1.5">
<div
v-for="t in currentTeam.children"
v-for="t in currentDep.children"
:key="t.id"
class="flex items-center"
>
......@@ -53,7 +57,6 @@
</div>
</div>
<div
v-if="t.children && t.children.length > 0"
class="flex-shrink-0 flex items-center text-color-primary py-3"
@click="goNext(t)"
>
......@@ -66,7 +69,6 @@
</div>
</div>
<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"
>
......@@ -79,7 +81,7 @@
<script lang="ts">
import Vue from 'vue'
import { team, flatTeams, Member } from '@/DTO'
import {Department} from '@/Interface'
export default Vue.extend({
name: 'SelectTeam',
......@@ -94,63 +96,81 @@ export default Vue.extend({
vm.fromPath = from.path
})
},
created() {
// console.log(this.team, 'team')
},
data() {
const selectedIds: Array<number> = []
const selectedIds: Array<Department> = []
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: '',
children: []
}
return {
team,
flatTeams,
checked: 0,
selectedIds,
currentTeamId: 0,
fromPath: ''
checked: '',
fromPath: '',
loading: false,
entId: '',
depId: '',
currentDep,
entName: ''
}
},
computed: {
tags() {
const arr: Array<Member> = []
this.selectedIds.forEach(id => {
const index = this.flatTeams.findIndex(team => team.id === id)
if (index > -1) {
arr.push(this.flatTeams[index])
created() {
const ent = JSON.parse(localStorage.getItem('ENT_INFO') || '{}')
this.entId = ent.id
this.depId = ent.rootDepId
this.checked = ent.id
this.getSub()
},
methods: {
getSub() {
this.loading = true
this.$service.department.getSub({
entId: this.entId,
parentId: this.depId
}).then((res: any) => {
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
console.log(data, 'adad')
this.currentDep = data.data.dep
if (this.currentDep.parentId === '-1') {
this.entName = this.currentDep.name
}
this.currentDep.children = data.data.subDepList
}
}).catch(()=>{
this.loading=false
})
return arr
},
currentTeam(): Member {
// return this.flatTeams.find(team => team.id === this.currentTeamId)
return this.findTeamById(this.currentTeamId, this.flatTeams) as Member
}
},
methods: {
// 下一级
goNext(team: Member) {
this.currentTeamId = team.id
goNext(team: Department) {
console.log(team, 'team')
// this.currentTeamId = team.id
this.depId = team.id
this.getSub()
},
// 所有部门
goPre() {
this.currentTeamId = this.currentTeam.parentId || 0
this.checked = 0
this.depId = this.currentDep.parentId
this.getSub()
},
// 选择
selectTeam(team: Member) {
selectTeam(team: Department) {
if (this.checked === team.id) {
this.checked = 0
this.checked = this.currentDep.id
return
}
this.checked = team.id
},
findTeamById(id: number | string, teamArr: Array<Member>) {
return teamArr.find(team => team.id === id)
},
// 确认选择
confirm() {
console.log(this.checked, 'checked')
this.$router.push({
path: this.fromPath,
query: {
teamId: String(this.checked)
id: String(this.checked)
}
})
}
......
......@@ -88,7 +88,8 @@ export default Vue.extend({
checkedMemberId: [],
showRadio: false,
ifContainChildDep: true,
loading: false
loading: false,
multiple: false
}
},
watch: {
......@@ -101,7 +102,8 @@ export default Vue.extend({
}
},
created() {
this.showRadio = this.$route.query.transfer === '1'
this.showRadio = this.$route.query.showRadio === '1'
this.multiple = this.$route.query.multiple === '2'
this.parentId = this.$route.params.id
this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id
this.getStaff(this.parentId)
......
......@@ -32,6 +32,7 @@
<div class="text-text-secondary py-1">成员</div>
<team-contacts
:radio="showRadio"
:multiple="multiple"
:checked.sync="checkedMemberId"
:contacts="contacts"
@click-member="clickMember"
......@@ -40,12 +41,12 @@
<!-- 底部操作 -->
<div class="py-2 px-4 bg-white w-screen fixed bottom-0 left-0 z-30">
<template v-if="showRadio">
<c-button round @click="$router.go(-1)">确定</c-button>
<c-button round @click="confirmSelect">确定</c-button>
</template>
<template v-else>
<div class="grid grid-cols-3 gap-2.5">
<c-button round @click="$router.push('/team/add-member')">添加成员</c-button>
<c-button round @click="$router.push('/team/add-department')">添加部门</c-button>
<c-button round @click="addMember">添加成员</c-button>
<c-button round @click="addDep">添加部门</c-button>
<c-button round @click="setDepartment">部门设置</c-button>
</div>
</template>
......@@ -73,8 +74,20 @@ 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: Array<Department> = []
const currentDep: Department = {
entId: '',
id: '',
leaderId: '',
name: '',
parentId: ''
}
return {
title: '导航',
team,
......@@ -83,10 +96,12 @@ export default Vue.extend({
parentId: '166961152260050945',
ifContainChildDep: true,
enterpriseInfo: {},
currentDep: {},
currentDep,
// 是否显示check
checkedMemberId: [],
showRadio: false
showRadio: false,
fromPath: '',
multiple: false
}
},
created() {
......@@ -98,6 +113,11 @@ export default Vue.extend({
this.getStaff()
},
methods: {
// 确认选择
confirmSelect() {
this.$store.commit('setAddDepLeader', this.checkedMemberId)
this.$router.push(this.fromPath)
},
getEntInfo() {
this.loading = true
this.$service.enterprise.getEnterpriseInfo({
......@@ -145,12 +165,12 @@ export default Vue.extend({
this.$router.push({
path: `/team/team/${val.id}`,
query: {
transfer: '1'
showRadio: '1',
multiple: '1' // 1单选2多选
}
})
return
}
console.log(val, 'del')
this.$router.push(`/team/team/${val.id}`)
},
// 切换成员显示
......@@ -161,6 +181,20 @@ export default Vue.extend({
setDepartment() {
const id = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').rootDepId
this.$router.push(`/team/department-management/${id}`)
},
// 添加成员
addMember() {
this.$router.push({
path: '/team/add-member',
query: {
id: this.currentDep.id
}
})
// $router.push('/team/add-member')
},
addDep() {
this.$store.commit('setAddDepParent', this.currentDep)
this.$router.push('/team/add-department')
}
}
})
......
......@@ -20,7 +20,7 @@
<vue-qr
:logoSrc="require('@/assets/icons/y-chat33.png')"
:text="qrCodeText"
:correct-level="3"
:margin="2"
:size="400"
/>
......@@ -73,8 +73,9 @@ export default Vue.extend({
async created() {
// console.log(Mock, 'mock')
this.joinInfo = this.$store.state.acceptJoin || {}
console.log(this.joinInfo, 'joinIndo')
this.qrCodeText = JSON.stringify(this.joinInfo)
let url = 'http://192.168.20.138:8080/team/join-team'
let url = 'http://192.168.20.138:8080/team/confirm-join'
// for(const key in this.joinInfo) {
// url = `${url}?${key}=${this.joinInfo[key]}`
// }
......
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