/**
 * 区域进场量分析
 */

import { sumBy } from 'lodash';
import { VmEmpty, VmPieCharts } from "../../../_components";
import { BaseService } from "../../api";
import "./index.less";
import { jsx as _jsx } from "react/jsx-runtime";
function Qyjcl(props) {
  var _areaSumData$areaDeta, _areaSumData$areaDeta2;
  var code = props.code,
    startDate = props.startDate,
    endDate = props.endDate;
  var _BaseService$useQyjcl = BaseService.useQyjcl(code, startDate, endDate),
    areaSumData = _BaseService$useQyjcl.areaSumData;
  var total = sumBy((areaSumData === null || areaSumData === void 0 ? void 0 : areaSumData.areaDetailList) || [], 'todayInWeight') || 0;
  return /*#__PURE__*/_jsx("div", {
    className: "df-qyjcl",
    children: areaSumData !== null && areaSumData !== void 0 && (_areaSumData$areaDeta = areaSumData.areaDetailList) !== null && _areaSumData$areaDeta !== void 0 && _areaSumData$areaDeta.length ? /*#__PURE__*/_jsx(VmPieCharts, {
      height: 216,
      total: total === null || total === void 0 ? void 0 : total.toFixed(2),
      title: "\u5428",
      unit: "\u5428",
      name: "\u533A\u57DF\u8FDB\u573A\u91CF",
      innerRadius: ['50%', '65%'],
      outerRadius: ['65%', '70%'],
      dataList: (areaSumData === null || areaSumData === void 0 || (_areaSumData$areaDeta2 = areaSumData.areaDetailList) === null || _areaSumData$areaDeta2 === void 0 ? void 0 : _areaSumData$areaDeta2.map(function (ele) {
        return {
          name: ele.areaName,
          value: ele.todayInWeight,
          rate: ele.todayInWeightPercent
        };
      })) || [],
      legendConfig: {
        right: 16
      }
    }) : /*#__PURE__*/_jsx(VmEmpty, {
      type: "NO_CHART"
    })
  });
}
export default Qyjcl;