From 59a29506851e9184a4275d5ab9bbca843918b49e Mon Sep 17 00:00:00 2001
From: zuoxiao <zuoxiao>
Date: 星期二, 13 五月 2025 17:26:16 +0800
Subject: [PATCH] 更新项目配置,添加梅江项目的相关信息,调整URL格式以提升代码一致性和可读性。
---
pages/waterIntake/waterIntake.js | 675 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 635 insertions(+), 40 deletions(-)
diff --git a/pages/waterIntake/waterIntake.js b/pages/waterIntake/waterIntake.js
index 869e711..73369f1 100644
--- a/pages/waterIntake/waterIntake.js
+++ b/pages/waterIntake/waterIntake.js
@@ -6,9 +6,61 @@
Page({
data: {
currentTab: 0, // 褰撳墠鏄剧ず鐨勮〃鏍硷紝榛樿涓虹涓�涓〃鏍�
- searchQuery:"",
+ searchQuery: "",
commonWaterPoints: [], // 甯哥敤鍙栨按鍙f暟鎹�
allWaterPoints: [], // 鎵�鏈夊彇姘村彛鏁版嵁
+ searchData: [{
+ intakeNum: "1111111"
+ }, {
+ intakeNum: "2222222"
+ }],
+ isRefreshing_all: false,
+ isRefreshing_common: false,
+ showConfirm: false,
+ waterIntakeName: "",
+ choseItem: null,
+ errorData: '', //閿欒鍐呭
+ showErrorDialog: false,
+ confirmBtn: {
+ content: '纭'
+ },
+ showForceConfirm: false,
+ forceIntakeId: "", //寮哄埗寮�闃�鐨勫彇姘村彛id
+ inputValue: "",
+ //浠ヤ笅涓哄紑闃�寮圭獥鐩稿叧
+ isShowOpenTime: "false",
+ isOpenTiming: false, //鏄惁鏄鍒掑紑闃�鏃堕棿鏍峰紡鐨勫紑闃�
+ postMinutes: 0, //瀹氱亴婧夋椂闀跨殑鏃堕棿
+ showForceConfirm: false,
+ showErrorDialog: false, //閿欒鎻愮ず
+ showDialog: false,
+ dialog_mode: false,
+ dialog_time: false,
+ dialog_water: false,
+ openTimeText: "",
+ openTime: "",
+ irrigateProfile: [], //鑾峰彇鎵�閫夌亴婧夋柟寮忕殑璇︾粏鏁版嵁
+ dialog_mode: true,
+ dialog_time: false,
+ dialog_water: false,
+ group_time: false, //鏄惁鏄剧ず閫夋嫨鍒嗛挓鎴栧皬鏃剁殑鍗曢�夋
+ openTime: "", //璁″垝寮�娉电殑寮�濮嬫椂闂�
+ openTimeText: "",
+ isShowOpenTime: "false",
+ showForceConfirm: false,
+ showErrorDialog: false, //閿欒鎻愮ず
+ errorData: "",
+ confirmBtn: {
+ content: '纭'
+ },
+ radioValue: "0", //寮�闃�鏂瑰紡閫変腑鐨勭被鍨�
+ costiomTime: "", //鑷畾涔夌亴婧夋椂闂�
+ waterAmount: 0, //瀹氶噺寮�闃�鐨勬按閲�
+ costiomWater: "", //杈撳叆鐨勮嚜瀹氫箟姘撮噺
+ isWXRefreshing: false,
+ irrigateProfile: [], //鑾峰彇鎵�閫夌亴婧夋柟寮忕殑璇︾粏鏁版嵁
+ datetimeVisible: false,
+
},
// 鍒囨崲 Tabs
@@ -18,7 +70,7 @@
currentTab: tab
});
},
- onInput(e){
+ onInput(e) {
this.setData({
searchQuery: e.detail.value // 灏嗚緭鍏ユ鐨勫�煎瓨鍌ㄥ埌 inputValue
});
@@ -26,10 +78,12 @@
onSearch: function () {
const query = this.data.searchQuery;
if (query) {
- this.getallWaterPoints(query)
+ this.getallWaterPoints(query)
// 鍦ㄨ繖閲岃繘琛屾悳绱㈡搷浣滐紝鏇存柊 allWaterPoints 鏁版嵁
} else {
- this.getallWaterPoints(query)
+ this.setData({
+ allWaterPoints: []
+ })
}
},
@@ -38,13 +92,75 @@
* @param {} event
*/
choseCard(event) {
- const intakeId= event.currentTarget.dataset.item.intakeId;
- console.log(intakeId);
- wx.navigateTo({
- url: '/pages/openCard/openCard?intakeId='+intakeId,
+ //鏄剧ず浜屾纭寮圭獥
+ this.setData({
+ showConfirm: true,
+ choseItem: event.currentTarget.dataset.item,
+ allWaterPoints: []
})
+ // 娉ㄦ剰锛歩nitDialogData鐨勮皟鐢ㄧЩ鍒颁簡confirmDialog鏂规硶涓�
},
-
+ //寮�娉甸�氫俊
+ /**
+ *
+ * @param {*} intakeId 鍙栨按鍙d
+ * @param {*} isforce 鏄惁寮哄埗寮�闃�
+ */
+ postOpenValva(intakeId, isforce) {
+ this.setData({
+ inputValue: ""
+ })
+ console.log("intakeId:" + intakeId + " isforce:" + isforce)
+ wx.showLoading({
+ title: '姝e湪寮�闃�璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const app = getApp();
+ const data = {
+ intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
+ // vcId: app.globalData.vcId, //铏氭嫙鍗D
+ operator: app.globalData.clientId, //鎿嶄綔鍛�
+ forceOpen: !!isforce // 浣跨敤閫昏緫闈炴搷浣滅 !! 鏉ョ‘淇� isForce 鏄竷灏斿��
+ };
+ post({
+ url: "wx/valve/open_wx",
+ data: data,
+ timeout: 180000
+ }).then(response => {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log('璇锋眰鎴愬姛:', response);
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ //瀹屾垚鍚庡洖鍒伴椤�
+ wx.reLaunch({
+ url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+ });
+ }).catch(error => {
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ // 澶勭悊閿欒鍝嶅簲
+ console.error('璇锋眰澶辫触:', error);
+ if (error.code === "10005") {
+ this.setData({
+ 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,
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ }
+ });
+ },
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -57,7 +173,6 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
*/
onReady() {
- this.getallWaterPoints();
this.getcommonWaterPoints();
},
@@ -82,12 +197,8 @@
},
- /**
- * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
- */
- onPullDownRefresh() {
- },
+
/**
* 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
@@ -101,24 +212,180 @@
*/
onShareAppMessage() {
- }
- ,
+ },
/**
- * 鑾峰彇鎵�鏈夊彇姘村彛
+ *鍦ㄦ墍鏈夊彇姘村彛鎼滅储
*/
getallWaterPoints: function (intakeNum) {
- let params = { url: 'rtu/get_online_intakes' };
+ let params = {
+ url: 'wx/intake/all_intakes'
+ };
if (intakeNum) {
- params.data = { intakeNum: intakeNum };
+ params.data = {
+ intakeNum: intakeNum
+ };
}
-
get(params)
.then((data) => {
- if(data.success&&data.code==="0001"){
+ this.setData({
+ isRefreshing_all: false
+ });
+ if (data.success && data.code === "0001") {
+ if (!data.content || data.content.itemTotal === 0 || !data.content.obj || data.content.obj.length === 0) {
+ wx.showToast({
+ title: '娌℃湁鎼滅储鍒板彇姘村彛',
+ icon: 'error',
+ })
+ } else {
+ this.setData({
+ allWaterPoints: data.content.obj
+ });
+ }
+
+ } else {
+ wx.showToast({
+ title: data.msg,
+ })
+ }
+ console.log('Failed to add item:');
+ })
+ .catch((error) => {
+ this.setData({
+ isRefreshing_all: false
+ });
+ wx.showToast({
+ title: error.msg,
+ icon: 'error',
+ duration: 3000 // 鎻愮ず鐨勬寔缁椂闂达紝鍗曚綅姣
+ })
+ console.error('Failed to add item:', error);
+ });
+ },
+ //鑾峰彇甯哥敤鍙栨按鍙�
+ getcommonWaterPoints() {
+ get({
+ url: 'wx/intake/used_intakes',
+ data: {
+ operatorId: getApp().globalData.clientId
+ }
+ })
+ .then((data) => {
+ this.setData({
+ isRefreshing_common: false
+ });
+ if (data.success && data.code === "0001") {
this.setData({
- allWaterPoints: data.content.obj
+ commonWaterPoints: data.content
});
- }else{
+ } else {
+ wx.showToast({
+ title: data.msg,
+ })
+ }
+ console.log('Failed to add item:');
+ })
+ .catch((error) => {
+ this.setData({
+ isRefreshing_common: false
+ });
+ wx.showToast({
+ title: error.msg,
+ icon: 'error',
+ duration: 3000 // 鎻愮ず鐨勬寔缁椂闂达紝鍗曚綅姣
+ })
+ console.error('Failed to add item:', error);
+ });
+ },
+ /**
+ * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
+ */
+ onPullDownRefresh_all() {
+ this.getallWaterPoints();
+ },
+ onPullDownRefresh_common() {
+ this.getcommonWaterPoints();
+ },
+ confirmDialog() {
+ this.setData({
+ showConfirm: false
+ })
+ this.initDialogData();
+ },
+ closeDialog() {
+ this.setData({
+ showConfirm: false
+ })
+ },
+ closeErrorDialog() {
+ this.setData({
+ showErrorDialog: false
+ })
+ },
+ cancelDialog() {
+ this.setData({
+ showForceConfirm: false
+ });
+ },
+ //寮哄埗寮�闃�
+ confirmForceDialog() {
+ this.postOpenValva(this.data.forceIntakeId, true);
+ },
+ closeSearch() {
+ this.setData({
+ allWaterPoints: [],
+ inputValue: ""
+ })
+ },
+
+ //浠ヤ笅涓哄畾鏃跺畾閲忕浉鍏充唬鐮�
+ //鍒濆鍖栨墍鏈夊紑娉电殑鍙傛暟
+ initDialogData() {
+ this.setData({
+ isShowOpenTime: "false",
+ isOpenTiming: false, //鏄惁鏄鍒掑紑闃�鏃堕棿鏍峰紡鐨勫紑闃�
+ postMinutes: 0, //瀹氱亴婧夋椂闀跨殑鏃堕棿
+ showForceConfirm: false,
+ showErrorDialog: false, //閿欒鎻愮ず
+ showDialog: true,
+ dialog_mode: true,
+ dialog_time: false,
+ dialog_water: false,
+ openTimeText: "",
+ openTime: ""
+ })
+ },
+ handleClost() {
+ this.setData({
+ showDialog: false
+ })
+ },
+ handleSetDuration() {
+ this.getIrrigateProfileData(1);
+ },
+ //鑾峰彇甯哥敤鐢ㄦ按鏃堕暱鍙婄敤姘撮噺
+ getIrrigateProfileData(type) {
+ get({
+ url: 'wx/valve/irrigate_profile',
+ data: {
+ type: type
+ }
+ })
+ .then((data) => {
+ if (data.success && data.code === "0001") {
+ const items = data.content.obj.map(item => {
+ return {
+ defaultValue: item.defaultValue,
+ unit: item.unit,
+ unitText: item.unit === "1" ? "灏忔椂" : item.unit === "2" ? "鍒嗛挓" : "绔嬫柟绫�"
+ };
+ });
+ this.setData({
+ dialog_mode: false,
+ dialog_time: type === 1,
+ dialog_water: type === 2,
+ irrigateProfile: items
+ });
+ } else {
wx.showToast({
title: data.msg,
})
@@ -129,25 +396,353 @@
console.error('Failed to add item:', error);
});
},
- getcommonWaterPoints(){
+ handleSetWaterVolume() {
+ this.getIrrigateProfileData(2);
+ },
+ dialogBack() {
+ this.setData({
+ dialog_time: false,
+ dialog_water: false,
+ dialog_mode: true,
+ group_time: false,
+ activeIndex: -1
+ })
+ },
+ //閫夋嫨鏃堕棿鍚庣殑澶勭悊
+ handleTimeWrapperTap(e) {
+ const index = e.currentTarget.dataset.index;
+ console.log(index)
+ if (index !== undefined) {
+ let minutes;
+ if (this.data.irrigateProfile[index].unit === "1") {
+ minutes = this.hourToMinutes(this.data.irrigateProfile[index].defaultValue)
+ } else {
+ minutes = this.data.irrigateProfile[index].defaultValue;
+ }
+ this.setData({
+ activeIndex: parseInt(index),
+ postMinutes: minutes,
+ costiomTime: "",
+ group_time: false,
+ });
+ }
+ },
+ onTimeInputChange(data) {
+ console.log(data.detail.value)
+ if (data.detail.value !== "") {
+ this.setData({
+ group_time: true,
+ activeIndex: -1,
+ postMinutes: parseInt(data.detail.value)
+ })
+ } else {
+ this.setData({
+ group_time: false,
+ postMinutes: 0,
+ })
+ }
- get({url:'rtu/used_intakes', data: {
- operator: getApp().globalData.sessionId
- }})
- .then((data) => {
- if(data.success&&data.code==="0001"){
+ },
+ //瀹氱亴婧夋椂闀胯嚜瀹氫箟杈撳叆鏃堕棿鏃朵慨鏀规椂闂村崟浣�0锛氬垎閽燂紝1锛氬皬鏃�
+ onGroupOpenTimeTypeChange(event) {
+ let value = event.detail.value;
+ if (value === "1") {
+ this.setData({
+ postMinutes: this.hourToMinutes(this.data.postMinutes)
+ })
+ } else {
+ this.setData({
+ postMinutes: this.minutesToHours(this.data.postMinutes)
+ })
+ }
+ },
+ onGroupOpenTimeChange(event) {
+ const {
+ value
+ } = event.detail;
+ console.log('onGroupOpenTimeChange:' + value);
+ if (value == 1) {
+ this.showPicker();
+ this.setData({
+ isOpenTiming: true,
+ radioValue: value,
+ dateStartTime: new Date().getTime()
+ })
+ } else {
+ this.setData({
+ isShowOpenTime: false,
+ isOpenTiming: false,
+ radioValue: value,
+ })
+ }
+ },
+ //瀹氭椂寮�娉垫寜閽�
+ btnOpenOnTime() {
+ if (this.data.postMinutes > 0) {
+ if (this.data.isOpenTiming) {
+ this.timeClosePlaned();
+ } else {
+ this.timeClose();
+ }
+ } else {
+ wx.showToast({
+ icon: 'error',
+ title: '璇烽�夋嫨鎴栬緭鍏ョ亴婧夋椂闂达紒',
+ })
+ }
+ },
+ //瀹氭椂鍏抽榾寮忚鍒掑紑闃�
+ timeClosePlaned() {
+ const app = getApp();
+ wx.showLoading({
+ title: '姝e湪閫氫俊璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
+ minutes: this.data.postMinutes, //鍒嗛挓
+ operator: app.globalData.clientId, //鎿嶄綔鍛�
+ plannedOpenTime: this.data.openTime
+ };
+ post({
+ url: "wx/valve/planed_open_timed_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({
- commonWaterPoints: data.content
- });
- }else{
- wx.showToast({
- title: data.msg,
+ showErrorDialog: true,
+ errorData: "閫氫俊瓒呮椂锛岃绋嶅悗鍐嶈瘯",
+ errorDialogTitle: "寮�闃�閿欒"
+ })
+ } else {
+ this.setData({
+ showErrorDialog: true,
+ errorData: error.msg,
+ errorDialogTitle: "寮�闃�閿欒"
})
}
- console.log('Failed to add item:');
- })
- .catch((error) => {
- console.error('Failed to add item:', error);
});
- }
+ },
+ //瀹氭椂鍏抽榾寮忓紑闃�
+ timeClose() {
+ const app = getApp();
+ wx.showLoading({
+ title: '姝e湪寮�闃�璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
+ minutes: this.data.postMinutes, //鍒嗛挓
+ operator: app.globalData.clientId //鎿嶄綔鍛�
+ };
+ post({
+ url: "wx/valve/timed_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: "寮�闃�閿欒"
+ })
+ }
+ });
+ },
+ // 閫氳繃灏忔椂杞崲鎴愬垎閽�
+ 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: ""
+ });
+ }
+ }, //鏄剧ず鏃堕棿閫夋嫨鍣�
+ showPicker(e) {
+ this.setData({
+ datetime: new Date().getTime(),
+ datetimeVisible: true,
+ isShowOpenTime: true
+ });
+ },
+ onConfirm(e) {
+ const {
+ value
+ } = e?.detail;
+ console.log(value);
+ this.setData({
+ openTime: value,
+ openTimeText: "璁″垝寮�闃�鏃堕棿锛�" + value
+ })
+ }, hidePicker() {
+ this.setData({
+ isShowOpenTime: false,
+ 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: '姝e湪閫氫俊璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
+ 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: '姝e湪寮�闃�璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ intakeId: this.data.choseItem.intakeId, //鍙栨按鍙D
+ 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: "寮�闃�閿欒"
+ })
+ }
+ });
+ },
})
\ No newline at end of file
--
Gitblit v1.8.0