staffInfo.vue
4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!-- 员工编辑 -->
<template>
<d2-container ref="staffInfoWrap">
<div class="staffInfo-wrap" >
<el-tabs v-model="activeName" type="card" @tab-click="tabClick">
<el-tab-pane label="员工信息" name="staffInfo" v-if="editPermissionFlag">
<edit-staff ref="editStaff" v-if="activeName == 'staffInfo'" :queryData="queryData"></edit-staff>
</el-tab-pane>
<el-tab-pane label="历史业绩" name="historyPerformance" v-if="historyPerformanceFlag">
<historical-performance ref="historicalPerformance" v-if="activeName == 'historyPerformance'" :queryData="queryData"></historical-performance>
</el-tab-pane>
</el-tabs>
<div class="btnCon">
<el-button v-if="activeName == 'staffInfo'" type="primary" @click="handleConfirm">提交</el-button>
<el-button v-if="activeName != 'staffInfo'" type="primary" @click="handleCancel">返回</el-button>
<el-button v-if="activeName == 'staffInfo'" @click="handleCancel">返回</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { mapActions } from "vuex"
import historicalPerformance from "./components/historicalPerformance.vue"
import editStaff from "./components/editStaff.vue"
export default {
name: "StaffInfo",
props: {
queryData: Object
},
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
activeName: 'staffInfo',
editPermissionFlag: false,
historyPerformanceFlag: false
}
},
components: {
editStaff,
historicalPerformance
},
computed: {},
async mounted() {
this.setActiveName(this.queryData)
this.$nextTick(() => {
const $store = this.$store.getters['d2admin/auth/curBtns']
const btnId = '9120505' // 员工编辑权限
const btnId2 = '9120508' // 历史业绩权限
const _item = $store?.find(i => (i.authId === btnId))
const _item2 = $store?.find(i => (i.authId === btnId2))
if (_item) {
this.editPermissionFlag = true
}
if (_item2) {
this.historyPerformanceFlag = true
}
})
},
methods: {
...mapActions({
get: "d2admin/base/get",
close: "d2admin/page/close"
}),
async getBaseData() { },
// tab选中项
setActiveName(data) {
this.activeName = data.activeName
setTimeout(() => {
// 将页面滚动回顶部
if (this.$refs['staffInfoWrap'] && this.$refs['staffInfoWrap'].$refs['component'] && this.$refs['staffInfoWrap'].$refs['component'].$el) {
this.$refs['staffInfoWrap'].$refs['component'].$el.scrollTop = 0
// 重新请求页面接口
let refs = data.activeName == 'staffInfo' ? 'editStaff' : 'historicalPerformance'
this.$refs[refs].resetData()
}
})
},
tabClick() {
this.setActiveName({ activeName: this.activeName })
},
handleCancel() {
this.$emit("backIndex")
},
handleConfirm() {
this.$refs.editStaff.handleConfirm().then(() => {
this.$emit("backIndex")
})
}
}
}
</script>
<style scoped lang="scss" >
.btnCon {
width: 100%;
margin-top: 40px;
text-align: center;
}
.staffInfo-wrap {
height: 100%;
// margin-left: 20px;
// overflow-y: scroll;
// height: calc(100vh - 40px);
::v-deep .el-tabs__header {
position: sticky;
top: 0;
margin-bottom: 0;
z-index: 10;
.el-tabs__nav-scroll{
background: #ffffff;
padding: 16px 0;
.el-tabs__nav{
height: 38px;
background: #E8E8E8;
border-radius: 4px;
margin-left: 22px;
padding: 2px;
.el-tabs__active-bar {
display: none !important;
}
.el-tabs__item {
height: 32px;
line-height: 32px;
width: 104px;
color: #666666;
padding: 0 24px;
}
.el-tabs__item.is-active {
color: #2A58AD;
font-weight: 600;
background: #ffffff;
border-radius: 3px;
border: none;
}
}
}
}
}
</style>