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 { VmPieCharts } from "../../../../_components";
import "./index.less";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export default function Pies(_ref) {
  var _ref$pieData = _ref.pieData,
    pieData = _ref$pieData === void 0 ? [] : _ref$pieData;
  var startPieData = pieData.find(function (item) {
    return item.startEndType === 'START';
  });
  var startDataList = ((startPieData === null || startPieData === void 0 ? void 0 : startPieData.detailList) || []).map(function (item) {
    return _objectSpread(_objectSpread({}, item), {}, {
      name: item.name,
      value: item.czzCount
    });
  });
  var startDataSum = startDataList === null || startDataList === void 0 ? void 0 : startDataList.length;
  var endPieData = pieData.find(function (item) {
    return item.startEndType === 'END';
  });
  var endDataList = ((endPieData === null || endPieData === void 0 ? void 0 : endPieData.detailList) || []).map(function (item) {
    return _objectSpread(_objectSpread({}, item), {}, {
      name: item.name,
      value: item.czzCount
    });
  });
  var endDataSum = endDataList === null || endDataList === void 0 ? void 0 : endDataList.length;
  var tooltipFormatter = "{a}\uFF1A<br/>{b}<br/>\u5173\u8054\u5904\u7F6E\u8BC1\uFF1A{c}\u5F20 ({d}%)";
  return /*#__PURE__*/_jsxs("div", {
    className: "jzlj-car-dispose-pies-main",
    children: [/*#__PURE__*/_jsx("div", {
      className: "jzlj-car-dispose-pies-main-item",
      children: /*#__PURE__*/_jsx(VmPieCharts, {
        dataList: startDataList,
        name: "\u8FD0\u8F93\u8D77\u70B9",
        title: "\u8FD0\u8F93\u8D77\u70B9(\u4E2A)",
        total: startDataSum !== null && startDataSum !== void 0 ? startDataSum : 0,
        unit: "\u4E2A",
        innerRadius: ['30%', '40%'],
        outerRadius: ['40%', '45%'],
        legendConfig: {
          formatter: function formatter(name) {
            var index = startDataList.findIndex(function (item) {
              return item.name === name;
            });
            var info = startDataList[index] || {};
            var value = info.value;
            return "{name|".concat(name.slice(0, 6)).concat(name.length > 6 ? '...' : '', "}(\u5173\u8054").concat(value !== null && value !== void 0 ? value : 0, "\u5F20\u5904\u7F6E\u8BC1)");
          }
        },
        tooltipFormatter: tooltipFormatter
      })
    }), /*#__PURE__*/_jsx("div", {
      className: "jzlj-car-dispose-pies-main-item",
      children: /*#__PURE__*/_jsx(VmPieCharts, {
        dataList: endDataList,
        name: "\u8FD0\u8F93\u7EC8\u70B9",
        title: "\u8FD0\u8F93\u7EC8\u70B9(\u4E2A)",
        total: endDataSum !== null && endDataSum !== void 0 ? endDataSum : 0,
        unit: "\u4E2A",
        innerRadius: ['30%', '40%'],
        outerRadius: ['40%', '45%'],
        legendConfig: {
          formatter: function formatter(name) {
            var index = endDataList.findIndex(function (item) {
              return item.name === name;
            });
            var info = endDataList[index] || {};
            var value = info.value;
            return "{name|".concat(name.slice(0, 6)).concat(name.length > 6 ? '...' : '', "}(\u5173\u8054").concat(value !== null && value !== void 0 ? value : 0, "\u5F20\u5904\u7F6E\u8BC1)");
          }
        },
        tooltipFormatter: tooltipFormatter
      })
    })]
  });
}