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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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 { Col, Row } from 'antd';
import useSettings from "../../../_hooks/useSettings";
import { VmMap, VmWrapper } from "../../../_components";
import { EquipmentService } from "../../api";
import "./index.less";
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
var MainItem = function MainItem(props) {
  var label = props.label,
    value = props.value;
  return /*#__PURE__*/_jsxs("div", {
    className: "staff-equip-main-item",
    children: [/*#__PURE__*/_jsxs("div", {
      className: "staff-equip-main-item-label",
      children: [label, ":"]
    }), /*#__PURE__*/_jsx("div", {
      className: "staff-equip-main-item-value",
      children: value || '-'
    })]
  });
};
var Equipment = function Equipment(props) {
  var id = props.id,
    customMapInfo = props.customMapInfo,
    realInfo = props.realInfo,
    service = props.service;
  var _useSettings = useSettings(),
    mapInfo = _useSettings.mapInfo;
  var mapPoints = realInfo.mapPoints,
    pointLngLat = realInfo.pointLngLat;
  var _EquipmentService$use = EquipmentService.useDevice(id, service),
    deviceRes = _EquipmentService$use.deviceRes,
    monitorRes = _EquipmentService$use.monitorRes;
  var _EquipmentService$use2 = EquipmentService.useDeviceStatus(monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.id, service),
    deviceStatusRes = _EquipmentService$use2.deviceStatusRes;
  var equipTypes = [{
    label: '设备类型',
    value: deviceRes === null || deviceRes === void 0 ? void 0 : deviceRes.deviceTypeName
  }, {
    label: '设备编号',
    value: deviceRes === null || deviceRes === void 0 ? void 0 : deviceRes.code
  }, {
    label: '手机号码',
    value: deviceRes === null || deviceRes === void 0 ? void 0 : deviceRes.phone
  }, {
    label: '所属机构',
    value: deviceRes === null || deviceRes === void 0 ? void 0 : deviceRes.deptName
  }, {
    label: 'SOS短信接收人',
    value: deviceRes === null || deviceRes === void 0 ? void 0 : deviceRes.receiverNames
  }];
  var monitorTypes = [{
    label: '设备状态',
    value: deviceStatusRes
  },
  // { label: '心率', value: '40' },
  {
    label: '定位时间',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.gpsTime
  }, {
    label: '定位模式',
    value: (monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.locationMode) === 1 ? 'GPS定位' : 'LBS/WIFI定位'
  }, {
    label: '经度',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.lngDone
  }, {
    label: '纬度',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.latDone
  }, {
    label: '电量时间',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.batteryTime
  }, {
    label: '电量',
    value: "".concat((monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.battery) || 0, "%")
  }, {
    label: '信号时间',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.signalLevelTime
  }, {
    label: '信号',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.signalLevel
  }, {
    label: '步数时间',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.stepsTime
  }, {
    label: '步数',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.steps
  }, {
    label: '佩戴监测时间',
    value: monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.wearDetectionTime
  }, {
    label: '是否佩戴',
    value: monitorRes !== null && monitorRes !== void 0 && monitorRes.wearDetection ? '是' : '否'
  }];
  return /*#__PURE__*/_jsx("div", {
    className: "staff-equip",
    children: /*#__PURE__*/_jsxs(Row, {
      gutter: [10, 16],
      children: [/*#__PURE__*/_jsx(Col, {
        span: 24,
        children: /*#__PURE__*/_jsx(VmWrapper, {
          title: "\u8BBE\u5907\u4FE1\u606F",
          children: /*#__PURE__*/_jsx(Row, {
            gutter: [10, 8],
            children: equipTypes.map(function (item, index) {
              return /*#__PURE__*/_jsx(Col, {
                span: 8,
                children: /*#__PURE__*/_jsx(MainItem, _objectSpread({}, item))
              }, index);
            })
          })
        })
      }), /*#__PURE__*/_jsx(Col, {
        span: 24,
        children: /*#__PURE__*/_jsx(VmWrapper, {
          title: "\u76D1\u6D4B\u4FE1\u606F",
          children: /*#__PURE__*/_jsx(Row, {
            gutter: [10, 8],
            children: monitorTypes.map(function (item, index) {
              return /*#__PURE__*/_jsx(Col, {
                span: 8,
                children: /*#__PURE__*/_jsx(MainItem, _objectSpread({}, item))
              }, index);
            })
          })
        })
      }), /*#__PURE__*/_jsx(Col, {
        span: 24,
        children: /*#__PURE__*/_jsx("div", {
          className: "staff-equip-map",
          children: /*#__PURE__*/_jsx(VmMap, _objectSpread({
            mapCenter: pointLngLat !== null && pointLngLat !== void 0 && pointLngLat.length ? pointLngLat : mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.mapCenter,
            newMapPoints: mapPoints
          }, customMapInfo))
        })
      })]
    })
  });
};
export default Equipment;