import { getClueStatistic } from '../../../model/clue/clueTask'; import { fetchClueTaskSummary } from '../../../services/clue/fetchClue'; /** * 线索任务统计相关信息获取逻辑 */ export const useStatistic = Behavior({ data: { 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), // }); // }, }, });