|  |  | 
 |  |  |     data, | 
 |  |  |     ignoreToken, | 
 |  |  |     form, | 
 |  |  |     isShowLoding | 
 |  |  |     isShowLoding, | 
 |  |  |     timeout, | 
 |  |  |     header | 
 |  |  |   } = _options | 
 |  |  |   const app = getApp() | 
 |  |  |   // 设置请求头 | 
 |  |  |   let header = {} | 
 |  |  |   if (form) { | 
 |  |  |     header = { | 
 |  |  |       'content-type': 'application/x-www-form-urlencoded' | 
 |  |  | 
 |  |  |       'content-type': 'application/json' //自定义请求头信息 | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  |   if (!timeout) { | 
 |  |  |     timeout = 60000 | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   if (!ignoreToken) { | 
 |  |  |     // 从全局变量中获取token | 
 |  |  |     let token = app.globalData.token | 
 |  |  |     header.Authorization = `Bearer ${token}` | 
 |  |  |   } | 
 |  |  |   header.tag = app.globalData.tag; | 
 |  |  |   return new Promise((resolve, reject) => { | 
 |  |  |     console.log("url:" + BASEURL + url); | 
 |  |  |     if (isShowLoding) { | 
 |  |  | 
 |  |  |       data, | 
 |  |  |       header, | 
 |  |  |       method, | 
 |  |  |       timeout: timeout, | 
 |  |  |       success: (res) => { | 
 |  |  |         let { | 
 |  |  |           statusCode: code | 
 |  |  | 
 |  |  |         if (isShowLoding) { | 
 |  |  |           wx.hideLoading(); // 隐藏加载动画 | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // showToast(err.errMsg) | 
 |  |  |         reject(err) | 
 |  |  |       } | 
 
 |  |  | 
 |  |  |   }, | 
 |  |  |   globalData: { | 
 |  |  |     sessionId:'2024052821300200006', | 
 |  |  |     tag:'ym', | 
 |  |  |     userInfo: null, | 
 |  |  |     userId:"", | 
 |  |  |     userCode:"", | 
 
 |  |  | 
 |  |  |   "componentFramework": "glass-easel", | 
 |  |  |   "sitemapLocation": "sitemap.json", | 
 |  |  |   "lazyCodeLoading": "requiredComponents" | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     scrollViewHeight: 0, | 
 |  |  |     listData: [], | 
 |  |  |     isRefreshing: false, | 
 |  |  |     isWXRefreshing: false | 
 |  |  |     isWXRefreshing: false, | 
 |  |  |     errorData: '', //错误内容 | 
 |  |  |     showErrorDialog: false, | 
 |  |  |     confirmBtn: { | 
 |  |  |       content: '确认' | 
 |  |  |     }, | 
 |  |  |   }, | 
 |  |  |  | 
 |  |  |   openValve: function (e) { | 
 |  |  | 
 |  |  |     post({ | 
 |  |  |       url: "wx/valve/close_wx", | 
 |  |  |       data: data, | 
 |  |  |       isShowLoding: false | 
 |  |  |       isShowLoding: false, | 
 |  |  |       timeout: 185000 | 
 |  |  |     }).then(response => { | 
 |  |  |  | 
 |  |  |       // 处理成功响应 | 
 |  |  | 
 |  |  |       }) | 
 |  |  |     }).catch(error => { | 
 |  |  |       wx.hideLoading(); | 
 |  |  |       if (error.code === "1002") { | 
 |  |  |         wx.showToast({ | 
 |  |  |           title: '关阀失败', | 
 |  |  |           icon: 'error', | 
 |  |  |           duration: 3000 // 提示的持续时间,单位毫秒 | 
 |  |  |         }) | 
 |  |  |       } | 
 |  |  |       this.setData({ | 
 |  |  |         showErrorDialog: true, | 
 |  |  |         errorData: error.msg | 
 |  |  |       }) | 
 |  |  |       // 处理错误响应 | 
 |  |  |       console.error('请求失败:', error); | 
 |  |  |  | 
 |  |  | 
 |  |  |       // 错误回调 | 
 |  |  |       this.setData({ | 
 |  |  |         isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 | 
 |  |  |         isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 | 
 |  |  |       }) | 
 |  |  |       wx.showToast({ | 
 |  |  |         title: err.msg, | 
 |  |  |         icon: 'error', | 
 |  |  |         duration: 3000 | 
 |  |  |       }) | 
 |  |  |     }); | 
 |  |  |   }, | 
 |  |  | 
 |  |  |   getUserDataBySession() { | 
 |  |  |     const app = getApp(); | 
 |  |  |     const params = { | 
 |  |  |       url: 'sell/client/simple_info', | 
 |  |  |       url: 'wx/client/simple_info', | 
 |  |  |       data: { | 
 |  |  |         sessionId: app.globalData.sessionId | 
 |  |  |       } | 
 |  |  | 
 |  |  |       }) | 
 |  |  |     }).catch(err => { | 
 |  |  |       // 错误回调 | 
 |  |  |  | 
 |  |  |       wx.showToast({ | 
 |  |  |         title: err.msg, | 
 |  |  |         icon: 'error', | 
 |  |  |         duration: 3000 | 
 |  |  |       }) | 
 |  |  |     }) | 
 |  |  |   }, | 
 |  |  |   maskPhoneNumber(phoneNumber) { | 
 |  |  | 
 |  |  |     // 使用正则表达式替换中间四位数字为星号 | 
 |  |  |     const maskedPhoneNumber = phoneNumber.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"); | 
 |  |  |     return maskedPhoneNumber; | 
 |  |  |   }, | 
 |  |  |   closeDialog() { | 
 |  |  |     this.setData({ | 
 |  |  |       showErrorDialog:false | 
 |  |  |     }) | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  |       <text class="noMore-text">没有开泵记录</text> | 
 |  |  |     </view> | 
 |  |  |   </scroll-view> | 
 |  |  |   <t-dialog class="t-dialog" visible="{{showConfirm}}" content="确认关闭{{waterIntakeName}}吗?" confirm-btn="{{ { content: '确认', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="取消"  bind:confirm="confirmDialog" bind:cancel="closeDialog" /> | 
 |  |  |  | 
 |  |  |   <t-dialog class="dialog" visible="{{showConfirm}}" content="确认关闭{{waterIntakeName}}吗?" confirm-btn="{{ { content: '确认', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="取消"  bind:confirm="confirmDialog" bind:cancel="closeDialog" /> | 
 |  |  |   <t-dialog class="error-dialog"  title="关阀错误" visible="{{showErrorDialog}}" content="{{errorData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="closeDialog" /> | 
 |  |  | </view> | 
 
 |  |  | 
 |  |  |   margin-left: 20rpx; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | .t-dialog { | 
 |  |  | .dialog { | 
 |  |  |   --td-dialog-content-font-size: 40rpx; | 
 |  |  |   --td-dialog-content-line-height: 50rpx | 
 |  |  | } | 
 |  |  | 
 |  |  |   width: 100%; | 
 |  |  |   margin-top: 2rpx; | 
 |  |  |   /* background-color: #e0e0e0; */ | 
 |  |  | } | 
 |  |  |  | 
 |  |  | .error-dialog{ | 
 |  |  |   --td-dialog-title-color:red; | 
 |  |  |   --td-dialog-title-font-size:40rpx; | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     isRefreshing_common: false, | 
 |  |  |     showConfirm: false, | 
 |  |  |     waterIntakeName: "", | 
 |  |  |     choseItem: null | 
 |  |  |     choseItem: null, | 
 |  |  |     errorData: '', //错误内容 | 
 |  |  |     showErrorDialog: false, | 
 |  |  |     confirmBtn: { | 
 |  |  |       content: '确认' | 
 |  |  |     }, | 
 |  |  |   }, | 
 |  |  |  | 
 |  |  |   // 切换 Tabs | 
 |  |  | 
 |  |  |     }; | 
 |  |  |     post({ | 
 |  |  |       url: "wx/valve/open_wx", | 
 |  |  |       data: data | 
 |  |  |       data: data, | 
 |  |  |       timeout: 180000 | 
 |  |  |     }).then(response => { | 
 |  |  |  | 
 |  |  |       // 处理成功响应 | 
 |  |  | 
 |  |  |       wx.hideLoading(); | 
 |  |  |       // 处理错误响应 | 
 |  |  |       console.error('请求失败:', error); | 
 |  |  |       if (error.code === "1002") { | 
 |  |  |         wx.showToast({ | 
 |  |  |           title: '开阀失败', | 
 |  |  |           icon: 'error', | 
 |  |  |           duration: 3000 // 提示的持续时间,单位毫秒 | 
 |  |  |         }) | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       this.setData({ | 
 |  |  |         showErrorDialog: true, | 
 |  |  |         errorData: error.msg | 
 |  |  |       }) | 
 |  |  |  | 
 |  |  |     }); | 
 |  |  |   }, | 
 |  |  |  | 
 |  |  | 
 |  |  |    */ | 
 |  |  |   getallWaterPoints: function (intakeNum) { | 
 |  |  |     let params = { | 
 |  |  |       url: 'project/intake/all_intakes' | 
 |  |  |       url: 'wx/intake/all_intakes' | 
 |  |  |     }; | 
 |  |  |     if (intakeNum) { | 
 |  |  |       params.data = { | 
 |  |  | 
 |  |  |         this.setData({ | 
 |  |  |           isRefreshing_all: false | 
 |  |  |         }); | 
 |  |  |         wx.showToast({ | 
 |  |  |           title: error.msg, | 
 |  |  |           icon: 'error', | 
 |  |  |           duration: 3000 // 提示的持续时间,单位毫秒 | 
 |  |  |         }) | 
 |  |  |         console.error('Failed to add item:', error); | 
 |  |  |       }); | 
 |  |  |   }, | 
 |  |  |   //获取常用取水口 | 
 |  |  |   getcommonWaterPoints() { | 
 |  |  |     get({ | 
 |  |  |         url: 'project/intake/used_intakes', | 
 |  |  |         url: 'wx/intake/used_intakes', | 
 |  |  |         data: { | 
 |  |  |           operator: getApp().globalData.sessionId | 
 |  |  |         } | 
 |  |  | 
 |  |  |           isRefreshing_common: false | 
 |  |  |         }); | 
 |  |  |         wx.showToast({ | 
 |  |  |           title: error.code, | 
 |  |  |           title: error.msg, | 
 |  |  |           icon: 'error', | 
 |  |  |           duration: 3000 // 提示的持续时间,单位毫秒 | 
 |  |  |         }) | 
 |  |  | 
 |  |  |   }, | 
 |  |  |   confirmDialog() { | 
 |  |  |     this.setData({ | 
 |  |  |       showConfirm:false | 
 |  |  |       showConfirm: false | 
 |  |  |     }) | 
 |  |  |     this.postOpenValva(this.data.choseItem.intakeId); | 
 |  |  |   }, | 
 |  |  | 
 |  |  |     this.setData({ | 
 |  |  |       showConfirm: false | 
 |  |  |     }) | 
 |  |  |   }, | 
 |  |  |   closeErrorDialog() { | 
 |  |  |     this.setData({ | 
 |  |  |       showErrorDialog: false | 
 |  |  |     }) | 
 |  |  |   } | 
 |  |  |  | 
 |  |  | }) | 
 
 |  |  | 
 |  |  |     </scroll-view> | 
 |  |  |   </view> | 
 |  |  |  | 
 |  |  |   <t-dialog class="t-dialog" visible="{{showConfirm}}" content="确认打开{{choseItem.intakeNum}}吗?" confirm-btn="{{ { content: '确认', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="取消"  bind:confirm="confirmDialog" bind:cancel="closeDialog" /> | 
 |  |  |   <t-dialog class="dialog" visible="{{showConfirm}}" content="确认打开{{choseItem.intakeNum}}吗?" confirm-btn="{{ { content: '确认', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="取消"  bind:confirm="confirmDialog" bind:cancel="closeDialog" /> | 
 |  |  |  | 
 |  |  |   <t-dialog class="error-dialog"  title="开阀错误" visible="{{showErrorDialog}}" content="{{errorData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="closeErrorDialog" /> | 
 |  |  | </view> | 
 
 |  |  | 
 |  |  |   flex-direction: column; | 
 |  |  |   padding-bottom: 10rpx; /* 增加底部填充 */ | 
 |  |  | } | 
 |  |  | .t-dialog{ | 
 |  |  | .dialog{ | 
 |  |  |   --td-dialog-content-font-size:40rpx; | 
 |  |  |   --td-dialog-content-line-height:50rpx | 
 |  |  | } | 
 |  |  |  | 
 |  |  | .error-dialog{ | 
 |  |  |   --td-dialog-title-color:red; | 
 |  |  |   --td-dialog-title-font-size:45rpx; | 
 |  |  | } |