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
<template>
<div class="container">
<el-tabs type="border-card">
<el-tab-pane label="同步设备">
<div class="top-box">
<div class="nav-title">同步设备</div>
<el-button type="primary" @click="handleTimeSync">开始同步</el-button>
</div>
<div class="table">
<el-table
:data="tableData"
style="width: 100%"
border
:header-cell-style="{ background: '#f5f7fa', color: '#909399' }"
>
<el-table-column
prop="ip"
label="设备ip"
width=""
></el-table-column>
<el-table-column
prop="equipmentCode"
label="设备编号"
width=""
></el-table-column>
<el-table-column
prop="lastModifiedTime"
label="同步时间"
width=""
></el-table-column>
</el-table>
<Pagination
:limit="params.size"
:page="params.current"
:total="total"
class="pagination"
@pagination="handlePageChange"
/>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { selectFeederPage } from "@/api/sync";
import { timeSync } from "@/api/udp";
export default {
data() {
return {
tableData: [],
params: {
current: 1,
size: 10,
},
total: 0,
};
},
mounted() {
this.handleSelectFeederPage();
},
methods: {
handlePageChange(pageData) {
this.params.size = pageData.size;
this.params.current = pageData.page;
this.handleSelectFeederPage();
},
async handleTimeSync() {
let res = await timeSync({});
console.log(res);
this.$message.success("开始备份");
this.handleSelectFeederPage();
},
async handleSelectFeederPage() {
let res = await selectFeederPage(this.params);
this.tableData = res.records;
this.total = res.total;
},
},
};
</script>
<style lang="scss" scoped>
.top-box {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
.nav-title {
color: #02a7f0;
font-size: 20px;
position: relative;
padding-left: 16px;
font-weight: bold;
line-height: 28px;
}
.nav-title::before {
content: "";
position: absolute;
left: 0px;
top: 1px;
width: 5px;
height: 100%;
background-color: #02a7f0;
border-radius: 4px;
}
}
</style>