| | |
| | | searchQuery: "", |
| | | commonWaterPoints: [], // 常用取水口数据 |
| | | allWaterPoints: [], // 所有取水口数据 |
| | | searchData: [{ |
| | | intakeNum: "1111111" |
| | | }, { |
| | | intakeNum: "2222222" |
| | | }], |
| | | isRefreshing_all: false, |
| | | isRefreshing_common: false, |
| | | showConfirm: false, |
| | |
| | | confirmBtn: { |
| | | content: '确认' |
| | | }, |
| | | showForceConfirm: false, |
| | | forceIntakeId: "", //强制开阀的取水口id |
| | | inputValue:"" |
| | | }, |
| | | |
| | | // 切换 Tabs |
| | |
| | | this.getallWaterPoints(query) |
| | | // 在这里进行搜索操作,更新 allWaterPoints 数据 |
| | | } else { |
| | | this.getallWaterPoints(query) |
| | | this.setData({ |
| | | allWaterPoints: [] |
| | | }) |
| | | } |
| | | }, |
| | | |
| | |
| | | * @param {} event |
| | | */ |
| | | choseCard(event) { |
| | | //显示二次确认弹窗 |
| | | this.setData({ |
| | | showConfirm: true, |
| | | choseItem: event.currentTarget.dataset.item |
| | | choseItem: event.currentTarget.dataset.item, |
| | | allWaterPoints: [] |
| | | }) |
| | | // console.log(intakeId); |
| | | // wx.navigateTo({ |
| | |
| | | |
| | | }, |
| | | //开泵通信 |
| | | postOpenValva(intakeId) { |
| | | /** |
| | | * |
| | | * @param {*} intakeId 取水口id |
| | | * @param {*} isforce 是否强制开阀 |
| | | */ |
| | | postOpenValva(intakeId, isforce) { |
| | | this.setData({ |
| | | inputValue:"" |
| | | }) |
| | | console.log("intakeId:" + intakeId + " isforce:" + isforce) |
| | | wx.showLoading({ |
| | | title: '正在开阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | |
| | | const data = { |
| | | intakeId: intakeId, //取水口ID |
| | | // vcId: vcId, //虚拟卡ID |
| | | operator: app.globalData.sessionId //操作员 |
| | | operator: app.globalData.sessionId, //操作员 |
| | | forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/open_wx", |
| | |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | |
| | | if (error.code === "10005") { |
| | | this.setData({ |
| | | forceIntakeId: intakeId, |
| | | showForceConfirm: true |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | }) |
| | | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | this.getallWaterPoints(); |
| | | this.getcommonWaterPoints(); |
| | | }, |
| | | |
| | |
| | | |
| | | }, |
| | | /** |
| | | * 获取所有取水口 |
| | | *在所有取水口搜索 |
| | | */ |
| | | getallWaterPoints: function (intakeNum) { |
| | | let params = { |
| | |
| | | isRefreshing_all: false |
| | | }); |
| | | if (data.success && data.code === "0001") { |
| | | if (!data.content) { |
| | | wx.showToast({ |
| | | title: '没有搜索到取水口', |
| | | icon: 'error', |
| | | }) |
| | | }else{ |
| | | this.setData({ |
| | | allWaterPoints: data.content.obj |
| | | allWaterPoints:[data.content] |
| | | }); |
| | | } |
| | | |
| | | } else { |
| | | wx.showToast({ |
| | | title: data.msg, |
| | |
| | | this.setData({ |
| | | showErrorDialog: false |
| | | }) |
| | | }, |
| | | cancelDialog() { |
| | | this.setData({ |
| | | showForceConfirm: false |
| | | }); |
| | | }, |
| | | //强制开阀 |
| | | confirmForceDialog() { |
| | | this.postOpenValva(this.data.forceIntakeId, true); |
| | | }, |
| | | closeSearch(){ |
| | | this.setData({ |
| | | allWaterPoints:[], |
| | | inputValue:"" |
| | | }) |
| | | } |
| | | }) |