"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = Situation;
var _react = _interopRequireDefault(require("react"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 实时运行情况
 */

function Situation(_ref) {
  var situationRes = _ref.situationRes;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "df-situation ".concat(theme)
  }, [{
    name: '进场量',
    value: situationRes === null || situationRes === void 0 ? void 0 : situationRes.todayInWeight,
    rate: ((situationRes === null || situationRes === void 0 ? void 0 : situationRes.todayInWeight) || 0) / ((situationRes === null || situationRes === void 0 ? void 0 : situationRes.yesterdayInWeight) || 1) * 100,
    unit: '吨',
    img: 'jcl'
  }, {
    name: '进场车次',
    value: situationRes === null || situationRes === void 0 ? void 0 : situationRes.todayInCar,
    rate: ((situationRes === null || situationRes === void 0 ? void 0 : situationRes.todayInCar) || 0) / ((situationRes === null || situationRes === void 0 ? void 0 : situationRes.yesterdayInCar) || 1) * 100,
    img: 'jccc'
  }].map(function (item, index) {
    var _a;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "df-situation-item ".concat(theme),
      key: index
    }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("img", {
      src: require("../../imgs/".concat(item.img).concat(theme !== 'light' ? '_dark' : '', ".png"))
    })), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
      className: "df-situation-item-name"
    }, item.name), /*#__PURE__*/_react["default"].createElement("div", {
      className: "df-situation-item-value".concat(index === 2 ? '_warn' : '')
    }, /*#__PURE__*/_react["default"].createElement("span", null, item.value || 0), (item === null || item === void 0 ? void 0 : item.unit) || '次'), /*#__PURE__*/_react["default"].createElement("div", {
      className: "df-situation-item-compare"
    }, "\u4E0E\u6628\u65E5\u6BD4 ", /*#__PURE__*/_react["default"].createElement("span", null, (_a = item.rate) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%"), /*#__PURE__*/_react["default"].createElement("img", {
      style: {
        width: 14,
        height: 14
      },
      src: require("../../imgs/".concat(item.rate > 100 ? 'up' : 'down', ".png"))
    }))));
  }));
}
//# sourceMappingURL=Situation.js.map
