"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = TodayWork;
var _progress = _interopRequireDefault(require("antd/es/progress"));
var _react = _interopRequireDefault(require("react"));
var _vmNodata = _interopRequireDefault(require("../../../vm-nodata"));
require("./index.less");
var _all_rate = _interopRequireDefault(require("../../imgs/all_rate.png"));
var _cy_rate = _interopRequireDefault(require("../../imgs/cy_rate.png"));
var _qt_rate = _interopRequireDefault(require("../../imgs/qt_rate.png"));
var _yh_rate = _interopRequireDefault(require("../../imgs/yh_rate.png"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
 * 收集点-总览信息-收运规则
 */

function TodayWork(props) {
  var data = props.data;
  var blockItem = function blockItem(title, value, unit) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-block-item"
    }, /*#__PURE__*/_react["default"].createElement("div", null, title), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-block-item-value"
    }, /*#__PURE__*/_react["default"].createElement("span", null, value || 0), unit));
  };
  var getValue = function getValue(name) {
    var strokeColor = {
      '0%': '#BFFFE8',
      '100%': '#37D3B0'
    };
    var src = _all_rate["default"];
    switch (name) {
      case '全部':
        strokeColor = {
          '0%': '#BFFFE8',
          '100%': '#37D3B0'
        };
        src = _all_rate["default"];
        break;
      case '其他垃圾':
        strokeColor = {
          '0%': '#EC982B',
          '100%': '#FFE49A'
        };
        src = _qt_rate["default"];
        break;
      case '厨余垃圾':
        strokeColor = {
          '0%': '#62C1FD',
          '100%': '#3E9DF9'
        };
        src = _cy_rate["default"];
        break;
      case '有害垃圾':
        strokeColor = {
          '0%': '#FFA793',
          '100%': '#FF6770'
        };
        src = _yh_rate["default"];
        break;
      default:
        strokeColor = {
          '0%': '#EC982B',
          '100%': '#FFE49A'
        };
        src = _qt_rate["default"];
        break;
    }
    return {
      strokeColor: strokeColor,
      src: src
    };
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork"
  }, Array.isArray(data) ? data.map(function (item, index) {
    var _getValue = getValue(item === null || item === void 0 ? void 0 : item.productTypeName),
      strokeColor = _getValue.strokeColor,
      src = _getValue.src;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item",
      key: index
    }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("img", {
      src: src
    })), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-progress"
    }, /*#__PURE__*/_react["default"].createElement("div", null, item === null || item === void 0 ? void 0 : item.productTypeName, "\u5B8C\u6210\u7387\uFF1A", item.rate * 100 || 0, "%"), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-progress-bg"
    }, /*#__PURE__*/_react["default"].createElement(_progress["default"], {
      strokeLinecap: "butt",
      percent: item.rate,
      strokeColor: strokeColor,
      trailColor: "#444B59",
      strokeWidth: 6,
      showInfo: false
    }))), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-block"
    }, blockItem('应收次数', item === null || item === void 0 ? void 0 : item.planNum, '次'), blockItem('实收次数', item === null || item === void 0 ? void 0 : item.collectNum, '次'), blockItem('收集桶数', item === null || item === void 0 ? void 0 : item.bucketNum, '桶'), blockItem('收集重量', item === null || item === void 0 ? void 0 : item.weight, 'kg')));
  }) : /*#__PURE__*/_react["default"].createElement(_vmNodata["default"], null));
}
//# sourceMappingURL=TodayWork.js.map
