"use strict";

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); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _ahooks = require("ahooks");
var _moment = _interopRequireDefault(require("moment"));
var _antd = require("antd");
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("../BaseInfo/Charts"));
require("../BaseInfo/index.less");
var _refresh = _interopRequireDefault(require("../../imgs/refresh.png"));
var _position = _interopRequireDefault(require("../../imgs/position.png"));
var _refresh_light = _interopRequireDefault(require("../../imgs/refresh_light.png"));
var _position_light = _interopRequireDefault(require("../../imgs/position_light.png"));
var _refresh_blue = _interopRequireDefault(require("../../imgs/refresh_blue.png"));
var _position_blue = _interopRequireDefault(require("../../imgs/position_blue.png"));
var _TodayWorkCC = _interopRequireDefault(require("./TodayWorkCC"));
var _ZyfxCC = _interopRequireDefault(require("./ZyfxCC"));
var _Chain = _interopRequireDefault(require("./Chain"));
var _api = require("../../api");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
var QdBaseInfo = function QdBaseInfo(props) {
  var id = props.id,
    info = props.info,
    service = props.service;
  var carInfo = _api.BaseService.useCCCarInfo(id);
  var baseInfo = [{
    label: '所属单位',
    key: 'deptName',
    value: info === null || info === void 0 ? void 0 : info.deptName
  }, {
    label: '使用单位',
    key: 'useUnitName',
    value: info === null || info === void 0 ? void 0 : info.useUnitName
  }, {
    label: '车辆类别',
    key: 'carClassName',
    value: info === null || info === void 0 ? void 0 : info.carClassName
  }, {
    label: '车辆种类',
    key: 'carGradeName',
    value: info === null || info === void 0 ? void 0 : info.carGradeName
  }];
  var _useSettings = (0, _useSettings2["default"])(),
    _useSettings$theme = _useSettings.theme,
    theme = _useSettings$theme === void 0 ? 'light' : _useSettings$theme,
    startDate = _useSettings.startDate;
  var _useSetState = (0, _ahooks.useSetState)({
      baseActiveKey: '1',
      activeKey: '1',
      date: startDate ? (0, _moment["default"])(startDate) : (0, _moment["default"])().subtract(1, 'd')
    }),
    _useSetState2 = _slicedToArray(_useSetState, 2),
    state = _useSetState2[0],
    setState = _useSetState2[1];
  var baseActiveKey = state.baseActiveKey,
    activeKey = state.activeKey,
    date = state.date;
  var baseTabContent = /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      marginTop: '12px'
    }
  }, /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: baseInfo,
    gap: 18,
    horizontal: true,
    width: '50%'
  }));
  var wgfx = /*#__PURE__*/_react["default"].createElement(_ZyfxCC["default"], {
    id: id,
    garbageType: carInfo.garbageType
  });
  var title = '作业分析'; // 右下角标题
  var subTabPanes = [{
    name: '今日作业',
    key: '1',
    content: /*#__PURE__*/_react["default"].createElement(_TodayWorkCC["default"], {
      id: id,
      garbageType: carInfo.garbageType
    })
  }];
  // 基本信息
  var jbxx = /*#__PURE__*/_react["default"].createElement(_antd.Col, {
    xxl: 24,
    xl: 24,
    lg: 24,
    md: 24
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-right-base",
    style: {
      height: 300
    }
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTabs["default"], {
    onChange: function onChange(key) {
      setState({
        baseActiveKey: key
      });
    },
    activeKey: baseActiveKey,
    ghost: "ghost"
  }, [{
    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);
  }))));
  // 今日运行、作业统计
  var jryxZytj = /*#__PURE__*/_react["default"].createElement(_antd.Col, {
    xxl: 24,
    xl: 24,
    lg: 24,
    md: 24
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-right-right"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTabs["default"], {
    ghost: "ghost",
    onChange: function onChange(key) {
      setState({
        activeKey: key
      });
    },
    activeKey: activeKey
  }, subTabPanes.map(function (ele) {
    return /*#__PURE__*/_react["default"].createElement(_vmSubTabs.SubTabPane, {
      key: ele.key,
      subKey: ele.key,
      tab: ele.name
    }, ele.content);
  }))));
  var icons = {
    refresh: {
      light: _refresh_light["default"],
      dark: _refresh["default"],
      blue: _refresh_blue["default"]
    },
    position: {
      light: _position_light["default"],
      dark: _position["default"],
      blue: _position_blue["default"]
    }
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base ".concat(theme)
  }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
    gutter: [10, 10],
    style: {
      height: '100%',
      width: 481
    }
  }, /*#__PURE__*/_react["default"].createElement(_antd.Col, {
    span: 24
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-left",
    style: {
      height: 300
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-left--text"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: icons['refresh'][theme]
  }), (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: icons['position'][theme]
  }), (info === null || info === void 0 ? void 0 : info.address) || '-'), /*#__PURE__*/_react["default"].createElement(_Charts["default"], Object.assign({}, info, {
    date: (0, _moment["default"])(date).format('YYYY-MM-DD'),
    isRow: true,
    service: service
  })), /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      marginTop: '12px'
    }
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTabs["default"], {
    ghost: "ghost",
    activeKey: '1'
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTabs.SubTabPane, {
    tab: '环比模型',
    subKey: '1',
    key: '1'
  }, /*#__PURE__*/_react["default"].createElement(_Chain["default"], {
    id: id,
    garbageType: carInfo.garbageType
  })))))), /*#__PURE__*/_react["default"].createElement(_antd.Col, {
    span: 24
  }, jryxZytj)), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-base-right"
  }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
    gutter: [10, 10]
  }, jbxx, /*#__PURE__*/_react["default"].createElement(_antd.Col, {
    span: 24
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-wgfx",
    style: {
      height: 370
    }
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: title
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "car-wgfx-content"
  }, wgfx))))));
};
var _default = exports["default"] = QdBaseInfo;
//# sourceMappingURL=index.js.map
