From 4a1793b20f6ee04ec92a2a284d08e792e6f49783 Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期五, 11 四月 2025 17:56:51 +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