|
@@ -0,0 +1,287 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="root">
|
|
3
|
+ <el-form :inline="true" :model="listQuery" class="form-listQuery">
|
|
4
|
+ <!-- <el-form-item label="业务名称">
|
|
5
|
+ <el-input v-model="listQuery.serviceName" placeholder="业务名称" />
|
|
6
|
+ </el-form-item>
|
|
7
|
+ <el-form-item>
|
|
8
|
+ <el-button type="info" @click="clearListQuery">清空</el-button>
|
|
9
|
+ <el-button type="primary" @click="handleFilter">查询</el-button>
|
|
10
|
+ </el-form-item> -->
|
|
11
|
+ </el-form>
|
|
12
|
+ <div class="operation">
|
|
13
|
+ <div>
|
|
14
|
+ <el-button type="primary" @click="addCarousel">新增轮播图</el-button>
|
|
15
|
+ <el-button type="danger" @click="deleteCarousel">删除</el-button>
|
|
16
|
+ </div>
|
|
17
|
+ </div>
|
|
18
|
+ <el-table
|
|
19
|
+ v-loading="listLoading"
|
|
20
|
+ ref="multipleTable"
|
|
21
|
+ :data="carouselList"
|
|
22
|
+ border
|
|
23
|
+ tooltip-effect="dark"
|
|
24
|
+ style="width: 100%; margin-top: 20px;"
|
|
25
|
+ @selection-change="handleSelectionChange">
|
|
26
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
27
|
+ <!-- <el-table-column label="业务名称" align="center">
|
|
28
|
+ <template slot-scope="scope">
|
|
29
|
+ <span>{{ scope.row.serviceName }}</span>
|
|
30
|
+ </template>
|
|
31
|
+ </el-table-column> -->
|
|
32
|
+ <el-table-column label="业务图片" align="center">
|
|
33
|
+ <template slot-scope="scope">
|
|
34
|
+ <img v-if="scope.row.imageUrl !== ''" :src="scope.row.imageUrl" width="50" height="50">
|
|
35
|
+ </template>
|
|
36
|
+ </el-table-column>
|
|
37
|
+ <el-table-column label="排序" align="center">
|
|
38
|
+ <template slot-scope="scope">
|
|
39
|
+ <span>{{ scope.row.sort }}</span>
|
|
40
|
+ </template>
|
|
41
|
+ </el-table-column>
|
|
42
|
+ <el-table-column label="创建时间" align="center">
|
|
43
|
+ <template slot-scope="scope">
|
|
44
|
+ <span>{{ formatDate(scope.row.createTime) }}</span>
|
|
45
|
+ </template>
|
|
46
|
+ </el-table-column>
|
|
47
|
+ </el-table>
|
|
48
|
+ <div class="block">
|
|
49
|
+ <el-pagination
|
|
50
|
+ :current-page.sync="listQuery.pageNum"
|
|
51
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
52
|
+ :page-size.sync="listQuery.pageSize"
|
|
53
|
+ :total="total"
|
|
54
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
55
|
+ @size-change="handleSizeChange"
|
|
56
|
+ @current-change="handleCurrentChange"/>
|
|
57
|
+ </div>
|
|
58
|
+ </div>
|
|
59
|
+</template>
|
|
60
|
+
|
|
61
|
+<script>
|
|
62
|
+import waves from '@/directive/waves' // Waves directive
|
|
63
|
+import { parseTime } from '@/utils'
|
|
64
|
+
|
|
65
|
+export default {
|
|
66
|
+ directives: { waves },
|
|
67
|
+ data() {
|
|
68
|
+ var _self = this
|
|
69
|
+ return {
|
|
70
|
+ events: {
|
|
71
|
+ click: (e) => {
|
|
72
|
+ // _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
|
|
73
|
+ _self.detail.longitude = e.lnglat.lng
|
|
74
|
+ _self.detail.latitude = e.lnglat.lat
|
|
75
|
+ }
|
|
76
|
+ },
|
|
77
|
+ markers: [],
|
|
78
|
+ searchOption: {
|
|
79
|
+ city: '南京',
|
|
80
|
+ citylimit: false
|
|
81
|
+ },
|
|
82
|
+ carouselList: [],
|
|
83
|
+ total: 0,
|
|
84
|
+ listLoading: true,
|
|
85
|
+ listQuery: {
|
|
86
|
+ pageNum: 1,
|
|
87
|
+ pageSize: 20
|
|
88
|
+ },
|
|
89
|
+ ids: [], // id集合
|
|
90
|
+ tableKey: 0,
|
|
91
|
+ downloadLoading: false
|
|
92
|
+ }
|
|
93
|
+ },
|
|
94
|
+ created() {
|
|
95
|
+ this.getList()
|
|
96
|
+ },
|
|
97
|
+ methods: {
|
|
98
|
+ setCurrent(item) {
|
|
99
|
+ this.setDetail({ ...item })
|
|
100
|
+ },
|
|
101
|
+ getList() {
|
|
102
|
+ this.listLoading = true
|
|
103
|
+ this.$store.dispatch('carousel/getCarouselList', this.listQuery).then((res) => {
|
|
104
|
+ console.log(res)
|
|
105
|
+ this.carouselList = res.data.data.records
|
|
106
|
+ this.total = res.data.data.total
|
|
107
|
+ this.listLoading = false
|
|
108
|
+ }).catch(() => {
|
|
109
|
+ this.loading = false
|
|
110
|
+ console.log('get list error')
|
|
111
|
+ })
|
|
112
|
+ },
|
|
113
|
+ clearListQuery() {
|
|
114
|
+ this.listQuery.pageNum = 1
|
|
115
|
+ this.listQuery.pageSize = 20
|
|
116
|
+ this.listQuery.billId = undefined
|
|
117
|
+ this.listQuery.billName = undefined
|
|
118
|
+ this.listQuery.billExplain = undefined
|
|
119
|
+ this.getList()
|
|
120
|
+ },
|
|
121
|
+ getInfo(billId, billStatus) {
|
|
122
|
+ if (billStatus === '2') {
|
|
123
|
+ this.$router.push({ name: 'bill-edi', query: { id: billId }})
|
|
124
|
+ } else {
|
|
125
|
+ this.$router.push({ name: 'bill-info', query: { id: billId }})
|
|
126
|
+ }
|
|
127
|
+ },
|
|
128
|
+ addCarousel() {
|
|
129
|
+ this.$router.push({ name: 'carousel-edit' })
|
|
130
|
+ },
|
|
131
|
+ handleFilter() {
|
|
132
|
+ this.listQuery.pageNum = 1
|
|
133
|
+ this.getList()
|
|
134
|
+ },
|
|
135
|
+ handleModifyStatus(row, status) {
|
|
136
|
+ this.$message({
|
|
137
|
+ message: '操作成功',
|
|
138
|
+ type: 'success'
|
|
139
|
+ })
|
|
140
|
+ row.status = status
|
|
141
|
+ },
|
|
142
|
+ sortChange(data) {
|
|
143
|
+ const { prop, order } = data
|
|
144
|
+ if (prop === 'id') {
|
|
145
|
+ this.sortByID(order)
|
|
146
|
+ }
|
|
147
|
+ },
|
|
148
|
+ handleSizeChange(val) {
|
|
149
|
+ // console.log(`每页 ${val} 条`);
|
|
150
|
+ this.listQuery.pageSize = val
|
|
151
|
+ this.getList()
|
|
152
|
+ },
|
|
153
|
+ handleCurrentChange(val) {
|
|
154
|
+ // console.log(`当前页: ${val}`);
|
|
155
|
+ this.listQuery.pageNum = val
|
|
156
|
+ this.getList()
|
|
157
|
+ },
|
|
158
|
+ sortByID(order) {
|
|
159
|
+ if (order === 'ascending') {
|
|
160
|
+ this.listQuery.sort = '+id'
|
|
161
|
+ } else {
|
|
162
|
+ this.listQuery.sort = '-id'
|
|
163
|
+ }
|
|
164
|
+ this.handleFilter()
|
|
165
|
+ },
|
|
166
|
+ handleUpdate(row) {
|
|
167
|
+ this.setCurrent(row)
|
|
168
|
+ this.dialogStatus = 'update'
|
|
169
|
+ this.dialogFormVisible = true
|
|
170
|
+ this.$nextTick(() => {
|
|
171
|
+ this.$refs['dataForm'].clearValidate()
|
|
172
|
+ })
|
|
173
|
+ this.getEditCityList()
|
|
174
|
+ this.getEditDistrictList()
|
|
175
|
+ },
|
|
176
|
+ handleLook(id) {
|
|
177
|
+ this.$router.push({ name: 'transaction-info', params: { id: id }})
|
|
178
|
+ },
|
|
179
|
+ handleCreate() {
|
|
180
|
+ this.resetDetail()
|
|
181
|
+ this.dialogStatus = 'create'
|
|
182
|
+ this.dialogFormVisible = true
|
|
183
|
+ this.$nextTick(() => {
|
|
184
|
+ this.$refs['dataForm'].clearValidate()
|
|
185
|
+ })
|
|
186
|
+ },
|
|
187
|
+ handleDelete(row) {
|
|
188
|
+ this.$notify({
|
|
189
|
+ title: '成功',
|
|
190
|
+ message: '删除成功',
|
|
191
|
+ type: 'success',
|
|
192
|
+ duration: 2000
|
|
193
|
+ })
|
|
194
|
+ const index = this.list.indexOf(row)
|
|
195
|
+ this.list.splice(index, 1)
|
|
196
|
+ },
|
|
197
|
+ handleDownload() {
|
|
198
|
+ this.downloadLoading = true
|
|
199
|
+ import('@/vendor/Export2Excel').then(excel => {
|
|
200
|
+ const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
|
201
|
+ const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
|
202
|
+ const data = this.formatJson(filterVal, this.list)
|
|
203
|
+ excel.export_json_to_excel({
|
|
204
|
+ header: tHeader,
|
|
205
|
+ data,
|
|
206
|
+ filename: 'table-list'
|
|
207
|
+ })
|
|
208
|
+ this.downloadLoading = false
|
|
209
|
+ })
|
|
210
|
+ },
|
|
211
|
+ padDate(value) {
|
|
212
|
+ value = value < 10 ? '0' + value : value
|
|
213
|
+ return value
|
|
214
|
+ },
|
|
215
|
+ formatDate(val) {
|
|
216
|
+ if (val === null) {
|
|
217
|
+ return ''
|
|
218
|
+ }
|
|
219
|
+ var value = new Date(val)
|
|
220
|
+ var year = value.getFullYear()
|
|
221
|
+ var month = this.padDate(value.getMonth() + 1)
|
|
222
|
+ var day = this.padDate(value.getDate())
|
|
223
|
+ var hour = this.padDate(value.getHours())
|
|
224
|
+ var minutes = this.padDate(value.getMinutes())
|
|
225
|
+ var seconds = this.padDate(value.getSeconds())
|
|
226
|
+ return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
|
|
227
|
+ },
|
|
228
|
+ formatJson(filterVal, jsonData) {
|
|
229
|
+ return jsonData.map(v => filterVal.map(j => {
|
|
230
|
+ if (j === 'timestamp') {
|
|
231
|
+ return parseTime(v[j])
|
|
232
|
+ } else {
|
|
233
|
+ return v[j]
|
|
234
|
+ }
|
|
235
|
+ }))
|
|
236
|
+ },
|
|
237
|
+ deleteCarousel() { // 删除
|
|
238
|
+ if (this.ids.length <= 0) {
|
|
239
|
+ this.$message.error('请至少选择一项')
|
|
240
|
+ return
|
|
241
|
+ }
|
|
242
|
+ this.$store.dispatch('carousel/deleteCarousel', this.ids).then(res => {
|
|
243
|
+ const resCode = res.data.code
|
|
244
|
+ if (resCode === '0') {
|
|
245
|
+ this.$message.success('删除成功')
|
|
246
|
+ this.getList()
|
|
247
|
+ return
|
|
248
|
+ }
|
|
249
|
+ this.$message.error(res.data.message)
|
|
250
|
+ }).catch(() => {
|
|
251
|
+ console.log('DeleteBillBeach error')
|
|
252
|
+ })
|
|
253
|
+ },
|
|
254
|
+ handleSelectionChange(val) { // 选择
|
|
255
|
+ console.log(val)
|
|
256
|
+ this.ids = []
|
|
257
|
+
|
|
258
|
+ val.map((item, index) => {
|
|
259
|
+ console.log(item, index)
|
|
260
|
+ this.ids.push(item.id)
|
|
261
|
+ })
|
|
262
|
+ }
|
|
263
|
+ }
|
|
264
|
+}
|
|
265
|
+</script>
|
|
266
|
+
|
|
267
|
+<style scoped>
|
|
268
|
+.root{
|
|
269
|
+ display: flex;
|
|
270
|
+ flex-flow: column;
|
|
271
|
+}
|
|
272
|
+.form-listQuery{
|
|
273
|
+ margin-top: 20px;
|
|
274
|
+ margin-left: 30px;
|
|
275
|
+}
|
|
276
|
+.operation{
|
|
277
|
+ display: flex;
|
|
278
|
+ justify-content: space-between;
|
|
279
|
+ margin-left: 20px;
|
|
280
|
+ margin-right: 20px;
|
|
281
|
+}
|
|
282
|
+.block{
|
|
283
|
+ display: flex;
|
|
284
|
+ justify-content: flex-end;
|
|
285
|
+ margin-top: 10px;
|
|
286
|
+}
|
|
287
|
+</style>
|