|
@@ -150,15 +150,22 @@ export default {
|
|
|
toXc(item) {
|
|
toXc(item) {
|
|
|
this.currentTime = moment().format('YYYY-MM-DD HH:mm:ss')
|
|
this.currentTime = moment().format('YYYY-MM-DD HH:mm:ss')
|
|
|
this.xcId = item.id
|
|
this.xcId = item.id
|
|
|
- this.inspectionPoint = item.inspectionPoints
|
|
|
|
|
|
|
+ if (typeof item.inspectionPoint === 'string') {
|
|
|
|
|
+ this.inspectionPoint = JSON.parse(item.inspectionPoint)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果已经是对象数组,则直接赋值
|
|
|
|
|
+ this.inspectionPoint = item.inspectionPoint
|
|
|
|
|
+ }
|
|
|
this.taskInfo = JSON.parse(JSON.stringify(item))
|
|
this.taskInfo = JSON.parse(JSON.stringify(item))
|
|
|
this.isPatrolling = true
|
|
this.isPatrolling = true
|
|
|
this.currentPatrolIndex = 0
|
|
this.currentPatrolIndex = 0
|
|
|
this.goToNextPatrolPoint()
|
|
this.goToNextPatrolPoint()
|
|
|
// 设置定时器,每20秒切换到下一个点
|
|
// 设置定时器,每20秒切换到下一个点
|
|
|
- this.patrolInterval = setInterval(() => {
|
|
|
|
|
- this.goToNextPatrolPoint()
|
|
|
|
|
- }, 20000)
|
|
|
|
|
|
|
+ if (this.inspectionPoint) {
|
|
|
|
|
+ this.patrolInterval = setInterval(() => {
|
|
|
|
|
+ this.goToNextPatrolPoint()
|
|
|
|
|
+ }, 20000)
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
// 切换到下一个巡查点
|
|
// 切换到下一个巡查点
|
|
|
goToNextPatrolPoint() {
|
|
goToNextPatrolPoint() {
|