"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = Rules;
var _react = _interopRequireDefault(require("react"));
var _vmNodata = _interopRequireDefault(require("../../../vm-nodata"));
var _api = require("../../api");
var _antd = require("antd");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 收集点-总览信息-收运规则
 */

function Rules(props) {
  var id = props.id,
    paramConfigsList = props.paramConfigsList;
  var rules = _api.BaseService.useGetRule(id);
  var getColor = function getColor(name) {
    var color = '#C8C8C8';
    switch (name) {
      case '其他垃圾':
        color = '#C8C8C8';
        break;
      case '厨余垃圾':
        color = '#77D5A9';
        break;
      case '易腐垃圾':
        color = '#77D5A9';
        break;
      case '有害垃圾':
        color = '#FFC1C1';
        break;
      case '可回收物':
        color = '#9FC1E8';
        break;
      default:
        color = '#C8C8C8';
        break;
    }
    return color;
  };
  var getImgCode = function getImgCode(name) {
    var code = 'qt';
    switch (name) {
      case '其他垃圾':
        code = 'qt';
        break;
      case '厨余垃圾':
        code = 'cy';
        break;
      case '易腐垃圾':
        code = 'yf';
        break;
      case '有害垃圾':
        code = 'yh';
        break;
      case '可回收物':
        code = 'khsw';
        break;
      default:
        code = 'qt';
        break;
    }
    return code;
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "syrules-content"
  }, Array.isArray(rules) ? rules.map(function (ele, index) {
    var _a, _b;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "syrules-item",
      key: index,
      style: {
        borderColor: getColor((ele === null || ele === void 0 ? void 0 : ele.productTypeName) || '')
      }
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "syrules-item--info"
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "syrules-item--icon ".concat(getImgCode((ele === null || ele === void 0 ? void 0 : ele.productTypeName) || ''))
    }), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_antd.Space, {
      size: 10
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "syrules-item--name"
    }, (ele === null || ele === void 0 ? void 0 : ele.productTypeName) || '--'), ((_a = paramConfigsList['SHOW_COLLECTING_BUCKETS']) === null || _a === void 0 ? void 0 : _a.value) === 'true' && /*#__PURE__*/_react["default"].createElement("div", null, (ele === null || ele === void 0 ? void 0 : ele.bucketNum) || 0, "\u4E2A\u6876")), /*#__PURE__*/_react["default"].createElement("div", {
      className: "syrules-item--unitName"
    }, ele === null || ele === void 0 ? void 0 : ele.accUnitName))), /*#__PURE__*/_react["default"].createElement(_antd.Space, {
      size: 10
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "syrules-item--label"
    }, "\u6536\u8FD0\u89C4\u5219:"), /*#__PURE__*/_react["default"].createElement("div", null, (_b = ele === null || ele === void 0 ? void 0 : ele.rules) === null || _b === void 0 ? void 0 : _b.map(function (rule) {
      return /*#__PURE__*/_react["default"].createElement(_antd.Space, {
        key: rule.ruleId,
        size: 12
      }, /*#__PURE__*/_react["default"].createElement("span", null, rule.ruleContent), /*#__PURE__*/_react["default"].createElement("span", null, rule.carCode));
    }))));
  }) : (/*#__PURE__*/_react["default"].createElement(_vmNodata["default"], null)));
}
//# sourceMappingURL=Rules.js.map
