"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _antd = require("antd");
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
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"));
var _traffic_light = _interopRequireDefault(require("../../imgs/traffic_light.png"));
var _stench_light = _interopRequireDefault(require("../../imgs/stench_light.png"));
var _temperature_light = _interopRequireDefault(require("../../imgs/temperature_light.png"));
var _humidity_light = _interopRequireDefault(require("../../imgs/humidity_light.png"));
var _water_light = _interopRequireDefault(require("../../imgs/water_light.png"));
var _electric_light = _interopRequireDefault(require("../../imgs/electric_light.png"));
var _male_light = _interopRequireDefault(require("../../imgs/male_light.png"));
var _female_light = _interopRequireDefault(require("../../imgs/female_light.png"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 公厕-监测信息-实时信息
 */

var RealtimeInfo = function RealtimeInfo(props) {
  var id = props.id;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme;
  var _MoniotrService$useRe = _api.MoniotrService.useRealtime(id, (0, _moment["default"])().format('YYYY-MM-DD')),
    realtimeList = _MoniotrService$useRe.realtimeList;
  var img = {
    light: {
      PersonNum: _traffic_light["default"],
      OdorValue: _stench_light["default"],
      temperature: _temperature_light["default"],
      humidity: _humidity_light["default"],
      WaterUse: _water_light["default"],
      ElecUse: _electric_light["default"],
      male: _male_light["default"],
      female: _female_light["default"]
    },
    dark: {
      PersonNum: _traffic["default"],
      OdorValue: _stench["default"],
      temperature: _temperature["default"],
      humidity: _humidity["default"],
      WaterUse: _water["default"],
      ElecUse: _electric["default"],
      male: _male["default"],
      female: _female["default"]
    }
  };
  var getRealtimeItem = function getRealtimeItem(code) {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j;
    var src = '';
    var str = code.split('_')[0];
    if (theme) {
      if (code.indexOf('_') < 0) {
        return (_a = img[theme]) === null || _a === void 0 ? void 0 : _a['PersonNum'];
      }
      switch (str) {
        case 'PersonNum':
          src = (_b = img[theme]) === null || _b === void 0 ? void 0 : _b['PersonNum'];
          break;
        case 'OdorValue':
          src = (_c = img[theme]) === null || _c === void 0 ? void 0 : _c['OdorValue'];
          break;
        case 'temperature':
          src = (_d = img[theme]) === null || _d === void 0 ? void 0 : _d['temperature'];
          break;
        case 'humidity':
          src = (_e = img[theme]) === null || _e === void 0 ? void 0 : _e['humidity'];
          break;
        case 'WaterUse':
          src = (_f = img[theme]) === null || _f === void 0 ? void 0 : _f['WaterUse'];
          break;
        case 'ElecUse':
          src = (_g = img[theme]) === null || _g === void 0 ? void 0 : _g['ElecUse'];
          break;
        case 'SeatNum':
          if (code.indexOf('female') > -1) {
            src = (_h = img[theme]) === null || _h === void 0 ? void 0 : _h['female'];
          } else {
            src = (_j = img[theme]) === null || _j === void 0 ? void 0 : _j['male'];
          }
          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"
  }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
    gutter: [36, 20]
  }, (realtimeList === null || realtimeList === void 0 ? void 0 : realtimeList.length) > 0 ? realtimeList.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_antd.Col, {
      xxl: 6,
      xl: 6,
      lg: 8,
      md: 12,
      className: "realtime-content-item",
      key: index
    }, /*#__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 ".concat(theme)
    }, 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(_antd.Col, {
    span: 24,
    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 = exports["default"] = RealtimeInfo;
//# sourceMappingURL=RealtimeInfo.js.map
