"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = CarWork;
var _react = _interopRequireDefault(require("react"));
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _track = _interopRequireDefault(require("../../imgs/track.png"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 收集点-总览信息-车辆作业信息
 */

function CarWork(props) {
  var _a, _b, _c;
  var dataSource = props.dataSource,
    paramConfigsList = props.paramConfigsList,
    isDark = props.isDark;
  var columns = [{
    title: '车牌号',
    dataIndex: 'carCode',
    key: 'carCode',
    ellipsis: true,
    width: '15%'
  }, {
    title: '收运单位',
    key: 'collectUnitName',
    dataIndex: 'collectUnitName',
    ellipsis: true,
    width: '16%'
  }, {
    title: '垃圾类型',
    dataIndex: 'productTypeName',
    key: 'productTypeName',
    width: '12%',
    ellipsis: true
  }, {
    title: '收集频次(次)',
    dataIndex: 'collectNum',
    key: 'collectNum',
    width: '14%',
    ellipsis: true,
    align: 'right'
  }, {
    title: '轨迹',
    dataIndex: 'carId',
    key: 'carId',
    width: '8%',
    fixed: 'right',
    render: function render(text) {
      return /*#__PURE__*/_react["default"].createElement("div", {
        style: {
          background: '#fff'
        }
      }, /*#__PURE__*/_react["default"].createElement("a", {
        onClick: function onClick() {
          window.open("".concat(location.protocol, "//").concat(location.host, "/carHistory/#/").concat(isDark ? 'index' : 'indexLight', "?carId=").concat(text, "&").concat(location.href.split('?')[1]));
        }
      }, /*#__PURE__*/_react["default"].createElement("img", {
        src: _track["default"]
      })));
    }
  }];
  var bucketIdx = 3,
    weightIdx = 3;
  if (((_a = paramConfigsList['SHOW_TENDER']) === null || _a === void 0 ? void 0 : _a.value) === 'true') {
    columns.splice(3, 0, {
      title: '标段',
      key: 'bidSectionName',
      dataIndex: 'bidSectionName',
      width: '10%',
      ellipsis: true
    });
    bucketIdx = 4;
    weightIdx = 4;
  }
  if (((_b = paramConfigsList['SHOW_COLLECTING_BUCKETS']) === null || _b === void 0 ? void 0 : _b.value) === 'true') {
    columns.splice(bucketIdx, 0, {
      title: '桶数(桶)',
      dataIndex: 'bucketNum',
      key: 'bucketNum',
      width: '12%',
      ellipsis: true,
      align: 'right'
    });
    weightIdx = bucketIdx + 1;
  }
  if (((_c = paramConfigsList['SHOW_WEIGHTING']) === null || _c === void 0 ? void 0 : _c.value) === 'true') {
    columns.splice(weightIdx, 0, {
      title: '收集重量(kg)',
      dataIndex: 'weight',
      key: 'weight',
      width: '15%',
      ellipsis: true,
      align: 'right'
    });
  }
  var tableProps = {
    scroll: {
      y: 240,
      x: '100%'
    },
    height: 240,
    pagination: {
      current: 1,
      pageSize: 10
    },
    dataSource: (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 ? dataSource.map(function (ele, index) {
      return Object.assign(Object.assign({}, ele), {
        index: index
      });
    }) : []
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      padding: 10
    }
  }, /*#__PURE__*/_react["default"].createElement(_vmTable["default"], Object.assign({
    columns: columns,
    rowKey: "index"
  }, tableProps)));
}
//# sourceMappingURL=CarWork.js.map
