"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fetchJzljEnum = exports.DisposeService = exports.CollectionService = exports.BaseService = exports.AlarmService = void 0;
var _tslib = require("tslib");
var _utils = require("@vtx/utils");
var _ahooks = require("ahooks");
var prefix = process.env.PREFIX || '';
var BaseService = exports.BaseService = {
  useBaseInfo: function useBaseInfo(id) {
    var _a, _b;
    var _useRequest = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("".concat(prefix, "/cloud/gps-reborn/sdk/car/getCarInfoByProductType"), {
          data: {
            carId: id
          }
        });
      }, {
        refreshDeps: [id]
      }),
      baseInfoRes = _useRequest.data;
    var info = baseInfoRes === null || baseInfoRes === void 0 ? void 0 : baseInfoRes.data;
    var baseInfo = [{
      label: '所属单位',
      key: 'deptName',
      value: info === null || info === void 0 ? void 0 : info.deptName
    }, {
      label: '使用单位',
      key: 'useUnitName',
      value: info === null || info === void 0 ? void 0 : info.useUnitName
    }, {
      label: '行政区划',
      key: 'divisionName',
      value: info === null || info === void 0 ? void 0 : info.divisionName
    }, {
      label: '责任人',
      key: 'manageStaffName',
      value: info === null || info === void 0 ? void 0 : info.manageStaffName
    }, {
      label: '联系人',
      key: 'contact',
      value: info === null || info === void 0 ? void 0 : info.contact
    }, {
      label: '联系电话',
      key: 'contactWay',
      value: info === null || info === void 0 ? void 0 : info.contactWay
    }, {
      label: '最后定位时间',
      key: 'equipmentTime',
      value: info === null || info === void 0 ? void 0 : info.equipmentTime
    }, {
      label: '当前位置',
      key: 'address',
      value: info === null || info === void 0 ? void 0 : info.address
    }];
    var _useRequest2 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("".concat(prefix, "/cloud/jcss-reborn/facility/type/config/getByCode"), {
          data: {
            code: 'jzlj-car'
          }
        });
      }, {
        refreshDeps: [id]
      }),
      tabConfig = _useRequest2.data;
    return {
      baseInfo: baseInfo,
      info: info,
      tabConfig: ((_b = (_a = tabConfig === null || tabConfig === void 0 ? void 0 : tabConfig.data) === null || _a === void 0 ? void 0 : _a.popupConfigJson) === null || _b === void 0 ? void 0 : _b.filter(function (ele) {
        return ele.display && !ele.code.includes('default');
      }).map(function (ele) {
        return {
          key: ele.code,
          title: ele.name
        };
      })) || []
    };
  },
  useDailyCarRun: function useDailyCarRun(id, beginTime, endTime) {
    //今日运行
    var _useRequest3 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("".concat(prefix, "/cloud/gps-reborn/report/dailyCarRun/list"), {
          data: {
            carIds: id,
            reportDateStart: beginTime,
            reportDateEnd: endTime
          }
        });
      }, {
        refreshDeps: [id, beginTime, endTime]
      }),
      dailyCarRunRes = _useRequest3.data;
    return {
      dailyCarRunRes: (dailyCarRunRes === null || dailyCarRunRes === void 0 ? void 0 : dailyCarRunRes.data) || []
    };
  },
  // 近7天运行分析
  useYxfx: function useYxfx(carId, startDate, endDate) {
    var _useRequest4 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("".concat(prefix, "/cloud/jzlj/web/dz/kanban/carWorkAnalyse"), {
          data: {
            id: carId,
            startDate: startDate,
            endDate: endDate
          }
        });
      }, {
        refreshDeps: [carId, startDate, endDate]
      }),
      yxfxRes = _useRequest4.data;
    return {
      yxfxData: (yxfxRes === null || yxfxRes === void 0 ? void 0 : yxfxRes.data) || []
    };
  },
  // 总览其他信息：二维码、生效中处置证、联单、报警
  useZlOtherInfo: function useZlOtherInfo(carId, startDate, endDate, url) {
    var _useRequest5 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("".concat(prefix, "/cloud/jzlj/web/api/gis/real/time/carBaseInfo"), {
          data: {
            id: carId,
            startDate: startDate,
            endDate: endDate,
            url: url
          }
        });
      }, {
        refreshDeps: [carId, startDate, endDate]
      }),
      zlOtherInfoRes = _useRequest5.data;
    return {
      zlOtherInfoData: (zlOtherInfoRes === null || zlOtherInfoRes === void 0 ? void 0 : zlOtherInfoRes.data) || {}
    };
  }
};
var DisposeService = exports.DisposeService = {
  page: function page(_a) {
    var carCode = _a.carCode,
      page = _a.page,
      size = _a.size,
      restParams = (0, _tslib.__rest)(_a, ["carCode", "page", "size"]);
    return _utils.request.get("/cloud/jzlj/web/api/disposal/certificate/info/page", {
      data: Object.assign({
        page: page,
        size: size,
        effectiveCarCode: carCode
      }, restParams)
    });
  },
  pie: function pie(_a) {
    var id = _a.id,
      page = _a.page,
      size = _a.size,
      restParams = (0, _tslib.__rest)(_a, ["id", "page", "size"]);
    return _utils.request.get("/cloud/jzlj//web/api/gis/real/time/carCzzPieChart", {
      data: Object.assign({
        page: page,
        size: size,
        id: id
      }, restParams)
    });
  }
};
var CollectionService = exports.CollectionService = {
  page: function page(_a) {
    var carId = _a.carId,
      stepThreeOperateTimeLeft = _a.stepThreeOperateTimeLeft,
      stepThreeOperateTimeRight = _a.stepThreeOperateTimeRight,
      page = _a.page,
      size = _a.size,
      restParams = (0, _tslib.__rest)(_a, ["carId", "stepThreeOperateTimeLeft", "stepThreeOperateTimeRight", "page", "size"]);
    return _utils.request.get("/cloud/jzlj/web/api/car/transport/joint/order/record/page", {
      data: Object.assign({
        page: page,
        size: size,
        carId: carId,
        stepThreeOperateTimeLeft: stepThreeOperateTimeLeft,
        stepThreeOperateTimeRight: stepThreeOperateTimeRight
      }, restParams)
    });
  },
  // 统计
  total: function total(carId, startDate, endDate, restParams) {
    return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssJzJointOrderSummaryStatistics", {
      data: Object.assign({
        carId: carId,
        // startDate,
        // endDate,
        stepThreeOperateTimeLeft: startDate + ' 00:00:00',
        stepThreeOperateTimeRight: endDate + ' 23:59:59'
      }, restParams)
    });
  }
};
var AlarmService = exports.AlarmService = {
  page_tccs: function page_tccs(_ref) {
    var carId = _ref.carId,
      startTime = _ref.startTime,
      endTime = _ref.endTime,
      page = _ref.page,
      size = _ref.size;
    return _utils.request.get("/cloud/jzlj/web/api/car/parking/timeout/alarm/job/page", {
      data: {
        page: page,
        size: size,
        carId: carId,
        alarmTimeLeft: startTime,
        alarmTimeRight: endTime
      }
    });
  },
  page_lxpl: function page_lxpl(_ref2) {
    var carId = _ref2.carId,
      startTime = _ref2.startTime,
      endTime = _ref2.endTime,
      page = _ref2.page,
      size = _ref2.size;
    return _utils.request.get("/cloud/jzlj/web/api/car/route/deviation/alarm/job/page", {
      data: {
        page: page,
        size: size,
        carId: carId,
        alarmTimeLeft: startTime,
        alarmTimeRight: endTime
      }
    });
  },
  // 报警汇总-饼图
  useAlarmSummary: function useAlarmSummary(carId, startDate, endDate) {
    var _useRequest6 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/dz/kanban/carAlarmTypeCountSummaryInfo", {
          data: {
            carId: carId,
            startDate: startDate,
            endDate: endDate,
            alarmTypes: 'parkingTimeout,routeDeviation'
          }
        });
      }, {
        refreshDeps: [carId, startDate, endDate]
      }),
      alarmSummaryRes = _useRequest6.data;
    return {
      alarmSummaryData: (alarmSummaryRes === null || alarmSummaryRes === void 0 ? void 0 : alarmSummaryRes.data) || {}
    };
  },
  // 报警趋势-折线图
  useAlarmTrend: function useAlarmTrend(id, startDate, endDate) {
    var _useRequest7 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/carOrderAlarmAnalyse", {
          data: {
            id: id,
            startDate: startDate,
            endDate: endDate
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate]
      }),
      alarmTrendRes = _useRequest7.data;
    return {
      alarmTrendData: (alarmTrendRes === null || alarmTrendRes === void 0 ? void 0 : alarmTrendRes.data) || []
    };
  }
};
var fetchJzljEnum = exports.fetchJzljEnum = function fetchJzljEnum(enumName) {
  var _useRequest8 = (0, _ahooks.useRequest)(function () {
      return _utils.request.get("".concat(prefix, "/cloud/jzlj/common/loadEnumValue"), {
        data: {
          enumName: enumName
        }
      });
    }, {
      refreshDeps: [enumName]
    }),
    _useRequest8$data = _useRequest8.data,
    data = _useRequest8$data === void 0 ? {} : _useRequest8$data;
  return (data === null || data === void 0 ? void 0 : data.data) || [];
};
//# sourceMappingURL=api.js.map
