"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.SummaryItem = void 0;
var _react = _interopRequireDefault(require("react"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _api = require("../../api");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var SummaryItem = function SummaryItem(_ref) {
  var icon = _ref.icon,
    name = _ref.name,
    unit = _ref.unit,
    num = _ref.num;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "summary-item"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: icon
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "summary-item-text"
  }, /*#__PURE__*/_react["default"].createElement("p", null, name), /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("span", null, num), unit)));
};
exports.SummaryItem = SummaryItem;
var TopItem = function TopItem(_ref2) {
  var name = _ref2.name,
    content = _ref2.content,
    icon = _ref2.icon,
    textStyleType = _ref2.textStyleType;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "top-item"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "img"
  }, /*#__PURE__*/_react["default"].createElement("p", {
    className: "name--".concat(textStyleType)
  }, name), /*#__PURE__*/_react["default"].createElement("img", {
    src: icon
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "statistic"
  }, content.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      key: item.text
    }, /*#__PURE__*/_react["default"].createElement("span", null, item.text), /*#__PURE__*/_react["default"].createElement("span", {
      className: "statistic-value--".concat(textStyleType)
    }, item.value));
  })));
};
var Manage = function Manage(_ref3) {
  var classPrefix = _ref3.classPrefix,
    id = _ref3.id;
  var data = _api.overViewService.managementData({
    housingEstateId: id
  });
  var cleanGroundDuration = (data === null || data === void 0 ? void 0 : data.dirtyGroundDuration) ? (12 - (data === null || data === void 0 ? void 0 : data.dirtyGroundDuration) / 60).toFixed(1) : 0;
  var noOverflowDuration = (data === null || data === void 0 ? void 0 : data.overflowDuration) ? (12 - (data === null || data === void 0 ? void 0 : data.overflowDuration) / 60).toFixed(1) : 0;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(classPrefix, "-manage")
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u8FD0\u8425\u7BA1\u7406"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(classPrefix, "-manage-top")
  }, /*#__PURE__*/_react["default"].createElement(TopItem, {
    name: "\u73AF\u5883\u7BA1\u7406\u6210\u6548",
    icon: require('../../imgs/manage-hjgl.png'),
    textStyleType: 1,
    content: [{
      text: '今日地面干净时长占比',
      value: "".concat(cleanGroundDuration, "h/12h")
    }, {
      text: '今日无爆桶状态时长占比',
      value: "".concat(noOverflowDuration, "h/12h")
    }]
  }), /*#__PURE__*/_react["default"].createElement(TopItem, {
    name: "\u516C\u4F17\u5BA3\u6559\u6210\u6548",
    icon: require('../../imgs/manage-gzcx.png'),
    textStyleType: 2,
    content: [{
      text: '厨余准确率',
      value: "".concat((data === null || data === void 0 ? void 0 : data.chuyuAccuracy) || 0, "%")
    }, {
      text: '居民参与率',
      value: "".concat((data === null || data === void 0 ? void 0 : data.personParticipationRate) || 0, "%")
    }]
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(classPrefix, "-manage-bottom")
  }, /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    icon: require('../../imgs/manage-yyxj.png'),
    name: "\u8BED\u97F3\u5BA3\u6559",
    unit: "\u6B21",
    num: (data === null || data === void 0 ? void 0 : data.voiceEducateTimes) || 0
  }), /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    icon: require('../../imgs/manage-wgmsr.png'),
    name: "\u8FDD\u89C4\u964C\u751F\u4EBA",
    unit: "\u4EBA",
    num: (data === null || data === void 0 ? void 0 : data.strangerNum) || 0
  }), /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    icon: require('../../imgs/manage-hmd.png'),
    name: "\u7070\u540D\u5355",
    unit: "\u4EBA",
    num: (data === null || data === void 0 ? void 0 : data.badLabelPersonNum) || 0
  })));
};
var _default = Manage;
exports["default"] = _default;
//# sourceMappingURL=Manage.js.map
