Commit 00b4867a authored by sixiaofeng's avatar sixiaofeng

1

parent 7d26ad2e
import BaseService from '../base' import BaseService from '../base'
import { AddSubDTO, DeleteSubDTO, GetALLStaffDTO, GetStaffInfoDTO, GetSub, UpdateDepDTO } from './service.dto' import { AddSubDTO, DeleteSubDTO, GetALLStaffDTO, GetDepDTO, GetSub, UpdateDepDTO } from './service.dto'
export default class Department extends BaseService { export default class Department extends BaseService {
router= { router= {
...@@ -52,10 +52,10 @@ export default class Department extends BaseService { ...@@ -52,10 +52,10 @@ export default class Department extends BaseService {
/** /**
* 获取部门基本信息 * 获取部门基本信息
* @param { GetStaffInfoDTO } data {GetStaffInfoDTO} * @param { GetDepDTO } data {GetDepDTO}
* @returns * @returns
*/ */
async getDep(data:GetStaffInfoDTO) { async getDep(data:GetDepDTO) {
return await this.useService(this.router.getDep, data) return await this.useService(this.router.getDep, data)
} }
......
...@@ -107,7 +107,6 @@ export interface GetRroupDTO { ...@@ -107,7 +107,6 @@ export interface GetRroupDTO {
} }
export interface GetStaffInfoDTO { export interface GetStaffInfoDTO {
"entId": string,
"id": string "id": string
} }
......
...@@ -159,7 +159,6 @@ export default Vue.extend({ ...@@ -159,7 +159,6 @@ export default Vue.extend({
getStaffInfo(id: string) { getStaffInfo(id: string) {
this.loading = true this.loading = true
this.$service.staff.getInfo({ this.$service.staff.getInfo({
entId: this.entId,
id id
}).then((res: any) => { }).then((res: any) => {
const {data} = res const {data} = res
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<!-- 通讯录 --> <!-- 通讯录 -->
<div class="py-2 font-medium">{{contactTitle ? contactTitle : dep.name}}</div> <div class="py-2 font-medium">{{contactTitle ? contactTitle : dep.name}}</div>
<div class="pb-16"> <div class="pb-16">
<div class="text-text-secondary py-1">成员</div> <!-- <div class="text-text-secondary py-1">成员</div> -->
<team-contacts <team-contacts
container-id="contact-selector" container-id="contact-selector"
:leader="leader" :leader="leader"
...@@ -129,6 +129,10 @@ export default Vue.extend({ ...@@ -129,6 +129,10 @@ export default Vue.extend({
this.$toast('移除成功') this.$toast('移除成功')
this.$emit('update:show', false) this.$emit('update:show', false)
this.$emit('update:checkedMemberId', this.checkedMember) this.$emit('update:checkedMemberId', this.checkedMember)
const usrId = JSON.parse(localStorage.getItem('USR_INFO') as string).id
if (this.checkedMember.indexOf(usrId) > -1) {
this.getStaffInfo(usrId)
}
this.checkedMember=[] this.checkedMember=[]
} }
} else { } else {
...@@ -138,6 +142,15 @@ export default Vue.extend({ ...@@ -138,6 +142,15 @@ export default Vue.extend({
}).catch(()=>{}) }).catch(()=>{})
} }
}, },
getStaffInfo(id: string) {
this.$service.staff.getInfo({id})
.then((res: any) => {
const {data} = res
if (data.code === this.$global.success) {
localStorage.setItem('USR_INFO', JSON.stringify(data.data))
}
})
},
goBack(){ goBack(){
this.$emit('update:show', false) this.$emit('update:show', false)
} }
......
...@@ -149,16 +149,20 @@ export default Vue.extend({ ...@@ -149,16 +149,20 @@ export default Vue.extend({
// confirmButtonText: '解散' // confirmButtonText: '解散'
}).then(() => { }).then(() => {
this.loading=true this.loading=true
const data = { const params = {
entId: this.entId, entId: this.entId,
depId: this.depId, depId: this.depId,
ids: this.checkedMember as Array<string> ids: this.checkedMember as Array<string>
} }
this.$service.staff.changeDep(data).then((res:any) => { this.$service.staff.changeDep(params).then((res:any) => {
this.loading=false this.loading=false
const {data} = res const {data} = res
if (data.code===this.$global.success) { if (data.code===this.$global.success) {
this.$toast('添加成功') this.$toast('添加成功')
const usrId = JSON.parse(localStorage.getItem('USR_INFO') as string).id
if(params.ids.indexOf(usrId) > -1) {
this.getStaffInfo(usrId)
}
} else { } else {
this.$toast(data.msg) this.$toast(data.msg)
} }
...@@ -166,6 +170,16 @@ export default Vue.extend({ ...@@ -166,6 +170,16 @@ export default Vue.extend({
}).catch(()=>{}) }).catch(()=>{})
} }
}, },
getStaffInfo(id: string) {
this.$service.staff.getInfo({
id,
}).then((res: any) => {
const {data} = res
if (data.code === this.$global.success) {
localStorage.setItem('USR_INFO', JSON.stringify(res.data.data))
}
})
},
goBack(){ goBack(){
this.$emit('update:show', false) this.$emit('update:show', false)
}, },
......
...@@ -152,7 +152,6 @@ export default Vue.extend({ ...@@ -152,7 +152,6 @@ export default Vue.extend({
getStaffInfo(id: string) { getStaffInfo(id: string) {
this.loading = true this.loading = true
this.$service.staff.getInfo({ this.$service.staff.getInfo({
entId: this.entId,
id id
}).then((res: any) => { }).then((res: any) => {
const {data} = res const {data} = res
......
...@@ -134,15 +134,13 @@ export default Vue.extend({ ...@@ -134,15 +134,13 @@ export default Vue.extend({
name: '徐丹', name: '徐丹',
role: 0 role: 0
} }
let usrId = ''
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
localStorage.setItem('USR_INFO', getUserInfo()) usrId = JSON.parse(getUserInfo() as string).id
} else { } else {
localStorage.setItem('USR_INFO', JSON.stringify(userInfoDev)) usrId = userInfoDev.id
} }
const usrInfo = JSON.parse(localStorage.getItem('USR_INFO') as string) this.getStaffInfo(usrId)
this.role = usrInfo.role
this.entId = usrInfo.entId
this.getEntInfo()
}, },
computed: { computed: {
isNotDepRoot():boolean { isNotDepRoot():boolean {
...@@ -163,6 +161,20 @@ export default Vue.extend({ ...@@ -163,6 +161,20 @@ export default Vue.extend({
} }
}, },
methods: { methods: {
getStaffInfo(id: string) {
this.loading = true
this.$service.staff.getInfo({id})
.then((res: any) => {
this.loading=false
const {data} = res
if (data.code === this.$global.success) {
localStorage.setItem('USR_INFO', JSON.stringify(data.data))
this.role=data.data.role
this.entId = data.data.entId
this.getEntInfo()
}
}).catch(() => this.loading=false)
},
handleBack() { handleBack() {
this.close() this.close()
}, },
......
...@@ -109,6 +109,7 @@ export default Vue.extend({ ...@@ -109,6 +109,7 @@ export default Vue.extend({
multiple: false, multiple: false,
selectedLeaderId: [] as string[], selectedLeaderId: [] as string[],
fromFrame: true, fromFrame: true,
role: 0,
// 企业id,跟部门id // 企业id,跟部门id
entId: '' entId: ''
} }
...@@ -122,24 +123,39 @@ export default Vue.extend({ ...@@ -122,24 +123,39 @@ export default Vue.extend({
name: '徐丹', name: '徐丹',
role: 0 role: 0
} }
let usrId = ''
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
localStorage.setItem('USR_INFO', getUserInfo()) usrId = JSON.parse(getUserInfo() as string).id
this.entId = JSON.parse(getUserInfo() as string).entId
} else { } else {
localStorage.setItem('USR_INFO', JSON.stringify(userInfoDev)) usrId = userInfoDev.id
this.entId = userInfoDev.entId
} }
const usrInfo = JSON.parse(localStorage.getItem('USR_INFO') as string)
this.entId = usrInfo.entId
this.getEntInfo() this.getEntInfo()
// this.enterpriseInfo = JSON.parse(localStorage.getItem('ENT_INFO') as string) this.getStaff(usrId)
// this.getSub()
}, },
computed: { computed: {
isLeader() { isLeader(): boolean {
const userInfo = JSON.parse(localStorage.getItem("USR_INFO") as string) return this.role === Role.LEADER
return userInfo?.role === Role.LEADER
} }
}, },
methods: { methods: {
getStaff(id: string) {
this.loading = true
this.$service.staff.getInfo({
id
}).then((res: any) => {
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
localStorage.setItem('USR_INFO', JSON.stringify(data.data))
this.role = data.data.role
this.entId = data.data.entId
} else {
this.$toast(data.msg)
}
}).catch(() => this.loading = false)
},
goBack() { goBack() {
if (this.fromFrame) { if (this.fromFrame) {
this.$router.push('/team/team-frame') this.$router.push('/team/team-frame')
......
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