riku
2025-04-27 233a467167e2b363098cc7fa63e7f26d1d15507b
线索任务

1. 新增任务完成统计接口
2. 新增任务完成状态展示
已修改12个文件
203 ■■■■ 文件已修改
app.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/home/index.js 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/home/options-proxy.js 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/home/statistic-proxy.js 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/home/tasks-proxy.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/home/tasks.wxml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/home/tasks.wxss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/question/index.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cluetask/question/index.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
project.private.config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
services/clue/fetchClue.js 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -136,6 +136,7 @@
    }
  },
  "requiredPrivateInfos": [
    "chooseLocation"
    "chooseLocation",
    "getLocation"
  ]
}
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/`;
// 运行模式
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'),
    };
  },
});
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();
    },
    // 时间更改
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),
    //   });
    // },
  },
});
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;
      });
    },
    /**
     * 格式化
     */
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" />
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);
}
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({
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>
project.private.config.json
@@ -2,7 +2,7 @@
  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档: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"
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,