"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = Summary;
var _react = _interopRequireDefault(require("react"));
var _ahooks = require("ahooks");
var _antd = require("antd");
var _moment = _interopRequireDefault(require("moment"));
var _vmFilter = require("../../../vm-filter");
var _Radar = _interopRequireDefault(require("./Radar"));
var _api = require("../../api");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function Summary(props) {
  var id = props.id;
  var _useSetState = (0, _ahooks.useSetState)({
      startDate: (0, _moment["default"])().format('YYYY-MM-DD'),
      endDate: (0, _moment["default"])().format('YYYY-MM-DD')
    }),
    _useSetState2 = _slicedToArray(_useSetState, 2),
    state = _useSetState2[0],
    setState = _useSetState2[1];
  var startDate = state.startDate,
    endDate = state.endDate;
  var _AppraiseService$useA = _api.AppraiseService.useAppraisSummary(id, startDate, endDate),
    appraiseSummary = _AppraiseService$useA.appraiseSummary;
  var valueEight = appraiseSummary.valueEight,
    valueFour = appraiseSummary.valueFour,
    valueFive = appraiseSummary.valueFive,
    valueSeven = appraiseSummary.valueSeven,
    valueSix = appraiseSummary.valueSix,
    assessCount = appraiseSummary.assessCount,
    totalValue = appraiseSummary.totalValue,
    goodItem = appraiseSummary.goodItem,
    goodItemStr = appraiseSummary.goodItemStr,
    badItem = appraiseSummary.badItem,
    badItemStr = appraiseSummary.badItemStr,
    exceedingRate = appraiseSummary.exceedingRate;
  var handleDateChange = function handleDateChange(start, end) {
    setState({
      startDate: start,
      endDate: end
    });
  };
  var radarData = {
    indicator: [{
      name: '容易找到',
      max: 10
    }, {
      name: '公众满意',
      max: 10
    }, {
      name: '服务管理',
      max: 10
    }, {
      name: '无需等待',
      max: 10
    }, {
      name: '干净卫生',
      max: 10
    }],
    value: [valueEight, valueFive, valueFour, valueSeven, valueSix]
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-head"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-subscribtion"
  }, "\u8BE5\u516C\u5395\u8FD1\u671F\u7EFC\u5408\u8BC4\u4EF7\u9886\u5148", exceedingRate || '0', "%\u7684\u516C\u5395\uFF0C\u7EE7\u7EED\u4FDD\u6301\uFF01"), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_vmFilter.VMRangePicker, {
    value: [(0, _moment["default"])(startDate), (0, _moment["default"])(endDate)],
    onChange: function onChange(dates) {
      return dates && handleDateChange((0, _moment["default"])(dates[0]).format('YYYY-MM-DD'), (0, _moment["default"])(dates[1]).format('YYYY-MM-DD'));
    }
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-radar"
  }, /*#__PURE__*/_react["default"].createElement(_Radar["default"], Object.assign({}, radarData))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-avg"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-avg-progress"
  }, /*#__PURE__*/_react["default"].createElement(_antd.Progress, {
    type: "circle",
    percent: 75,
    strokeWidth: 10,
    strokeColor: "#4AFFE6",
    trailColor: "#162123",
    strokeLinecap: "butt",
    showInfo: false,
    style: {
      width: '100px',
      height: '100px',
      margin: '24px 0 0 24px'
    }
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-avg-progress-text"
  }, /*#__PURE__*/_react["default"].createElement("span", null, totalValue), /*#__PURE__*/_react["default"].createElement("div", null, "\u5E73\u5747\u603B\u5206"))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-avg-count"
  }, /*#__PURE__*/_react["default"].createElement("span", null, assessCount, "\u6B21"), /*#__PURE__*/_react["default"].createElement("div", null, "\u8BC4\u4EF7\u603B\u6B21\u6570"))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-appraise"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-appraise-good"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-appraise-good-bg"
  }, "\u4F18\u79C0\u9879\uFF1A ", goodItem || '无'), goodItemStr || '--'), /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-appraise-bad"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "appraise-summary-main-appraise-bad-bg"
  }, "\u8584\u5F31\u9879\uFF1A", badItem || '无'), badItemStr || '--'))));
}
//# sourceMappingURL=Summary.js.map
