48ea9c43
wuxw
巡检开发完成
|
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
|
{{ $t('common.save') }}
</el-button>
</div>
</el-dialog>
</template>
<script>
import { getCommunityId } from '@/api/community/communityApi'
import { updateInspectionRoute } from '@/api/inspection/inspectionRouteApi'
export default {
name: 'EditInspectionRoute',
data() {
return {
visible: false,
editInspectionRouteInfo: {
inspectionRouteId: '',
routeName: '',
seq: 1,
remark: ''
},
communityId: '',
rules: {
routeName: [
{ required: true, message: this.$t('inspectionRoute.routeNameRequired'), trigger: 'blur' },
{ max: 100, message: this.$t('inspectionRoute.routeNameMaxLength'), trigger: 'blur' }
],
seq: [
{ required: true, message: this.$t('inspectionRoute.sequenceRequired'), trigger: 'blur' },
|
48ea9c43
wuxw
巡检开发完成
|
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
|
],
remark: [
{ max: 200, message: this.$t('inspectionRoute.remarkMaxLength'), trigger: 'blur' }
],
inspectionRouteId: [
{ required: true, message: this.$t('inspectionRoute.routeIdRequired'), trigger: 'blur' }
]
}
}
},
created() {
this.communityId = getCommunityId()
},
methods: {
open(route) {
this.visible = true
this.editInspectionRouteInfo = { ...route }
this.editInspectionRouteInfo.communityId = this.communityId
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
},
async editInspectionRoute() {
try {
await this.$refs.form.validate()
|
48ea9c43
wuxw
巡检开发完成
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
await updateInspectionRoute(this.editInspectionRouteInfo)
this.$message.success(this.$t('inspectionRoute.editSuccess'))
this.$emit('success')
this.handleClose()
} catch (error) {
if (error !== 'validate') {
console.error('修改巡检路线失败:', error)
this.$message.error(this.$t('inspectionRoute.editFailed'))
}
}
},
handleClose() {
this.visible = false
this.editInspectionRouteInfo = {
inspectionRouteId: '',
routeName: '',
seq: 1,
remark: ''
}
this.$refs.form.clearValidate()
}
}
}
</script>
|