| | |
| | | openTime: "", //计划开泵的开始时间 |
| | | openTimeText: "", |
| | | isShowOpenTime: "false", |
| | | isOpenTiming: false, //是否是计划开阀时间样式的开阀 |
| | | postMinutes: 0, //定灌溉时长的时间 |
| | | showForceConfirm: false, |
| | | showErrorDialog: false, //错误提示 |
| | | errorData: "", |
| | |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | |
| | | forceIntakeId: intakeId, |
| | | showForceConfirm: true |
| | | }) |
| | | } else if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | // vcId: app.globalData.vcId, //虚拟卡ID |
| | | minutes: this.data.postMinutes, //分钟 |
| | | operator: app.globalData.clientId, //操作员 |
| | | plannedOpenTime: this.data.openTime |
| | | }; |
| | | post({ |
| | | url: "wx/valve/planed_open_timed_close", |
| | | data: data |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | //定时关阀式开阀 |
| | |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | // vcId: app.globalData.vcId, //虚拟卡ID |
| | | minutes: this.data.postMinutes, //分钟 |
| | | operator: app.globalData.clientId //操作员 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/timed_close", |
| | | data: data |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | // 通过小时转换成分钟 |
| | |
| | | isOpenTiming: false, |
| | | radioValue: "0" |
| | | }) |
| | | }, // 定量开泵按钮 |
| | | btnOpenOnWater() { |
| | | if (this.data.waterAmount > 0) { |
| | | if (this.data.isOpenTiming) { |
| | | this.quantifyOpenTime(); |
| | | } else { |
| | | this.quantifyOpen(); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | icon: 'error', |
| | | title: '请选择或输入灌溉时间!', |
| | | }) |
| | | } |
| | | },//定量开阀式计划开阀 |
| | | quantifyOpenTime() { |
| | | const app = getApp(); |
| | | wx.showLoading({ |
| | | title: '正在通信请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | waterAmount: this.data.waterAmount, //水量 |
| | | operator: app.globalData.clientId, //操作员 |
| | | plannedOpenTime: this.data.openTime |
| | | }; |
| | | post({ |
| | | url: "wx/valve/planed_open_quantify_close", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=2' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | },//定量开阀 |
| | | quantifyOpen() { |
| | | const app = getApp(); |
| | | wx.showLoading({ |
| | | title: '正在开阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | waterAmount: this.data.waterAmount, //水量 |
| | | operator: app.globalData.clientId //操作员 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/quantify_close", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=1' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | }) |