Commit ee2c6e8a authored by hanfeng zhang's avatar hanfeng zhang

Merge branch 'main' of gitlab.33.cn:HF_web/OKR

parents 30a875bf c28b2d16
export enum Role {
TEAM_LEDER = 0,
LEADER = 0,
SUPER_ADMIN = 1,
CLIENT_MANAGER = 2,
COMMOM_MEMBER = 3
CUSTOMER_ADMIN = 2,
COMMON_MEMBER = 3,
CHILD_ADMIN = 4,
}
export enum Apply {
......
......@@ -2,6 +2,7 @@ import Mock from 'mockjs'
import { strChineseFirstPY } from './strChineseFirstPY'
import { oMultiDiff } from './oMultiDiff'
import { Staff } from '@/Interface'
import { Role } from '@/service/moudles/service.dto'
// 参数,中文字符串
// 返回值:拼音首字母串数组
......@@ -108,3 +109,8 @@ export function getContacts(arr: Array<Staff>) {
})
return contacts
}
export function getLeaders(arr: Array<Staff>) {
if (typeof arr === 'undefined' || arr.length === 0) return []
return arr.filter((item: Staff) => item.role !== Role.COMMON_MEMBER).sort((a, b) => a.role - b.role)
}
......@@ -20,7 +20,7 @@
:radio="true"
:multiple="multiple"
:checked.sync="checkedMember"
:contacts="contacts"
:contact-list="contacts"
/>
</div>
<!-- 底部操作 -->
......@@ -62,7 +62,12 @@ export default Vue.extend({
type: String,
default: '团队成员'
},
contacts: Object,
contacts: {
type: Array,
default() {
return []
}
},
actionType: String
},
data() {
......
......@@ -41,7 +41,7 @@
:radio="true"
:multiple="multiple"
:checked.sync="checkedMember"
:contacts="contacts"
:contact-list="contacts"
/>
</div>
<!-- 底部操作 -->
......@@ -103,7 +103,7 @@ export default Vue.extend({
return {
team,
loading: false,
contacts: {},
contacts: [] as Array<Staff>,
parentId: '',
entId: '',
ifContainChildDep: false,
......@@ -197,7 +197,7 @@ export default Vue.extend({
if (data.code === this.$global.success) {
this.currentDep = data.data.dep
// 通讯录
this.contacts = getContacts(data.data.staffList || [])
this.contacts = data.data.staffList || []
// 部门树
const depTree = data.data.dep
depTree.children = data.data.subDepList
......
......@@ -15,7 +15,7 @@
</div>
<template v-if="Object.keys(list).length > 0">
<!-- 主管负责人 -->
<div class="leaders">
<div class="leaders" v-if="leaders.length > 0">
<div
v-for="(leader, index) in leaders"
:key="index"
......@@ -91,16 +91,17 @@
</template>
<script lang="ts">
import Vue from 'vue'
import Vue, {PropType} from 'vue'
import { Staff, Contacts } from '@/Interface'
import { Role } from '@/service/moudles/service.dto'
import { getContacts, getLeaders } from '@/util/Contact'
export default Vue.extend({
props: {
contacts: {
type: Object,
contactList: {
type: Array as PropType<Array<Staff>>,
default() {
return {}
return []
}
},
radio: {
......@@ -138,15 +139,14 @@ export default Vue.extend({
},
computed: {
leaders() {
let arr: Array<Staff> = []
for (const key in this.contacts) {
arr = arr.concat(this.contacts[key])
}
return arr.filter(item => item.role === Role.TEAM_LEDER || item.role === Role.SUPER_ADMIN ).sort((a, b) => b.role - a.role)
return getLeaders(this.contactList)
},
filteredContacts() {
return getContacts(this.contactList.filter((staff: Staff) => staff.role === Role.COMMON_MEMBER) || [])
},
navs() {
let arr: Array<string> = []
for (let key in this.contacts) {
for (let key in this.filteredContacts) {
if (key !== '#'){
arr.push(key)
} else {
......@@ -158,7 +158,7 @@ export default Vue.extend({
list() {
const obj: Contacts = {}
this.navs.forEach(nav => {
obj[nav] = this.contacts[nav]
obj[nav] = this.filteredContacts[nav]
})
return obj
}
......
......@@ -19,6 +19,7 @@
:multiple="multiple"
:action-type="actionType"
:contacts="contacts"
:leaders="leaders"
/>
<div class="pt-14 px-4">
<input-cell
......@@ -75,7 +76,7 @@
<script lang="ts">
import { Department, Staff } from '@/Interface'
import Vue from 'vue'
import { getContacts } from '@/util/Contact'
import { getContacts, getLeaders } from '@/util/Contact'
export default Vue.extend({
name: 'DepartmentManagement',
......@@ -105,7 +106,8 @@ export default Vue.extend({
memberSelectorTitle: '',
multiple: false,
contacts: {},
contacts: [],
leaders: [] as Array<Staff>,
showContactSelector: false,
contactSelectorTitle: '',
actionType: 'add'
......@@ -162,8 +164,8 @@ export default Vue.extend({
this.loading = false
if (data.code === this.$global.success) {
// 通讯录
this.contacts = getContacts(data.data.staffList || [])
console.log(this.contacts, data.data.staffList, 'this.contacts')
console.log(data.data.staffList, 'lll')
this.contacts = data.data.staffList || []
// 部门树
} else {
this.$toast(data.msg)
......
......@@ -35,7 +35,7 @@
<div class="text-text-secondary py-1">成员</div>
<team-contacts
:checked.sync="checkedMemberId"
:contacts="contacts"
:contact-list="contacts"
@click-member="clickMember"
/>
</div>
......@@ -56,7 +56,6 @@
import Vue from 'vue'
import { useLocalStorageState } from 'ahooks-vue'
import { appNavBack, getUserInfo, openCompanyUserInfo } from '@/util/Bridge'
import { getContacts } from '@/util/Contact'
import { Department, Staff } from '@/Interface'
// import {openCompanyUserInfo} from '@/util/Bridge'
......@@ -88,7 +87,7 @@ export default Vue.extend({
title: '导航',
team,
loading: false,
contacts: {},
contacts: [] as Array<Staff>,
parentId: '',
entId: '',
ifContainChildDep: true,
......@@ -168,7 +167,7 @@ export default Vue.extend({
if (data.code === this.$global.success) {
this.currentDep = data.data.dep
// 通讯录
this.contacts = getContacts(data.data.staffList || [])
this.contacts = data.data.staffList
// 部门树
const depTree = data.data.dep
depTree.children = data.data.subDepList
......
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