diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index 5d00faf..9142ad4 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -137,7 +137,9 @@ this.initManholeData(wellList) app.globalData.addsuccessWellCode = '' this.setData({ - activeMarker: null + activeMarker: null, + activeMarkerId: null, + activeMarkerWellCode: null }) } } @@ -227,6 +229,11 @@ // }) // } Toast.fail('未查询到数据'); + that.setData({ + activeMarker: null, + activeMarkerId: null, + activeMarkerWellCode: null + }) } } wx.hideLoading() @@ -317,11 +324,6 @@ default: return '未知 '; } }, - // 按钮点击事件处理方法 - createDevice() { - console.log('气泡里面的按钮被点击'); - // 在这里可以添加按钮点击后的具体逻辑 - }, // 点击井打不开2 notopen() { var that = this @@ -697,6 +699,11 @@ // --------------------------------------------新建设备---------------------------------- createDevice() { console.log('当前选中的设备', this.data.activeMarker); + console.log('当前选中activeMarkerId的设备', this.data.activeMarkerId); + if(!this.data.activeMarker) { + Toast('请先选中一个井'); + return false + } wx.navigateTo({ url: `../addDevice/addDevice?fromPage=defineMap&latitude=${this.data.activeMarker.latitude}&longitude=${this.data.activeMarker.longitude}&position=${this.data.activeMarker.manholeInfo.position}&wellCode=${this.data.activeMarker.manholeInfo.wellCode}&wellType=${this.data.activeMarker.manholeInfo.wellType}` }) @@ -792,6 +799,11 @@ icon: 'none', duration: 3000 }) + that.setData({ + activeMarker: null, + activeMarkerId: null, + activeMarkerWellCode: null + }) } } else { that.fetchManhole() @@ -822,8 +834,10 @@ console.log('确认选择井类型', event); const { picker, value, index } = event.detail; that.onCloseTAMSelect() - console.log('ppppp'); - console.log(value); + if(!that.activeMarker) { + Toast('请先选中一个井') + return + } let sendIsInStallParam = '' const tempIndex = tamWellTypes.findIndex(item => item.label === value) if(tempIndex !== -1) { diff --git a/miniprogram/pages/defineMap/defineMap.js b/miniprogram/pages/defineMap/defineMap.js index 5d00faf..9142ad4 100644 --- a/miniprogram/pages/defineMap/defineMap.js +++ b/miniprogram/pages/defineMap/defineMap.js @@ -137,7 +137,9 @@ this.initManholeData(wellList) app.globalData.addsuccessWellCode = '' this.setData({ - activeMarker: null + activeMarker: null, + activeMarkerId: null, + activeMarkerWellCode: null }) } } @@ -227,6 +229,11 @@ // }) // } Toast.fail('未查询到数据'); + that.setData({ + activeMarker: null, + activeMarkerId: null, + activeMarkerWellCode: null + }) } } wx.hideLoading() @@ -317,11 +324,6 @@ default: return '未知 '; } }, - // 按钮点击事件处理方法 - createDevice() { - console.log('气泡里面的按钮被点击'); - // 在这里可以添加按钮点击后的具体逻辑 - }, // 点击井打不开2 notopen() { var that = this @@ -697,6 +699,11 @@ // --------------------------------------------新建设备---------------------------------- createDevice() { console.log('当前选中的设备', this.data.activeMarker); + console.log('当前选中activeMarkerId的设备', this.data.activeMarkerId); + if(!this.data.activeMarker) { + Toast('请先选中一个井'); + return false + } wx.navigateTo({ url: `../addDevice/addDevice?fromPage=defineMap&latitude=${this.data.activeMarker.latitude}&longitude=${this.data.activeMarker.longitude}&position=${this.data.activeMarker.manholeInfo.position}&wellCode=${this.data.activeMarker.manholeInfo.wellCode}&wellType=${this.data.activeMarker.manholeInfo.wellType}` }) @@ -792,6 +799,11 @@ icon: 'none', duration: 3000 }) + that.setData({ + activeMarker: null, + activeMarkerId: null, + activeMarkerWellCode: null + }) } } else { that.fetchManhole() @@ -822,8 +834,10 @@ console.log('确认选择井类型', event); const { picker, value, index } = event.detail; that.onCloseTAMSelect() - console.log('ppppp'); - console.log(value); + if(!that.activeMarker) { + Toast('请先选中一个井') + return + } let sendIsInStallParam = '' const tempIndex = tamWellTypes.findIndex(item => item.label === value) if(tempIndex !== -1) { diff --git a/miniprogram/pages/defineMap/defineMap.wxml b/miniprogram/pages/defineMap/defineMap.wxml index 57fc3ea..eb9525e 100644 --- a/miniprogram/pages/defineMap/defineMap.wxml +++ b/miniprogram/pages/defineMap/defineMap.wxml @@ -55,7 +55,7 @@ 井找不到 --> - -