"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _api = require("../../api");
var _traffic = _interopRequireDefault(require("../../imgs/traffic.png"));
var _stench = _interopRequireDefault(require("../../imgs/stench.png"));
var _temperature = _interopRequireDefault(require("../../imgs/temperature.png"));
var _humidity = _interopRequireDefault(require("../../imgs/humidity.png"));
var _water = _interopRequireDefault(require("../../imgs/water.png"));
var _electric = _interopRequireDefault(require("../../imgs/electric.png"));
var _male = _interopRequireDefault(require("../../imgs/male.png"));
var _female = _interopRequireDefault(require("../../imgs/female.png"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
 * 公厕-监测信息-实时信息
 */

var RealtimeInfo = function RealtimeInfo(props) {
  var id = props.id;
  var _MoniotrService$useRe = _api.MoniotrService.useRealtime(id, (0, _moment["default"])().format('YYYY-MM-DD')),
    realtimeList = _MoniotrService$useRe.realtimeList;
  window.console.log(realtimeList);
  var getRealtimeItem = function getRealtimeItem(code) {
    var src = '';
    if (code.indexOf('_') < 0) {
      return _traffic["default"];
    }
    var str = code.split('_')[0];
    switch (str) {
      case 'PersonNum':
        src = _traffic["default"];
        break;
      case 'OdorValue':
        src = _stench["default"];
        break;
      case 'temperature':
        src = _temperature["default"];
        break;
      case 'humidity':
        src = _humidity["default"];
        break;
      case 'WaterUse':
        src = _water["default"];
        break;
      case 'ElecUse':
        src = _electric["default"];
        break;
      case 'SeatNum':
        if (code.indexOf('female') > -1) {
          src = _female["default"];
        } else {
          src = _male["default"];
        }
        break;
      default:
        break;
    }
    return src;
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "wr-monitor-realtime"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-head"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-head-title"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u5B9E\u65F6\u4FE1\u606F"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-head-time"
  }, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (0, _moment["default"])().format('YYYY-MM-DD HH:mm:ss')))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content"
  }, (realtimeList === null || realtimeList === void 0 ? void 0 : realtimeList.length) > 0 ? realtimeList.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "realtime-content-item",
      key: item.code
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "realtime-content-item-icon"
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: getRealtimeItem(item.code)
    }), /*#__PURE__*/_react["default"].createElement("div", {
      className: "realtime-content-item-icon-name"
    }, item.title)), /*#__PURE__*/_react["default"].createElement("div", {
      className: "realtime-content-item-main"
    }, item.dataList.map(function (subItem, idx) {
      return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
        className: "realtime-content-item-main-item",
        key: idx
      }, /*#__PURE__*/_react["default"].createElement("div", null, subItem.name), /*#__PURE__*/_react["default"].createElement("div", null, subItem.value)), idx < item.dataList.length - 1 && /*#__PURE__*/_react["default"].createElement("div", {
        className: "realtime-content-item-main-line"
      }));
    })));
  }) : /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-icon"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: _traffic["default"]
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-icon-name"
  }, "\u4ECA\u65E5\u4EBA\u6D41\u91CF\uFF08\u4EBA\u6B21\uFF09")), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-main"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-main-item"
  }, /*#__PURE__*/_react["default"].createElement("div", null, "\u5168\u90E8"), /*#__PURE__*/_react["default"].createElement("div", null, "0")), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-main-line"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-main-item"
  }, /*#__PURE__*/_react["default"].createElement("div", null, "\u7537"), /*#__PURE__*/_react["default"].createElement("div", null, "0")), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-main-line"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "realtime-content-item-main-item"
  }, /*#__PURE__*/_react["default"].createElement("div", null, "\u5973"), /*#__PURE__*/_react["default"].createElement("div", null, "0"))))));
};
var _default = RealtimeInfo;
exports["default"] = _default;
//# sourceMappingURL=RealtimeInfo.js.map
