"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = RmRecord;
var _react = _interopRequireDefault(require("react"));
var _moment = _interopRequireDefault(require("moment"));
var _vmTable = _interopRequireDefault(require("../vm-table"));
var _api = require("./api");
var _ahooks = require("ahooks");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function RmRecord(props) {
  var id = props.id;
  window.console.log(props);
  var _useSetState = (0, _ahooks.useSetState)({
      pagination: {
        current: 1,
        pageSize: 10,
        total: 0
      }
    }),
    _useSetState2 = _slicedToArray(_useSetState, 2),
    state = _useSetState2[0],
    setState = _useSetState2[1];
  var pagination = state.pagination;
  var startDate = (0, _moment["default"])().startOf('y').format('YYYY-MM-DD HH:mm:ss');
  var endDate = (0, _moment["default"])().format('YYYY-MM-DD HH:mm:ss');
  var _BaseService$useRmRec = _api.BaseService.useRmRecord(id, startDate, endDate, pagination.current - 1),
    rmRecord = _BaseService$useRmRec.rmRecord;
  var columns = [{
    title: '工单编号',
    dataIndex: 'workOrderNo',
    key: 'workOrderNo',
    width: 120,
    ellipsis: true
  }, {
    title: '维保类型',
    dataIndex: 'maintainTypeName',
    key: 'maintainTypeName',
    width: 120,
    ellipsis: true
  }, {
    title: '申请金额',
    dataIndex: 'fee',
    key: 'fee',
    render: function render(text) {
      return /*#__PURE__*/_react["default"].createElement("span", {
        style: {
          color: '#FF7272'
        }
      }, text);
    }
  }, {
    title: '申请人',
    dataIndex: 'applyUserName',
    key: 'applyUserName'
  }, {
    title: '申请时间',
    dataIndex: 'applyTime',
    key: 'applyTime',
    width: 150
  }, {
    title: '维保状态',
    dataIndex: 'facilityStatusDesc',
    key: 'facilityStatusDesc'
  }, {
    title: '维保时间',
    dataIndex: 'lastAuditTime',
    key: 'lastAuditTime',
    width: 150
  }];
  var pageChange = function pageChange(page) {
    setState({
      pagination: Object.assign(Object.assign({}, pagination), {
        current: page
      })
    });
  };
  var tableProps = {
    pagination: Object.assign(Object.assign({}, pagination), {
      total: rmRecord.total,
      defaultPageSize: 10,
      onChange: pageChange
    }),
    height: 240,
    dataSource: rmRecord.rows
  };
  return /*#__PURE__*/_react["default"].createElement(_vmTable["default"], Object.assign({
    columns: columns
  }, tableProps));
}
//# sourceMappingURL=RmRecord.js.map
