"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = TodayRun;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _api = require("../../api");
var _outTime = _interopRequireDefault(require("../../imgs/outTime.png"));
var _runTime = _interopRequireDefault(require("../../imgs/runTime.png"));
var _outTime_light = _interopRequireDefault(require("../../imgs/outTime_light.png"));
var _runTime_light = _interopRequireDefault(require("../../imgs/runTime_light.png"));
var _outTime_blue = _interopRequireDefault(require("../../imgs/outTime_blue.png"));
var _runTime_blue = _interopRequireDefault(require("../../imgs/runTime_blue.png"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 今日运行-通用
 */

function TodayRun(props) {
  var _a, _b;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme;
  var id = props.id,
    data = props.data;
  var _BaseService$useDaily = _api.BaseService.useDailyCarRun(id, (0, _moment["default"])().format('YYYY-MM-DD'), (0, _moment["default"])().format('YYYY-MM-DD')),
    dailyCarRunRes = _BaseService$useDaily.dailyCarRunRes;
  var columns = [{
    title: '报警类型',
    dataIndex: 'alarmTypeName',
    key: 'alarmTypeName',
    width: 100,
    ellipsis: true
  }, {
    title: '报警时间',
    dataIndex: 'day',
    key: 'day',
    width: 100,
    render: function render(_text, record) {
      return "".concat((0, _moment["default"])(record.detail.alarmBeginTime).format('HH:mm:ss'), "-").concat((0, _moment["default"])(record.detail.alarmEndTime).format('HH:mm:ss'));
    }
  }, {
    title: '报警内容',
    dataIndex: 'alarmTypeName',
    key: 'alarmTypeName',
    ellipsis: true,
    render: function render(_text, record) {
      return record.detail.alarmTypeName;
    }
  }];
  var tableProps = {
    height: 220,
    paganitation: false,
    dataSource: data
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run-head"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run-head-item"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: theme === 'dark' ? _outTime["default"] : theme === 'blue' ? _outTime_blue["default"] : _outTime_light["default"]
  }), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run-head-item--name"
  }, "\u51FA\u8F66\u65F6\u95F4"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run-head-item--value"
  }, (dailyCarRunRes === null || dailyCarRunRes === void 0 ? void 0 : dailyCarRunRes.length) > 0 ? ((_a = dailyCarRunRes[0]) === null || _a === void 0 ? void 0 : _a.firstRunTime) || 0 : 0))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run-head-item"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: theme === 'dark' ? _runTime["default"] : theme === 'blue' ? _runTime_blue["default"] : _runTime_light["default"]
  }), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run-head-item--name"
  }, "\u8FD0\u884C\u65F6\u957F"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "today-run-head-item--value"
  }, (dailyCarRunRes === null || dailyCarRunRes === void 0 ? void 0 : dailyCarRunRes.length) > 0 ? (_b = dailyCarRunRes[0]) === null || _b === void 0 ? void 0 : _b.driveDurationStr : 0)))), /*#__PURE__*/_react["default"].createElement(_vmTable["default"], Object.assign({
    columns: columns,
    isIndex: false,
    rowKey: "index"
  }, tableProps)));
}
//# sourceMappingURL=TodayRun.js.map
