import { useContext } from 'react';
import { VmTable, VmTag, VmWrapper } from "../../../_components";
import { AlarmService } from "../../api";
import { RestaurantContext } from "../../index";
import { jsx as _jsx } from "react/jsx-runtime";
var columns = [{
  title: '异常类型',
  dataIndex: 'abnormalTypeName',
  render: function render(text) {
    return /*#__PURE__*/_jsx(VmTag, {
      title: text,
      type: 'red'
    });
  }
}, {
  title: '等级',
  dataIndex: 'levelStr'
}, {
  title: '报警开始时间',
  dataIndex: 'alarmStartTime'
}, {
  title: '报警结束时间',
  dataIndex: 'alarmEndTime'
}];
var AlarmRecord = function AlarmRecord(_ref) {
  var startDate = _ref.startDate,
    endDate = _ref.endDate;
  var _useContext = useContext(RestaurantContext),
    id = _useContext.id;
  var _AlarmService$useAlar = AlarmService.useAlarmRecord({
      id: id,
      startDate: startDate,
      endDate: endDate
    }),
    _AlarmService$useAlar2 = _AlarmService$useAlar.rows,
    rows = _AlarmService$useAlar2 === void 0 ? [] : _AlarmService$useAlar2;
  return /*#__PURE__*/_jsx(VmWrapper, {
    title: '报警记录明细',
    children: /*#__PURE__*/_jsx(VmTable, {
      columns: columns,
      dataSource: rows,
      size: "small",
      pagination: false
    })
  });
};
export default AlarmRecord;