|
@@ -1,116 +1,286 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="body-wrapper">
|
3
|
|
- <div style="display: flex; justify-content: space-between;">
|
|
3
|
+ <div style="display: flex; justify-content: space-between">
|
4
|
4
|
<div style="width: 100%">
|
5
|
|
- <el-form class="form-wrapper" :inline="true" :model="formInline" style="margin-bottom: 20px;">
|
|
5
|
+ <el-form
|
|
6
|
+ class="form-wrapper"
|
|
7
|
+ :inline="true"
|
|
8
|
+ :model="formInline"
|
|
9
|
+ style="margin-bottom: 20px"
|
|
10
|
+ >
|
6
|
11
|
<el-row>
|
7
|
12
|
<el-col :span="6">
|
8
|
13
|
<el-form-item label="车牌号:">
|
9
|
|
- <el-input v-model="formInline.plateNo" placeholder="请输入"></el-input>
|
|
14
|
+ <el-input
|
|
15
|
+ v-model="formInline.plateNo"
|
|
16
|
+ placeholder="请输入"
|
|
17
|
+ ></el-input>
|
10
|
18
|
</el-form-item>
|
11
|
19
|
</el-col>
|
12
|
20
|
<el-col :span="6">
|
13
|
21
|
<el-form-item label="电话号码:">
|
14
|
|
- <el-input v-model="formInline.phoneNo" placeholder="请输入"></el-input>
|
|
22
|
+ <el-input
|
|
23
|
+ v-model="formInline.phoneNo"
|
|
24
|
+ placeholder="请输入"
|
|
25
|
+ ></el-input>
|
15
|
26
|
</el-form-item>
|
16
|
27
|
</el-col>
|
17
|
28
|
<el-col :span="6">
|
18
|
29
|
<el-form-item label="电话是否有效:">
|
19
|
|
- <el-select clearable v-model="formInline.phoneStatus" placeholder="错误类型" popper-class="cur-select">
|
|
30
|
+ <el-select
|
|
31
|
+ clearable
|
|
32
|
+ v-model="formInline.phoneStatus"
|
|
33
|
+ placeholder="请选择"
|
|
34
|
+ popper-class="cur-select"
|
|
35
|
+ >
|
20
|
36
|
<el-option label="全部" value=""></el-option>
|
21
|
37
|
<el-option label="有效" value="有效"></el-option>
|
22
|
38
|
<el-option label="无效" value="无效"></el-option>
|
23
|
39
|
</el-select>
|
24
|
40
|
</el-form-item>
|
25
|
41
|
</el-col>
|
26
|
|
- <el-col :span="4">
|
|
42
|
+ <el-col :span="6">
|
|
43
|
+ <el-form-item>
|
|
44
|
+ <el-button
|
|
45
|
+ type="primary"
|
|
46
|
+ class="query-btn"
|
|
47
|
+ @click="onSubmit"
|
|
48
|
+ icon="el-icon-search"
|
|
49
|
+ >查询</el-button
|
|
50
|
+ >
|
|
51
|
+ </el-form-item>
|
27
|
52
|
<el-form-item>
|
28
|
|
- <el-button type="primary" class="query-btn" @click="onSubmit" icon="el-icon-search">查询</el-button>
|
|
53
|
+ <el-button type="success" @click="handleAdd">录入</el-button>
|
29
|
54
|
</el-form-item>
|
30
|
55
|
</el-col>
|
31
|
56
|
</el-row>
|
32
|
57
|
</el-form>
|
33
|
|
- <el-table border :row-class-name="rowClassName" :data="tableData" v-loading="loading">
|
34
|
|
- <el-table-column v-for="(item, index) in columns" :key="index" :label="item.label" :prop="item.key">
|
|
58
|
+ <el-table
|
|
59
|
+ border
|
|
60
|
+ :row-class-name="rowClassName"
|
|
61
|
+ :data="tableData"
|
|
62
|
+ v-loading="loading"
|
|
63
|
+ >
|
|
64
|
+ <el-table-column
|
|
65
|
+ v-for="(item, index) in columns"
|
|
66
|
+ :key="index"
|
|
67
|
+ :label="item.label"
|
|
68
|
+ :prop="item.key"
|
|
69
|
+ >
|
|
70
|
+ </el-table-column>
|
|
71
|
+ <el-table-column label="操作" width="200">
|
|
72
|
+ <template slot-scope="scope" style="display: inline-block">
|
|
73
|
+ <el-button
|
|
74
|
+ type="primary"
|
|
75
|
+ @click="handleEdit(scope.row)"
|
|
76
|
+ slot="reference"
|
|
77
|
+ >修改</el-button
|
|
78
|
+ >
|
|
79
|
+ <el-popconfirm
|
|
80
|
+ title="确定删除吗?"
|
|
81
|
+ @confirm="deleteRow(scope.row)"
|
|
82
|
+ >
|
|
83
|
+ <el-button type="danger" slot="reference">删除</el-button>
|
|
84
|
+ </el-popconfirm>
|
|
85
|
+ </template>
|
35
|
86
|
</el-table-column>
|
36
|
87
|
</el-table>
|
37
|
88
|
<div class="table-pagination">
|
38
|
|
- <el-pagination :background="false" layout="total, prev, pager, next" :total="total" @current-change="handlePageChange"
|
39
|
|
- :current-page.sync="pageNum" :page-size.sync="pageSize">
|
|
89
|
+ <el-pagination
|
|
90
|
+ :background="false"
|
|
91
|
+ layout="total, prev, pager, next"
|
|
92
|
+ :total="total"
|
|
93
|
+ @current-change="handlePageChange"
|
|
94
|
+ :current-page.sync="pageNum"
|
|
95
|
+ :page-size.sync="pageSize"
|
|
96
|
+ >
|
40
|
97
|
</el-pagination>
|
41
|
98
|
</div>
|
42
|
99
|
</div>
|
43
|
100
|
</div>
|
|
101
|
+ <el-dialog
|
|
102
|
+ :title="title"
|
|
103
|
+ :visible.sync="dialogVisible"
|
|
104
|
+ width="45%"
|
|
105
|
+ custom-class="audit-dialog"
|
|
106
|
+ >
|
|
107
|
+ <div class="form-div">
|
|
108
|
+ <el-form
|
|
109
|
+ label-position="left"
|
|
110
|
+ label-width="100px"
|
|
111
|
+ :model="formLabelAlign"
|
|
112
|
+ ref="formLabelAlign"
|
|
113
|
+ :rules="rules"
|
|
114
|
+ >
|
|
115
|
+ <el-form-item label="车牌号" prop="plateNo">
|
|
116
|
+ <el-input v-model="formLabelAlign.plateNo"></el-input>
|
|
117
|
+ </el-form-item>
|
|
118
|
+ <el-form-item label="联系方式" prop="phoneNo">
|
|
119
|
+ <el-input v-model="formLabelAlign.phoneNo"></el-input>
|
|
120
|
+ </el-form-item>
|
|
121
|
+ <el-form-item label="电话是否有效" prop="phoneStatus">
|
|
122
|
+ <el-select
|
|
123
|
+ v-model="formLabelAlign.phoneStatus"
|
|
124
|
+ placeholder="请选择"
|
|
125
|
+ popper-class="cur-select"
|
|
126
|
+ >
|
|
127
|
+ <el-option label="有效" value="有效"></el-option>
|
|
128
|
+ <el-option label="无效" value="无效"></el-option>
|
|
129
|
+ </el-select>
|
|
130
|
+ </el-form-item>
|
|
131
|
+ </el-form>
|
|
132
|
+ </div>
|
|
133
|
+ <span slot="footer" class="dialog-footer">
|
|
134
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
135
|
+ <el-button type="primary" @click="handleConfirm">确 定</el-button>
|
|
136
|
+ </span>
|
|
137
|
+ </el-dialog>
|
44
|
138
|
</div>
|
45
|
139
|
</template>
|
46
|
140
|
<script>
|
47
|
141
|
import api from "@/api/audit";
|
48
|
142
|
import api_z from "@/api/article_z.js";
|
49
|
|
-
|
|
143
|
+import { vehicleNumber, checkPhone } from "@/util/common";
|
50
|
144
|
|
51
|
145
|
export default {
|
52
|
|
- components: {
|
53
|
|
-
|
54
|
|
- },
|
|
146
|
+ components: {},
|
55
|
147
|
data() {
|
56
|
148
|
return {
|
57
|
149
|
loading: false,
|
58
|
150
|
formInline: {
|
59
|
|
- plateNo: '',
|
60
|
|
- phoneNo: '',
|
61
|
|
- phoneStatus: ''
|
|
151
|
+ plateNo: "",
|
|
152
|
+ phoneNo: "",
|
|
153
|
+ phoneStatus: "",
|
|
154
|
+ },
|
|
155
|
+ title: "",
|
|
156
|
+ dialogVisible: false,
|
|
157
|
+ formLabelAlign: {
|
|
158
|
+ plateNo: "",
|
|
159
|
+ phoneNo: "",
|
|
160
|
+ phoneStatus: "",
|
62
|
161
|
},
|
63
|
162
|
columns: [
|
64
|
163
|
{
|
65
|
|
- label: '车牌号',
|
66
|
|
- key: 'plateNo'
|
67
|
|
- },
|
68
|
|
- {
|
69
|
|
- label: '电话号码',
|
70
|
|
- key: 'phoneNo'
|
|
164
|
+ label: "车牌号",
|
|
165
|
+ key: "plateNo",
|
71
|
166
|
},
|
72
|
167
|
{
|
73
|
|
- label: '导入时间',
|
74
|
|
- key: 'importTime'
|
|
168
|
+ label: "电话号码",
|
|
169
|
+ key: "phoneNo",
|
75
|
170
|
},
|
|
171
|
+ // {
|
|
172
|
+ // label: '导入时间',
|
|
173
|
+ // key: 'importTime'
|
|
174
|
+ // },
|
76
|
175
|
{
|
77
|
|
- label: '电话状态',
|
78
|
|
- key: 'phoneStatus'
|
|
176
|
+ label: "电话状态",
|
|
177
|
+ key: "phoneStatus",
|
79
|
178
|
},
|
80
|
179
|
],
|
81
|
|
- tableData:[],
|
|
180
|
+ rules: {
|
|
181
|
+ plateNo: [
|
|
182
|
+ { required: true, message: "车牌号不能为空", trigger: "blur" },
|
|
183
|
+ {
|
|
184
|
+ validator: vehicleNumber,
|
|
185
|
+ trigger: "blur",
|
|
186
|
+ },
|
|
187
|
+ ],
|
|
188
|
+ phoneNo: [
|
|
189
|
+ { required: true, message: "电话号码不能为空", trigger: "blur" },
|
|
190
|
+ { validator: checkPhone, trigger: "blur" },
|
|
191
|
+ ],
|
|
192
|
+ phoneStatus: [
|
|
193
|
+ { required: true, message: "是否有效不能为空", trigger: "change" },
|
|
194
|
+ ],
|
|
195
|
+ },
|
|
196
|
+ tableData: [],
|
82
|
197
|
total: 0,
|
83
|
198
|
pageSize: 10,
|
84
|
199
|
pageNum: 1,
|
85
|
|
- }
|
|
200
|
+ };
|
86
|
201
|
},
|
87
|
202
|
mounted() {
|
88
|
|
- this.getTableData()
|
|
203
|
+ this.getTableData();
|
89
|
204
|
},
|
90
|
205
|
watch: {},
|
91
|
206
|
methods: {
|
|
207
|
+ handleAdd() {
|
|
208
|
+ this.title = "录入";
|
|
209
|
+ this.formLabelAlign = {};
|
|
210
|
+ this.dialogVisible = true;
|
|
211
|
+ },
|
|
212
|
+ handleEdit(row) {
|
|
213
|
+ this.title = "修改";
|
|
214
|
+ this.formLabelAlign = { ...row };
|
|
215
|
+ this.dialogVisible = true;
|
|
216
|
+ },
|
|
217
|
+ deleteRow(record) {
|
|
218
|
+ api_z.deleteTelephone([{ id: record.id }]).then((res) => {
|
|
219
|
+ if (res.code === 200) {
|
|
220
|
+ this.$message({ type: "success", message: "删除成功!" });
|
|
221
|
+ this.getTableData();
|
|
222
|
+ }
|
|
223
|
+ });
|
|
224
|
+ },
|
|
225
|
+ handleConfirm() {
|
|
226
|
+ this.$refs["formLabelAlign"].validate((valid) => {
|
|
227
|
+ if (valid) {
|
|
228
|
+ if (this.title === "修改") {
|
|
229
|
+ api_z.editTelephone({ ...this.formLabelAlign }).then((res) => {
|
|
230
|
+ if (res.code === 200) {
|
|
231
|
+ this.dialogVisible = false;
|
|
232
|
+ this.$message({
|
|
233
|
+ message: "修改成功!",
|
|
234
|
+ type: "success",
|
|
235
|
+ });
|
|
236
|
+ this.getTableData();
|
|
237
|
+ }
|
|
238
|
+ });
|
|
239
|
+ } else {
|
|
240
|
+ api_z.addTelephone({ ...this.formLabelAlign }).then((res) => {
|
|
241
|
+ if (res.code === 200) {
|
|
242
|
+ this.dialogVisible = false;
|
|
243
|
+ this.$message({
|
|
244
|
+ message: "添加成功!",
|
|
245
|
+ type: "success",
|
|
246
|
+ });
|
|
247
|
+ this.getTableData();
|
|
248
|
+ }
|
|
249
|
+ });
|
|
250
|
+ }
|
|
251
|
+ } else {
|
|
252
|
+ return false;
|
|
253
|
+ }
|
|
254
|
+ });
|
|
255
|
+ },
|
92
|
256
|
rowClassName({ rowIndex }) {
|
93
|
257
|
// 偶数行和奇数行分别返回不同的类名,也可以根据实际需求基于rowData进行条件判断
|
94
|
|
- return rowIndex % 2 === 0 ? 'even-row' : 'odd-row';
|
|
258
|
+ return rowIndex % 2 === 0 ? "even-row" : "odd-row";
|
95
|
259
|
},
|
96
|
260
|
onSubmit() {
|
97
|
|
- this.pageNum = 1
|
98
|
|
- this.getTableData()
|
|
261
|
+ this.pageNum = 1;
|
|
262
|
+ this.getTableData();
|
99
|
263
|
},
|
100
|
264
|
handlePageChange() {
|
101
|
|
- this.getTableData()
|
|
265
|
+ this.getTableData();
|
102
|
266
|
},
|
103
|
267
|
getTableData() {
|
104
|
|
- this.loading = true
|
105
|
|
- const {pageNum, pageSize} = this
|
106
|
|
- api_z.queryTelephoneManagementByPage({current: pageNum, size: pageSize, ...this.formInline}).then(res => {
|
107
|
|
- this.tableData = res.data.records || []
|
108
|
|
- this.total = res.data.total
|
109
|
|
- this.loading = false
|
110
|
|
- })
|
|
268
|
+ this.loading = true;
|
|
269
|
+ const { pageNum, pageSize } = this;
|
|
270
|
+ api_z
|
|
271
|
+ .queryTelephoneManagementByPage({
|
|
272
|
+ current: pageNum,
|
|
273
|
+ size: pageSize,
|
|
274
|
+ ...this.formInline,
|
|
275
|
+ })
|
|
276
|
+ .then((res) => {
|
|
277
|
+ this.tableData = res.data.records || [];
|
|
278
|
+ this.total = res.data.total;
|
|
279
|
+ this.loading = false;
|
|
280
|
+ });
|
111
|
281
|
},
|
112
|
|
- }
|
113
|
|
-}
|
|
282
|
+ },
|
|
283
|
+};
|
114
|
284
|
</script>
|
115
|
285
|
<style lang="scss" scoped>
|
116
|
286
|
.body-wrapper {
|
|
@@ -139,5 +309,4 @@ export default {
|
139
|
309
|
}
|
140
|
310
|
}
|
141
|
311
|
}
|
142
|
|
-
|
143
|
312
|
</style>
|