|
|
1
|
+<template>
|
|
|
2
|
+ <section>
|
|
|
3
|
+ <!--工具条-->
|
|
|
4
|
+ <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
|
|
|
5
|
+ <el-form :inline="true" :model="filters">
|
|
|
6
|
+ <el-form-item>
|
|
|
7
|
+ <el-button type="success" @click="applyAdd()">新 增</el-button>
|
|
|
8
|
+ </el-form-item>
|
|
|
9
|
+ </el-form>
|
|
|
10
|
+ </el-col>
|
|
|
11
|
+ <!--列表-->
|
|
|
12
|
+
|
|
|
13
|
+ <el-table :data="tableData" highlight-current-row style="width: 100%;"
|
|
|
14
|
+ row-key="ruleId">
|
|
|
15
|
+ <el-table-column width="80" prop="loginName" label="用户名" >
|
|
|
16
|
+ </el-table-column>
|
|
|
17
|
+ <el-table-column width="240" prop="verifyCodeImg" label="验证码图" >
|
|
|
18
|
+ <template slot-scope="scope">
|
|
|
19
|
+ <el-image
|
|
|
20
|
+ v-if="verifyCodeBase64"
|
|
|
21
|
+ style="width: 125px; height: 60px"
|
|
|
22
|
+ :src="verifyCodeBase64"
|
|
|
23
|
+ fit="fit"></el-image>
|
|
|
24
|
+ <el-button v-else type="text" @click="getVerifyCodeAPI(scope.row)">获取验证码</el-button>
|
|
|
25
|
+ </template>
|
|
|
26
|
+ </el-table-column>
|
|
|
27
|
+ <el-table-column width="240" prop="verifyCode" label="验证码" >
|
|
|
28
|
+ <template slot-scope="scope">
|
|
|
29
|
+ <el-input v-model="scope.row.verifyCode" placeholder="请输入验证码" style="width:100px"/>
|
|
|
30
|
+ </template>
|
|
|
31
|
+ </el-table-column>
|
|
|
32
|
+ <el-table-column width="240" prop="jwtToken" label="随机码" >
|
|
|
33
|
+ <template slot-scope="scope">
|
|
|
34
|
+ <el-input v-model="scope.row.jwtToken" placeholder="请输入随机码" style="width:100px"/>
|
|
|
35
|
+ </template>
|
|
|
36
|
+ </el-table-column>
|
|
|
37
|
+ <el-table-column width="120" prop="loginUrl" label="登录地址" show-overflow-tooltip>
|
|
|
38
|
+ </el-table-column>
|
|
|
39
|
+ <el-table-column width="120" prop="verifyUrl" label="验证码地址" show-overflow-tooltip>
|
|
|
40
|
+ </el-table-column>
|
|
|
41
|
+ <el-table-column width="120" prop="heartbeatUrl" label="心跳地址" show-overflow-tooltip>
|
|
|
42
|
+ </el-table-column>
|
|
|
43
|
+ <el-table-column width="120" prop="declareUrl" label="申报同步地址" show-overflow-tooltip>
|
|
|
44
|
+ </el-table-column>
|
|
|
45
|
+ <el-table-column width="120" prop="taskStatus" label="状态" >
|
|
|
46
|
+ </el-table-column>
|
|
|
47
|
+ <el-table-column width="120" prop="offlineTime" label="离线时间" >
|
|
|
48
|
+ </el-table-column>
|
|
|
49
|
+ <el-table-column width="240" label="操作" fixed="right">
|
|
|
50
|
+ <template slot-scope="scope">
|
|
|
51
|
+ <el-button type="success" @click="firing(scope.row)">启动</el-button>
|
|
|
52
|
+ <el-button type="warning" @click="suspend(scope.$index,scope.row)">暂停</el-button>
|
|
|
53
|
+ <el-button type="danger" @click="batchRemove(scope.$index,scope.row)">删除</el-button>
|
|
|
54
|
+ </template>
|
|
|
55
|
+ </el-table-column>
|
|
|
56
|
+ </el-table>
|
|
|
57
|
+ <!-- 分页-->
|
|
|
58
|
+ <div class="block">
|
|
|
59
|
+ <el-pagination
|
|
|
60
|
+ :current-page="filters.pageNum"
|
|
|
61
|
+ :page-sizes="[10, 50, 100, 500]"
|
|
|
62
|
+ :page-size="filters.pageSize"
|
|
|
63
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
64
|
+ :total="total"
|
|
|
65
|
+ @size-change="handleSizeChange"
|
|
|
66
|
+ @current-change="handleCurrentChange"
|
|
|
67
|
+ />
|
|
|
68
|
+ </div>
|
|
|
69
|
+ <el-row>
|
|
|
70
|
+ <el-dialog :title="dialogMap[dialogApply]" :visible.sync="apply_dialog" width="50%">
|
|
|
71
|
+ <el-form :model="addForm" :rules="rules" ref="addForm" style="margin-top: 20px">
|
|
|
72
|
+ <el-row>
|
|
|
73
|
+ <el-col :span="11">
|
|
|
74
|
+ <el-form-item label="服务器ID" :label-width="formLabelWidth" prop="hostid">
|
|
|
75
|
+<!-- <el-input v-model="addForm.hostid" autocomplete="off" size="small" style="width: 260px">-->
|
|
|
76
|
+<!-- </el-input>-->
|
|
|
77
|
+ <el-select v-model="addForm.hostid" clearable placeholder="请选择"
|
|
|
78
|
+ style="width: 260px">
|
|
|
79
|
+ <el-option
|
|
|
80
|
+ v-for="item in hostid"
|
|
|
81
|
+ :key="item.id"
|
|
|
82
|
+ :label="item.hostid"
|
|
|
83
|
+ :value="item.hostid">
|
|
|
84
|
+ </el-option>
|
|
|
85
|
+ </el-select>
|
|
|
86
|
+ </el-form-item>
|
|
|
87
|
+ </el-col>
|
|
|
88
|
+ </el-row>
|
|
|
89
|
+ <el-row>
|
|
|
90
|
+ <el-col :span="12">
|
|
|
91
|
+ <el-form-item label="本地发送目录" :label-width="formLabelWidth" prop="localdir">
|
|
|
92
|
+ <el-input v-model="addForm.localdir" autocomplete="off" size="small" style="width: 260px">
|
|
|
93
|
+ </el-input>
|
|
|
94
|
+ </el-form-item>
|
|
|
95
|
+ </el-col>
|
|
|
96
|
+ </el-row>
|
|
|
97
|
+ <el-row>
|
|
|
98
|
+ <el-col :span="11">
|
|
|
99
|
+ <el-form-item label="目的地虚拟机" :label-width="formLabelWidth" prop="destvr">
|
|
|
100
|
+ <el-input v-model="addForm.destvr" autocomplete="off" size="small" style="width: 260px">
|
|
|
101
|
+ </el-input>
|
|
|
102
|
+ </el-form-item>
|
|
|
103
|
+ </el-col>
|
|
|
104
|
+ </el-row>
|
|
|
105
|
+ <el-row>
|
|
|
106
|
+ <el-col :span="12">
|
|
|
107
|
+ <el-form-item label="路由" :label-width="formLabelWidth" prop="routerkey">
|
|
|
108
|
+ <el-input v-model="addForm.routerkey" autocomplete="off" size="small" style="width: 260px">
|
|
|
109
|
+ </el-input>
|
|
|
110
|
+ </el-form-item>
|
|
|
111
|
+ </el-col>
|
|
|
112
|
+ </el-row>
|
|
|
113
|
+ <el-row>
|
|
|
114
|
+ <el-col :span="11">
|
|
|
115
|
+ <el-form-item label="队列" :label-width="formLabelWidth" prop="queue">
|
|
|
116
|
+ <el-input v-model="addForm.queue" autocomplete="off" size="small" style="width: 260px">
|
|
|
117
|
+ </el-input>
|
|
|
118
|
+ </el-form-item>
|
|
|
119
|
+ </el-col>
|
|
|
120
|
+ </el-row>
|
|
|
121
|
+ <el-row>
|
|
|
122
|
+ <el-col :span="11">
|
|
|
123
|
+ <el-form-item label="目的地交换" :label-width="formLabelWidth" prop="destchange">
|
|
|
124
|
+ <el-input v-model="addForm.destchange" autocomplete="off" size="small" style="width: 260px">
|
|
|
125
|
+ </el-input>
|
|
|
126
|
+ </el-form-item>
|
|
|
127
|
+ </el-col>
|
|
|
128
|
+ </el-row>
|
|
|
129
|
+ <el-row>
|
|
|
130
|
+ <el-col :span="11">
|
|
|
131
|
+ <el-form-item label="广播类型" :label-width="formLabelWidth" prop="broadtype">
|
|
|
132
|
+ <el-input v-model="addForm.broadtype" autocomplete="off" size="small" style="width: 260px">
|
|
|
133
|
+ </el-input>
|
|
|
134
|
+ </el-form-item>
|
|
|
135
|
+ </el-col>
|
|
|
136
|
+ </el-row>
|
|
|
137
|
+ </el-form>
|
|
|
138
|
+ <div slot="footer" class="dialog-footer">
|
|
|
139
|
+ <el-button @click="apply_dialog = false" size="small">取 消</el-button>
|
|
|
140
|
+ <el-button type="primary" @click="dialogApply==='create'?add():edit()" size="small">提 交</el-button>
|
|
|
141
|
+ </div>
|
|
|
142
|
+ </el-dialog>
|
|
|
143
|
+ </el-row>
|
|
|
144
|
+ <el-dialog :visible.sync="tableData1_dialog" >
|
|
|
145
|
+ <!--列表-->
|
|
|
146
|
+ <el-table disabled :data="tableData1" highlight-current-row style="width: 100%;"
|
|
|
147
|
+ row-key="ruleId">
|
|
|
148
|
+ <el-table-column width="120" prop="hostid" label="服务器IP" >
|
|
|
149
|
+ </el-table-column>
|
|
|
150
|
+ <el-table-column width="120" prop="port" label="端口" >
|
|
|
151
|
+ </el-table-column>
|
|
|
152
|
+ <el-table-column width="120" prop="user" label="账号" >
|
|
|
153
|
+ </el-table-column>
|
|
|
154
|
+ <el-table-column width="120" prop="pass" label="密码" >
|
|
|
155
|
+ </el-table-column>
|
|
|
156
|
+ </el-table>
|
|
|
157
|
+ </el-dialog>
|
|
|
158
|
+ </section>
|
|
|
159
|
+</template>
|
|
|
160
|
+<script>
|
|
|
161
|
+ import {
|
|
|
162
|
+ listSendConfigs,
|
|
|
163
|
+ insertSendConfig,
|
|
|
164
|
+ deleteSendConfig,
|
|
|
165
|
+ addsendtask,
|
|
|
166
|
+ removesendTask,
|
|
|
167
|
+ listRabbitConfigs
|
|
|
168
|
+ } from '../../api/configuration';
|
|
|
169
|
+ import {getVerifyCode} from '../../api/consigner/station';
|
|
|
170
|
+ export default {
|
|
|
171
|
+ data() {
|
|
|
172
|
+ return {
|
|
|
173
|
+ verifyCodeBase64: '',
|
|
|
174
|
+ verifyJwtToken: '',
|
|
|
175
|
+ filters: {
|
|
|
176
|
+ pageNum: 1,
|
|
|
177
|
+ pageSize: 10
|
|
|
178
|
+ },
|
|
|
179
|
+ total: 0,
|
|
|
180
|
+ tableData: [],
|
|
|
181
|
+ hostid:[],
|
|
|
182
|
+ tableData1: [],
|
|
|
183
|
+ tableData1_dialog:false,
|
|
|
184
|
+ dialogMap: {
|
|
|
185
|
+ update: '编辑',
|
|
|
186
|
+ create: '新增'
|
|
|
187
|
+ },
|
|
|
188
|
+ dis: undefined,
|
|
|
189
|
+ dialogApply: 'create',
|
|
|
190
|
+ apply_dialog: false,
|
|
|
191
|
+ addForm: {
|
|
|
192
|
+ hostid:'',
|
|
|
193
|
+ localdir: '',
|
|
|
194
|
+ destvr: '',
|
|
|
195
|
+ routerkey: '',
|
|
|
196
|
+ queue: '',
|
|
|
197
|
+ destchange:'',
|
|
|
198
|
+ broadtype:'',
|
|
|
199
|
+ id:'',
|
|
|
200
|
+ del: '',
|
|
|
201
|
+ durability: '',
|
|
|
202
|
+ internal: 'false',
|
|
|
203
|
+ status:'',
|
|
|
204
|
+ },
|
|
|
205
|
+ formLabelWidth: '200px',
|
|
|
206
|
+ rules: {
|
|
|
207
|
+ },
|
|
|
208
|
+
|
|
|
209
|
+ }
|
|
|
210
|
+ },
|
|
|
211
|
+ mounted() {
|
|
|
212
|
+ // this.getList();
|
|
|
213
|
+ this.tableData = [
|
|
|
214
|
+ {
|
|
|
215
|
+ "id": 0,
|
|
|
216
|
+ "loginName": "admin",
|
|
|
217
|
+ "loginPass": "vmvnv1v2VV.",
|
|
|
218
|
+ "verifyCode": "",
|
|
|
219
|
+ "declareUrl": "http://kako.cgo:17999/api/byonet-import/businesstype/save",
|
|
|
220
|
+ "heartbeatUrl": "http://kako.cgo:17999/api/cloud-kako-user-center/heartbeat",
|
|
|
221
|
+ "loginUrl": "http://kako.cgo:17999/api/cloud-kako-user-center/login",
|
|
|
222
|
+ "verifyUrl": "http://kako.cgo:17999/api/cloud-kako-user-center/anonymous/randCode"
|
|
|
223
|
+ }
|
|
|
224
|
+ ];
|
|
|
225
|
+ // this.getVerifyCodeAPI();
|
|
|
226
|
+ },
|
|
|
227
|
+ methods: {
|
|
|
228
|
+ //分页
|
|
|
229
|
+ handleSizeChange(val) {
|
|
|
230
|
+ this.filters.pageSize = val
|
|
|
231
|
+ this.getList()
|
|
|
232
|
+ },
|
|
|
233
|
+ handleCurrentChange(val) {
|
|
|
234
|
+ this.filters.pageNum = val
|
|
|
235
|
+ this.getList()
|
|
|
236
|
+ },
|
|
|
237
|
+ //获取列表
|
|
|
238
|
+ getList() {
|
|
|
239
|
+ const _this = this
|
|
|
240
|
+ listSendConfigs().then((response) => {
|
|
|
241
|
+ const res = response.data
|
|
|
242
|
+ if (res.code !== '200') {
|
|
|
243
|
+ return _this.$message.error('获取消息收发记录,失败!')
|
|
|
244
|
+ }
|
|
|
245
|
+ // 获取列表数据
|
|
|
246
|
+ _this.tableData = res.data
|
|
|
247
|
+ // 获取列表的总记录数
|
|
|
248
|
+ _this.total = res.data.total
|
|
|
249
|
+ _this.$message.success('获取消息收发记录,成功!')
|
|
|
250
|
+ }).catch(error => {
|
|
|
251
|
+ // 关闭加载
|
|
|
252
|
+ _this.$message.error(error.toString())
|
|
|
253
|
+ })
|
|
|
254
|
+ },
|
|
|
255
|
+ //获取验证码
|
|
|
256
|
+ getVerifyCodeAPI(row) {
|
|
|
257
|
+ const _this = this
|
|
|
258
|
+ getVerifyCode(row).then((response) => {
|
|
|
259
|
+ const res = response.data
|
|
|
260
|
+ if (res.code !== '200') {
|
|
|
261
|
+ return _this.$message.error('获取消息收发记录,失败!')
|
|
|
262
|
+ }
|
|
|
263
|
+ // 获取列表数据
|
|
|
264
|
+ _this.verifyCodeBase64 = res.data.verifyImg
|
|
|
265
|
+ _this.verifyJwtToken = res.data.jwtToken
|
|
|
266
|
+ _this.$message.success('获取验证码成功')
|
|
|
267
|
+ }).catch(error => {
|
|
|
268
|
+ // 关闭加载
|
|
|
269
|
+ _this.$message.error(error.toString())
|
|
|
270
|
+ })
|
|
|
271
|
+ },
|
|
|
272
|
+ // 添加对话框,打开事件
|
|
|
273
|
+ applyAdd() {
|
|
|
274
|
+ this.hostid=[];
|
|
|
275
|
+ const _this = this
|
|
|
276
|
+ listRabbitConfigs().then((response) => {
|
|
|
277
|
+ const res = response.data
|
|
|
278
|
+ if (res.code !== '200') {
|
|
|
279
|
+ return _this.$message.error('获取消息收发记录,失败!')
|
|
|
280
|
+ }
|
|
|
281
|
+ // 获取列表数据
|
|
|
282
|
+ _this.tableData1 = res.data
|
|
|
283
|
+ _this.hostid=_this.tableData1;
|
|
|
284
|
+ _this.$message.success('获取消息收发记录,成功!')
|
|
|
285
|
+ }).catch(error => {
|
|
|
286
|
+ // 关闭加载
|
|
|
287
|
+ _this.$message.error(error.toString())
|
|
|
288
|
+ })
|
|
|
289
|
+ this.addForm = {
|
|
|
290
|
+ hostid:'',
|
|
|
291
|
+ localdir: '',
|
|
|
292
|
+ destvr: '',
|
|
|
293
|
+ routerkey: '',
|
|
|
294
|
+ queue: '',
|
|
|
295
|
+ destchange:'',
|
|
|
296
|
+ broadtype:'',
|
|
|
297
|
+ id:'',
|
|
|
298
|
+ del: '',
|
|
|
299
|
+ durability: '',
|
|
|
300
|
+ internal: 'false',
|
|
|
301
|
+ status:'',
|
|
|
302
|
+ };
|
|
|
303
|
+ this.dialogApply= 'create';
|
|
|
304
|
+ this.dis= 'create';
|
|
|
305
|
+ this.apply_dialog = true;
|
|
|
306
|
+ },
|
|
|
307
|
+ // 添加功能
|
|
|
308
|
+ add() {
|
|
|
309
|
+ this.$refs.addForm.validate(valid => {
|
|
|
310
|
+ // 未通过,表单预校验
|
|
|
311
|
+ if (!valid) return;
|
|
|
312
|
+ insertSendConfig(this.addForm).then((response) => {
|
|
|
313
|
+ let res = response.data;
|
|
|
314
|
+ // 添加失败
|
|
|
315
|
+ if (res.code !== '200') {
|
|
|
316
|
+ return this.$message.error(res.msg);
|
|
|
317
|
+ }
|
|
|
318
|
+ // 添加,成功
|
|
|
319
|
+ this.$message.success(res.msg);
|
|
|
320
|
+ // 隐藏对话框
|
|
|
321
|
+ this.apply_dialog = false;
|
|
|
322
|
+ // 刷新列表
|
|
|
323
|
+ this.getList();
|
|
|
324
|
+ }).catch(error => {
|
|
|
325
|
+ this.$message.error(error.toString());
|
|
|
326
|
+ });
|
|
|
327
|
+ })
|
|
|
328
|
+ },
|
|
|
329
|
+ // 启动功能
|
|
|
330
|
+ firing() {
|
|
|
331
|
+ // 弹框询问是否删除?
|
|
|
332
|
+ this.$confirm(' 是否继续?', '警告', {
|
|
|
333
|
+ confirmButtonText: '确定启动',
|
|
|
334
|
+ cancelButtonText: '取消',
|
|
|
335
|
+ type: 'warning'
|
|
|
336
|
+ }
|
|
|
337
|
+ ).then(() => {
|
|
|
338
|
+ addsendtask({row:this.row}).then((response) => {
|
|
|
339
|
+ const res = response.data
|
|
|
340
|
+ this.$message.success(res.msg)
|
|
|
341
|
+ this.getList()
|
|
|
342
|
+ }).catch(error => {
|
|
|
343
|
+ this.$message.error(error)
|
|
|
344
|
+ })
|
|
|
345
|
+ }).catch(() => {
|
|
|
346
|
+ })
|
|
|
347
|
+
|
|
|
348
|
+ },
|
|
|
349
|
+ //暂停
|
|
|
350
|
+ suspend(index,row) {
|
|
|
351
|
+ // 弹框询问是否删除?
|
|
|
352
|
+ this.$confirm(' 是否继续?', '警告', {
|
|
|
353
|
+ confirmButtonText: '确定暂停',
|
|
|
354
|
+ cancelButtonText: '取消',
|
|
|
355
|
+ type: 'warning'
|
|
|
356
|
+ }
|
|
|
357
|
+ ).then(() => {
|
|
|
358
|
+ removesendTask({id:row.id}).then((response) => {
|
|
|
359
|
+ const res = response.data
|
|
|
360
|
+ this.$message.success(res.msg)
|
|
|
361
|
+ this.getList()
|
|
|
362
|
+ }).catch(error => {
|
|
|
363
|
+ this.$message.error(error)
|
|
|
364
|
+ })
|
|
|
365
|
+ }).catch(() => {
|
|
|
366
|
+ })
|
|
|
367
|
+ },
|
|
|
368
|
+ //删除
|
|
|
369
|
+ batchRemove(index,row) {
|
|
|
370
|
+ // 弹框询问是否删除?
|
|
|
371
|
+ this.$confirm('此操作永久删除该消息, 是否继续?', '警告', {
|
|
|
372
|
+ confirmButtonText: '确定删除',
|
|
|
373
|
+ cancelButtonText: '取消',
|
|
|
374
|
+ type: 'warning'
|
|
|
375
|
+ }
|
|
|
376
|
+ ).then(() => {
|
|
|
377
|
+ deleteSendConfig({id:row.id}).then((response) => {
|
|
|
378
|
+ const res = response.data
|
|
|
379
|
+ this.$message.success(res.msg)
|
|
|
380
|
+ this.getList()
|
|
|
381
|
+ }).catch(error => {
|
|
|
382
|
+ this.$message.error(error)
|
|
|
383
|
+ })
|
|
|
384
|
+ }).catch(() => {
|
|
|
385
|
+ })
|
|
|
386
|
+ },
|
|
|
387
|
+ },
|
|
|
388
|
+
|
|
|
389
|
+
|
|
|
390
|
+ }
|
|
|
391
|
+</script> |