From 1f9e43b7bbb848c7ee2aaa89ffece17002b2c915 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 16 一月 2026 17:31:08 +0800
Subject: [PATCH] 2026.1.16

---
 pages/selfpatrol/index.js |  116 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 107 insertions(+), 9 deletions(-)

diff --git a/pages/selfpatrol/index.js b/pages/selfpatrol/index.js
index 68dad67..ad2ae82 100644
--- a/pages/selfpatrol/index.js
+++ b/pages/selfpatrol/index.js
@@ -1,10 +1,18 @@
-import { useLoading } from '../../behaviors/loading';
-import { sceneTypeList } from '../../common/dataSceneTypes';
+import {
+  useLoading
+} from '../../behaviors/loading';
+import {
+  sceneTypeList
+} from '../../common/dataSceneTypes';
 import {
   fetchPublish,
   fetchPublishedTask,
+  deleteTask
 } from '../../services/patrol/fetchSelfPatrol';
 import dayjs from 'dayjs';
+import ActionSheet, {
+  ActionSheetTheme
+} from 'tdesign-miniprogram/action-sheet';
 
 Page({
   behaviors: [useLoading],
@@ -22,9 +30,17 @@
     },
 
     unfinishedList: [],
+    // 甯告寜閫変腑鐨勮嚜宸℃煡绱㈠紩
+    longPressIndex: undefined,
     finishedList: [],
 
     newTask: false,
+
+    dialog: {
+      show: false,
+      title: '纭鍒犻櫎褰撳墠鑷贰鏌ヤ换鍔★紵',
+      message: '',
+    },
   },
 
   /**
@@ -65,7 +81,10 @@
           finishedList.push(r);
         }
       });
-      this.setData({ unfinishedList, finishedList });
+      this.setData({
+        unfinishedList,
+        finishedList
+      });
       // if (this.data.newTask) {
       //   wx.pageScrollTo({
       //     duration: 0,
@@ -81,9 +100,53 @@
     });
   },
 
+  // 甯告寜寰呭畬鎴愮殑鑷贰鏌ヤ换鍔�
+  handleAction(e) {
+    this.setData({
+      longPressIndex: e.target.dataset.index
+    });
+    ActionSheet.show({
+      theme: ActionSheetTheme.List,
+      selector: '#t-action-sheet',
+      context: this,
+      items: [{
+        label: '鍒犻櫎',
+      }, ],
+    });
+    console.log(e);
+  },
+
+  // 鍒犻櫎鑷贰鏌ヤ换鍔�
+  handleSelected(e) {
+    const {
+      index
+    } = e.detail;
+    switch (index) {
+      // 鍒犻櫎
+      case 0:
+        const {
+          longPressIndex, unfinishedList
+        } = this.data;
+        const seleted = unfinishedList[longPressIndex];
+        this.setData({
+          dialog: {
+            show: true,
+            title: '纭鍒犻櫎褰撳墠鍘嗗彶璁板綍锛�',
+            message: seleted.finished > 0 ? '褰撳墠鑷贰鏌ュ凡鏈変笂浼犺褰曪紒' : '',
+          },
+        });
+        break;
+
+      default:
+        break;
+    }
+  },
+
   // 鍦烘櫙绫诲瀷鏇存敼
   handleSceneChange(e) {
-    const { sceneValue } = e.detail;
+    const {
+      sceneValue
+    } = e.detail;
     this.setData({
       ['searchOptions.sceneType']: sceneValue[0],
     });
@@ -92,7 +155,9 @@
 
   // 鏃堕棿鏇存敼
   handleTimeChange(e) {
-    const { timeValue } = e.detail;
+    const {
+      timeValue
+    } = e.detail;
     this.setData({
       ['searchOptions.period']: timeValue + '-01',
     });
@@ -123,8 +188,13 @@
   },
 
   onPopupSearch(e) {
-    const { searchOptions } = this.data;
-    const { districtText, townText } = e.detail;
+    const {
+      searchOptions
+    } = this.data;
+    const {
+      districtText,
+      townText
+    } = e.detail;
     searchOptions.districtText = districtText;
     searchOptions.townText = townText;
     this.setData({
@@ -136,7 +206,35 @@
 
   // 寮瑰嚭妗嗗叧闂�
   close(e) {
-    this.setData({ show: e.detail.visible });
+    this.setData({
+      show: e.detail.visible
+    });
+  },
+
+  dialogConfirm() {
+    const {
+      longPressIndex,
+      unfinishedList
+    } = this.data;
+    const seleted = unfinishedList[longPressIndex];
+    // deleteTask(seleted.guid).then(res=>{
+    //   unfinishedList.splice(longPressIndex, 1)
+    //   this.setData({ 
+    //     unfinishedList,
+    //     ['dialog.show']: false 
+    //   });
+    // })
+    unfinishedList.splice(longPressIndex, 1)
+    this.setData({
+      unfinishedList,
+      ['dialog.show']: false
+    });
+  },
+
+  dialogClose() {
+    this.setData({
+      ['dialog.show']: false
+    });
   },
 
   navToPublishTask() {
@@ -149,4 +247,4 @@
       },
     });
   },
-});
+});
\ No newline at end of file

--
Gitblit v1.9.3