function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import { getVtxToken } from '@vtx/utils';
import { Col, Image, Row } from 'antd';
import { VmInfoCollection, VmMap, VmWrapper } from "../../../_components";
import DetailList from "./DetailList";
import "./index.less";
import Statistics from "./Statistics";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var BaseInfo = function BaseInfo(_ref) {
  var _info$location;
  var info = _ref.info,
    id = _ref.id;
  var dataSource = [{
    label: '单位名称',
    key: 'unitName',
    value: info.unitName
  }, {
    label: '营业执照编号',
    key: 'licenseNumber',
    value: info.licenseNumber,
    width: '100%'
  }, {
    label: '营业执照',
    key: 'licenseFiles',
    width: '100%',
    render: function render() {
      var photos = JSON.parse(info.licenseFiles || '[]');
      return /*#__PURE__*/_jsx("div", {
        style: {
          whiteSpace: 'break-spaces'
        },
        children: photos.map(function (item) {
          return /*#__PURE__*/_jsx(Image, {
            width: 80,
            height: 80,
            src: "/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id=".concat(item.id, "&token=").concat(getVtxToken('token')),
            preview: {
              src: "/cloudFile/common/downloadFile?id=".concat(item.id, "&token=").concat(getVtxToken('token'))
            }
          }, item.id);
        })
      });
    }
  }, {
    label: '服务范围',
    key: 'ccScopeServiceVOList',
    value: info.ccScopeServiceVOList && info.ccScopeServiceVOList.length ? info.ccScopeServiceVOList.map(function (item) {
      return item.divisionName;
    }).join(',') : '-'
  }, {
    label: '成立时间',
    key: 'establishedTime',
    value: info.establishedTime
  }];
  var _ref2 = info !== null && info !== void 0 && (_info$location = info.location) !== null && _info$location !== void 0 && _info$location.lngLats ? info.location.lngLats.split(',') : [],
    _ref3 = _slicedToArray(_ref2, 2),
    lng = _ref3[0],
    lat = _ref3[1];
  var mapPoints = lng && lat ? [{
    lng: lng,
    lat: lat,
    icon: 'DSFHSQY',
    name: info.unitName,
    type: 'point',
    id: info.unitName
  }] : [];
  return /*#__PURE__*/_jsxs(Row, {
    gutter: [16, 16],
    style: {
      height: '100%'
    },
    children: [/*#__PURE__*/_jsx(Col, {
      flex: '400px',
      children: /*#__PURE__*/_jsxs(VmWrapper, {
        title: '基本信息',
        children: [/*#__PURE__*/_jsx(VmInfoCollection, {
          data: dataSource
        }), lng && lat ? /*#__PURE__*/_jsx("div", {
          className: 'vm-cc-unit-map-wrap',
          children: /*#__PURE__*/_jsx(VmMap, {
            mapPoints: mapPoints,
            mapType: 'wgs84',
            mapCenter: [lng, lat],
            address: info === null || info === void 0 ? void 0 : info.address
          })
        }) : null]
      })
    }), /*#__PURE__*/_jsx(Col, {
      flex: '1',
      style: {
        minWidth: 0
      },
      children: /*#__PURE__*/_jsxs("div", {
        className: 'vtx-cc-unit-info-right-wrap',
        children: [/*#__PURE__*/_jsx("div", {
          style: {
            height: 138
          },
          children: /*#__PURE__*/_jsx(Statistics, {
            id: id,
            garbageType: info.garbageType
          })
        }), /*#__PURE__*/_jsx("div", {
          className: 'vtx-cc-unit-info-right-wrap-bottom',
          children: /*#__PURE__*/_jsx(DetailList, {
            id: id
          })
        })]
      })
    })]
  });
};
export default BaseInfo;