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 * as echarts from 'echarts';
import { max } from 'lodash';
import { VmEmpty, VmLineCharts, VmWrapper } from "../../../_components";
import { jsx as _jsx } from "react/jsx-runtime";
var ChartJcqs = function ChartJcqs(props) {
  var _props$data, _props$data2, _props$data3, _props$data4;
  var xData = (props === null || props === void 0 || (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.map(function (ele) {
    return ele.date;
  })) || [];
  var values = (props === null || props === void 0 || (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.map(function (ele) {
    return ele.todayTotalInWeight;
  })) || [];
  var maxNum = max([props === null || props === void 0 ? void 0 : props.handleAbility].concat(_toConsumableArray((props === null || props === void 0 || (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.map(function (ele) {
    return ele.todayTotalInWeight;
  })) || []))) || 0;
  console.log(props);
  return /*#__PURE__*/_jsx(VmWrapper, {
    title: "\u8FDB\u573A\u8D8B\u52BF\u5206\u6790",
    needChange: false,
    children: /*#__PURE__*/_jsx("div", {
      style: {
        height: 360
      },
      children: (props === null || props === void 0 || (_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.length) > 0 ? /*#__PURE__*/_jsx(VmLineCharts, {
        title: '进场量',
        height: 360,
        unit: "\u5428",
        yMax: maxNum,
        xAxis: xData,
        dataList: [{
          data: values,
          name: '进场量',
          areaStyle: {
            color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
              offset: 0,
              color: 'rgba(22, 119, 255, 0)'
            }, {
              offset: 0.5,
              color: 'rgba(22, 119, 255, 0.5)'
            }, {
              offset: 1,
              color: 'rgba(22, 119, 255, 1)'
            }])
          },
          markLine: {
            data: [{
              yAxis: props === null || props === void 0 ? void 0 : props.handleAbility,
              lineStyle: {
                normal: {
                  color: '#F5222D'
                }
              },
              name: '设计能力(吨/日)'
            }],
            lineStyle: {
              color: '#F5222D'
            },
            label: {
              show: true,
              position: 'insideEndTop',
              formatter: '{b}: {c}',
              color: '#F5222D',
              fontWeight: 'normal'
            }
          }
        }]
      }) : /*#__PURE__*/_jsx(VmEmpty, {
        type: "NO_CHART"
      })
    })
  });
};
export default ChartJcqs;