"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _ahooks = require("ahooks");
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _vmSubTabs = _interopRequireWildcard(require("../../../vm-sub-tabs"));
var _vmInfoCollection = _interopRequireDefault(require("../../../vm-info-collection"));
var _Charts = _interopRequireDefault(require("./Charts"));
var _TodayRun = _interopRequireDefault(require("./TodayRun"));
var _TodayRunJXH = _interopRequireDefault(require("./TodayRunJXH"));
var _TodayRunLJSY = _interopRequireDefault(require("./TodayRunLJSY"));
var _Wgfx = _interopRequireDefault(require("./Wgfx"));
var _WgfxJXH = _interopRequireDefault(require("./WgfxJXH"));
var _WgfxLJSY = _interopRequireDefault(require("./WgfxLJSY"));
var _api = require("../../api");
require("./index.less");
var _refresh = _interopRequireDefault(require("../../imgs/refresh.png"));
var _position = _interopRequireDefault(require("../../imgs/position.png"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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 _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme;
  var _useSetState = (0, _ahooks.useSetState)({
      baseActiveKey: '1',
      activeKey: '1' // 今日运行key
    }),
    _useSetState2 = _slicedToArray(_useSetState, 2),
    state = _useSetState2[0],
    setState = _useSetState2[1];
  var baseActiveKey = state.baseActiveKey,
    activeKey = state.activeKey;
  var _BaseService$useBaseI = _api.BaseService.useBaseInfo(id),
    baseInfo = _BaseService$useBaseI.baseInfo,
    info = _BaseService$useBaseI.info;
  var baseTabContent = /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: baseInfo,
    gap: 18
  });
  var todayRun = /*#__PURE__*/_react["default"].createElement(_TodayRun["default"], null);
  var wgfx = /*#__PURE__*/_react["default"].createElement(_Wgfx["default"], null);
  if ((info === null || info === void 0 ? void 0 : info.actionType) === 'ACTION_JXH') {
    todayRun = /*#__PURE__*/_react["default"].createElement(_TodayRunJXH["default"], null);
    wgfx = /*#__PURE__*/_react["default"].createElement(_WgfxJXH["default"], {
      data: []
    });
  }
  if ((info === null || info === void 0 ? void 0 : info.actionType) === 'ACTION_LJSY') {
    todayRun = /*#__PURE__*/_react["default"].createElement(_TodayRunLJSY["default"], null);
    wgfx = /*#__PURE__*/_react["default"].createElement(_WgfxLJSY["default"], {
      data: []
    });
  }
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base ".concat(theme)
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-left"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-left--text"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: _refresh["default"]
  }), info === null || info === void 0 ? void 0 : info.equipmentTime), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-left--text"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: _position["default"]
  }), info === null || info === void 0 ? void 0 : info.address), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-left--online"
  }, "\u5728\u7EBF"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-left--gif"
  }), /*#__PURE__*/_react["default"].createElement(_Charts["default"], Object.assign({}, info))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-right"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-right-base"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTabs["default"], {
    onChange: function onChange(key) {
      setState({
        baseActiveKey: key
      });
    },
    activeKey: baseActiveKey
  }, [{
    name: '基本信息',
    key: '1',
    content: baseTabContent
  }].map(function (ele) {
    return /*#__PURE__*/_react["default"].createElement(_vmSubTabs.SubTabPane, {
      subKey: ele.key,
      key: ele.key,
      tab: ele.name
    }, ele.content);
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-right-right"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTabs["default"], {
    onChange: function onChange(key) {
      setState({
        activeKey: key
      });
    },
    activeKey: activeKey
  }, [{
    name: '今日运行',
    key: '1',
    content: todayRun
  }, {
    name: '作业统计',
    key: '2',
    content: /*#__PURE__*/_react["default"].createElement("div", null, "\u8FDD\u89C4\u6B21\u6570\u3001\u7D2F\u8BA1\u8FDD\u89C4\u5929\u6570\u3001\u7D2F\u8BA1\u8FDD\u89C4\u65F6\u957F\uFF08\u53EA\u6709\u673A\u68B0\u5316\u9700\u8981\uFF09")
  }].map(function (ele) {
    return /*#__PURE__*/_react["default"].createElement(_vmSubTabs.SubTabPane, {
      key: ele.key,
      subKey: ele.key,
      tab: ele.name
    }, ele.content);
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-wgfx"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u8FDD\u89C4\u5206\u6790"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-wgfx-content"
  }, wgfx))));
};
var _default = BaseInfo;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
