"use strict";

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

function Situation(_ref) {
  var code = _ref.code,
    alarm = _ref.alarm;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme;
  var nowDate = (0, _moment["default"])().format('YYYY-MM-DD');
  var _BaseService$useSitua = _api.BaseService.useSituation(code, nowDate, nowDate),
    situationRes = _BaseService$useSitua.situationRes;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "df-situation ".concat(theme)
  }, [{
    name: '进场量',
    value: situationRes === null || situationRes === void 0 ? void 0 : situationRes.dailyInWeight,
    unit: '吨',
    img: 'jcl'
  }, {
    name: '进场车次',
    value: situationRes === null || situationRes === void 0 ? void 0 : situationRes.dailyCarNum,
    img: 'jccc'
  }, {
    name: '车辆进场报警',
    value: situationRes === null || situationRes === void 0 ? void 0 : situationRes.carInAlarmCount,
    img: 'cljcbj'
  }].map(function (item, index) {
    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, ".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) || '次')));
  }), alarm !== null && (/*#__PURE__*/_react["default"].createElement("div", {
    className: "df-situation-item ".concat(theme)
  }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("img", {
    src: require("../../imgs/yxzbbj.png")
  })), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "df-situation-item-name"
  }, "\u8FD0\u884C\u6307\u6807\u62A5\u8B66"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "df-situation-item-value_warn"
  }, /*#__PURE__*/_react["default"].createElement("span", null, alarm || 0), "\u6B21")))));
}
//# sourceMappingURL=Situation.js.map
