"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = JBXX;
var _react = _interopRequireWildcard(require("react"));
var _olMap = require("@vtx/ol-map");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
function JBXX(_ref) {
  var baseInfo = _ref.baseInfo,
    info = _ref.info;
  var _a, _b;
  var mapRef = (0, _react.useRef)(null);
  var mapPolygons = ((_a = info === null || info === void 0 ? void 0 : info.geometryInfo) === null || _a === void 0 ? void 0 : _a.lngLats) ? [{
    name: info === null || info === void 0 ? void 0 : info.name,
    geometryInfo: info === null || info === void 0 ? void 0 : info.geometryInfo
  }] : [];
  (0, _react.useEffect)(function () {
    var _a;
    if (mapRef.current && (mapPolygons === null || mapPolygons === void 0 ? void 0 : mapPolygons.length)) {
      (_a = mapRef.current) === null || _a === void 0 ? void 0 : _a.fitView({
        geometryInfo: mapPolygons[0].geometryInfo
      }, {
        maxZoom: 14
      });
    }
  }, [JSON.stringify(mapPolygons)]);
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "jzlj-card-title"
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: "jzlj-card-title-text"
  }, "\u57FA\u672C\u4FE1\u606F")), /*#__PURE__*/_react["default"].createElement("div", {
    className: "jzlj-card-content",
    style: {
      lineHeight: '28px'
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "ssxx-map"
  }, /*#__PURE__*/_react["default"].createElement(_olMap.Map, {
    tk: "1adbb6e47668cb33757cd799548bf1f4",
    createdMap: function createdMap(map) {
      mapRef.current = map;
    }
  }, /*#__PURE__*/_react["default"].createElement(_olMap.FeatureLayer, {
    data: mapPolygons,
    style: ((_b = info === null || info === void 0 ? void 0 : info.geometryInfo) === null || _b === void 0 ? void 0 : _b.type) === 'point' ? {
      type: 'Marker',
      style: {
        icon: 'DF',
        color: '#119FFB'
      }
    } : {
      type: 'Polygon',
      style: {
        stroke: {
          color: '#1899ff',
          opacity: 1,
          width: 2
        },
        fill: {
          color: '#1899ff',
          opacity: 0.4
        }
      }
    }
  }))), baseInfo.map(function (item) {
    var _a;
    return /*#__PURE__*/_react["default"].createElement("div", {
      key: item.key
    }, /*#__PURE__*/_react["default"].createElement("span", {
      className: "label"
    }, item.label, "\uFF1A"), /*#__PURE__*/_react["default"].createElement("span", {
      className: "value"
    }, (_a = item.value) !== null && _a !== void 0 ? _a : '--'));
  })));
}
//# sourceMappingURL=JBXX.js.map
