"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = WorkSummaryJxh;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _vmImageText = _interopRequireDefault(require("../../../vm-image-text"));
var _util = require("../../../util");
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _api = require("../../api");
var _zylc = _interopRequireDefault(require("../../imgs/zylc.png"));
var _xslc = _interopRequireDefault(require("../../imgs/xslc.png"));
var _zyl = _interopRequireDefault(require("../../imgs/zyl.png"));
var _zysc = _interopRequireDefault(require("../../imgs/zysc.png"));
var _zycs = _interopRequireDefault(require("../../imgs/zycs.png"));
var _zycssc = _interopRequireDefault(require("../../imgs/zycssc.png"));
var _zylc_light = _interopRequireDefault(require("../../imgs/zylc_light.png"));
var _xslc_light = _interopRequireDefault(require("../../imgs/xslc_light.png"));
var _zyl_light = _interopRequireDefault(require("../../imgs/zyl_light.png"));
var _zysc_light = _interopRequireDefault(require("../../imgs/zysc_light.png"));
var _zycs_light = _interopRequireDefault(require("../../imgs/zycs_light.png"));
var _zycssc_light = _interopRequireDefault(require("../../imgs/zycssc_light.png"));
var _zylc_blue = _interopRequireDefault(require("../../imgs/zylc_blue.png"));
var _xslc_blue = _interopRequireDefault(require("../../imgs/xslc_blue.png"));
var _zyl_blue = _interopRequireDefault(require("../../imgs/zyl_blue.png"));
var _zysc_blue = _interopRequireDefault(require("../../imgs/zysc_blue.png"));
var _zycs_blue = _interopRequireDefault(require("../../imgs/zycs_blue.png"));
var _zycssc_blue = _interopRequireDefault(require("../../imgs/zycssc_blue.png"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 作业统计- 机械化
 */

function WorkSummaryJxh(_ref) {
  var id = _ref.id,
    date = _ref.date,
    service = _ref.service;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme;
  var _BaseService$useWorkS = _api.BaseService.useWorkSummaryJxh(id, (0, _moment["default"])(date).format('YYYY-MM-DD'), (0, _moment["default"])(date).format('YYYY-MM-DD'), service),
    workSummaryJxhRes = _BaseService$useWorkS.workSummaryJxhRes;
  var getSrc = function getSrc(code) {
    var obj = {};
    if (theme === 'dark') {
      obj = {
        zylc: _zylc["default"],
        xslc: _xslc["default"],
        zyl: _zyl["default"],
        zysc: _zysc["default"],
        zycs: _zycs["default"],
        zycssc: _zycssc["default"]
      };
    } else if (theme === 'blue') {
      obj = {
        zylc: _zylc_blue["default"],
        xslc: _xslc_blue["default"],
        zyl: _zyl_blue["default"],
        zysc: _zysc_blue["default"],
        zycs: _zycs_blue["default"],
        zycssc: _zycssc_blue["default"]
      };
    } else {
      obj = {
        zylc: _zylc_light["default"],
        xslc: _xslc_light["default"],
        zyl: _zyl_light["default"],
        zysc: _zysc_light["default"],
        zycs: _zycs_light["default"],
        zycssc: _zycssc_light["default"]
      };
    }
    return obj[code];
  };
  var data = [{
    src: getSrc('zylc'),
    name: '核算作业里程',
    value: (workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.workMileage) || 0,
    unit: 'km'
  }, {
    src: getSrc('xslc'),
    name: '行驶里程',
    value: (workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.driveMileage) || 0,
    unit: 'km'
  }, {
    src: getSrc('zyl'),
    name: '有效作业率',
    value: (workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.workRate) || 0,
    unit: '%'
  }, {
    src: getSrc('zysc'),
    name: '作业时长',
    specialCase: "".concat((0, _util.secondToFormatTime)((workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.workDuration) || 0))
  }, {
    src: getSrc('zycs'),
    name: '作业超速',
    value: (workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.overSpeedRate) || 0,
    unit: '%'
  }, {
    src: getSrc('zycssc'),
    name: '作业超速时长',
    specialCase: "".concat((0, _util.secondToFormatTime)((workSummaryJxhRes === null || workSummaryJxhRes === void 0 ? void 0 : workSummaryJxhRes.overSpeedDuration) || 0))
  }];
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "work-summary"
  }, data === null || data === void 0 ? void 0 : data.map(function (ele, index) {
    return /*#__PURE__*/_react["default"].createElement(_vmImageText["default"], Object.assign({
      key: index
    }, ele, {
      style: {
        margin: '0 0 36px 0',
        width: '50%'
      }
    }));
  }));
}
//# sourceMappingURL=WorkSummaryJxh.js.map
