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); }
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); }
/**
 * 收集点-总览信息-车辆作业信息
 */
import { VmTable } from "../../../_components";
import track from "../../imgs/track.png";
import { jsx as _jsx } from "react/jsx-runtime";
export default function CarWork(props) {
  var _paramConfigsList$SHO, _paramConfigsList$SHO2, _paramConfigsList$SHO3;
  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__*/_jsx("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]));
        },
        children: /*#__PURE__*/_jsx("img", {
          src: track
        })
      });
    }
  }];
  var bucketIdx = 3,
    weightIdx = 3;
  if (((_paramConfigsList$SHO = paramConfigsList['SHOW_TENDER']) === null || _paramConfigsList$SHO === void 0 ? void 0 : _paramConfigsList$SHO.value) === 'true') {
    columns.splice(3, 0, {
      title: '标段',
      key: 'bidSectionName',
      dataIndex: 'bidSectionName',
      width: '10%',
      ellipsis: true
    });
    bucketIdx = 4;
    weightIdx = 4;
  }
  if (((_paramConfigsList$SHO2 = paramConfigsList['SHOW_COLLECTING_BUCKETS']) === null || _paramConfigsList$SHO2 === void 0 ? void 0 : _paramConfigsList$SHO2.value) === 'true') {
    columns.splice(bucketIdx, 0, {
      title: '桶数(桶)',
      dataIndex: 'bucketNum',
      key: 'bucketNum',
      width: '12%',
      ellipsis: true,
      align: 'right'
    });
    weightIdx = bucketIdx + 1;
  }
  if (((_paramConfigsList$SHO3 = paramConfigsList['SHOW_WEIGHTING']) === null || _paramConfigsList$SHO3 === void 0 ? void 0 : _paramConfigsList$SHO3.value) === 'true') {
    columns.splice(weightIdx, 0, {
      title: '收集重量(kg)',
      dataIndex: 'weight',
      key: 'weight',
      width: '15%',
      ellipsis: true,
      align: 'right'
    });
  }
  var tableProps = {
    scroll: {
      y: 194,
      x: '100%'
    },
    pagination: {
      current: 1,
      pageSize: 10
    },
    indexWidth: '8%',
    dataSource: (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 ? dataSource.map(function (ele, index) {
      var _ele$bidSectionName;
      return _objectSpread(_objectSpread({}, ele), {}, {
        bidSectionName: (_ele$bidSectionName = ele.bidSectionName) !== null && _ele$bidSectionName !== void 0 ? _ele$bidSectionName : '-',
        index: index
      });
    }) : []
  };
  return /*#__PURE__*/_jsx(VmTable, _objectSpread({
    columns: columns,
    rowKey: "index"
  }, tableProps));
}