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
<template>
<!-- 漏缆监测告警 -->
<div class="leakage-cable">
<el-button-group>
<el-button
v-for="item in tabs"
:key="item.key"
:type="confirmStatus === item.key ? 'primary' : ''"
@click="changeType(item)"
>{{ item.label }}</el-button
>
</el-button-group>
<div class="leakage-top">
<div style="color: #666666"></div>
<div class="operate-btn">
<el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button>
<el-button type="primary" @click="exportList">导出</el-button>
</div>
</div>
<el-table
:data="tableData"
style="width: 100%"
:cell-class-name="cellClassFn"
:header-cell-style="{ background: '#EAF1FE', color: '#666666' }"
>
<el-table-column type="index" label="序列号" width="100" align="center" />
<el-table-column
prop="siteName"
label="基站名称"
width="180"
align="center"
/>
<el-table-column
prop="alarmTarget"
label="告警对象"
width="180"
align="center"
/>
<el-table-column prop="alarmLevelName" label="告警级别" width="150" align="center">
</el-table-column>
<el-table-column
prop="alarmInfo"
label="告警信息"
align="center"
width="300"
>
<!-- <template slot-scope="scope">
<div
v-for="(item, index) in scope.row.message.red"
:key="index + 'red'"
class="red message"
>
{{ item }}
</div>
<div
v-for="(item, index) in scope.row.message.green"
:key="index + 'green'"
class="green message"
>
{{ item }}
</div>
<div
v-for="(item, index) in scope.row.message.black"
:key="index + 'black'"
class="black message"
>
{{ item }}
</div>
</template> -->
</el-table-column>
<el-table-column
prop="lateUploadTime"
label="最新上传时间"
align="center"
width="105"
/>
<el-table-column
prop="statusTimeChange"
label="状态变化时间"
align="center"
width="105"
/>
<el-table-column prop="confirmPerson" label="确认人" align="center" />
<el-table-column prop="confirmTime" label="确认时间" align="center" />
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button type="text" v-if="scope.row.confirmStatus === 1">取消</el-button>
<el-button type="text" v-else>确认</el-button>
</template>
</el-table-column>
</el-table>
<Pagination
:limit="params.size"
:page="params.current"
:total="total"
class="pagination"
@pagination="handlePageChange"
/>
</div>
</template>
<script>
import { cableTimeList, cableExport } from '../api'
export default {
data() {
return {
confirmStatus: 2,
params: {
current: 1,
size: 10
},
total: 10,
tableData: [],
tabs: [ // 1:已确认,0:未确认
{
label: '全部',
key: 2
},
{
label: '已确认',
key: 1
},
{
label: '未确认',
key: 0
}
],
};
},
methods: {
// 表格背景图颜色
cellClassFn({ row, column, rowIndex, columnIndex }) {
if (row.level == '紧急' && column.label == '告警级别') {
return 'emergency'
} else if (row.level == '重要' && column.label == '告警级别') {
return 'important'
}
if (rowIndex % 2 == 1) {
return 'stripe'
}
},
handlePageChange(pageData) {
this.params.size = pageData.size
this.params.current = pageData.page
this.getTableData()
},
getTableData(type) {
let param = {
confirmStatus: type,
...this.params
}
cableTimeList(param).then(res => {
let list = res.records || []
this.tableData = list
this.total = res.total
})
},
changeType(item) {
this.confirmStatus = item.key
if(item.key == 2) {
this.getTableData('')
} else {
this.getTableData(item.key)
}
},
exportList() {
cableExport({confirmStatus: this.confirmStatus}).then(res => {
})
},
},
mounted() {
this.getTableData()
},
};
</script>
<style lang="scss" scoped>
.leakage-cable {
.leakage-top {
margin-bottom: 20px;
display: flex;
align-items: flex-end;
justify-content: space-between;
}
& ::v-deep .cell {
color: #333333;
}
.message {
line-height: 22px;
}
.red {
color: red;
}
.green {
color: green;
}
.black {
color: black;
}
& ::v-deep .stripe {
background-color: #eaf1fe;
}
& ::v-deep .emergency {
background-color: #f00;
}
& ::v-deep .important {
background-color: #f89850;
}
.page {
display: flex;
align-items: center;
justify-content: center;
margin: 20px 0;
.pageNum {
margin: 0 20px;
}
}
}
</style>