transferDia.vue
6.64 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<template>
<div>
<GLDialog :mode="'big'" :visible.sync="dialogTransferVisible" @close="closeDia">
<!-- 自定义标题 -->
<div slot="title">
<span class="title-left">选择转移员工</span>
<span class="title-right">接口有效期至:{{ transferInfo.expireTime }}</span>
</div>
<div class="gl-form-min">
<el-form :inline="true" class="member-form" :model="searchForm">
<el-form-item label="员工姓名:">
<el-input v-model="searchForm.staffName" :size="size" placeholder="输入关键字搜索"></el-input>
</el-form-item>
<el-form-item label="启用状态:">
<el-select v-model="searchForm.openJoinStatus" placeholder="全部" :size="size">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :size="size" class="gap8" @click="findNotActiveStaff">查询</el-button>
<el-button plain :size="size" class="btn-three" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="table-title">员工列表</div>
<GLTable :hasPage="false" :hasNum="false" :searchForm="searchForm" v-loading="loading" ref="transferTable" :tableParams="tableParams" :tableData="tableActiveData" :noDataImg="url">
<div slot="association" slot-scope="scope" class="association">
<el-radio :label="scope.scope.id" v-model="associationRadio" @change.native="getTransferInfo()"></el-radio>
</div>
<div slot="openJoinStatusString" class="dot" slot-scope="scope">
<div :class="status[scope.scope.openJoinStatusString]"></div>
<span v-if="scope.scope.openJoinStatusString == '未开启'">未开启</span>
<span v-if="scope.scope.openJoinStatusString == '已开启'">已开启</span>
<span v-if="scope.scope.openJoinStatusString == '未授权'">未授权</span>
</div>
</GLTable>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="closeDia">取 消</el-button>
<el-button size="small" type="primary" @click="transferStaff">确 定</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
const status = {
未开启: 'dot3',
已开启: 'dot2',
未授权: 'dot3'
}
const options = [
{
value: 0,
label: '未开启'
},
{
value: 1,
label: '已开启'
},
{
value: 2,
label: '未授权'
}
]
export default {
name: 'TransferDia',
data() {
return {
url,
options: options,
status,
dialogTransferVisible: false,
associationRadio: '',
loading: false,
searchForm: {
openJoinStatus: '',
staffName: ''
},
tableParams: {
listName: 'list',
tableColumns: [
{
prop: 'association',
addHtml: 'association',
width: '50'
},
{
label: '序号',
prop: 'num',
width: '100'
},
{
label: '员工姓名',
prop: 'staffName'
},
{
label: '员工手机号',
prop: 'departmentName'
},
{
label: '部门',
prop: 'departmentName'
},
{
label: '启用状态',
prop: 'openJoinStatusString',
addHtml: 'openJoinStatusString'
}
]
},
tableActiveData: [],
transferInfo: {},
selectStaff: {},
routerInfo: {}
}
},
mounted() {},
methods: {
init(scope, routerInfo) {
this.transferInfo = scope
this.routerInfo = routerInfo
this.dialogTransferVisible = true
this.findNotActiveStaff()
},
findNotActiveStaff() {
const { corpId, merchantId } = this.routerInfo
var params = {
...JSON.parse(JSON.stringify(this.searchForm)),
corpId,
merchantId
}
this.loading = true
this.$apis.accountConfig.findNotActiveStaff(params).then(res => {
if (res.code == 0) {
this.tableActiveData = res.data
let num = 0
this.tableActiveData.forEach(item => {
item.num = ++num
})
this.loading = false
} else {
this.loading = false
this.$message({
message: res.message,
type: 'error',
customClass: 'global-messageZindex'
})
}
})
},
// 重置搜索框搜索
handleReset() {
this.searchForm = {
openJoinStatus: '',
staffName: ''
}
this.findNotActiveStaff()
},
// 选择转移员工
getTransferInfo() {
let inx = this.tableActiveData.filter(value => value.id == this.associationRadio)
this.selectStaff = inx[0]
},
// 转移员工
transferStaff() {
this.loading = true
const { merchantId, corpId } = this.routerInfo
let params = {
merchantId,
corpId
}
params.handoverUserid = this.transferInfo.userid
params.takeoverUserid = this.selectStaff.userId
this.$apis.accountConfig.transferLicenseAccount(params).then(res => {
if (res.code == 0) {
this.loading = false
this.$message({
message: '账号转移成功',
type: 'success',
customClass: 'global-messageZindex'
})
this.dialogTransferVisible = false
this.$emit('transferStaff')
} else {
this.loading = false
this.$message({
message: res.message,
type: 'error',
customClass: 'global-messageZindex'
})
this.dialogTransferVisible = false
}
})
},
// 关闭转移员工弹窗
closeDia() {
this.associationRadio = ''
this.selectStaff = {}
this.dialogTransferVisible = false
}
}
}
</script>
<style lang="scss" scoped>
.table-title {
font-size: 16px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 22px;
margin-bottom: 6px;
}
.title-left {
font-size: 20px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 28px;
margin-right: 16px;
}
.title-right {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
line-height: 20px;
}
.association {
/deep/ .el-radio__label {
display: none;
}
}
.global-messageZindex {
z-index: 3000 !important;
}
</style>