electricity.vue
8.4 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
<template>
<div class="system-container">
<div class="container">
<h1 class="page_title">
<span>电量统计</span>
<el-popover placement="right-start" trigger="hover">
<div class="popover_box">
<h3 class="h3">首次上点时间</h3>
<p>指无线设备激活时间;</p>
<h3 class="h3">最近上点时间</h3>
<p>指无线设备最近一次的上点时间;</p>
<h3 class="h3">当前电量(%)</h3>
<p>显示设备当前电量百分比;</p>
<p>仅统计无线设备的用户</p>
</div>
<span class="title_tip_icon" slot="reference"><i class="el-icon-question"></i></span>
</el-popover>
</h1>
<div class="m-b-md title_tips">用于统计无线设备的剩余电量</div>
<!-- 搜索区域 开始 -->
<div class="search_box">
<el-form :model="searchForm" :inline="true" size="small">
<el-form-item label="关键字:">
<el-input placeholder="业务工单|姓名|车架号|设备号" class="a_input" maxlength="20" v-model.trim="searchForm.keywords">
</el-input>
</el-form-item>
<el-form-item label="选择电量:">
<div class="input_number_list">
<el-input-number class="a_input_number" placeholder="最低" v-model="searchForm.minBattery" :controls="false" :min="0" :max="searchForm.maxBattery"></el-input-number>
<span class="sp">-</span>
<el-input-number class="a_input_number" placeholder="最高" v-model="searchForm.maxBattery" :controls="false" :min="searchForm.minBattery" :max="100"></el-input-number>
</div>
</el-form-item>
<el-form-item label="车辆归属:">
<el-popover v-model="filterVisible" placement="bottom-start" width="400" trigger="click">
<div>
<glsx-organization @change="onChange"></glsx-organization>
</div>
<el-input v-model="searchForm.orgName" :placeholder="searchForm.specialShopName || '所属组织'" slot="reference" readonly>
</el-input>
</el-popover>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="getList()">查询</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-refresh" @click="rest()">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 搜索区域 end -->
<!-- 按钮区域 开始 -->
<div class="links_group">
<span>电量统计列表</span>
<el-button class="pull-right" type="primary" icon="el-icon-download" size="mini" :loading="dloading" @click="downloadExcel">导出Excel</el-button>
</div>
<!-- 按钮区域 end -->
<!-- 列表 开始 -->
<glsx-table ref="glsxTable" v-loading="loading" :list="tableData" :column="columnList" :pageTotal="pageTotal" @change="getList">
</glsx-table>
<!-- 列表 end -->
</div>
</div>
</template>
<script>
import GlsxTable from "@/components/glsx-table";
import { GET_BATTERY_LIST, EXPORT_BATTERY_LIST } from "services/report";
import GlsxOrganization from "@/components/glsx-organization";
import { deepClone, showToast, downFileByPath } from "@/utils/util";
import moment from "moment";
export default {
components: {
GlsxTable,
GlsxOrganization,
},
data() {
return {
searchForm: {},
tableData: [],
columnList: [
{
label: "业务工单号",
prop: "workOrderNo",
formatter: (row) => {
return `${row.workOrderNo || "--"}`;
},
},
{
label: "姓名",
prop: "ownerName",
formatter: (row) => {
return `${row.ownerName || "--"}`;
},
},
{
label: "设备号",
prop: "sn",
formatter: (row) => {
return `${row.sn || "--"}`;
},
},
{
label: "车架号",
prop: "vin",
formatter: (row) => {
return `${row.vin || "--"}`;
},
},
{
label: "首次上点时间",
prop: "firstGpsTime",
formatter: (row) => {
return `${row.firstGpsTime || "--"}`;
},
},
{
label: "最后上点时间",
prop: "lastGpsTime",
formatter: (row) => {
return `${row.lastGpsTime || "--"}`;
},
},
{
label: "当前电量",
prop: "soc",
formatter: (row) => {
return `${row.soc || row.soc == 0 ? row.soc + "%" : "--"}`;
},
},
],
pageTotal: 0,
pageSize: 10,
filterVisible: false,
dloading: false,
showPopover: false,
cloading: false,
loading: false,
aloading: false,
isTimeOut: false,
sTime: "",
eTime: "",
pickerOptions: {
onPick: ({ maxDate, minDate }) => {
this.sTime = minDate || "";
this.eTime = maxDate || "";
if (maxDate && minDate) {
let m = moment(maxDate).diff(moment(minDate), "days");
if (m > 60) {
this.isTimeOut = true;
} else {
this.isTimeOut = false;
}
this.eTime = "";
this.sTime = "";
}
},
},
showDialog: false,
uploadFile: {},
showResult: false,
uploadHeaders: {},
uploadResult: {},
fileList: [],
acceptFile: ".xlsx,.xls",
};
},
mounted() {
let token = localStorage.getItem("token");
this.uploadHeaders = { Authorization: token };
this.getList();
},
methods: {
// 获取查询参数
getParams() {
let oParams = deepClone(this.searchForm);
if (
(oParams.minBattery || oParams.minBattery == 0) &&
!oParams.maxBattery &&
oParams.maxBattery !== 0
) {
showToast({
message: "请输入最大电量",
});
return false;
}
if (
!oParams.minBattery &&
oParams.minBattery !== 0 &&
(oParams.maxBattery || oParams.maxBattery == 0)
) {
showToast({
message: "请输入最小电量",
});
return false;
}
delete oParams.orgName;
return oParams;
},
// 获取列表
getList(options) {
let oParams = this.getParams();
console.log(options);
console.log(this.$refs.glsxTable.pageSizeNum);
oParams.pageSize = options
? options.pageSize
: this.$refs.glsxTable.pageSizeNum;
oParams.pageNumber = options ? options.pageNumber || 1 : 1;
this.loading = true;
GET_BATTERY_LIST(oParams)
.then((res) => {
this.loading = false;
let { data } = res;
let { list, totalElements } = data;
this.pageTotal = totalElements || 0;
this.tableData = list || [];
})
.catch((error) => {
this.loading = false;
});
},
// 查看详情
lookDetail(row) {
console.log(row);
let o = window.location.origin;
let query = { vin: row.vin };
//let path = "/trialRun#/reportManage/map";
let path = `/oEshield/#/monitor/activeLocation`;
//history.pushState(query, path, path);
this.$root.parentCommon.setBreadCrumbs(path);
window.open(path + "?sns=" + row.sns);
//this.$router.push({ name: "mileageDetail", query: { vin: row.vin } });
},
// 监听树
onChange(e) {
this.filterVisible = false;
console.log(e);
if (e) {
this.orgInfo = e.origin;
this.searchForm.orgId = e.origin.orgId;
this.searchForm.orgType = e.origin.type;
this.searchForm.orgName = e.origin.orgName;
}
},
// 导出excel
downloadExcel() {
let _this = this;
let oParams = this.getParams();
_this.dloading = true;
EXPORT_BATTERY_LIST(oParams).then((res) => {
_this.dloading = false;
if (res.code != 200) {
return false;
}
//window.open(res.data);
downFileByPath(res.data);
});
},
// 重置
rest() {
this.searchForm = {};
this.$refs.glsxTable.rest();
this.getList();
},
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/common.scss";
</style>>