"use strict";

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); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var _api = require("../../api");
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _index = require("../../index");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var CollectRecord = function CollectRecord(_ref) {
  var id = _ref.id,
    startTime = _ref.startTime,
    endTime = _ref.endTime,
    garbageType = _ref.garbageType;
  var _useContext = (0, _react.useContext)(_index.CcUnitContext),
    openRestaurant = _useContext.openRestaurant,
    openCar = _useContext.openCar;
  var tableProps = _api.BasicService.collectList({
    startTime: startTime,
    endTime: endTime,
    id: id,
    garbageType: garbageType
  });
  var columns = [{
    title: '产生单位',
    dataIndex: 'restaurantName',
    width: 100,
    ellipsis: true,
    render: function render(text, record) {
      return text ? /*#__PURE__*/_react["default"].createElement("a", {
        onClick: function onClick() {
          return openRestaurant && openRestaurant({
            id: record.restaurantId,
            title: record.restaurantName
          });
        }
      }, text) : '-';
    }
  }, {
    title: '垃圾净重(kg)',
    dataIndex: 'netWeight',
    width: 180,
    align: 'right',
    sorter: true
  }, {
    title: '车牌号',
    dataIndex: 'carCode',
    width: 100,
    ellipsis: true,
    render: function render(text, record) {
      return /*#__PURE__*/_react["default"].createElement("a", {
        onClick: function onClick() {
          return openCar && openCar({
            id: record.carId,
            title: record.carCode
          });
        }
      }, text);
    }
  }];
  return /*#__PURE__*/_react["default"].createElement(_vmTable["default"], Object.assign({}, tableProps, {
    columns: columns,
    height: 400
  }));
};
var _default = exports["default"] = CollectRecord;
//# sourceMappingURL=CollectRecord.js.map
