"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = TodayWorkTable;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _api = require("../../api");
var _track = _interopRequireDefault(require("../../imgs/track.png"));
var _useSettings3 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _dayjs = _interopRequireDefault(require("dayjs"));
var _antd = require("antd");
var _icons = require("@ant-design/icons");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 路段-总览信息-今日作业
 */

function TodayWorkTable(props) {
  var id = props.id,
    service = props.service,
    setIframeModalInfo = props.setIframeModalInfo;
  var _useSettings = (0, _useSettings3["default"])(),
    date = _useSettings.date;
  var _useSettings2 = (0, _useSettings3["default"])(),
    theme = _useSettings2.theme;
  var _BaseService$useRecor = _api.BaseService.useRecordService(id, date || (0, _moment["default"])().format('YYYY-MM-DD'), service),
    dataSource = _BaseService$useRecor.carWorkRecord;
  var columns = [{
    title: '车牌号',
    dataIndex: 'carCode',
    key: 'carCode',
    ellipsis: true
  }, {
    title: '作业类型',
    dataIndex: 'workTypeName',
    key: 'workTypeName',
    width: 80,
    ellipsis: true
  }, {
    title: '作业趟数',
    dataIndex: 'workCount',
    key: 'workCount',
    width: 80
  }, {
    title: '作业里程(km)',
    dataIndex: 'realWorkMileage',
    key: 'realWorkMileage',
    width: 100
  }, {
    title: (/*#__PURE__*/_react["default"].createElement("span", null, "\u6838\u7B97\u4F5C\u4E1A\u91CC\u7A0B(km)", /*#__PURE__*/_react["default"].createElement(_antd.Tooltip, {
      title: "\u6838\u7B97\u4F5C\u4E1A\u91CC\u7A0B\uFF1A\u6839\u636E\u4F5C\u4E1A\u8DEF\u6BB5\u957F\u5EA6\u548C\u4F5C\u4E1A\u89C4\u5219\uFF0C\u540C\u4E00\u8DEF\u6BB5\u540C\u4E00\u65F6\u6BB5\u7684\u4F5C\u4E1A\u7C7B\u578B\u4E0B\uFF0C\u4E0D\u53EF\u8D85\u8FC7\u8BA1\u5212\u4F5C\u4E1A\u91CC\u7A0B\u3002"
    }, /*#__PURE__*/_react["default"].createElement(_icons.QuestionCircleOutlined, {
      style: {
        marginLeft: 8
      }
    })))),
    dataIndex: 'workMileage',
    key: 'workMileage',
    width: 120
  }, {
    title: '轨迹',
    dataIndex: 'track',
    key: 'track',
    width: 40,
    render: function render(_text, record) {
      return /*#__PURE__*/_react["default"].createElement("a", {
        onClick: function onClick() {
          var prefix = '';
          var prefixList = location.pathname.split('/').filter(function (item) {
            return item;
          });
          if (prefixList.length === 2) {
            prefix = "/".concat(prefixList[0]);
          }
          var src = "".concat(prefix, "/carHistory/#/index?carId=").concat(record.carId, "&").concat(location.href.split('?')[1]);
          if (service === 'zyqs-zqb') {
            src = "".concat(prefix, "/carHistory/#/zyqsHistory?carId=").concat(record.carId, "&theme=").concat(theme == 'blue' ? 'dark' : theme, "&startTime=").concat((0, _dayjs["default"])(date).format('YYYY-MM-DD 00:00:00'), "&endTime=").concat((0, _dayjs["default"])(date).format('YYYY-MM-DD 23:59:59'), "&").concat(location.href.split('?')[1]);
          }
          setIframeModalInfo({
            title: '车辆轨迹',
            visible: true,
            src: src
          });
        }
      }, /*#__PURE__*/_react["default"].createElement("img", {
        src: _track["default"]
      }));
    }
  }];
  var tableProps = {
    height: 260,
    pagination: {
      defaultCurrent: 1,
      total: (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0
    },
    columns: columns,
    isIndex: false,
    rowKey: 'index',
    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(_vmTable["default"], Object.assign({}, tableProps));
}
//# sourceMappingURL=TodayWorkTable.js.map
