dispatching.js 4.11 KB
Newer Older
DarkForst's avatar
DarkForst committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
import { autoCreateEffects } from '@/utils/handleModels';
import {
  common_service_m_schedule_plan_getDynamicDutyUser_post, // 根据动态条件获取值班人员
  common_service_t_dictionary_post,
  common_service_m_schedule_plan_currentPersonnelOnDuty_post, // 值班人员
  common_service_calendar_attcDasicInformation_post, // 用户值班信息
} from '@/sdk/api/common';

import {
  operation_service_statistics_getTodayTaskNumber_post, // 今日任务数
  operation_service_statistics_getWaitingForTask_post, // 待任务数(待处理报修,待验收报修,待处理养护,待验收养护)
  operation_service_m_repair_task_mrepairPageList_post, // 维修工单分页列表
  operation_service_m_task_taskList_post, // 所有业务类型分页列表
} from '@/sdk/api/operation'

import {
  device_alarm_analysis_by_time_patch, // 根据时间统计项目处理率
  device_alarm_analysis_by_project_patch, // 根据项目统计项目处理率
  device_alarm__query_post, // 使用POST方式分页动态查询待处理报警信息
} from '@/sdk/extend'

import {
  account_service_user_detail_id_get
} from '@/sdk/api/account'

export default {

  namespace: 'dispatching',
  state: {
    alarmTotalCount: {},
    alarmCount: {},
    todayTaskCount: {},
    personnelOnDutyList: [],
    pendingThingsCount: {},
    pendingAlarmList: { list: [], pagination: {} },
    orderList: { list: [], pagination: {} },
    scheduleingType: [],
    alarmInfoList: [], // 暂存报警信息id列表
    peopleOnDutyList: [],
    taskList: { list: [], pagination: {} },
    userDetail: {},
    dutyPeopleDetail: {}
  },
  effects: {

    ...autoCreateEffects([
      {// 根据时间统计项目处理率
        type: 'device_alarm_analysis_by_time_patch',
        api: device_alarm_analysis_by_time_patch,
        key: 'alarmTotalCount'
      },
      {// 根据项目统计项目处理率
        type: 'device_alarm_analysis_by_project_patch',
        api: device_alarm_analysis_by_project_patch,
        key: 'alarmCount'
      },
      { // 今日任务数
        type: 'operation_service_statistics_getTodayTaskNumber_post',
        api: operation_service_statistics_getTodayTaskNumber_post,
        key: 'todayTaskCount'
      },
      {// 根据动态条件获取值班人员
        type: 'common_service_m_schedule_plan_getDynamicDutyUser_post',
        api: common_service_m_schedule_plan_getDynamicDutyUser_post,
        key: 'personnelOnDutyList'
      },
      {// 待任务数(待处理报修,待验收报修,待处理养护,待验收养护)
        type: 'operation_service_statistics_getWaitingForTask_post',
        api: operation_service_statistics_getWaitingForTask_post,
        key: 'pendingThingsCount'
      },
      {// 使用POST方式分页动态查询待处理报警信息
        type: 'device_alarm__query_post',
        api: device_alarm__query_post,
        handle: 'content',
        key: 'pendingAlarmList'
      },
      {// 维修工单分页列表
        type: 'operation_service_m_repair_task_mrepairPageList_post',
        api: operation_service_m_repair_task_mrepairPageList_post,
        handle: 'content',
        key: 'orderList'
      },
      {
        type: 'common_service_t_dictionary_post_scheduleing',
        api: common_service_t_dictionary_post,
        key: 'scheduleingType'
      },
      {
        type: 'common_service_m_schedule_plan_currentPersonnelOnDuty_post',
        api: common_service_m_schedule_plan_currentPersonnelOnDuty_post,
        key: 'peopleOnDutyList'
      },
      {
        type: 'operation_service_m_task_taskList_post',
        api: operation_service_m_task_taskList_post,
        handle: 'content',
        key: 'taskList'
      },
      {
        type: 'account_service_user_detail_id_get',
        api: account_service_user_detail_id_get,
        key: 'userDetail'
      },
      {
        type: 'common_service_calendar_attcDasicInformation_post',
        api: common_service_calendar_attcDasicInformation_post,
        key: 'dutyPeopleDetail'
      },
    ]),

  },
  reducers: {
    setModelsState(state, action) {
      return {
        ...state,
        ...action.payload,
      };
    }

  },
};