function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import dayjs from 'dayjs';
import { VmFactor, VmWrapper } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { overViewService, useGetDivisionBusinessPackages } from "../../api";
import { getPercent } from "./RightBottom";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var TopItem = function TopItem(_ref) {
  var name = _ref.name,
    content = _ref.content,
    icon = _ref.icon,
    textStyleType = _ref.textStyleType;
  return /*#__PURE__*/_jsxs("div", {
    className: "top-item",
    children: [/*#__PURE__*/_jsxs("div", {
      className: "img",
      children: [/*#__PURE__*/_jsx("p", {
        className: "name--".concat(textStyleType),
        children: name
      }), /*#__PURE__*/_jsx("img", {
        src: icon
      })]
    }), /*#__PURE__*/_jsx("div", {
      className: "statistic",
      children: content.map(function (item) {
        return /*#__PURE__*/_jsxs("div", {
          style: {
            width: 240
          },
          children: [/*#__PURE__*/_jsx("span", {
            children: item.text
          }), /*#__PURE__*/_jsx("span", {
            className: "statistic-value--".concat(textStyleType),
            children: item.value
          })]
        }, item.text);
      })
    })]
  });
};
var Manage = function Manage(_ref2) {
  var classPrefix = _ref2.classPrefix,
    id = _ref2.id;
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark;
  var data = overViewService.useManagementData({
    throwPointId: id
  });
  var businessPackages = useGetDivisionBusinessPackages(id) || [];
  // 今日已过时常
  var todayPastHour = Number(((dayjs().valueOf() - dayjs().startOf('day').valueOf()) / 1000 / 60 / 60).toFixed(1));
  var cleanGroundDuration = data !== null && data !== void 0 && data.dirtyGroundDuration ? (todayPastHour - (data === null || data === void 0 ? void 0 : data.dirtyGroundDuration) / 60).toFixed(1) : 0;
  var noOverflowDuration = data !== null && data !== void 0 && data.overflowDuration ? (todayPastHour - (data === null || data === void 0 ? void 0 : data.overflowDuration) / 60).toFixed(1) : 0;
  return /*#__PURE__*/_jsx("div", {
    className: "".concat(classPrefix, "-manage"),
    children: /*#__PURE__*/_jsxs(VmWrapper, {
      title: "\u8FD0\u8425\u7BA1\u7406",
      children: [/*#__PURE__*/_jsx("div", {
        className: "".concat(classPrefix, "-row"),
        children: [{
          name: '语音宣教',
          value: data === null || data === void 0 ? void 0 : data.voiceEducateTimes,
          unit: '次',
          key: 'yyxj',
          fontType: 'blue'
        }, {
          name: '违规陌生人',
          value: data === null || data === void 0 ? void 0 : data.strangerNum,
          unit: '人',
          key: 'wgmsr',
          fontType: 'red'
        }, {
          name: '灰名单',
          value: data === null || data === void 0 ? void 0 : data.badLabelPersonNum,
          unit: '人',
          key: 'hmd',
          fontType: 'gray'
        }].map(function (ele, index) {
          return /*#__PURE__*/_jsx(VmFactor, _objectSpread(_objectSpread({}, ele), {}, {
            img: require("../../imgs/".concat(ele.key).concat(isDark ? '' : '_light', ".png")),
            unitStyle: {
              fontSize: 14
            }
          }), index);
        })
      }), /*#__PURE__*/_jsxs("div", {
        className: "".concat(classPrefix, "-manage-bottom"),
        children: [/*#__PURE__*/_jsxs("div", {
          className: "".concat(classPrefix, "-manage-bottom-item"),
          children: [/*#__PURE__*/_jsxs("div", {
            className: "".concat(classPrefix, "-manage-bottom-item-left"),
            children: ["\u73AF\u5883\u7BA1\u7406\u6210\u6548", /*#__PURE__*/_jsx("img", {
              src: require("../../imgs/hjglcx.png")
            })]
          }), /*#__PURE__*/_jsxs("div", {
            className: "".concat(classPrefix, "-manage-bottom-item-right"),
            children: [/*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-manage-bottom-item-right-item"),
              children: ["\u4ECA\u65E5\u5730\u9762\u5E72\u51C0\u65F6\u957F\u5360\u6BD4", /*#__PURE__*/_jsx("div", {
                className: "".concat(isDark ? 'white_blue' : 'blue'),
                style: {
                  display: 'inline-block',
                  fontSize: 14,
                  marginLeft: 12
                },
                children: "".concat(cleanGroundDuration, "h/").concat(todayPastHour, "h")
              }), /*#__PURE__*/_jsx("img", {
                src: require("../../imgs/manage_bg".concat(isDark ? '' : '_light', ".png"))
              })]
            }), /*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-manage-bottom-item-right-item"),
              children: ["\u4ECA\u65E5\u65E0\u7206\u6876\u72B6\u6001\u65F6\u957F\u5360\u6BD4", /*#__PURE__*/_jsx("div", {
                className: "".concat(isDark ? 'white_cyan' : 'cyan'),
                style: {
                  display: 'inline-block',
                  fontSize: 14,
                  marginLeft: 12
                },
                children: "".concat(noOverflowDuration, "h/").concat(todayPastHour, "h")
              }), /*#__PURE__*/_jsx("img", {
                src: require("../../imgs/manage_bg".concat(isDark ? '' : '_light', ".png"))
              })]
            })]
          })]
        }), /*#__PURE__*/_jsxs("div", {
          className: "".concat(classPrefix, "-manage-bottom-item"),
          children: [/*#__PURE__*/_jsxs("div", {
            className: "".concat(classPrefix, "-manage-bottom-item-left"),
            children: ["\u516C\u4F17\u5BA3\u6559\u6210\u6548", /*#__PURE__*/_jsx("img", {
              src: require("../../imgs/gzxjcx.png")
            })]
          }), /*#__PURE__*/_jsxs("div", {
            className: "".concat(classPrefix, "-manage-bottom-item-right"),
            children: [/*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-manage-bottom-item-right-item"),
              children: ["\u53A8\u4F59\u51C6\u786E\u7387", /*#__PURE__*/_jsxs("div", {
                className: "".concat(isDark ? 'white_green' : 'green'),
                style: {
                  display: 'inline-block',
                  fontSize: 14,
                  marginLeft: 12
                },
                children: [getPercent(data === null || data === void 0 ? void 0 : data.chuyuAccuracy), "%"]
              }), /*#__PURE__*/_jsx("img", {
                src: require("../../imgs/manage_bg".concat(isDark ? '' : '_light', ".png"))
              })]
            }), /*#__PURE__*/_jsxs("div", {
              className: "".concat(classPrefix, "-manage-bottom-item-right-item"),
              children: ["\u5C45\u6C11\u53C2\u4E0E\u7387", /*#__PURE__*/_jsxs("div", {
                className: "".concat(isDark ? 'white_cyan' : 'cyan'),
                style: {
                  display: 'inline-block',
                  fontSize: 14,
                  marginLeft: 12
                },
                children: [getPercent(data === null || data === void 0 ? void 0 : data.personParticipationRate), "%"]
              }), /*#__PURE__*/_jsx("img", {
                src: require("../../imgs/manage_bg".concat(isDark ? '' : '_light', ".png"))
              })]
            })]
          })]
        })]
      })]
    })
  });
};
export default Manage;