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 { Image } from 'antd';
import { VmInfoCollection, VmMap, VmWrapper } from "../../../_components";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
var DetailInfo = function DetailInfo(_ref) {
  var _info$location;
  var info = _ref.info;
  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
  }] : [];
  var dataSource = [{
    label: '单位名称',
    key: 'unitName',
    value: info.unitName
  }, {
    label: '关联单位',
    key: 'managementName',
    value: info.managementName
  }, {
    label: '法定代表人',
    key: 'legal',
    value: info.legal
  }, {
    label: '法定代表人手机号',
    key: 'legalPhone',
    value: info.legalPhone
  }, {
    label: '法定代表人身份证号',
    key: 'legalIdCard',
    value: info.legalIdCard
  }, {
    label: '地址',
    key: 'address',
    value: info.address,
    isAddress: true
  }];
  var dataSource1 = [{
    label: '营业执照编号',
    key: 'licenseNumber',
    value: info.licenseNumber
  }, {
    label: '营业执照',
    key: 'licenseFiles',
    value: info.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: 'carParkAddress',
    value: info.carParkAddress,
    isAddress: true
  }, {
    label: '服务范围',
    key: 'ccScopeServiceVOList',
    value: info.ccScopeServiceVOList && info.ccScopeServiceVOList.length ? info.ccScopeServiceVOList.map(function (item) {
      return item.divisionName;
    }).join(',') : '-'
  }, {
    label: '成立时间',
    key: 'establishedTime',
    value: info.establishedTime
  }, {
    label: '是否启用',
    key: 'whetherUsed',
    value: info.whetherUsed ? '是' : '否'
  }];
  return /*#__PURE__*/_jsx(VmWrapper, {
    showTitle: false,
    children: /*#__PURE__*/_jsxs(_Fragment, {
      children: [/*#__PURE__*/_jsx(VmInfoCollection, {
        data: dataSource,
        horizontal: true,
        width: "50%",
        ellipsis: true
      }), lng && lat ? /*#__PURE__*/_jsx("div", {
        style: {
          height: 200
        },
        children: /*#__PURE__*/_jsx(VmMap, {
          mapPoints: mapPoints,
          mapType: 'wgs84',
          mapCenter: [lng, lat],
          address: info === null || info === void 0 ? void 0 : info.address
        })
      }) : null, /*#__PURE__*/_jsx(VmInfoCollection, {
        data: dataSource1,
        horizontal: true,
        width: "50%",
        ellipsis: true
      })]
    })
  });
};
export default DetailInfo;