"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = TodayWork;
var _react = _interopRequireDefault(require("react"));
var _progress = _interopRequireDefault(require("antd/es/progress"));
var _vmNodata = _interopRequireDefault(require("../../../vm-nodata"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _TodayWorkTable = _interopRequireDefault(require("./TodayWorkTable"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
require("./index.less");
var _all_rate_light = _interopRequireDefault(require("../../imgs/all_rate_light.png"));
var _cx_rate_light = _interopRequireDefault(require("../../imgs/cx_rate_light.png"));
var _xs_rate_light = _interopRequireDefault(require("../../imgs/xs_rate_light.png"));
var _ss_rate_light = _interopRequireDefault(require("../../imgs/ss_rate_light.png"));
var _all_rate = _interopRequireDefault(require("../../imgs/all_rate.png"));
var _cx_rate = _interopRequireDefault(require("../../imgs/cx_rate.png"));
var _xs_rate = _interopRequireDefault(require("../../imgs/xs_rate.png"));
var _ss_rate = _interopRequireDefault(require("../../imgs/ss_rate.png"));
var _antd = require("antd");
var _icons = require("@ant-design/icons");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 收集点-总览信息-收运规则
 */

function TodayWork(props) {
  var data = props.data,
    id = props.id,
    service = props.service,
    setIframeModalInfo = props.setIframeModalInfo;
  var _useSettings = (0, _useSettings2["default"])(),
    _useSettings$theme = _useSettings.theme,
    theme = _useSettings$theme === void 0 ? 'light' : _useSettings$theme;
  var srcs = function srcs(name) {
    var _a;
    var obj = {
      light: {
        全部: _all_rate_light["default"],
        冲洗: _cx_rate_light["default"],
        洗扫: _xs_rate_light["default"],
        洒水: _ss_rate_light["default"]
      },
      dark: {
        全部: _all_rate["default"],
        冲洗: _cx_rate["default"],
        洗扫: _xs_rate["default"],
        洒水: _ss_rate["default"]
      },
      blue: {
        全部: _all_rate_light["default"],
        冲洗: _cx_rate_light["default"],
        洗扫: _xs_rate_light["default"],
        洒水: _ss_rate_light["default"]
      }
    };
    return theme ? (_a = obj[theme]) === null || _a === void 0 ? void 0 : _a[name] : '';
  };
  var getValue = function getValue(name) {
    var strokeColor = {
      '0%': '#BFFFE8',
      '100%': '#37D3B0'
    };
    var src = srcs === null || srcs === void 0 ? void 0 : srcs(name);
    switch (name) {
      case '全部':
        strokeColor = {
          '0%': '#BFFFE8',
          '100%': '#37D3B0'
        };
        break;
      case '冲洗':
        strokeColor = {
          '0%': '#EC982B',
          '100%': '#FFE49A'
        };
        break;
      case '洗扫':
        strokeColor = {
          '0%': '#62C1FD',
          '100%': '#3E9DF9'
        };
        break;
      case '洒水':
        strokeColor = {
          '0%': '#FFA793',
          '100%': '#FF6770'
        };
        break;
      default:
        strokeColor = {
          '0%': '#EC982B',
          '100%': '#FFE49A'
        };
        src = srcs('全部');
        break;
    }
    return {
      strokeColor: strokeColor,
      src: src
    };
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-right-twork"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u4ECA\u65E5\u4F5C\u4E1A"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--head"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--head-img"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--head-carType"
  }, "\u4F5C\u4E1A\u7C7B\u578B"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--head-block"
  }, "\u8BA1\u5212\u91CC\u7A0B"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--head-block",
    style: {
      width: 120
    }
  }, "\u6838\u7B97\u4F5C\u4E1A\u91CC\u7A0B", /*#__PURE__*/_react["default"].createElement(_antd.Tooltip, {
    title: "\u6838\u7B97\u4F5C\u4E1A\u91CC\u7A0B\uFF1A\u6839\u636E\u4F5C\u4E1A\u8DEF\u6BB5\u957F\u5EA6\u548C\u4F5C\u4E1A\u89C4\u5219\uFF0C\u540C\u4E00\u8DEF\u6BB5\u540C\u4E00\u65F6\u6BB5\u7684\u4F5C\u4E1A\u7C7B\u578B\u4E0B\uFF0C\u4E0D\u53EF\u8D85\u8FC7\u8BA1\u5212\u4F5C\u4E1A\u91CC\u7A0B\u3002"
  }, /*#__PURE__*/_react["default"].createElement(_icons.QuestionCircleOutlined, {
    style: {
      marginLeft: 8
    }
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--head-block"
  }, "\u8BA1\u5212\u8D9F\u6570"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--head-block"
  }, "\u6709\u6548\u8D9F\u6570")), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork--item-wrap"
  }, Array.isArray(data) ? data.map(function (item, index) {
    var _getValue = getValue(item === null || item === void 0 ? void 0 : item.workTypeStr),
      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.workTypeStr, "\u5B8C\u6210\u7387\uFF1A", (item === null || item === void 0 ? void 0 : item.rate) || 0, "%"), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-progress-bg"
    }, /*#__PURE__*/_react["default"].createElement(_progress["default"], {
      strokeLinecap: "butt",
      percent: (item === null || item === void 0 ? void 0 : item.rate) || 0,
      strokeColor: strokeColor,
      trailColor: "#444B59",
      strokeWidth: 6,
      showInfo: false
    }))), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-block"
    }, /*#__PURE__*/_react["default"].createElement("span", null, (item === null || item === void 0 ? void 0 : item.planMileage) || 0), "\u516C\u91CC"), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-block",
      style: {
        width: 120
      }
    }, /*#__PURE__*/_react["default"].createElement("span", null, (item === null || item === void 0 ? void 0 : item.workMileage) || 0), "\u516C\u91CC"), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-block"
    }, /*#__PURE__*/_react["default"].createElement("span", null, (item === null || item === void 0 ? void 0 : item.planCount) || 0), "\u8D9F"), /*#__PURE__*/_react["default"].createElement("div", {
      className: "twork--item-block"
    }, /*#__PURE__*/_react["default"].createElement("span", null, (item === null || item === void 0 ? void 0 : item.workCount) || 0), "\u8D9F"));
  }) : (/*#__PURE__*/_react["default"].createElement(_vmNodata["default"], null)))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "twork-table"
  }, /*#__PURE__*/_react["default"].createElement(_TodayWorkTable["default"], {
    id: id,
    service: service,
    setIframeModalInfo: setIframeModalInfo
  })));
}
//# sourceMappingURL=TodayWork.js.map
