hcong
2024-11-08 d7d7da5c09340eafcd2e2c672e6b2c001a4cc0be
src/api/fysp/taskApi.js
@@ -2,10 +2,88 @@
export default {
  /**
   * 新建任务
   * @param {Object} task
   */
  putTask(task){
    return $fysp.put(`task/create`, task).then((res) => res.data);
  },
  /**
   * 根据主键获取总任务或日任务
   */
  fetchTaskById(id){
    return $fysp.get(`task/${id}`).then((res) => res.data);
  },
  /**
   * 获取顶层任务
   */
  getTopTask() {
    return $fysp.get('task/alltask/0').then((res) => res.data);
  },
  /**
   * 获取顶层任务和日任务
   */
  getTopTaskWithDayTask() {
    return $fysp.get('task/alltask/1').then((res) => res.data);
  },
  getLastTopTask(task){
    return $fysp.post(`task/lastTask`, task).then((res) => res.data);
  },
  /**
   * 获取总任务的监管场景版本信息
   */
  fetchMonitorObjectVersion(taskId) {
    return $fysp.get(`monitorobjectversion/task/${taskId}`).then((res) => res.data);
  },
  /**
   * 添加监管对象
   */
  addMonitorObject(objList) {
    return $fysp.put(`monitorobjectversion/addlist`, objList).then((res) => res.data);
  },
  /**
   * 更新监管对象
   */
  updateMonitorObject(objList) {
    return $fysp.post(`monitorobjectversion/uplist`, objList).then((res) => res.data);
  },
  /**
   * 删除监管对象
   */
  deleteMonitorObject(objList) {
    return $fysp({
      method: 'delete',
      url: 'monitorobjectversion/deleteList',
      data: objList
    }).then((res) => res.data);
  },
  /**
   * 查询总任务
   * @param {Object} param
   * @returns
   */
  fetchTopTasks(param) {
    return $fysp.post('task/find', param).then((res) => res.data);
  },
  /**
   * 获取每日任务统计信息
   * @param {String} topTaskId 总任务主键id
   * @param {String} userId 用户id,当用户类型userType为1(监管用户)时,会根据用户id获取其权限内的统计信息
   * @param {String} userType 用户类型,0:管理员;1:监管用户;2:政府部门;3:企业
   */
  fetchDayTasks(topTaskId, userId = '', userType = '0') {
    return $fysp
      .get(`task/dayTask/${topTaskId}?userId=${userId}&userType=${userType}`)
      .then((res) => res.data);
  },
  /**
@@ -16,10 +94,21 @@
      .get('subtask/summary', {
        params: {
          topTaskId: topTaskId,
          sceneTypeId: sceneTypeId,
        },
          sceneTypeId: sceneTypeId
        }
      })
      .then((res) => res.data);
  },
  /**
   * 获取具体子任务信息
   * @param {String} dayTaskId 日任务主键id
   * @param {String} userId 用户id,当用户类型userType为1(监管用户)时,会根据用户id获取其权限内的统计信息
   * @param {String} userType 用户类型,0:管理员;1:监管用户;2:政府部门;3:企业
   */
  fetchSubtaskByDayTask(dayTaskId, userId = '', userType = '0') {
    const params = `?dayTaskId=${dayTaskId}&userId=${userId}&userType=${userType}`;
    return $fysp.get(`subtask/byDayTaskId${params}`).then((res) => res.data);
  },
  /**
@@ -29,9 +118,25 @@
    return $fysp
      .get('problemlist/subtask', {
        params: {
          stGuid: id,
        },
          stGuid: id
        }
      })
      .then((res) => res.data);
  },
  /**
   * 通过总任务id和时间区间获取子任务列表
   */
  async getByTopTaskAndDate({startTime = null, endTime = null, sceneTypeId = null, topTaskId}) {
    // const params = `?startTime=${startTime}&endTime=${endTime}&sceneTypeId=${sceneTypeId}&topTaskId=${topTaskId}`;
    return await $fysp.get(`subtask/getSubTask`, {
      params: {startTime: startTime, endTime: endTime, sceneTypeId: sceneTypeId, topTaskId: topTaskId}
    }).then((res) => res.data);
  },
  /**
   * 获取某个场景的巡查任务
   */
  async getSubtaskByScene({startTime, endTime, sceneId}) {
    const params = `?startTime=${startTime}&endTime=${endTime}&sceneId=${sceneId}`;
    return await $fysp.get(`subtask/byScene${params}`).then((res) => res.data);
  }
};