viewConfig.vue
8.47 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<template>
<div>
<div class="container">
<div class="title">{{ routerInfo.merchantName }}</div>
<GLCombiForm :formObj="searchForm" :rowNumber="1" :formData="searchFormData" @handleOk="getListApi" @handleRest="handleReset"></GLCombiForm>
<div class="tableBox">
<GLTable ref="accountCodeTable" @refreshTable="getListApi" :noDataImg="url" :layout="layout" :tableData="accountTableData" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :tableTotal="tableTotal" @setTableFinishFun="setTableFinishFun">
<!-- 账号许可类型 -->
<div slot="type" slot-scope="scope">
<span v-if="scope.scope.type == 1">基础帐号</span>
<span v-else>互通帐号</span>
</div>
<!-- 账号激活状态 -->
<div slot="status" class="dot" slot-scope="scope">
<div :class="accountStatus[scope.scope.status]"></div>
<span v-if="scope.scope.status == 1">未绑定</span>
<span v-if="scope.scope.status == 2">已绑定</span>
<span v-if="scope.scope.status == 3">已过期</span>
<span v-if="scope.scope.status == 4">待转移</span>
<span v-if="scope.scope.status == 5">已合并</span>
</div>
<template slot="auth-button" slot-scope="scope" :data="scope.scope" v-if="scope.scope.status == 2">
<el-button type="text" @click="handelTransfer(scope.scope)">转移</el-button>
</template>
</GLTable>
</div>
</div>
<GLDialog class="trans-dia" title="帐号接口许可转移" :visible.sync="dialogTransferVisible">
<el-form :model="transferForm">
<el-form-item label="转移员工:">
<el-select @change="selectTransferStaff" v-model="transferForm.staff" filterable :size="size" placeholder="请选择或输入关键字搜索">
<el-option v-for="item in notActiveStaffList" :key="item.userId" :label="item.staffName" :value="item.userId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="接口有效期至:">{{ expireTime }}</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button :size="size" @click="handleClose">取消</el-button>
<el-button :size="size" type="primary" @click="transferCount">提交</el-button>
</span>
</GLDialog>
</div>
</template>
<script>
const accountStatus = {
'1': 'dot1',
'2': 'normal',
'3': 'dot3',
'4': 'dot6',
'5': 'normal'
}
import url from '@/assets/empty.png'
export default {
name: 'ConfigDetail',
data() {
return {
url,
accountStatus,
searchForm: {
status: '',
staffName: ''
},
transferForm: {
staff: ''
},
routerInfo: '',
dialogTransferVisible: false,
accountTableData: [],
tableTotal: 0,
notActiveStaffList: [],
expireTime: '',
takeoverUserid: '',
handoverUserid: '',
searchFormData: [
{
label: '激活状态',
name: 'status',
type: 'select',
optionList: [
{
label: '全部',
value: ''
},
{
label: '未绑定',
value: 1
},
{
label: '已绑定',
value: 2
},
{
label: '已过期',
value: 3
},
{
label: '待转移',
value: 4
},
{
label: '已合并',
value: 5
}
],
optionId: 'value',
optionLabel: 'label',
isClear: true
},
{
label: '员工姓名',
name: 'staffName',
type: 'input',
isClear: true,
placeholder: '输入关键字搜索'
}
],
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '帐号许可类型',
prop: 'type',
addHtml: 'type'
},
{
label: '激活状态',
prop: 'status',
addHtml: 'status'
},
{
label: '绑定员工',
prop: 'staffName'
},
{
label: '手机号码',
prop: 'staffPhone'
},
{
label: '激活时间',
prop: 'activeTime'
},
{
label: '有效期',
prop: 'expireTime'
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
layout: 'sizes, prev, pager, next, jumper, ->, total'
}
},
mounted() {
this.routerInfo = this.$route.query
this.getListApi()
},
methods: {
getListApi() {
const { status, staffName } = this.searchForm
const { merchantId, corpId } = this.routerInfo
let params = {
merchantId,
corpId,
status,
staffName
}
params.pageSize = this.$refs.accountCodeTable.page.pageSize
params.pageNum = this.$refs.accountCodeTable.page.pageNum
this.$apis.accountConfig.listAccountCodeWithPage(params).then(res => {
this.accountTableData = res.list
this.tableTotal = res.total
})
},
// 账号许可转移弹窗
handelTransfer(scope) {
const { merchantId, corpId } = this.routerInfo
let params = {
merchantId,
corpId
}
this.handoverUserid = scope.userid
this.expireTime = scope.expireTime
this.$apis.accountConfig.findNotActiveStaff(params).then(res => {
if (res.data) {
this.dialogTransferVisible = true
this.notActiveStaffList = res.data
} else {
// var txt = '<i class="el-icon-warning" style="color:#e6a23c;font-size:48px;"></i><p>无可用的用户转移</p>'
this.$confirm('无可用的用户转移', '提示', {
confirmButtonText: '我知道了',
dangerouslyUseHTMLString: true,
showClose: true,
showCancelButton: false,
confirmButtonClass: 'confirmbtn',
type: 'warning',
customClass: 'gl-message-box confirm-btn'
})
}
})
},
// 选择转移员工
selectTransferStaff(id) {
this.takeoverUserid = id
},
// 账号许可转移
transferCount() {
const { merchantId, corpId } = this.routerInfo
let params = {
merchantId,
corpId
}
params.handoverUserid = this.handoverUserid
params.takeoverUserid = this.takeoverUserid
this.$apis.accountConfig.transferLicenseAccount(params).then(res => {
if (res.code == 0) {
this.$message({
message: '账号转移成功',
type: 'success',
customClass: 'global-messageZindex'
})
this.getListApi()
this.dialogTransferVisible = false
this.transferForm.staff = ''
} else {
this.$message({
message: '账号转移失败,请联系管理员',
type: 'error',
customClass: 'global-messageZindex'
})
this.dialogTransferVisible = false
this.transferForm.staff = ''
}
})
},
// 关闭弹窗
handleClose() {
this.dialogTransferVisible = false
this.transferForm.staff = ''
},
// 搜索框搜索
handleSearch() {
this.$refs.accountCodeTable.refreshTable()
},
// 重置搜索框搜索
handleReset() {
this.searchForm = {
status: '',
staffName: ''
}
this.getListApi()
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.accountCodeTable.data.length ? (this.$refs.accountCodeTable.tableHeightValues = '') : this.$refs.accountCodeTable.setTableHeightFun()
}
}
}
</script>
<style lang="scss" scoped>
.container {
background-color: #fff;
.title {
height: 58px;
margin-bottom: 20px;
padding-left: 20px;
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 58px;
border-bottom: 1px solid #e5e5e5;
}
.tableBox {
padding: 0 20px 60px 20px;
}
}
.trans-dia {
/deep/ .el-form-item__label {
width: 154px;
}
/deep/ .el-select {
width: 474px;
}
}
/deep/ .el-dialog__title {
font-weight: 600;
}
.global-messageZindex {
z-index: 3000 !important;
}
</style>