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 { BaseService } from "./api";
import { AlarmInfo, Attendance, BaseInfo, Calendar, Equipment } from "./components";
import "./style";
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 VtxStaffModal = function VtxStaffModal(props) {
  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,
    _props$iframeUrl = props.iframeUrl,
    iframeUrl = _props$iframeUrl === void 0 ? '' : _props$iframeUrl,
    _props$width = props.width,
    width = _props$width === void 0 ? null : _props$width;
  var _useGetConfig = useGetConfig('staff', tabs),
    tabsData = _useGetConfig.tabsData;
  var _BaseService$useDetai = BaseService.useDetailInfo(id),
    detail = _BaseService$useDetai.detail;
  var _BaseService$useBaseI = BaseService.useBaseInfo(id),
    baseInfo = _BaseService$useBaseI.baseInfo,
    info = _BaseService$useBaseI.info;
  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
  })), TABS_CALENDAR, /*#__PURE__*/_jsx(Calendar, {
    id: id
  })), TABS_ALARM, /*#__PURE__*/_jsx(AlarmInfo, {
    id: id
  })), TABS_ATTENDANCE, /*#__PURE__*/_jsx(Attendance, {
    id: id
  })), TABS_EUQIPMENT, /*#__PURE__*/_jsx(Equipment, {
    id: id,
    realInfo: realInfo
  }));

  // 自定义页签可配置多个，
  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",
    width: width,
    title: title,
    subTitle: subTitle,
    visible: visible,
    source: source,
    theme: theme,
    onCancel: onCancel,
    frameParams: frameParams,
    tabChose: tabChose,
    top: top,
    iframeUrl: iframeUrl,
    tabs: tabsList,
    tagList: [{
      color: 'blue',
      value: detail === null || detail === void 0 ? void 0 : detail.employmentTypeName
    }, {
      color: 'green',
      value: info === null || info === void 0 ? void 0 : info.statusName
    }],
    contents: contents
  });
};
export default VtxStaffModal;