"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"] = YXXX;
var _react = _interopRequireWildcard(require("react"));
require("./index.less");
var _vmFilter = require("../../../vm-filter");
var _moment = _interopRequireDefault(require("moment"));
var _api = require("../../api");
var _util = require("../../..//util");
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); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function YXXX(_ref) {
  var id = _ref.id;
  var _a, _b, _c, _d;
  var _useState = (0, _react.useState)((0, _moment["default"])()),
    _useState2 = _slicedToArray(_useState, 2),
    date = _useState2[0],
    setDate = _useState2[1];
  var _BaseService$useDaily = _api.BaseService.useDailyCarRun(id, date.format('YYYY-MM-DD'), date.format('YYYY-MM-DD')),
    dailyCarRunRes = _BaseService$useDaily.dailyCarRunRes;
  var _BaseService$useZlOth = _api.BaseService.useZlOtherInfo(id, date.format('YYYY-MM-DD'), date.format('YYYY-MM-DD')),
    zlOtherInfoData = _BaseService$useZlOth.zlOtherInfoData;
  var _ref2 = zlOtherInfoData || {},
    orderCount = _ref2.orderCount,
    yysWeight = _ref2.yysWeight,
    lxplAlarmCount = _ref2.lxplAlarmCount,
    tccsAlarmCount = _ref2.tccsAlarmCount;
  var columns_left = [{
    name: '核算行驶里程',
    key: 'hsxslc',
    num: (_b = (_a = dailyCarRunRes === null || dailyCarRunRes === void 0 ? void 0 : dailyCarRunRes[0]) === null || _a === void 0 ? void 0 : _a.sumMileage) !== null && _b !== void 0 ? _b : 0,
    unit: 'km'
  }, {
    name: '作业时长',
    key: 'zysc',
    num: (0, _util.secondToFormatTime)(((_d = (_c = dailyCarRunRes === null || dailyCarRunRes === void 0 ? void 0 : dailyCarRunRes[0]) === null || _c === void 0 ? void 0 : _c.driveDuration) !== null && _d !== void 0 ? _d : 0) / 1000 || 0),
    unit: ''
  }];
  var columns_middle = [{
    name: '完成联单数',
    key: 'wcld',
    num: orderCount !== null && orderCount !== void 0 ? orderCount : 0,
    unit: '单'
  }, {
    name: '已运输量',
    key: 'yysl',
    num: yysWeight !== null && yysWeight !== void 0 ? yysWeight : 0,
    unit: '吨'
  }];
  var columns_right = [{
    name: '路线偏移报警数',
    key: 'lxpy',
    num: lxplAlarmCount !== null && lxplAlarmCount !== void 0 ? lxplAlarmCount : 0,
    unit: '条',
    color: '#F5222D'
  }, {
    name: '停车超时报警数',
    key: 'tccs',
    num: tccsAlarmCount !== null && tccsAlarmCount !== void 0 ? tccsAlarmCount : 0,
    unit: '条',
    color: '#F5222D'
  }];
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "jzlj-card-title"
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: "jzlj-card-title-text"
  }, "\u8FD0\u884C\u4FE1\u606F"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "jzlj-card-title-right"
  }, /*#__PURE__*/_react["default"].createElement(_vmFilter.VMDatePicker, {
    value: date,
    onChange: function onChange(date) {
      setDate(date);
    }
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "jzlj-card-content"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "yxxx"
  }, [columns_left, columns_middle, columns_right].map(function (column, index) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "yxxx-item",
      key: index
    }, column.map(function (item) {
      return /*#__PURE__*/_react["default"].createElement("div", {
        style: {
          textAlign: 'center'
        },
        key: item.key
      }, /*#__PURE__*/_react["default"].createElement("div", {
        className: "name"
      }, item.name), /*#__PURE__*/_react["default"].createElement("div", {
        className: "num",
        style: {
          color: item.color
        }
      }, /*#__PURE__*/_react["default"].createElement("span", null, item.num), /*#__PURE__*/_react["default"].createElement("span", {
        className: "unit"
      }, item.unit)));
    }));
  }))));
}
//# sourceMappingURL=YXXX.js.map
