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
<template>
<div>
<div class="leakage-top">
<div style="color: #666666"></div>
<div class="operate-btn">
<el-button
:type="multipleSelection.length ? 'primary' : 'info'"
:disabled="!multipleSelection.length"
@click="delData"
>删除</el-button
>
<el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="query">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button>
</div>
</div>
<el-table
ref="multipleTable"
class="statistics-table"
:data="tableData"
tooltip-effect="dark"
style="width: 100%"
:row-class-name="tableRowClassName"
:row-style="{ height: '50px' }"
:header-cell-style="{
background: '#eaf1fe',
color: '#000',
fontWeight: 700,
height: '50px',
}"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column prop="parentId" label="站点所属铁路线:" align="center" />
<el-table-column prop="siteCode" label="站点编号" align="center" />
<el-table-column
prop="siteName"
label="站名"
align="center"
/>
<el-table-column
prop="siteAddress"
label="站点地址"
show-overflow-tooltip
align="center"
/>
<el-table-column
prop="siteArea"
label="站点所在局"
show-overflow-tooltip
align="center"
/>
<el-table-column
prop="siteSectionCode"
label="站点所在段号"
show-overflow-tooltip
align="center"
/> <el-table-column
prop="siteKmSign"
label="站点所在公里标"
show-overflow-tooltip
align="center"
/> <el-table-column
prop="siteLatitude"
label="站点经度"
show-overflow-tooltip
align="center"
/> <el-table-column
prop="siteLongitude"
label="站点维度"
show-overflow-tooltip
align="center"
/> <el-table-column
prop="siteOtherMessage"
label="站点其他信息"
show-overflow-tooltip
align="center"
/>
<el-table-column
prop="action"
label="详细信息"
show-overflow-tooltip
align="center"
>
<template slot-scope="{ row }">
<el-link type="primary" :underline="false" @click="handleView(row)"
>查看</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
:limit="params.pageSize"
:page="params.pageNum"
:total="total"
class="pagination"
@pagination="handlePageChange"
/>
</div>
</template>
<script>
import Pagination from "@/components/Pagination";
import { sitelist } from "../../api";
export default {
props: [],
components: { Pagination },
data() {
return {
tableData:[],
params: {
pageNum: 1,
pageSize: 10,
},
total: 10,
multipleSelection: [],
ids: [],
};
},
computed: {},
methods: {
tableRowClassName({ row, rowIndex }) {
return rowIndex % 2 === 0 ? "" : "single-row";
},
changeType(item) {
this.activeName = item.key;
},
delData() {
let ids = this.ids;
railWaybatchDelete({ ids }).then((res) => {});
this.getTableData();
},
refresh() {},
query() {},
exportData() {},
handleSelectionChange(val) {
this.multipleSelection = val;
this.ids = this.multipleSelection.map((i) => i.id);
console.log(this.ids);
},
handleView(row) {
console.log(row.id);
let id = row.id;
railWaydetail({ id }).then((res) => {
console.log(res);
});
},
handlePageChange(pageData) {
this.params.pageSize = pageData.size;
this.params.pageNum = pageData.page;
this.getTableData();
},
getTableData() {
// this.tableData2 = this.tableData.slice(( this.params.pageNum - 1) * this.params.pageSize,
// this.params.pageNum * this.params.pageSize
// );
// this.total = this.tableData.length
let params = {
current: this.params.pageNum,
size: this.params.pageSize,
};
sitelist(params).then((res) => {
let list = res.records || [];
this.tableData = list;
this.total = res.total;
});
},
},
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;
}
& ::v-deep .stripe {
background-color: #eaf1fe;
}
& ::v-deep .red {
background-color: #f00;
}
& ::v-deep .green {
background-color: green;
}
.page {
display: flex;
align-items: center;
justify-content: center;
margin: 20px 0;
.pageNum {
margin: 0 20px;
}
}
}
</style>
<style lang="scss">
.statistics-table {
.single-row {
background: #f1f6ff;
}
td {
padding: 5px !important;
}
}
</style>