From 910c37c43eceb27888b90631c868caa08f7eafcc Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期四, 30 五月 2024 15:36:59 +0800
Subject: [PATCH] 开泵流程相关界面优化
---
pages/waterIntake/waterIntake.js | 85 ++++++++++++++++++++++++++++++++++--------
1 files changed, 69 insertions(+), 16 deletions(-)
diff --git a/pages/waterIntake/waterIntake.js b/pages/waterIntake/waterIntake.js
index bcfb618..869e711 100644
--- a/pages/waterIntake/waterIntake.js
+++ b/pages/waterIntake/waterIntake.js
@@ -1,11 +1,14 @@
// pages/waterIntake/waterIntake.js
+const {
+ get,
+ post
+} = require('../../api/request.js');
Page({
-
-
data: {
currentTab: 0, // 褰撳墠鏄剧ず鐨勮〃鏍硷紝榛樿涓虹涓�涓〃鏍�
- commonWaterPoints: [ "甯哥敤鍙栨按鍙�2", "甯哥敤鍙栨按鍙�3"], // 甯哥敤鍙栨按鍙f暟鎹�
- allWaterPoints: ["鎵�鏈夊彇姘村彛1", "鎵�鏈夊彇姘村彛2", "鎵�鏈夊彇姘村彛3"], // 鎵�鏈夊彇姘村彛鏁版嵁
+ searchQuery:"",
+ commonWaterPoints: [], // 甯哥敤鍙栨按鍙f暟鎹�
+ allWaterPoints: [], // 鎵�鏈夊彇姘村彛鏁版嵁
},
// 鍒囨崲 Tabs
@@ -15,19 +18,18 @@
currentTab: tab
});
},
- onSearch: function() {
+ onInput(e){
+ this.setData({
+ searchQuery: e.detail.value // 灏嗚緭鍏ユ鐨勫�煎瓨鍌ㄥ埌 inputValue
+ });
+ },
+ onSearch: function () {
const query = this.data.searchQuery;
if (query) {
- wx.showToast({
- title: '鎼滅储: ' + query,
- icon: 'success'
- });
+ this.getallWaterPoints(query)
// 鍦ㄨ繖閲岃繘琛屾悳绱㈡搷浣滐紝鏇存柊 allWaterPoints 鏁版嵁
} else {
- wx.showToast({
- title: '璇疯緭鍏ユ悳绱㈠唴瀹�',
- icon: 'none'
- });
+ this.getallWaterPoints(query)
}
},
@@ -35,9 +37,11 @@
* 閫夋嫨铏氭嫙鍗�
* @param {} event
*/
- choseCard(event){
+ choseCard(event) {
+ const intakeId= event.currentTarget.dataset.item.intakeId;
+ console.log(intakeId);
wx.navigateTo({
- url: '/pages/openCard/openCard',
+ url: '/pages/openCard/openCard?intakeId='+intakeId,
})
},
@@ -53,7 +57,8 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
*/
onReady() {
-
+ this.getallWaterPoints();
+ this.getcommonWaterPoints();
},
/**
@@ -97,4 +102,52 @@
onShareAppMessage() {
}
+ ,
+ /**
+ * 鑾峰彇鎵�鏈夊彇姘村彛
+ */
+ getallWaterPoints: function (intakeNum) {
+ let params = { url: 'rtu/get_online_intakes' };
+ if (intakeNum) {
+ params.data = { intakeNum: intakeNum };
+ }
+
+ get(params)
+ .then((data) => {
+ if(data.success&&data.code==="0001"){
+ this.setData({
+ allWaterPoints: data.content.obj
+ });
+ }else{
+ wx.showToast({
+ title: data.msg,
+ })
+ }
+ console.log('Failed to add item:');
+ })
+ .catch((error) => {
+ console.error('Failed to add item:', error);
+ });
+ },
+ getcommonWaterPoints(){
+
+ get({url:'rtu/used_intakes', data: {
+ operator: getApp().globalData.sessionId
+ }})
+ .then((data) => {
+ if(data.success&&data.code==="0001"){
+ this.setData({
+ commonWaterPoints: data.content
+ });
+ }else{
+ wx.showToast({
+ title: data.msg,
+ })
+ }
+ console.log('Failed to add item:');
+ })
+ .catch((error) => {
+ console.error('Failed to add item:', error);
+ });
+ }
})
\ No newline at end of file
--
Gitblit v1.8.0