From 032f821c77485c1178de18f78092ddedd25d2fb2 Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期三, 09 四月 2025 15:26:58 +0800 Subject: [PATCH] 添加删除功能到灌溉计划页面,用户可通过点击删除按钮确认删除相应的轮灌计划;更新样式以增强用户体验。 --- pages/irrigation/irrigation.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/pages/irrigation/irrigation.js b/pages/irrigation/irrigation.js index 61b0f3e..e4adbc2 100644 --- a/pages/irrigation/irrigation.js +++ b/pages/irrigation/irrigation.js @@ -239,6 +239,51 @@ } }); }, + + /** + * 鐐瑰嚮鍒犻櫎鎸夐挳 + */ + onDelete: function (e) { + const id = e.currentTarget.dataset.id; + wx.showModal({ + title: '纭鍒犻櫎', + content: '纭畾瑕佸垹闄よ杞亴璁″垝鍚楋紵', + success: (res) => { + if (res.confirm) { + // 璋冪敤鍒犻櫎鎺ュ彛 + post({ + url: '/wx/plan/deletePlan', + data: { + planId: id, + 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' + }); + }); + } + } + }); + }, + //缁堟杞亴璁″垝 postStop(planID){ post({ -- Gitblit v1.8.0