import dayjs from 'dayjs';
|
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;
|
});
|
},
|
|
/**
|
* 格式化
|
*/
|
formatClueTask() {
|
const { clueTaskList } = this.data;
|
clueTaskList.forEach(t => {
|
t._taskTime = dayjs(t.taskTime).format('YYYY-MM-DD');
|
let note = '';
|
note += t.provinceName ? t.provinceName : '';
|
note += t.provinceName == t.cityName ? '' : t.cityName ? `/${t.cityName}` : '';
|
note += t.districtName ? `/${t.districtName}` : '';
|
note += t.townName ? `/${t.townName}` : '';
|
t._location = note;
|
t._resLevelTxt = dataResponseLevel.toLabel2(t.responseLevel);
|
t._travelModeTxt = dataTravelMode.toLabel2(t.travelMode);
|
t._hasUavTxt = t.hasUav ? '有' : '无';
|
});
|
this.setData({ clueTaskList });
|
},
|
|
handleClueTaskClick(e) {
|
const { index } = e.currentTarget.dataset;
|
const clueTask = this.data.clueTaskList[index];
|
wx.navigateTo({
|
url: '/pages/cluetask/manage/index',
|
events: {
|
uploadOver: () => {
|
// 线索提交完成后更新状态
|
},
|
},
|
success: res => {
|
res.eventChannel.emit('acceptClueTask', clueTask);
|
},
|
});
|
},
|
},
|
});
|