From 233a467167e2b363098cc7fa63e7f26d1d15507b Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期日, 27 四月 2025 16:23:28 +0800
Subject: [PATCH] 线索任务

---
 pages/cluetask/home/statistic-proxy.js |   59 +++++++++++++-
 app.json                               |    3 
 pages/cluetask/question/index.js       |   14 +++
 pages/cluetask/question/index.wxml     |    4 
 config/index.js                        |    4 
 pages/cluetask/home/options-proxy.js   |   25 +++---
 services/clue/fetchClue.js             |   38 +++++++++
 pages/cluetask/home/tasks-proxy.js     |   14 +++
 project.private.config.json            |    2 
 pages/cluetask/home/tasks.wxml         |    7 +
 pages/cluetask/home/tasks.wxss         |    3 
 pages/cluetask/home/index.js           |   30 +++++--
 12 files changed, 170 insertions(+), 33 deletions(-)

diff --git a/app.json b/app.json
index 3598588..16ad222 100644
--- a/app.json
+++ b/app.json
@@ -136,6 +136,7 @@
     }
   },
   "requiredPrivateInfos": [
-    "chooseLocation"
+    "chooseLocation",
+    "getLocation"
   ]
 }
\ No newline at end of file
diff --git a/config/index.js b/config/index.js
index 6894fb8..ece4cb1 100644
--- a/config/index.js
+++ b/config/index.js
@@ -19,9 +19,9 @@
 
 // 閬撹矾搴旀�ョ嚎绱�
 const clueUrl = 'https://fyami.com.cn:448/';
-// const clueUrl = 'http://192.168.0.110:8080/';
+// const clueUrl = 'http://192.168.0.110:8084/';
 const cu = 'https://fyami.com.cn:448';
-// const cu = 'http://192.168.0.110:8080';
+// const cu = 'http://192.168.0.110:8084';
 const cluePicUrl = `${cu}/images/`;
 
 // 杩愯妯″紡
diff --git a/pages/cluetask/home/index.js b/pages/cluetask/home/index.js
index 1069fa1..b148dff 100644
--- a/pages/cluetask/home/index.js
+++ b/pages/cluetask/home/index.js
@@ -1,9 +1,9 @@
+import dayjs from 'dayjs';
+
 import { useLoading } from '../../../behaviors/loading';
 import { useOptions } from './options-proxy.js';
 import { useStatistic } from './statistic-proxy.js';
 import { useTasks } from './tasks-proxy.js';
-
-import { fetchClueTask } from '../../../services/clue/fetchClue';
 
 const app = getApp();
 
@@ -19,9 +19,9 @@
 
   onShow() {
     if (this.getTabBar()) {
-      this.getTabBar().init();      
+      this.getTabBar().init();
     }
-    this.refresh();
+    // this.refresh();
   },
 
   onPullDownRefresh() {
@@ -45,14 +45,26 @@
   },
 
   refresh() {
-    this._startLoad();
+    if (this.optionsCount >= 2) this._startLoad();
   },
 
   _fetchData(page) {
-    return fetchClueTask({}).then(res => {
-      this.setData({ clueTaskList: res.data });
-      this.calClueCount();
-      this.formatClueTask();
+    const array = [];
+    array.push(this.searchClueTask(page));
+    if (page == 1) {
+      array.push(this.fetchClueTaskSummary(page));
+    }
+    return Promise.all(array).then(res => {
+      return res[0].head;
     });
   },
+
+  _getOptions() {
+    const { location, time } = this.data;
+    return {
+      ...location,
+      startTime: dayjs(time).startOf('month').format('YYYY-MM-DD HH:mm:ss'),
+      endTime: dayjs(time).endOf('month').format('YYYY-MM-DD HH:mm:ss'),
+    };
+  },
 });
diff --git a/pages/cluetask/home/options-proxy.js b/pages/cluetask/home/options-proxy.js
index a9d6890..8056d29 100644
--- a/pages/cluetask/home/options-proxy.js
+++ b/pages/cluetask/home/options-proxy.js
@@ -6,7 +6,7 @@
  */
 export const useOptions = Behavior({
   data: {
-    time:'',
+    time: '',
   },
   methods: {
     setLocation(e) {
@@ -22,15 +22,17 @@
         locationValue,
       } = e.detail;
       this.setData({
-        provinceName,
-        cityName,
-        districtName,
-        townName,
-        provinceCode,
-        cityCode,
-        districtCode,
-        townCode,
-        locationValue,
+        location: {
+          provinceName,
+          cityName,
+          districtName,
+          townName,
+          provinceCode,
+          cityCode,
+          districtCode,
+          townCode,
+          locationValue,
+        },
       });
     },
     initLocation(e) {
@@ -40,8 +42,7 @@
     // 琛屾斂鍖哄垝鍒囨崲鏃讹紝鑾峰彇鏂扮殑绾夸笂鐩戠淇℃伅浠ュ強绾夸笅宸℃煡鐩戠淇℃伅
     onLocationChange(e) {
       this.setLocation(e);
-      this.fetchSupervision();
-      this.fetchInspection();
+      this._startLoad();
     },
 
     // 鏃堕棿鏇存敼
diff --git a/pages/cluetask/home/statistic-proxy.js b/pages/cluetask/home/statistic-proxy.js
index 189bdb3..65ed899 100644
--- a/pages/cluetask/home/statistic-proxy.js
+++ b/pages/cluetask/home/statistic-proxy.js
@@ -1,4 +1,6 @@
 import { getClueStatistic } from '../../../model/clue/clueTask';
+import { fetchClueTaskSummary } from '../../../services/clue/fetchClue';
+
 
 /**
  * 绾跨储浠诲姟缁熻鐩稿叧淇℃伅鑾峰彇閫昏緫
@@ -8,13 +10,60 @@
     clueCountRes: [],
   },
   methods: {
+    fetchClueTaskSummary(page) {
+      const options = this._getOptions();
+      fetchClueTaskSummary(options).then(res => {
+        const {
+          totalCount,
+          internalTaskCount,
+          externalTaskCount,
+          finishedCount,
+          unfinishedCount,
+          internalFinishedCount,
+          internalUnFinishedCount,
+          externalFinishedCount,
+          externalUnFinishedCount,
+        } = res.data;
+        const p1 = Math.round((finishedCount / totalCount) * 1000) / 10;
+        const p2 = Math.round((unfinishedCount / totalCount) * 1000) / 10;
+        this.setData({
+          clueCountRes: [
+            {
+              name: '鎬昏',
+              value: totalCount,
+              diff: '',
+              clickable: false,
+            },
+            {
+              name: '宸插畬鎴�',
+              value: finishedCount,
+              diff: totalCount == 0 ? '0%' : `${p1}%`,
+              clickable: false,
+            },
+            {
+              name: '寰呭畬鎴�',
+              value: unfinishedCount,
+              diff: totalCount == 0 ? '0%' : `${p2}%`,
+              clickable: false,
+            },
+            // {
+            //   name: '寰呭畬鎴�',
+            //   value: unfinishedCount,
+            //   diff: totalCount == 0 ? '0%' : `${p2}%`,
+            //   clickable: false,
+            // },
+          ],
+        });
+      });
+    },
+
     /**
      * 璁$畻绾跨储宸℃煡瀹屾垚鎯呭喌
      */
-    calClueCount() {
-      this.setData({
-        clueCountRes: getClueStatistic(this.data.clueTaskList),
-      });
-    },
+    // calClueCount() {
+    //   this.setData({
+    //     clueCountRes: getClueStatistic(this.data.clueTaskList),
+    //   });
+    // },
   },
 });
diff --git a/pages/cluetask/home/tasks-proxy.js b/pages/cluetask/home/tasks-proxy.js
index 7bde071..91c6eb3 100644
--- a/pages/cluetask/home/tasks-proxy.js
+++ b/pages/cluetask/home/tasks-proxy.js
@@ -2,12 +2,26 @@
 import dataResponseLevel from '../../../common/clue/dataResponseLevel';
 import dataTravelMode from '../../../common/clue/dataTravelMode';
 
+import { searchClueTask } from '../../../services/clue/fetchClue';
+
+
 /**
  * 绾跨储浠诲姟鍒楄〃灞曠ず鐩稿叧閫昏緫
  */
 export const useTasks = Behavior({
   data: {},
   methods: {
+    searchClueTask(page) {
+      const options = this._getOptions()
+      options.finished = false
+      return searchClueTask(options, page, 30).then(res => {
+        this.setData({ clueTaskList: res.data });
+        this.formatClueTask();
+  
+        return res.head;
+      });
+    },
+
     /**
      * 鏍煎紡鍖�
      */
diff --git a/pages/cluetask/home/tasks.wxml b/pages/cluetask/home/tasks.wxml
index 60fafba..860826f 100644
--- a/pages/cluetask/home/tasks.wxml
+++ b/pages/cluetask/home/tasks.wxml
@@ -8,7 +8,12 @@
     bindtap="handleClueTaskClick"
   >
     <view class="clue-task__title-wrap">
-      <view class="clue-task__title">{{item._taskTime}}</view>
+      <view class="clue-task__title">
+        <t-tag variant="light" theme="{{item.finished ? 'success' : 'danger'}}"
+          >{{item.finished ? '瀹屾垚' : '寰呭鐞�'}}</t-tag
+        >
+        {{item._taskTime}}
+      </view>
       <view class="clue-task__abstract">
         搴旀�ュ贰鏌�
         <t-icon name="chevron-right" size="var(--icon-width)" color="black" />
diff --git a/pages/cluetask/home/tasks.wxss b/pages/cluetask/home/tasks.wxss
index 6c22bd9..b00da27 100644
--- a/pages/cluetask/home/tasks.wxss
+++ b/pages/cluetask/home/tasks.wxss
@@ -12,6 +12,9 @@
 }
 
 .clue-task__title {
+  display: flex;
+  align-items: center;
+  gap: 4px;
   font-weight: 550;
   font-size: var(--td-font-size-m);
 }
diff --git a/pages/cluetask/question/index.js b/pages/cluetask/question/index.js
index 1762113..48a8915 100644
--- a/pages/cluetask/question/index.js
+++ b/pages/cluetask/question/index.js
@@ -189,6 +189,20 @@
 
   // 娣诲姞鍥剧墖
   handleAddImg(e) {
+    wx.chooseAddress({
+      
+    })
+    wx.getLocation({
+      type:'wgs84',
+      success:res=>{
+        this.setData({
+          locations: {
+            ...res,
+            coorTxt: `${res.longitude},${res.latitude}`,
+          },
+        });
+      }
+    })
     const { fileList } = this.data;
     const { files } = e.detail;
     this.setData({
diff --git a/pages/cluetask/question/index.wxml b/pages/cluetask/question/index.wxml
index 3fbb8d1..c2b4668 100644
--- a/pages/cluetask/question/index.wxml
+++ b/pages/cluetask/question/index.wxml
@@ -39,8 +39,8 @@
         />
       </t-cell>
       <view wx:if="{{validated && (!fileList || fileList.length == 0)}}" class="tips">
-          闂鍥剧墖鑷冲皯閫変竴寮�
-        </view>
+        闂鍥剧墖鑷冲皯閫変竴寮�
+      </view>
     </t-form>
   </view>
   <view class="page-footer"></view>
diff --git a/project.private.config.json b/project.private.config.json
index ce2e311..b9996cb 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -2,7 +2,7 @@
   "description": "椤圭洰绉佹湁閰嶇疆鏂囦欢銆傛鏂囦欢涓殑鍐呭灏嗚鐩� project.config.json 涓殑鐩稿悓瀛楁銆傞」鐩殑鏀瑰姩浼樺厛鍚屾鍒版鏂囦欢涓�傝瑙佹枃妗o細https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
   "projectname": "ep-law-abiding-manage-weixin",
   "setting": {
-    "compileHotReLoad": false,
+    "compileHotReLoad": true,
     "urlCheck": true
   },
   "libVersion": "3.7.12"
diff --git a/services/clue/fetchClue.js b/services/clue/fetchClue.js
index be15df5..6c6d3de 100644
--- a/services/clue/fetchClue.js
+++ b/services/clue/fetchClue.js
@@ -61,6 +61,42 @@
   });
 }
 
+/**
+ * 鏌ヨ绾跨储浠诲姟
+ * @param {object} options 鏌ヨ鏉′欢
+ * @param {Number} page 椤电爜
+ * @param {Number} per_page 鍗曢〉鏁版嵁閲�
+ * @returns
+ */
+function searchClueTask(options, page, per_page) {
+  return post(
+    {
+      url: `clue/task/search`,
+      params:{page, per_page},
+      data: options,
+    },
+    clueUrl,
+  ).then(res => {
+    return res.data;
+  });
+}
+
+/**
+ * 鏌ヨ绾跨储浠诲姟
+ * @param {object} options 鏌ヨ鏉′欢
+ * @returns
+ */
+function fetchClueTaskSummary(options) {
+  return post(
+    {
+      url: `clue/task/summary`,
+      data: options,
+    },
+    clueUrl,
+  ).then(res => {
+    return res.data;
+  });
+}
 /******************************************************************************* */
 /**
  * 鑾峰彇绾跨储缁撹
@@ -195,6 +231,8 @@
   fetchClue,
   fetchClueInternal,
   fetchClueTask,
+  searchClueTask,
+  fetchClueTaskSummary,
   getConclusion,
   uploadConclusion,
   updateQuestion,

--
Gitblit v1.9.3