"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");
var _FactoryCharts = _interopRequireDefault(require("./FactoryCharts"));
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 Factory = function Factory(_ref) {
  var id = _ref.id,
    startTime = _ref.startTime,
    endTime = _ref.endTime,
    _ref$height = _ref.height,
    height = _ref$height === void 0 ? 120 : _ref$height,
    _ref$showCharts = _ref.showCharts,
    showCharts = _ref$showCharts === void 0 ? false : _ref$showCharts;
  var _useContext = (0, _react.useContext)(_index.CcUnitContext),
    openCar = _useContext.openCar;
  var tableProps = _api.BasicService.factoryPage({
    startTime: startTime,
    endTime: endTime,
    id: id
  });
  var list = _api.BasicService.factoryList({
    startTime: startTime,
    endTime: endTime,
    id: id
  });
  var columns = [{
    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);
    }
  }, {
    title: '处置单位',
    dataIndex: 'handleUnit',
    width: 150,
    ellipsis: true
  }, {
    title: '进厂时间',
    dataIndex: 'grossDateTime',
    width: 150,
    sorter: true
  }, {
    title: '净重（kg）',
    dataIndex: 'netWeight',
    width: 120,
    align: 'right',
    sorter: true
  }];
  return showCharts ? (/*#__PURE__*/_react["default"].createElement(_FactoryCharts["default"], {
    list: list
  })) : (/*#__PURE__*/_react["default"].createElement(_vmTable["default"], Object.assign({}, tableProps, {
    columns: columns,
    height: height
  })));
};
var _default = exports["default"] = Factory;
//# sourceMappingURL=Factory.js.map
