From 50433e86b718fab0d94ea1410724b29b5f53fa0a Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期三, 09 四月 2025 15:11:26 +0800 Subject: [PATCH] 更新SVG图标样式,优化灌溉计划和取水口页面逻辑,添加状态处理和信息提示功能;调整界面样式,提升用户体验。 --- pages/irrigation/irrigation.js | 102 +++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 74 insertions(+), 28 deletions(-) diff --git a/pages/irrigation/irrigation.js b/pages/irrigation/irrigation.js index 248efcc..61b0f3e 100644 --- a/pages/irrigation/irrigation.js +++ b/pages/irrigation/irrigation.js @@ -46,16 +46,20 @@ url: '/wx/plan/getNotCompletePlans' }).then(res => { if (res.success) { - const activeList = res.content.map(item => ({ - id: item.planId, - title: item.planName, - projectName: item.projectName || '鏈垎閰嶉」鐩�', - status: item.planState, - planStartTime: item.planStartTime, - planStopTime: item.planStopTime, - duration: item.duration, - startupMode: item.startupMode - })); + const activeList = res.content.map(item => { + // 纭繚灏唒lanState杞崲涓哄瓧绗︿覆 + const planState = String(item.planState); + return { + id: item.planId, + title: item.planName, + projectName: item.projectName || '鏈垎閰嶉」鐩�', + status: planState, + planStartTime: item.planStartTime, + planStopTime: item.planStopTime, + duration: item.duration, + startupMode: item.startupMode + }; + }); console.log('杞亴璁″垝鏁版嵁锛�', activeList); @@ -91,16 +95,20 @@ url: '/wx/plan/getCompletedPlans' }).then(res => { if (res.success) { - const completedList = res.content.map(item => ({ - id: item.planId, - title: item.planName, - projectName: item.projectName || '鏈垎閰嶉」鐩�', - status: item.planState, - planStartTime: item.planStartTime, - planStopTime: item.planStopTime, - duration: item.duration, - startupMode: item.startupMode - })); + const completedList = res.content.map(item => { + // 纭繚灏唒lanState杞崲涓哄瓧绗︿覆 + const planState = String(item.planState); + return { + id: item.planId, + title: item.planName, + projectName: item.projectName || '鏈垎閰嶉」鐩�', + status: planState, + planStartTime: item.planStartTime, + planStopTime: item.planStopTime, + duration: item.duration, + startupMode: item.startupMode + }; + }); console.log('宸插畬鎴愯疆鐏岃鍒掓暟鎹細', completedList); @@ -153,9 +161,22 @@ const id = e.currentTarget.dataset.id; const status = e.currentTarget.dataset.status; + console.log('鐐瑰嚮椤圭洰鐘舵��:', status, '绫诲瀷:', typeof status); + + // 鍒ゆ柇璁″垝鐘舵�侊紝濡傛灉鏄�1(鏈彂甯�)锛屽垯鎻愮ず鐢ㄦ埛 + if (status === '1' || status === 1) { + wx.showModal({ + title: '鎻愮ず', + content: '褰撳墠璁″垝鏈彂甯冿紝璇峰彂甯冨悗鏌ョ湅', + showCancel: false, + confirmText: '纭' + }); + return; + } + // 瀵艰埅鍒扮亴婧夎鎯呴〉闈紝骞朵紶閫掑弬鏁� wx.navigateTo({ - url: `/pages/irrigationDetail/irrigationDetail?id=${id}&fromList=true` + url: `/pages/irrigationDetail/irrigationDetail?planId=${id}&fromList=true` }); }, @@ -213,17 +234,42 @@ content: '纭畾瑕佺粓姝㈣杞亴璁″垝鍚楋紵', success: (res) => { if (res.confirm) { - // 杩欓噷搴旇璋冪敤API缁堟杞亴璁″垝 - wx.showToast({ - title: '宸茬粓姝�', - icon: 'success' - }); - // 鍒锋柊鏁版嵁 - this.loadIrrigationData(); + this.postStop(id) } } }); }, + //缁堟杞亴璁″垝 + postStop(planID){ + post({ + url: '/wx/plan/terminatePlan', + data: { + planId: planID, + operatorId: app.globalData.clientId + }, + isShowLoding: true + }).then(res => { + if (res.success) { + wx.showToast({ + title: '缁堟鎴愬姛', + icon: 'success' + }); + // 鍒锋柊鏁版嵁 + this.loadIrrigationData(); + } else { + wx.showToast({ + title: res.msg || '缁堟澶辫触', + icon: 'none' + }); + } + }).catch(err => { + console.error('缁堟澶辫触锛�', err); + wx.showToast({ + title: '缁堟澶辫触', + icon: 'none' + }); + }); + }, /** * 鐐瑰嚮绔嬪嵆鎵ц鎸夐挳 -- Gitblit v1.8.0