File tree Expand file tree Collapse file tree 4 files changed +73
-5
lines changed
CrazyCarBackground/src/views Expand file tree Collapse file tree 4 files changed +73
-5
lines changed Original file line number Diff line number Diff line change 17
17
</el-table-column >
18
18
<el-table-column label =" Status" width =" 110px" align =" center" >
19
19
<template v-slot =" {row } " >
20
- <span >{{ row.is_on }}</span >
20
+ <el-switch
21
+ v-model =" row.is_on"
22
+ @change =" handleIsOnChange(row)"
23
+ />
21
24
</template >
22
25
</el-table-column >
23
26
<el-table-column label =" Url" min-width =" 150px" >
@@ -166,6 +169,20 @@ export default {
166
169
this .$refs [' dataForm' ].clearValidate ()
167
170
})
168
171
},
172
+ handleIsOnChange (row ) {
173
+ const tempData = Object .assign ({}, row)
174
+ tempData .timestamp = + new Date (tempData .timestamp )
175
+ updateAssetsInfo (tempData).then (response => {
176
+ const index = this .list .findIndex (v => v .id === response .id )
177
+ this .list .splice (index, 1 , response)
178
+ this .$notify ({
179
+ title: ' Success' ,
180
+ message: ' Update Successfully' ,
181
+ type: ' success' ,
182
+ duration: 2000
183
+ })
184
+ })
185
+ },
169
186
updateData () {
170
187
this .$refs [' dataForm' ].validate ((valid ) => {
171
188
if (valid) {
Original file line number Diff line number Diff line change 47
47
</el-table-column >
48
48
<el-table-column label =" Wade" min-width =" 150px" >
49
49
<template v-slot =" {row } " >
50
- <span >{{ row.can_wade }}</span >
50
+ <el-switch
51
+ v-model =" row.can_wade"
52
+ @change =" handleSwitchChange(row)"
53
+ />
51
54
</template >
52
55
</el-table-column >
53
56
<el-table-column label =" Show" min-width =" 150px" >
54
57
<template v-slot =" {row } " >
55
- <span >{{ row.is_show }}</span >
58
+ <el-switch
59
+ v-model =" row.is_show"
60
+ @change =" handleSwitchChange(row)"
61
+ />
56
62
</template >
57
63
</el-table-column >
58
64
<el-table-column label =" Actions" align =" center" width =" 230" class-name =" small-padding fixed-width" >
@@ -217,6 +223,19 @@ export default {
217
223
this .$refs [' dataForm' ].clearValidate ()
218
224
})
219
225
},
226
+ handleSwitchChange (row ) {
227
+ const tempData = Object .assign ({}, row)
228
+ updtaeEquipInfo (tempData).then (response => {
229
+ const index = this .list .findIndex (v => v .eid === response .eid )
230
+ this .list .splice (index, 1 , response)
231
+ this .$notify ({
232
+ title: ' Success' ,
233
+ message: ' Update Successfully' ,
234
+ type: ' success' ,
235
+ duration: 2000
236
+ })
237
+ })
238
+ },
220
239
updateData () {
221
240
this .$refs [' dataForm' ].validate ((valid ) => {
222
241
if (valid) {
Original file line number Diff line number Diff line change 42
42
</el-table-column >
43
43
<el-table-column label =" Water" min-width =" 150px" >
44
44
<template v-slot =" {row } " >
45
- <span >{{ row.has_water }}</span >
45
+ <el-switch
46
+ v-model =" row.has_water"
47
+ @change =" handleHasWaterChange(row)"
48
+ />
46
49
</template >
47
50
</el-table-column >
48
51
<el-table-column label =" Actions" align =" center" width =" 230" class-name =" small-padding fixed-width" >
@@ -196,6 +199,19 @@ export default {
196
199
this .$refs [' dataForm' ].clearValidate ()
197
200
})
198
201
},
202
+ handleHasWaterChange (row ) {
203
+ const tempData = Object .assign ({}, row)
204
+ updtaeMatchInfo (tempData).then (response => {
205
+ const index = this .list .findIndex (v => v .cid === response .cid )
206
+ this .list .splice (index, 1 , response)
207
+ this .$notify ({
208
+ title: ' Success' ,
209
+ message: ' Update Successfully' ,
210
+ type: ' success' ,
211
+ duration: 2000
212
+ })
213
+ })
214
+ },
199
215
updateData () {
200
216
this .$refs [' dataForm' ].validate ((valid ) => {
201
217
if (valid) {
Original file line number Diff line number Diff line change 42
42
</el-table-column >
43
43
<el-table-column label =" Water" min-width =" 150px" >
44
44
<template v-slot =" {row } " >
45
- <span >{{ row.has_water }}</span >
45
+ <el-switch
46
+ v-model =" row.has_water"
47
+ @change =" handleHasWaterChange(row)"
48
+ />
46
49
</template >
47
50
</el-table-column >
48
51
<el-table-column label =" Actions" align =" center" width =" 230" class-name =" small-padding fixed-width" >
@@ -196,6 +199,19 @@ export default {
196
199
this .$refs [' dataForm' ].clearValidate ()
197
200
})
198
201
},
202
+ handleHasWaterChange (row ) {
203
+ const tempData = Object .assign ({}, row)
204
+ updtaeTimeTrialInfo (tempData).then (response => {
205
+ const index = this .list .findIndex (v => v .cid === response .cid )
206
+ this .list .splice (index, 1 , response)
207
+ this .$notify ({
208
+ title: ' Success' ,
209
+ message: ' Update Successfully' ,
210
+ type: ' success' ,
211
+ duration: 2000
212
+ })
213
+ })
214
+ },
199
215
updateData () {
200
216
this .$refs [' dataForm' ].validate ((valid ) => {
201
217
if (valid) {
You can’t perform that action at this time.
0 commit comments