"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _components = require("@vtx/components");
var _ahooks = require("ahooks");
var _antd = require("antd");
var _moment = _interopRequireDefault(require("moment"));
var _vmFilter = require("../../../vm-filter");
var _vmInfoCollection = _interopRequireDefault(require("../../../vm-info-collection"));
var _vmNodata = _interopRequireDefault(require("../../../vm-nodata"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _Jcqsfx = _interopRequireDefault(require("./Jcqsfx"));
var _Situation = _interopRequireDefault(require("./Situation"));
var _api = require("../../api");
var _RealtimeMonitor = _interopRequireDefault(require("./RealtimeMonitor"));
require("./index.less");
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; }
var BaseInfo = function BaseInfo(props) {
  var id = props.id;
  var nowDate = (0, _moment["default"])().format('YYYY-MM-DD');
  var _useSetState = (0, _ahooks.useSetState)({
      startDate: nowDate,
      endDate: nowDate,
      alarmTabs: [{
        key: '',
        name: '全部',
        value: 0
      }],
      alarmTabsValue: [{}]
    }),
    _useSetState2 = _slicedToArray(_useSetState, 2),
    state = _useSetState2[0],
    setState = _useSetState2[1];
  var startDate = state.startDate,
    endDate = state.endDate;
  var handleDateChange = function handleDateChange(start, end) {
    setState({
      startDate: start,
      endDate: end
    });
  };
  var _BaseService$useBaseI = _api.BaseService.useBaseInfo(id, nowDate, nowDate),
    baseInfo = _BaseService$useBaseI.baseInfo,
    photos = _BaseService$useBaseI.photos;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "df-baseContent"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top-img"
  }, photos.length ? /*#__PURE__*/_react["default"].createElement(_components.VtxImage.PreviewGroup, null, /*#__PURE__*/_react["default"].createElement(_antd.Carousel, {
    style: {
      width: '315px',
      height: '240px'
    }
  }, photos.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement(_components.VtxImage, {
      key: item.id,
      src: "/cloudFile/common/downloadFile?id=".concat(item.id),
      alt: item.name
    });
  }))) : /*#__PURE__*/_react["default"].createElement(_vmNodata["default"], null)), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--base"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u57FA\u672C\u4FE1\u606F"
  }), /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: baseInfo
  })), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--jcqsfx"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--jcqsfx-head"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u8FDB\u573A\u8D8B\u52BF\u5206\u6790"
  }), /*#__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: "base-top--chart"
  }, /*#__PURE__*/_react["default"].createElement(_Jcqsfx["default"], null)))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-bottom"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-bottom--left"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u5B9E\u65F6\u8FD0\u884C\u60C5\u51B5"
  }), /*#__PURE__*/_react["default"].createElement(_Situation["default"], null)), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-bottom--right"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u6307\u6807\u5B9E\u65F6\u76D1\u6D4B"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-bottom--right-content"
  }, /*#__PURE__*/_react["default"].createElement(_RealtimeMonitor["default"], null)))));
};
var _default = BaseInfo;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
