import { VmEmpty, VmLineCharts, VmPieCharts } from "../../../_components";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var Charts = function Charts(_ref) {
  var chartData = _ref.chartData,
    lineData = _ref.lineData;
  var legends = lineData.legends,
    names = lineData.names,
    values = lineData.values;
  var series = [];
  if ((values === null || values === void 0 ? void 0 : values.length) > 0) {
    values.forEach(function (item, index) {
      series.push({
        type: 'line',
        name: legends[index],
        data: item
      });
    });
  }
  var total = chartData === null || chartData === void 0 ? void 0 : chartData.reduce(function (acc, cur) {
    return acc + cur.value;
  }, 0);
  return /*#__PURE__*/_jsxs("div", {
    className: "staff-alarm-charts",
    children: [/*#__PURE__*/_jsx("div", {
      className: "staff-alarm-charts-item",
      children: (chartData === null || chartData === void 0 ? void 0 : chartData.length) > 0 ? /*#__PURE__*/_jsx(VmPieCharts, {
        height: 216,
        unit: "\u6B21",
        name: "\u62A5\u8B66\u6B21\u6570",
        subTitle: "\u603B\u6570(\u6B21)",
        total: total,
        innerRadius: ['50%', '65%'],
        outerRadius: ['65%', '70%'],
        dataList: (chartData === null || chartData === void 0 ? void 0 : chartData.filter(function (ele) {
          return ele.alarmTypeCode;
        })) || []
      }) : /*#__PURE__*/_jsx(VmEmpty, {
        type: "NO_CHART"
      })
    }), /*#__PURE__*/_jsx("div", {
      className: "staff-alarm-charts-item",
      children: (values === null || values === void 0 ? void 0 : values.length) > 0 ? /*#__PURE__*/_jsx(VmLineCharts, {
        height: 216,
        unit: "\u6B21",
        name: "\u62A5\u8B66\u6B21\u6570",
        dataList: (values === null || values === void 0 ? void 0 : values.map(function (ele, index) {
          return {
            name: legends[index],
            data: ele
          };
        })) || [],
        xAxis: names
      }) : /*#__PURE__*/_jsx(VmEmpty, {
        type: "NO_CHART"
      })
    })]
  });
};
export default Charts;