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); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { VtxImage } from '@vtx/components';
import { getVtxToken } from '@vtx/utils';
import { VmEmpty, VmFactorList, VmInfoCollection, VmWrapper } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { OverViewLeftFields } from "../../config";
import DDYPZ from "../../imgs/ddypz.png";
import DDYPZ_LIGHT from "../../imgs/ddypz_light.png";
import TFD from "../../imgs/tfd.png";
import TFD_LIGHT from "../../imgs/tfd_light.png";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var Left = function Left(_ref) {
  var classPrefix = _ref.classPrefix,
    _ref$throwPoints = _ref.throwPoints,
    throwPoints = _ref$throwPoints === void 0 ? [] : _ref$throwPoints,
    basicInfo = _ref.basicInfo;
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark;
  var fieldsData = OverViewLeftFields.map(function (item) {
    return _objectSpread(_objectSpread({}, item), {}, {
      value: basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo[item.key]
    });
  });
  // 户/点
  var num1 = basicInfo !== null && basicInfo !== void 0 && basicInfo.householdNum && basicInfo !== null && basicInfo !== 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 && basicInfo.throwPointNum && basicInfo !== null && basicInfo !== 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 photos = JSON.parse((basicInfo === null || basicInfo === void 0 ? void 0 : basicInfo.photos) || '[]');
  return /*#__PURE__*/_jsx("div", {
    className: "".concat(classPrefix, "-left"),
    children: /*#__PURE__*/_jsxs(VmWrapper, {
      title: "\u57FA\u672C\u4FE1\u606F",
      children: [photos && /*#__PURE__*/_jsx("div", {
        className: "".concat(classPrefix, "-left-img"),
        children: photos.length ? /*#__PURE__*/_jsx(VtxImage.PreviewGroup, {
          children: photos.map(function (item) {
            return /*#__PURE__*/_jsx(VtxImage, {
              src: "/cloudFile/common/downloadFile?id=".concat(item.id, "&token=").concat(getVtxToken('token')),
              alt: item.name
            }, item.id);
          })
        }) : /*#__PURE__*/_jsx(VmEmpty, {
          type: "NO_PICTURE",
          showText: false
        })
      }), /*#__PURE__*/_jsx(VmFactorList, {
        list: [{
          name: '投放点密度',
          unit: '户/点',
          value: num1,
          img: isDark ? TFD : TFD_LIGHT,
          fontType: 'blue',
          unitStyle: {
            fontSize: 14
          }
        }, {
          name: '督导员配置',
          unit: '点/人',
          value: num2,
          img: isDark ? DDYPZ : DDYPZ_LIGHT,
          fontType: 'blue',
          unitStyle: {
            fontSize: 14
          }
        }]
      }), /*#__PURE__*/_jsx(VmInfoCollection, {
        data: fieldsData,
        gap: 12,
        horizontal: true,
        labelStyle: {
          minWidth: 'unset'
        },
        style: {
          marginTop: 16
        }
      })]
    })
  });
};
export default Left;