function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var _excluded = ["startingPointId", "page", "size"],
  _excluded2 = ["startingPointId"],
  _excluded3 = ["startingPointId", "stepThreeOperateTimeLeft", "stepThreeOperateTimeRight", "page", "size"],
  _excluded4 = ["startingPointId", "stepThreeOperateTimeLeft", "stepThreeOperateTimeRight"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { getVtxToken, request } from '@vtx/utils';
import { useRequest } from 'ahooks';
import dayjs from 'dayjs';
var overviewApis = {
  useInfo: function useInfo(id) {
    var _useRequest = useRequest(function () {
        return request.get('/cloud/jcss-reborn/facility/get', {
          data: {
            id: id,
            coordType: 'wgs84'
          }
        });
      }, {
        ready: !!id,
        refreshDeps: [id]
      }),
      data = _useRequest.data;
    return {
      info: (data === null || data === void 0 ? void 0 : data.data) || {}
    };
  },
  useJcssBubble: function useJcssBubble(id) {
    var _useRequest2 = useRequest(function () {
        return request.get('/cloud/jzlj/web/api/gis/real/time/jcssBubble', {
          data: {
            id: id,
            coordType: 'wgs84'
          }
        });
      }, {
        ready: !!id,
        refreshDeps: [id]
      }),
      data = _useRequest2.data;
    return {
      jcssBubbleData: (data === null || data === void 0 ? void 0 : data.data) || {}
    };
  },
  // 处置证信息
  useCzz: function useCzz(id) {
    var _useRequest3 = useRequest(function () {
        return request.get('/cloud/jzlj/web/api/gis/real/time/jcssCzzInfo', {
          data: {
            id: id,
            startEndType: 'END'
          }
        });
      }),
      data = _useRequest3.data;
    return {
      data: (data === null || data === void 0 ? void 0 : data.data) || {}
    };
  },
  // 出土量分析
  useCtl: function useCtl(id) {
    var _useRequest4 = useRequest(function () {
        return request.get('/cloud/jzlj/web/api/gis/real/time/jcssOrderCzzSummary', {
          data: {
            id: id,
            startEndType: 'END',
            startDate: dayjs().format('YYYY-MM-DD'),
            endDate: dayjs().format('YYYY-MM-DD')
          }
        });
      }),
      data = _useRequest4.data,
      loading = _useRequest4.loading;
    return {
      data: (data === null || data === void 0 ? void 0 : data.data) || {},
      loading: loading
    };
  },
  // 出土运量
  useCtyl: function useCtyl(id) {
    var _useRequest5 = useRequest(function () {
        return request.get('/cloud/jzlj/web/api/gis/real/time/jcssOrderAnalyse', {
          data: {
            id: id,
            startEndType: 'END',
            startDate: dayjs().subtract(6, 'day').format('YYYY-MM-DD'),
            endDate: dayjs().format('YYYY-MM-DD')
          }
        });
      }),
      data = _useRequest5.data,
      loading = _useRequest5.loading;
    return {
      data: (data === null || data === void 0 ? void 0 : data.data) || {},
      loading: loading
    };
  }
};
var disposeApis = {
  page: function page(_ref) {
    var startingPointId = _ref.startingPointId,
      _page = _ref.page,
      size = _ref.size,
      restParams = _objectWithoutProperties(_ref, _excluded);
    return request.get("/cloud/jzlj/web/api/disposal/certificate/info/page", {
      data: _objectSpread({
        page: _page,
        size: size,
        endingPointId: startingPointId
      }, restParams)
    });
  },
  list: function list(_ref2) {
    var startingPointId = _ref2.startingPointId,
      restParams = _objectWithoutProperties(_ref2, _excluded2);
    return request.get("/cloud/jzlj/web/api/disposal/certificate/info/list", {
      data: _objectSpread({
        endingPointId: startingPointId,
        coordinateType: 'wgs84'
      }, restParams)
    });
  }
};

// 联单
var collectionApis = {
  page: function page(_ref3) {
    var startingPointId = _ref3.startingPointId,
      stepThreeOperateTimeLeft = _ref3.stepThreeOperateTimeLeft,
      stepThreeOperateTimeRight = _ref3.stepThreeOperateTimeRight,
      _page2 = _ref3.page,
      size = _ref3.size,
      restParams = _objectWithoutProperties(_ref3, _excluded3);
    return request.get("/cloud/jzlj/web/api/car/transport/joint/order/record/page", {
      data: _objectSpread({
        page: _page2,
        size: size,
        endingPointId: startingPointId,
        stepThreeOperateTimeLeft: stepThreeOperateTimeLeft,
        stepThreeOperateTimeRight: stepThreeOperateTimeRight
      }, restParams)
    });
  },
  // 统计
  total: function total(_ref4) {
    var startingPointId = _ref4.startingPointId,
      stepThreeOperateTimeLeft = _ref4.stepThreeOperateTimeLeft,
      stepThreeOperateTimeRight = _ref4.stepThreeOperateTimeRight,
      restParams = _objectWithoutProperties(_ref4, _excluded4);
    return request.get("/cloud/jzlj/web/api/gis/real/time/jcssJzJointOrderSummaryStatistics", {
      data: _objectSpread({
        endingPointId: startingPointId,
        stepThreeOperateTimeLeft: stepThreeOperateTimeLeft,
        stepThreeOperateTimeRight: stepThreeOperateTimeRight
      }, restParams)
    });
  },
  // 图表
  jcssOrderAnalyse: function jcssOrderAnalyse(_ref5) {
    var startingPointId = _ref5.startingPointId,
      startDate = _ref5.startDate,
      endDate = _ref5.endDate;
    return request.get("/cloud/jzlj/web/api/gis/real/time/jcssOrderAnalyse", {
      data: {
        id: startingPointId,
        startDate: startDate,
        endDate: endDate,
        startEndType: 'END'
      }
    });
  }
};
export { collectionApis, disposeApis, overviewApis };

// 建筑垃圾枚举
export var fetchJzljEnum = function fetchJzljEnum(enumName) {
  var _useRequest6 = useRequest(function () {
      return request.get("/cloud/jzlj/common/loadEnumValue", {
        data: {
          enumName: enumName
        }
      });
    }, {
      refreshDeps: [enumName]
    }),
    _useRequest6$data = _useRequest6.data,
    data = _useRequest6$data === void 0 ? {} : _useRequest6$data;
  return (data === null || data === void 0 ? void 0 : data.data) || [];
};
export var getByParamTypeCode = function getByParamTypeCode(paramTypeCode) {
  var _useRequest7 = useRequest(function () {
      return request.get("/cloud/management/rest/np/param/getByParamTypeCode", {
        data: {
          parameters: JSON.stringify({
            paramTypeCode: paramTypeCode,
            tenantId: getVtxToken('tenantId')
          })
        }
      });
    }, {
      refreshDeps: [paramTypeCode]
    }),
    _useRequest7$data = _useRequest7.data,
    data = _useRequest7$data === void 0 ? {} : _useRequest7$data;
  return (data === null || data === void 0 ? void 0 : data.data) || [];
};

// 单位
export var useUnit = function useUnit() {
  var _data$data, _unitStr;
  var groupCode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'XTPZ';
  var _useRequest8 = useRequest(function () {
      return request.get("/cloud/jzlj/web/api/tenant/system/config/getConfig", {
        data: {}
      });
    }, {
      refreshDeps: [groupCode]
    }),
    data = _useRequest8.data;
  var obj = {};
  var originalData = data === null || data === void 0 || (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data[groupCode];
  for (var group in originalData) {
    if (originalData.hasOwnProperty(group)) {
      for (var item in originalData[group]) {
        var _originalData$group;
        obj[item] = (_originalData$group = originalData[group]) === null || _originalData$group === void 0 ? void 0 : _originalData$group[item];
      }
    }
  }
  var jointOrderWeightUnitTypeName = obj === null || obj === void 0 ? void 0 : obj.jointOrderWeightUnitTypeName;
  var nameSplitArr = jointOrderWeightUnitTypeName === null || jointOrderWeightUnitTypeName === void 0 ? void 0 : jointOrderWeightUnitTypeName.split('（');
  var unitStr = (nameSplitArr === null || nameSplitArr === void 0 ? void 0 : nameSplitArr[1]) || '吨）';
  unitStr = (_unitStr = unitStr) === null || _unitStr === void 0 ? void 0 : _unitStr.replace('）', '');
  return {
    unitStr: unitStr
  };
};

// 处置证字段配置
export var useCzzFields = function useCzzFields() {
  var _useRequest9 = useRequest(function () {
      return request.get("/cloud/jzlj/web/field/config/list", {
        data: {
          ledgerType: 'CZHZBA'
        }
      });
    }, {
      refreshDeps: []
    }),
    res = _useRequest9.data;
  var dataList = (res === null || res === void 0 ? void 0 : res.data) || [];
  var visibleList = dataList.filter(function (item) {
    var _item$functionKeys;
    return ['YES', 'YES_NO_UPDATE'].includes(item.isVisible) && ['YES', 'YES_NO_UPDATE'].includes(item.listVisible) && (item === null || item === void 0 || (_item$functionKeys = item.functionKeys) === null || _item$functionKeys === void 0 || (_item$functionKeys = _item$functionKeys.split(',')) === null || _item$functionKeys === void 0 ? void 0 : _item$functionKeys.includes('modal_show'));
  });
  return {
    visibleList: visibleList
  };
};

// 联单字段配置
export var useLdFields = function useLdFields() {
  var _useRequest10 = useRequest(function () {
      return request.get("/cloud/jzlj/web/field/config/list", {
        data: {
          ledgerType: 'CLYSLD'
        }
      });
    }, {
      refreshDeps: []
    }),
    res = _useRequest10.data;
  var dataList = (res === null || res === void 0 ? void 0 : res.data) || [];
  var visibleList = dataList.filter(function (item) {
    var _item$functionKeys2;
    return ['YES', 'YES_NO_UPDATE'].includes(item.isVisible) && ['YES', 'YES_NO_UPDATE'].includes(item.listVisible) && (item === null || item === void 0 || (_item$functionKeys2 = item.functionKeys) === null || _item$functionKeys2 === void 0 || (_item$functionKeys2 = _item$functionKeys2.split(',')) === null || _item$functionKeys2 === void 0 ? void 0 : _item$functionKeys2.includes('modal_show'));
  });
  return {
    visibleList: visibleList
  };
};