function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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; }
import { max } from 'lodash';
import { VmLineCharts, VmWrapper } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { CalendarService } from "../../api-zd-reborn";
import { jsx as _jsx } from "react/jsx-runtime";
export default function Jcqsfx(props) {
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark,
    chartFontColor = _useSettings.chartFontColor;
  var deviceId = props.deviceId,
    startDate = props.startDate,
    endDate = props.endDate,
    handleAbility = props.handleAbility;
  var _CalendarService$useF = CalendarService.useFetchData(deviceId, startDate, endDate),
    data1 = _CalendarService$useF.data1;
  var maxNum = max([handleAbility].concat(_toConsumableArray((data1 === null || data1 === void 0 ? void 0 : data1.map(function (ele) {
    return ele.todayTotalInWeight;
  })) || []))) || 0;
  return /*#__PURE__*/_jsx("div", {
    className: "base-top--jcqsfx",
    children: /*#__PURE__*/_jsx(VmWrapper, {
      title: "\u8FDB\u573A\u8D8B\u52BF\u5206\u6790",
      needChange: false,
      children: /*#__PURE__*/_jsx(VmLineCharts, {
        unit: "\u5428",
        height: 240,
        showLegend: false,
        yMax: maxNum,
        xAxis: (data1 === null || data1 === void 0 ? void 0 : data1.map(function (ele) {
          return ele.date;
        })) || [],
        legendOption: {
          data: ['进场量']
        },
        dataList: [{
          data: (data1 === null || data1 === void 0 ? void 0 : data1.map(function (ele) {
            return ele.todayTotalInWeight;
          })) || [],
          name: '进场量',
          markLine: {
            data: [{
              yAxis: handleAbility,
              lineStyle: {
                normal: {
                  color: '#FFE25D'
                }
              },
              name: '设计能力(吨/日)'
            }],
            lineStyle: {
              color: '#52C41A'
            },
            label: {
              show: true,
              position: 'insideEndTop',
              formatter: '{b}: {c}',
              color: isDark ? '#fff' : chartFontColor,
              fontWeight: 'normal'
            }
          }
        }]
      })
    })
  });
}