"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getByParamTypeCode = 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 _moment = _interopRequireDefault(require("moment"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var prefix = process.env.PREFIX || '';
var BaseService = exports.BaseService = {
  useBaseInfo: function useBaseInfo(id) {
    var _a, _b, _c;
    var _useRequest = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jcss-reborn/facility/get", {
          data: {
            id: id,
            coordType: 'wgs84'
          }
        });
      }, {
        refreshDeps: [id]
      }),
      baseInfoRes = _useRequest.data;
    var _useRequest2 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssBubble", {
          data: {
            id: id
          }
        });
      }, {
        refreshDeps: [id]
      }),
      jcssBubbleRes = _useRequest2.data;
    var info = baseInfoRes === null || baseInfoRes === void 0 ? void 0 : baseInfoRes.data;
    var jcssBubbleData = jcssBubbleRes === null || jcssBubbleRes === void 0 ? void 0 : jcssBubbleRes.data;
    var baseInfo = [{
      label: '名称',
      key: 'name',
      value: info === null || info === void 0 ? void 0 : info.name
    }, {
      label: '类别',
      key: 'facilityClassName',
      value: info === null || info === void 0 ? void 0 : info.facilityClassName
    }, {
      label: '地址',
      key: 'address',
      value: info === null || info === void 0 ? void 0 : info.address
    }];
    for (var key in jcssBubbleData === null || jcssBubbleData === void 0 ? void 0 : jcssBubbleData.otherWeight) {
      baseInfo.push({
        label: key,
        key: key,
        value: jcssBubbleData === null || jcssBubbleData === void 0 ? void 0 : jcssBubbleData.otherWeight[key]
      });
    }
    var _BaseService$useCzzxx = BaseService.useCzzxx(id),
      czzxxData = _BaseService$useCzzxx.czzxxData;
    baseInfo.push({
      label: '剩余量(吨)',
      key: 'syWeight',
      value: (_a = czzxxData === null || czzxxData === void 0 ? void 0 : czzxxData.syWeight) !== null && _a !== void 0 ? _a : '--'
    });
    var _useRequest3 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("".concat(prefix, "/cloud/jcss-reborn/facility/type/config/getByCode"), {
          data: {
            code: 'jzlj-xnc'
          }
        });
      }, {
        refreshDeps: [id]
      }),
      tabConfig = _useRequest3.data;
    return {
      baseInfo: baseInfo,
      info: info,
      tabConfig: ((_c = (_b = tabConfig === null || tabConfig === void 0 ? void 0 : tabConfig.data) === null || _b === void 0 ? void 0 : _b.popupConfigJson) === null || _c === void 0 ? void 0 : _c.filter(function (ele) {
        return ele.display && !ele.code.includes('default');
      }).map(function (ele) {
        return {
          key: ele.code,
          title: ele.name
        };
      })) || []
    };
  },
  // 处置证信息
  useCzzxx: function useCzzxx(id) {
    var _useRequest4 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssCzzInfo", {
          data: {
            id: id,
            startEndType: 'END'
          }
        });
      }, {
        refreshDeps: [id]
      }),
      czzxxRes = _useRequest4.data;
    return {
      czzxxData: czzxxRes === null || czzxxRes === void 0 ? void 0 : czzxxRes.data
    };
  },
  // 出土量分析、联单汇总
  useCtlfxAndLd: function useCtlfxAndLd(id) {
    var _useRequest5 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssOrderCzzSummary", {
          data: {
            id: id,
            startEndType: 'END',
            startDate: (0, _moment["default"])().format('YYYY-MM-DD'),
            endDate: (0, _moment["default"])().format('YYYY-MM-DD')
          }
        });
      }, {
        refreshDeps: [id]
      }),
      ctlfxAndLdRes = _useRequest5.data;
    return {
      ctlfxAndLdData: ctlfxAndLdRes === null || ctlfxAndLdRes === void 0 ? void 0 : ctlfxAndLdRes.data
    };
  },
  // 联单
  useLdList: function useLdList(id) {
    var _useRequest6 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/api/car/transport/joint/order/record/list", {
          data: {
            endingPointId: id,
            stepThreeOperateTimeLeft: (0, _moment["default"])().format('YYYY-MM-DD 00:00:00'),
            stepThreeOperateTimeRight: (0, _moment["default"])().format('YYYY-MM-DD 23:59:59')
          }
        });
      }, {
        refreshDeps: [id]
      }),
      ldListRes = _useRequest6.data;
    return {
      ldListData: ldListRes === null || ldListRes === void 0 ? void 0 : ldListRes.data
    };
  }
};
// 处置证
var DisposeService = exports.DisposeService = {
  page: function page(_a) {
    var startingPointId = _a.startingPointId,
      page = _a.page,
      size = _a.size,
      restParams = (0, _tslib.__rest)(_a, ["startingPointId", "page", "size"]);
    return _utils.request.get("/cloud/jzlj/web/api/disposal/certificate/info/page", {
      data: Object.assign({
        page: page,
        size: size,
        endingPointId: startingPointId
      }, restParams)
    });
  },
  list: function list(_a) {
    var startingPointId = _a.startingPointId,
      restParams = (0, _tslib.__rest)(_a, ["startingPointId"]);
    return _utils.request.get("/cloud/jzlj/web/api/disposal/certificate/info/list", {
      data: Object.assign({
        endingPointId: startingPointId,
        coordinateType: 'wgs84'
      }, restParams)
    });
  }
};
// 联单
var CollectionService = exports.CollectionService = {
  page: function page(_a) {
    var startingPointId = _a.startingPointId,
      stepThreeOperateTimeLeft = _a.stepThreeOperateTimeLeft,
      stepThreeOperateTimeRight = _a.stepThreeOperateTimeRight,
      page = _a.page,
      size = _a.size,
      restParams = (0, _tslib.__rest)(_a, ["startingPointId", "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,
        endingPointId: startingPointId,
        // stepOneOperateTimeLeft: stepThreeOperateTimeLeft,
        // stepOneOperateTimeRight: stepThreeOperateTimeRight,
        stepThreeOperateTimeLeft: stepThreeOperateTimeLeft,
        stepThreeOperateTimeRight: stepThreeOperateTimeRight
      }, restParams)
    });
  },
  // 统计
  total: function total(startingPointId, stepThreeOperateTimeLeft, stepThreeOperateTimeRight, restParams) {
    return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssJzJointOrderSummaryStatistics", {
      data: Object.assign({
        endingPointId: startingPointId,
        stepThreeOperateTimeLeft: stepThreeOperateTimeLeft,
        stepThreeOperateTimeRight: stepThreeOperateTimeRight
      }, restParams)
    });
  },
  // 图表
  jcssOrderAnalyse: function jcssOrderAnalyse(startingPointId, startDate, endDate) {
    return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssOrderAnalyse", {
      data: {
        id: startingPointId,
        startDate: startDate,
        endDate: endDate,
        startEndType: 'END'
      }
    });
  }
};
// 报警
var AlarmService = exports.AlarmService = {
  // 饼图
  usePie: function usePie(id, startDate, endDate, alarmType) {
    var _useRequest7 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssOrderAlarmPieChart", {
          data: {
            id: id,
            startDate: startDate,
            endDate: endDate,
            alarmType: alarmType
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate, alarmType]
      }),
      pieRes = _useRequest7.data;
    return {
      pieData: pieRes === null || pieRes === void 0 ? void 0 : pieRes.data
    };
  },
  // 折线图
  useLine: function useLine(id, startDate, endDate, alarmType) {
    var _useRequest8 = (0, _ahooks.useRequest)(function () {
        return _utils.request.get("/cloud/jzlj/web/api/gis/real/time/jcssOrderAlarmAnalyse", {
          data: {
            id: id,
            startDate: startDate,
            endDate: endDate,
            alarmType: alarmType,
            startEndType: 'END'
          }
        });
      }, {
        refreshDeps: [id, startDate, endDate, alarmType]
      }),
      lineRes = _useRequest8.data;
    return {
      lineData: lineRes === null || lineRes === void 0 ? void 0 : lineRes.data
    };
  },
  page_tccs: function page_tccs(_ref) {
    var id = _ref.id,
      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,
        endingPointId: id,
        alarmTimeLeft: startTime,
        alarmTimeRight: endTime
      }
    });
  },
  page_lxpl: function page_lxpl(_ref2) {
    var id = _ref2.id,
      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,
        endingPointId: id,
        alarmTimeLeft: startTime,
        alarmTimeRight: endTime
      }
    });
  },
  page_ylyc: function page_ylyc(_ref3) {
    var id = _ref3.id,
      startTime = _ref3.startTime,
      endTime = _ref3.endTime,
      page = _ref3.page,
      size = _ref3.size;
    return _utils.request.get("/cloud/jzlj/web/api/car/transport/alarm/job/page", {
      data: {
        page: page,
        size: size,
        yszdId: id,
        alarmTimeLeft: startTime,
        alarmTimeRight: endTime
      }
    });
  }
};
var fetchJzljEnum = exports.fetchJzljEnum = function fetchJzljEnum(enumName) {
  var _useRequest9 = (0, _ahooks.useRequest)(function () {
      return _utils.request.get("".concat(prefix, "/cloud/jzlj/common/loadEnumValue"), {
        data: {
          enumName: enumName
        }
      });
    }, {
      refreshDeps: [enumName]
    }),
    _useRequest9$data = _useRequest9.data,
    data = _useRequest9$data === void 0 ? {} : _useRequest9$data;
  return (data === null || data === void 0 ? void 0 : data.data) || [];
};
var getByParamTypeCode = exports.getByParamTypeCode = function getByParamTypeCode(paramTypeCode) {
  var _useRequest0 = (0, _ahooks.useRequest)(function () {
      return _utils.request.get("/cloud/management/rest/np/param/getByParamTypeCode", {
        data: {
          parameters: JSON.stringify({
            paramTypeCode: paramTypeCode,
            tenantId: (0, _utils.getVtxToken)('tenantId')
          })
        }
      });
    }, {
      refreshDeps: [paramTypeCode]
    }),
    _useRequest0$data = _useRequest0.data,
    data = _useRequest0$data === void 0 ? {} : _useRequest0$data;
  return (data === null || data === void 0 ? void 0 : data.data) || [];
};
//# sourceMappingURL=api.js.map
