"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _vmCharts = require("../../../vm-charts");
var _api = require("../../api");
require("./index.less");
var _vmEmpty = _interopRequireDefault(require("../../../vm-empty"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 区域进厂量分析
 */

function Qyjcl(props) {
  var _a, _b;
  var code = props.code,
    startDate = props.startDate,
    endDate = props.endDate;
  var _BaseService$useQyjcl = _api.BaseService.useQyjcl(code, startDate, endDate),
    areaSumData = _BaseService$useQyjcl.areaSumData;
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "alarm-trend"
  }, ((_a = areaSumData === null || areaSumData === void 0 ? void 0 : areaSumData.areaDetailList) === null || _a === void 0 ? void 0 : _a.length) ? (/*#__PURE__*/_react["default"].createElement(_vmCharts.Pie, {
    data: ((_b = areaSumData === null || areaSumData === void 0 ? void 0 : areaSumData.areaDetailList) === null || _b === void 0 ? void 0 : _b.map(function (ele) {
      return {
        name: ele.areaName,
        value: ele.todayInWeight,
        rate: ele.todayInWeightPercent
      };
    })) || [],
    name: "",
    exportShow: false,
    style: {
      height: 250
    },
    legendConfig: {
      left: '50%',
      icon: 'circle',
      top: 'middle',
      formatter: function formatter(name) {
        var value = areaSumData === null || areaSumData === void 0 ? void 0 : areaSumData.areaDetailList.find(function (item) {
          return item.areaName === name;
        });
        if (value) {
          return "\t\t".concat(name, "\t\t").concat(value.todayInWeight, "\u5428\t\t").concat(value.todayInWeightPercent, "%");
        } else {
          return '';
        }
      }
    }
  })) : (/*#__PURE__*/_react["default"].createElement(_vmEmpty["default"], {
    style: {
      display: 'block'
    },
    type: "chart",
    text: ""
  }))));
}
var _default = exports["default"] = Qyjcl;
//# sourceMappingURL=Qyjcl.js.map
