"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = Jcqsfx;
var _react = _interopRequireDefault(require("react"));
var _lodash = require("lodash");
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
var _vmWrapper = _interopRequireDefault(require("../../../vm-wrapper"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _api = require("../../api");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function Jcqsfx(props) {
  var _a;
  var _useSettings = (0, _useSettings2["default"])(),
    chartFontColor = _useSettings.chartFontColor,
    theme = _useSettings.theme;
  var code = props.code,
    startDate = props.startDate,
    endDate = props.endDate;
  var _BaseService$useTrend = _api.BaseService.useTrendInfo(code, startDate, endDate),
    trendRes = _BaseService$useTrend.trendRes;
  var maxNum = null;
  if (((_a = trendRes === null || trendRes === void 0 ? void 0 : trendRes.values) === null || _a === void 0 ? void 0 : _a.length) > 0) {
    maxNum = (0, _lodash.max)((0, _lodash.flatten)(trendRes.values));
  }
  var option = {
    color: ['#1890FF'],
    tooltip: {
      trigger: 'axis',
      formatter: function formatter(params) {
        return params[0].name + '<br/>' + params[0].seriesName + ': ' + params[0].value + '吨';
      }
    },
    legend: {
      show: false
    },
    grid: {
      top: 28,
      left: 56,
      right: 42,
      bottom: 18,
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      axisTick: {
        show: false
      },
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      data: (trendRes === null || trendRes === void 0 ? void 0 : trendRes.names) || []
    },
    yAxis: {
      name: '吨',
      type: 'value',
      axisTick: {
        show: false
      },
      max: maxNum,
      nameTextStyle: {
        //y轴上方单位的颜色
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      splitLine: {
        lineStyle: {
          type: 'dashed',
          color: 'rgba(151,151,151,0.28)'
        }
      }
    },
    series: [{
      name: '进场量',
      type: 'line',
      data: (trendRes === null || trendRes === void 0 ? void 0 : trendRes.values) ? trendRes.values[0] : [],
      markLine: {
        data: [{
          yAxis: (trendRes === null || trendRes === void 0 ? void 0 : trendRes.values) && trendRes.values[1] ? trendRes.values[1][0] : 0,
          lineStyle: {
            normal: {
              color: '#FFE25D'
            }
          },
          name: '设计能力(吨/日)'
        }],
        lineStyle: {
          color: '#52C41A'
        },
        label: {
          show: true,
          position: 'insideEndTop',
          formatter: '{b}: {c}',
          color: theme === 'blue' ? '#fff' : chartFontColor,
          fontWeight: 'normal'
        }
      }
    }]
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--jcqsfx"
  }, /*#__PURE__*/_react["default"].createElement(_vmWrapper["default"], {
    title: "\u8FDB\u573A\u8D8B\u52BF\u5206\u6790",
    needChange: false
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--chart"
  }, /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option,
    notMerge: true,
    lazyUpdate: true,
    style: {
      height: '100%',
      width: '100%'
    }
  }))));
}
//# sourceMappingURL=Jcqsfx.js.map
