管灌系统农户端微信小程序(嘉峪关应用)
添加删除功能到灌溉计划页面,用户可通过点击删除按钮确认删除相应的轮灌计划;更新样式以增强用户体验。
1个文件已添加
3个文件已修改
58 ■■■■■ 已修改文件
images/delete_bt.svg 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/irrigation/irrigation.js 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/irrigation/irrigation.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/irrigation/irrigation.wxss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
images/delete_bt.svg
New file
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 10V44H39V10H9Z" fill="none" stroke="#fff" stroke-width="4" stroke-linejoin="round"/><path d="M20 20V33" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M28 20V33" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 10H44" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 10L19.289 4H28.7771L32 10H16Z" fill="none" stroke="#fff" stroke-width="4" stroke-linejoin="round"/></svg>
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({
pages/irrigation/irrigation.wxml
@@ -63,6 +63,10 @@
            <view class="action-section" catchtap="stopPropagation" wx:if="{{item.status !== '4'}}">
              <block wx:if="{{item.status === '1'}}">
                <view class="action-buttons">
                  <button class="action-button delete-button" hover-class="delete-button-hover" bindtap="onDelete" data-id="{{item.id}}">
                    <image src="/images/delete_bt.svg" mode="aspectFit"></image>
                    <text>删除</text>
                  </button>
                  <button class="action-button publish-button" hover-class="publish-button-hover" bindtap="onPublish" data-id="{{item.id}}">
                    <image src="/images/publish-icon.svg" mode="aspectFit"></image>
                    <text>发布</text>
pages/irrigation/irrigation.wxss
@@ -257,6 +257,10 @@
  background-color: #1890FF !important;
}
.delete-button {
  background-color: #ff4d4f !important;
}
.stop-button {
  background-color: #ff4d4f !important;
}
@@ -319,6 +323,10 @@
  opacity: 0.8 !important;
}
.delete-button-hover {
  opacity: 0.8 !important;
}
.stop-button-hover {
  opacity: 0.8 !important;
}