管灌系统农户端微信小程序(嘉峪关应用)
zuoxiao
2024-07-04 c6ad105d1b743bcfd8aa6ee2781d39039f319a87
pages/waterIntake/waterIntake.js
@@ -13,7 +13,12 @@
    isRefreshing_common: false,
    showConfirm: false,
    waterIntakeName: "",
    choseItem: null
    choseItem: null,
    errorData: '', //错误内容
    showErrorDialog: false,
    confirmBtn: {
      content: '确认'
    },
  },
  // 切换 Tabs
@@ -67,7 +72,8 @@
    };
    post({
      url: "wx/valve/open_wx",
      data: data
      data: data,
      timeout: 180000
    }).then(response => {
      // 处理成功响应
@@ -84,13 +90,12 @@
      wx.hideLoading();
      // 处理错误响应
      console.error('请求失败:', error);
      if (error.code === "1002") {
        wx.showToast({
          title: '开阀失败',
          icon: 'error',
          duration: 3000 // 提示的持续时间,单位毫秒
        })
      }
      this.setData({
        showErrorDialog: true,
        errorData: error.msg
      })
    });
  },
@@ -151,7 +156,7 @@
   */
  getallWaterPoints: function (intakeNum) {
    let params = {
      url: 'project/intake/all_intakes'
      url: 'wx/intake/all_intakes'
    };
    if (intakeNum) {
      params.data = {
@@ -178,13 +183,18 @@
        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
        }
@@ -209,7 +219,7 @@
          isRefreshing_common: false
        });
        wx.showToast({
          title: error.code,
          title: error.msg,
          icon: 'error',
          duration: 3000 // 提示的持续时间,单位毫秒
        })
@@ -227,7 +237,7 @@
  },
  confirmDialog() {
    this.setData({
      showConfirm:false
      showConfirm: false
    })
    this.postOpenValva(this.data.choseItem.intakeId);
  },
@@ -235,6 +245,10 @@
    this.setData({
      showConfirm: false
    })
  },
  closeErrorDialog() {
    this.setData({
      showErrorDialog: false
    })
  }
})