"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _antd = require("antd");
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _api = require("../../api");
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
require("./index.less");
var _vmRowCol = require("../../../vm-row-col");
var _vmMap = _interopRequireDefault(require("../../../vm-map"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 设备信息
 */

var MainItem = function MainItem(props) {
  var label = props.label,
    value = props.value;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-main-item"
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-main-item-label"
  }, label, ":"), /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-main-item-value"
  }, value || '-'));
};
var Equipment = function Equipment(props) {
  var id = props.id,
    customMapInfo = props.customMapInfo;
  var _useSettings = (0, _useSettings2["default"])(),
    mapInfo = _useSettings.mapInfo;
  var coordType = (customMapInfo === null || customMapInfo === void 0 ? void 0 : customMapInfo.coordinate) || (mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.coordinate);
  if ((customMapInfo === null || customMapInfo === void 0 ? void 0 : customMapInfo.mapType) === 'olmap') {
    coordType = 'wgs84';
  }
  var _BaseService$useMapIn = _api.BaseService.useMapInfo(id, coordType),
    mapPoints = _BaseService$useMapIn.mapPoints,
    pointLngLat = _BaseService$useMapIn.pointLngLat;
  var _EquipmentService$use = _api.EquipmentService.useDevice(id),
    deviceRes = _EquipmentService$use.deviceRes,
    monitorRes = _EquipmentService$use.monitorRes;
  var _EquipmentService$use2 = _api.EquipmentService.useDeviceStatus(monitorRes === null || monitorRes === void 0 ? void 0 : monitorRes.id),
    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 ? void 0 : monitorRes.wearDetection) ? '是' : '否'
  }];
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip"
  }, /*#__PURE__*/_react["default"].createElement(_vmRowCol.VmRow, {
    gutter: [10, 10]
  }, /*#__PURE__*/_react["default"].createElement(_vmRowCol.VmCol, {
    span: 18
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-main"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u8BBE\u5907\u4FE1\u606F"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-main-item-wrap"
  }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
    gutter: [10, 8]
  }, equipTypes.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_antd.Col, {
      span: 12,
      key: index
    }, /*#__PURE__*/_react["default"].createElement(MainItem, Object.assign({}, item)));
  })))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-main"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u76D1\u6D4B\u4FE1\u606F"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-main-item-wrap"
  }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
    gutter: [10, 8]
  }, monitorTypes.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_antd.Col, {
      span: 12,
      key: index
    }, /*#__PURE__*/_react["default"].createElement(MainItem, Object.assign({}, item)));
  }))))), /*#__PURE__*/_react["default"].createElement(_vmRowCol.VmCol, {
    span: 6
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "staff-equip-map"
  }, /*#__PURE__*/_react["default"].createElement(_vmMap["default"], Object.assign({
    mapCenter: (pointLngLat === null || pointLngLat === void 0 ? void 0 : pointLngLat.length) ? pointLngLat : mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.mapCenter,
    mapType: (mapInfo === null || mapInfo === void 0 ? void 0 : mapInfo.mapType) || 'bmap',
    mapPoints: mapPoints
  }, customMapInfo))))));
};
var _default = exports["default"] = Equipment;
//# sourceMappingURL=index.js.map
