/** * 现场巡查监管相关数据接口 */ import { get, post } from '../baseRequset'; import { inspectUrl, inspectPicUrl } from '../../config/index'; import { transSceneType } from '../../model/sceneType'; import { getInspectionStatisticList } from '../../model/inspection'; import { getProblemList } from '../../model/problem'; import dayjs from 'dayjs'; // 获取巡查任务数及各自问题数统计 function fetchInspectionStatistic(area) { // 两个系统之间的场景类型需要转换 area.scensetypeid = transSceneType(area.scensetypeid); return post( { url: `/task/progress`, data: area, }, inspectUrl, ).then(res => { return res.data; }); } // 获取各问题类型发生的数量统计 function fetchProblemsStatistic(area) { area.scensetypeid = transSceneType(area.scensetypeid); return post( { url: `/problemlist/getStatisticalResult`, data: area, }, inspectUrl, ).then(res => { return res; }); } // function fetchSubtasksByProType({ area, pType }) { area.scensetypeid = transSceneType(area.scensetypeid); return post( { url: `/problemlist/type/subtask`, params: { pType: pType }, data: area, }, inspectUrl, ).then(res => { if (res.data.data) { res.data.data.forEach(d => { d.planstarttime = dayjs(d.planstarttime).format('MM月DD日'); d.planendtime = dayjs(d.planstarttime).format('MM月DD日'); d.executionstarttime; }); } return res.data; }); } function fetchSubtask(subtaskId) { return get( { url: `/subtask/${subtaskId}`, }, inspectUrl, ).then(res => { return res.data; }); } function fetchSubtaskSummary({ sceneId, startTime, endTime }) { return get( { url: `/subtask/byScene`, params: { sceneId: sceneId, startTime: startTime, endTime: endTime, }, }, inspectUrl, ).then(res => { return res.data; }); } function fetchSubtaskSummaryByArea(area) { area.scensetypeid = transSceneType(area.scensetypeid); return post( { url: `/subtask/summary/area`, data: area, }, inspectUrl, ).then(res => { res.data.data = getInspectionStatisticList(res.data.data); return res.data; }); } /** * 获取巡查任务的问题及整改详情 * @param {String} subtaskId * @param {boolean} all 是否获取未审核及审核不通过的问题 */ function fetchProblems(subtaskId, all) { return get( { url: `/problemlist/subtask`, params: { stGuid: subtaskId, all: all ? all : false, }, }, inspectUrl, ).then(res => { res.data = getProblemList(res.data); return res.data; }); } export { fetchInspectionStatistic, fetchProblemsStatistic, fetchSubtasksByProType, fetchSubtask, fetchSubtaskSummary, fetchSubtaskSummaryByArea, fetchProblems, };