Commit 00b4867a authored by sixiaofeng's avatar sixiaofeng

1

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