removeAlarm.vue
4.53 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
<template>
<div class="system-container">
<div class="container">
<search-form class="searchTop border-shadow removeAlarm" :formModel="searchForm" :formList="todoFormList">
<span class="inline-b" slot="form-slot">
<el-button type="primary" :size="btn_size" icon="el-icon-search" :id="removeAlarmTableParams.btnId">搜索</el-button>
<el-button type="primary" :size="btn_size" icon="el-icon-refresh" @click="refresh">重置</el-button>
</span>
</search-form>
<h3>防拆报警(试驾)
<div class="pull-right">
<template>
<el-button v-for="item in authList" :key="item.id" :type="item.type" :size="btn_size" @click="btnClick(item.pType)">{{item.name}}</el-button>
</template>
</div>
</h3>
<basic-table class="basic-table" ref="removeAlarmForm" :tableParams="removeAlarmTableParams" :getListApi="getListApi" :beforeSearchFn="beforeSearchFn" :searchForm="searchDataForm" :hasNum="false">
</basic-table>
</div>
</div>
</template>
<script>
import { TEARDOWN_API } from "@/config/config";
import store from "@/store";
import { getList } from "services/alarmCenter";
export default {
data() {
return {
searchForm: {},
searchDataForm: {},
todoFormList: [
{
type: "input",
inputType: "text",
prop: "keywords",
placeholder: "特约店编码|店名称 | 设备号 | 车型",
},
{
type: "daterange",
prop: "daterange",
startPlaceholder: "报警开始时间",
endPlaceholder: "报警结束时间",
// pickerOptions: {
// disabledDate(time) {
// return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
// }
// }
},
],
removeAlarmTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: "所属大区",
prop: "area",
},
{
label: "所属省",
prop: "province",
},
{
label: "所属市",
prop: "city",
},
{
label: "特约店名称",
prop: "shopName",
},
{
label: "特约店编码",
prop: "shopCode",
},
{
label: "店级别",
prop: "shopLevel",
},
{
label: "车型",
prop: "modelName",
},
{
label: "配置",
prop: "configDesc",
},
{
label: "车架号",
prop: "vin",
width: 150,
},
{
label: "设备号",
prop: "sn",
width: 100,
},
{
label: "报警时间",
prop: "alarmTime",
width: 160,
},
{
label: "拆除报警类型",
prop: "alarmType",
width: 100,
formatter: (cellValue) => {
return {
1: "断电报警",
99: "光感报警",
}[cellValue.alarmType];
},
},
{
label: "报警次数",
prop: "alarmCount",
},
],
},
getListApi: getList,
authList: [
{
id: 1,
name: "导出Excel",
type: "primary",
pType: "export",
},
],
};
},
methods: {
refresh() {
this.searchForm = {};
this.searchDataForm = {};
this.$refs.removeAlarmForm.refreshTable();
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
if (this.searchForm.daterange) {
this.searchDataForm.startTime = this.searchForm.daterange[0];
this.searchDataForm.endTime = this.searchForm.daterange[1];
} else {
this.searchDataForm.startTime = "";
this.searchDataForm.endTime = "";
} /* */
this.searchDataForm.keywords = this.searchForm.keywords;
resolve();
});
},
btnClick(pType, scope) {
switch (pType) {
case "export":
this.$Common.exportExcel({
url: `${store.state.baseURL}${TEARDOWN_API.TEAR_EXPORT}`,
method: "GET",
data: this.searchDataForm,
fileName: "导出拆除预警Excel",
});
break;
}
},
},
};
</script>