|  |  |  | 
|---|
|  |  |  | openTimeText: "", | 
|---|
|  |  |  | openTime: "", | 
|---|
|  |  |  | irrigateProfile: [], //获取所选灌溉方式的详细数据 | 
|---|
|  |  |  | dialog_mode: true, | 
|---|
|  |  |  | dialog_time: false, | 
|---|
|  |  |  | dialog_water: false, | 
|---|
|  |  |  | group_time: false, //是否显示选择分钟或小时的单选框 | 
|---|
|  |  |  | openTime: "", //计划开泵的开始时间 | 
|---|
|  |  |  | openTimeText: "", | 
|---|
|  |  |  | isShowOpenTime: "false", | 
|---|
|  |  |  | isOpenTiming: false, //是否是计划开阀时间样式的开阀 | 
|---|
|  |  |  | postMinutes: 0, //定灌溉时长的时间 | 
|---|
|  |  |  | showForceConfirm: false, | 
|---|
|  |  |  | showErrorDialog: false, //错误提示 | 
|---|
|  |  |  | errorData: "", | 
|---|
|  |  |  | confirmBtn: { | 
|---|
|  |  |  | content: '确认' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | radioValue: "0", //开阀方式选中的类型 | 
|---|
|  |  |  | costiomTime: "", //自定义灌溉时间 | 
|---|
|  |  |  | waterAmount: 0, //定量开阀的水量 | 
|---|
|  |  |  | costiomWater: "", //输入的自定义水量 | 
|---|
|  |  |  | isWXRefreshing: false, | 
|---|
|  |  |  | irrigateProfile: [], //获取所选灌溉方式的详细数据 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 切换 Tabs | 
|---|
|  |  |  | 
|---|
|  |  |  | choseCard(event) { | 
|---|
|  |  |  | //显示二次确认弹窗 | 
|---|
|  |  |  | this.setData({ | 
|---|
|  |  |  | showConfirm: true, | 
|---|
|  |  |  | //   showConfirm: true, | 
|---|
|  |  |  | choseItem: event.currentTarget.dataset.item, | 
|---|
|  |  |  | allWaterPoints: [] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.initDialogData(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //  console.log(intakeId); | 
|---|
|  |  |  | //   wx.navigateTo({ | 
|---|
|  |  |  | //     url: '/pages/openCard/openCard?intakeId='+intakeId, | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | const app = getApp(); | 
|---|
|  |  |  | const data = { | 
|---|
|  |  |  | intakeId: intakeId, //取水口ID | 
|---|
|  |  |  | // vcId: vcId, //虚拟卡ID | 
|---|
|  |  |  | intakeId: this.data.choseItem.intakeId, //取水口ID | 
|---|
|  |  |  | //   vcId:  app.globalData.vcId, //虚拟卡ID | 
|---|
|  |  |  | operator: app.globalData.clientId, //操作员 | 
|---|
|  |  |  | forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值 | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | 
|---|
|  |  |  | this.getcommonWaterPoints(); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | confirmDialog() { | 
|---|
|  |  |  | // this.setData({ | 
|---|
|  |  |  | //   showConfirm: false | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | // this.postOpenValva(this.data.choseItem.intakeId); | 
|---|
|  |  |  | this.setData({ | 
|---|
|  |  |  | showConfirm: false | 
|---|
|  |  |  | showConfirm: false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.postOpenValva(this.data.choseItem.intakeId); | 
|---|
|  |  |  | this.initDialogData(); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | closeDialog() { | 
|---|
|  |  |  | this.setData({ | 
|---|
|  |  |  | 
|---|
|  |  |  | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | const data = { | 
|---|
|  |  |  | intakeId: this.data.intakeId, //取水口ID | 
|---|
|  |  |  | // vcId: this.data.vcId, //虚拟卡ID | 
|---|
|  |  |  | intakeId: this.data.choseItem.intakeId, //取水口ID | 
|---|
|  |  |  | //   vcId:  app.globalData.vcId, //虚拟卡ID | 
|---|
|  |  |  | minutes: this.data.postMinutes, //分钟 | 
|---|
|  |  |  | operator: app.globalData.clientId, //操作员 | 
|---|
|  |  |  | plannedOpenTime: this.data.openTime | 
|---|
|  |  |  | 
|---|
|  |  |  | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | const data = { | 
|---|
|  |  |  | intakeId: this.data.intakeId, //取水口ID | 
|---|
|  |  |  | // vcId: this.data.vcId, //虚拟卡ID | 
|---|
|  |  |  | intakeId: this.data.choseItem.intakeId, //取水口ID | 
|---|
|  |  |  | //   vcId:  app.globalData.vcId, //虚拟卡ID | 
|---|
|  |  |  | minutes: this.data.postMinutes, //分钟 | 
|---|
|  |  |  | operator: app.globalData.clientId //操作员 | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 通过小时转换成分钟 | 
|---|
|  |  |  | hourToMinutes(hours) { | 
|---|
|  |  |  | // 检查输入是否合法 | 
|---|
|  |  |  | if (isNaN(hours) || hours < 0) { | 
|---|
|  |  |  | console.error('请输入有效的小时数'); | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 将小时转换为分钟 | 
|---|
|  |  |  | const minutes = hours * 60; | 
|---|
|  |  |  | return minutes; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | minutesToHours(minutes) { | 
|---|
|  |  |  | // 检查输入是否合法 | 
|---|
|  |  |  | if (isNaN(minutes) || hours < 0) { | 
|---|
|  |  |  | console.error('请输入有效的小时数'); | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 将小时转换为分钟 | 
|---|
|  |  |  | const hours = minutes / 60; | 
|---|
|  |  |  | return hours; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 选择水量后的处理 | 
|---|
|  |  |  | handleWaterWrapperTap(e) { | 
|---|
|  |  |  | const index = e.currentTarget.dataset.index; | 
|---|
|  |  |  | console.log(index) | 
|---|
|  |  |  | if (index !== undefined) { | 
|---|
|  |  |  | this.data.waterAmount = parseInt(this.data.irrigateProfile[index].defaultValue) | 
|---|
|  |  |  | this.setData({ | 
|---|
|  |  |  | activeIndex: parseInt(index), | 
|---|
|  |  |  | costiomWater: "" | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }) | 
|---|