"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SyService = exports.BaseService = exports.AlarmService = void 0;
var _utils = require("@vtx/utils");
var _ahooks = require("ahooks");
var BaseService = {
  useBaseInfo: function useBaseInfo(id, startDate, endDate) {
    var _useRequest = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/collect/point/get', {
          data: {
            id: id,
            coordinateType: 'bd09'
          }
        });
      }, {
        refreshDeps: [id]
      }),
      baseInfoRes = _useRequest.data;
    var info = baseInfoRes === null || baseInfoRes === void 0 ? void 0 : baseInfoRes.data;
    var baseInfo = [{
      label: '行政区划',
      key: 'divisionName',
      value: info === null || info === void 0 ? void 0 : info.divisionName
    }, {
      label: '垃圾类型',
      key: 'productTypeNames',
      value: info === null || info === void 0 ? void 0 : info.productTypeNames
    }, {
      label: '管理单位',
      key: 'manageUnitName',
      value: info === null || info === void 0 ? void 0 : info.manageUnitName
    }, {
      label: '收运单位',
      key: 'accUnitName',
      value: info === null || info === void 0 ? void 0 : info.accUnitName
    }, {
      label: '地址',
      key: 'address',
      value: info === null || info === void 0 ? void 0 : info.address
    }];
    // 今日作业
    var _useRequest2 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/kanban/collectRateByProduct', {
          data: {
            collectPointId: id,
            startDate: startDate,
            endDate: endDate,
            coordinateType: 'bd09'
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate]
      }),
      todayWorkRes = _useRequest2.data;
    // 车辆作业信息
    var _useRequest3 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/kanban/getCarCollectInfoByPointId', {
          data: {
            collectPointId: id,
            startDate: startDate,
            endDate: endDate,
            coordinateType: 'bd09'
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate]
      }),
      carWorkRes = _useRequest3.data;
    return {
      baseInfo: baseInfo,
      rules: (info === null || info === void 0 ? void 0 : info.rules) || [],
      todayWorkRes: (todayWorkRes === null || todayWorkRes === void 0 ? void 0 : todayWorkRes.data) || [],
      dataSource: (carWorkRes === null || carWorkRes === void 0 ? void 0 : carWorkRes.data) || []
    };
  }
};
exports.BaseService = BaseService;
var SyService = {
  useBaseInfo: function useBaseInfo(id, startDate, endDate) {
    var _useRequest4 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/kanban/collectRateByProduct', {
          data: {
            collectPointId: id,
            startDate: startDate,
            endDate: endDate
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate]
      }),
      baseInfoRes = _useRequest4.data;
    var baseInfo = (baseInfoRes === null || baseInfoRes === void 0 ? void 0 : baseInfoRes.data) || [];
    var _useRequest5 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/kanban/collectWeightAnalyze', {
          data: {
            collectPointId: id,
            startDate: startDate,
            endDate: endDate
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate]
      }),
      collectWeightRes = _useRequest5.data;
    var collectWeight = collectWeightRes === null || collectWeightRes === void 0 ? void 0 : collectWeightRes.data;
    return {
      baseInfo: baseInfo,
      collectWeight: collectWeight
    };
  },
  useRecordInfo: function useRecordInfo(id, startTime, endTime, page) {
    var _useRequest6 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/collect/record/day/page', {
          data: {
            productTypeId: id,
            startTime: startTime,
            endTime: endTime,
            page: page,
            size: 10
          }
        });
      }, {
        refreshDeps: [id, startTime, endTime, page]
      }),
      recordRes = _useRequest6.data;
    var records = (recordRes === null || recordRes === void 0 ? void 0 : recordRes.data) || {
      total: 0,
      rows: []
    };
    return {
      records: records
    };
  }
};
exports.SyService = SyService;
var AlarmService = {
  //信息汇总
  useAlarmSummary: function useAlarmSummary(id, dateValue) {
    var _useRequest7 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/kanban/getAlarmStatisticsByCollectPointId', {
          data: {
            collectPointId: id,
            dateValue: dateValue
          }
        });
      }, {
        refreshDeps: [id, dateValue]
      }),
      alarmSummaryRes = _useRequest7.data;
    var alarmSummary = (alarmSummaryRes === null || alarmSummaryRes === void 0 ? void 0 : alarmSummaryRes.data) || [];
    return {
      alarmSummary: alarmSummary
    };
  },
  // 类型分析
  useAlarmTrend: function useAlarmTrend(id, startDate, endDate) {
    var _useRequest8 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/kanban/alarmStatisticsByAlarmType', {
          data: {
            collectPointId: id,
            startDate: startDate,
            endDate: endDate
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate]
      }),
      alarmTypeRes = _useRequest8.data;
    var alarmTypes = (alarmTypeRes === null || alarmTypeRes === void 0 ? void 0 : alarmTypeRes.data) || [];
    return {
      alarmTypes: alarmTypes
    };
  },
  // 月度趋势分析
  useAlarmMonthTrend: function useAlarmMonthTrend(id, startDate, endDate) {
    var _useRequest9 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/kanban/alarmStatisticsByMonth', {
          data: {
            collectPointId: id,
            startDate: startDate,
            endDate: endDate
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate]
      }),
      alarmMonthTrendRes = _useRequest9.data;
    var alarmMonthTrend = (alarmMonthTrendRes === null || alarmMonthTrendRes === void 0 ? void 0 : alarmMonthTrendRes.data) || [];
    return {
      alarmMonthTrend: alarmMonthTrend
    };
  },
  // 报警记录
  useAlarmRecord: function useAlarmRecord(id, alarmTypeCode, start, end, page) {
    var _a, _b;
    var _useRequest10 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get('/cloud/ljsy-reborn/api/collect/point/alarm/alarmPage', {
          data: {
            collectPointIds: id,
            alarmTypeCode: alarmTypeCode,
            startDate: start,
            endDate: end,
            page: page,
            size: 10
          }
        });
      }, {
        paginated: true,
        refreshDeps: [id, alarmTypeCode, start, end, page]
      }),
      alarmRecordRes = _useRequest10.data;
    var dataSource = ((_a = alarmRecordRes === null || alarmRecordRes === void 0 ? void 0 : alarmRecordRes.data) === null || _a === void 0 ? void 0 : _a.rows) || [];
    var total = (_b = alarmRecordRes === null || alarmRecordRes === void 0 ? void 0 : alarmRecordRes.data) === null || _b === void 0 ? void 0 : _b.total;
    return {
      detail: {
        dataSource: dataSource,
        total: total
      }
    };
  }
};
exports.AlarmService = AlarmService;
//# sourceMappingURL=api.js.map
