riku
2025-04-27 233a467167e2b363098cc7fa63e7f26d1d15507b
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),
    //   });
    // },
  },
});