"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _vmMap = _interopRequireDefault(require("../../../vm-map"));
var _vmInfoCollection = _interopRequireDefault(require("../../../vm-info-collection"));
var _config = require("../../config");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
// 统计
var SummaryItem = function SummaryItem(_ref) {
  var name = _ref.name,
    icon = _ref.icon,
    unit = _ref.unit,
    num = _ref.num,
    _ref$top = _ref.top,
    top = _ref$top === void 0 ? 0 : _ref$top,
    color = _ref.color;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "vm-estate-summary",
    style: {
      top: top,
      color: color
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "vm-estate-summary-img"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: icon
  }), /*#__PURE__*/_react["default"].createElement("span", null, name)), /*#__PURE__*/_react["default"].createElement("div", {
    className: "vm-estate-summary-text"
  }, /*#__PURE__*/_react["default"].createElement("span", null, num), /*#__PURE__*/_react["default"].createElement("span", null, unit)));
};
var Left = function Left(_ref2) {
  var classPrefix = _ref2.classPrefix,
    _ref2$throwPoints = _ref2.throwPoints,
    throwPoints = _ref2$throwPoints === void 0 ? [] : _ref2$throwPoints,
    basicInfo = _ref2.basicInfo,
    _ref2$customMapInfo = _ref2.customMapInfo,
    customMapInfo = _ref2$customMapInfo === void 0 ? {} : _ref2$customMapInfo;
  var fieldsData = _config.OverViewLeftFields.map(function (item) {
    return Object.assign(Object.assign({}, item), {
      value: basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo[item.key]
    });
  });
  // 户/点
  var num1 = (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.householdNum) && (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.throwPointNum) ? Math.ceil((basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.householdNum) / (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.throwPointNum)) : 0;
  // 点/人
  var num2 = (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.throwPointNum) && (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.supervisorNum) ? Math.ceil((basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.throwPointNum) / (basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.supervisorNum)) : 0;
  var points = throwPoints === null || throwPoints === void 0 ? void 0 : throwPoints.filter(function (item) {
    return item.longitude && item.latitude;
  }).map(function (item) {
    return {
      id: item.id,
      name: item.pointName,
      lng: item.longitude,
      lat: item.latitude,
      url: require('../../imgs/tfd.png')
    };
  });
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(classPrefix, "-left")
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(classPrefix, "-left-map")
  }, /*#__PURE__*/_react["default"].createElement(_vmMap["default"], Object.assign({
    mapPoints: points
  }, customMapInfo))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(classPrefix, "-left-info")
  }, /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    top: 16,
    icon: require('../../imgs/left-tfdmd.png'),
    unit: "\u6237/\u70B9",
    num: num1,
    name: "\u6295\u653E\u70B9\u5BC6\u5EA6",
    color: "#88FFD4"
  }), /*#__PURE__*/_react["default"].createElement(SummaryItem, {
    top: 250,
    icon: require('../../imgs/left-ddypz.png'),
    unit: "\u70B9/\u4EBA",
    num: num2,
    name: "\u7763\u5BFC\u5458\u914D\u7F6E",
    color: "#29EFFF"
  }), /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: fieldsData,
    gap: 16
  })));
};
var _default = exports["default"] = Left;
//# sourceMappingURL=Left.js.map
