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 _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 { useMemo } from 'react';
import VmCustom from "../_components/vm-custom";
import useGetConfig from "../_hooks/useGetConfig";
import VtxBaseModal from "../vtx-base-modal";
import { AlarmInfo, Attendance, BaseInfo, Calendar, Equipment } from "../vtx-staff-modal/components";
import "../vtx-staff-modal/style";
import { BaseService } from "./api";
import { jsx as _jsx } from "react/jsx-runtime";
var TABS_BASE = 'base';
var TABS_CALENDAR = 'calendar';
var TABS_ALARM = 'alarm';
var TABS_ATTENDANCE = 'attendance';
var TABS_EUQIPMENT = 'equipment';
var tabs = [{
  key: TABS_BASE,
  title: '总览信息'
}, {
  key: TABS_CALENDAR,
  title: '作业日历'
}, {
  key: TABS_ALARM,
  title: '报警信息'
}, {
  key: TABS_ATTENDANCE,
  title: '考勤信息'
}, {
  key: TABS_EUQIPMENT,
  title: '设备信息'
}];
var VtxQyryModal = function VtxQyryModal(props) {
  var _realInfo$info, _realInfo$info2;
  var id = props.id,
    title = props.title,
    subTitle = props.subTitle,
    theme = props.theme,
    source = props.source,
    visible = props.visible,
    onCancel = props.onCancel,
    _props$top = props.top,
    top = _props$top === void 0 ? 50 : _props$top,
    _props$frameParams = props.frameParams,
    frameParams = _props$frameParams === void 0 ? {} : _props$frameParams,
    _props$customMapInfo = props.customMapInfo,
    customMapInfo = _props$customMapInfo === void 0 ? {} : _props$customMapInfo,
    _props$tabChose = props.tabChose,
    tabChose = _props$tabChose === void 0 ? '' : _props$tabChose;
  var _useGetConfig = useGetConfig('qyry', tabs),
    tabsData = _useGetConfig.tabsData;
  var _BaseService$useBaseI = BaseService.useBaseInfo(id),
    baseInfo = _BaseService$useBaseI.baseInfo;
  var realInfo = BaseService.useMapInfo(id);
  var tabsList = useMemo(function () {
    var tabsList = tabsData;
    return tabsList;
  }, [JSON.stringify(tabsData)]);
  var contents = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TABS_BASE, /*#__PURE__*/_jsx(BaseInfo, {
    id: id,
    baseInfo: baseInfo,
    realInfo: realInfo,
    customMapInfo: customMapInfo,
    service: "rykq"
  })), TABS_CALENDAR, /*#__PURE__*/_jsx(Calendar, {
    id: id,
    service: "rykq"
  })), TABS_ALARM, /*#__PURE__*/_jsx(AlarmInfo, {
    id: id,
    service: "rykq"
  })), TABS_ATTENDANCE, /*#__PURE__*/_jsx(Attendance, {
    id: id,
    service: "rykq"
  })), TABS_EUQIPMENT, /*#__PURE__*/_jsx(Equipment, {
    id: id,
    realInfo: realInfo,
    service: "rykq"
  }));

  // 自定义页签可配置多个，
  if (tabsData !== null && tabsData !== void 0 && tabsData.length) {
    tabsData.forEach(function (ele) {
      if (ele.url) {
        contents[ele.key] = /*#__PURE__*/_jsx(VmCustom, {
          id: id,
          url: ele === null || ele === void 0 ? void 0 : ele.url
        });
      }
    });
  }
  return /*#__PURE__*/_jsx(VtxBaseModal, {
    id: id,
    type: "staff",
    title: title,
    subTitle: subTitle,
    visible: visible,
    source: source,
    theme: theme,
    onCancel: onCancel,
    frameParams: frameParams,
    tabChose: tabChose,
    top: top,
    tabs: tabsList,
    tagList: [{
      color: 'blue',
      value: realInfo === null || realInfo === void 0 || (_realInfo$info = realInfo.info) === null || _realInfo$info === void 0 ? void 0 : _realInfo$info.workTypeName
    }, {
      color: 'green',
      value: realInfo === null || realInfo === void 0 || (_realInfo$info2 = realInfo.info) === null || _realInfo$info2 === void 0 ? void 0 : _realInfo$info2.statusName
    }],
    contents: contents
  });
};
export default VtxQyryModal;