"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _useModal2 = _interopRequireDefault(require("../vm-hooks/useModal"));

var _baseContent = _interopRequireDefault(require("./baseContent"));

var _vmGasModal = _interopRequireDefault(require("../vm-gas-modal"));

var _fillingInfo = _interopRequireDefault(require("./fillingInfo"));

var _useGasEnumList2 = _interopRequireDefault(require("../vm-hooks/useGasEnumList"));

var _circulationInfo = _interopRequireDefault(require("./circulationInfo"));

var _inspectionInfo = _interopRequireDefault(require("./inspectionInfo"));

var _lastProcessFlow = _interopRequireDefault(require("./lastProcessFlow"));

require("./style");

var _utils = require("@vtx/utils");

var _excluded = ["id"],
    _excluded2 = ["showModal"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var TABS_BASE = 'gas-cylinder-file-base';
var TABS_FILLINGINFO = 'gas-cylinder-file-filling-info';
var TABS_CIRCULATIONINFO = 'gas-cylinder-file-circulation-info';
var TABS_INSPECTIONINFO = 'gas-cylinder-file-inspection-info';
var TABS_LASTPROCESSFLOW = 'gas-cylinder-file-last-process-flow';

var Modal = function Modal(_ref) {
  var id = _ref.id,
      resetProps = _objectWithoutProperties(_ref, _excluded);

  var _useGasEnumList = (0, _useGasEnumList2["default"])('BottleOperateType'),
      enumList = _useGasEnumList.enumList;

  var tabs = [{
    value: '气瓶信息',
    key: TABS_BASE,
    content: /*#__PURE__*/_react["default"].createElement(_baseContent["default"], {
      id: id
    })
  }, {
    value: '充装信息',
    key: TABS_FILLINGINFO,
    content: /*#__PURE__*/_react["default"].createElement(_fillingInfo["default"], {
      id: id,
      bottleOperateTypeList: enumList
    })
  }, {
    value: '流转信息',
    key: TABS_CIRCULATIONINFO,
    content: /*#__PURE__*/_react["default"].createElement(_circulationInfo["default"], {
      id: id,
      bottleOperateTypeList: enumList
    })
  }, {
    value: '检验信息',
    key: TABS_INSPECTIONINFO,
    content: /*#__PURE__*/_react["default"].createElement(_inspectionInfo["default"], {
      id: id,
      bottleOperateTypeList: enumList
    })
  }, {
    value: '末次工序流转',
    key: TABS_LASTPROCESSFLOW,
    content: /*#__PURE__*/_react["default"].createElement(_lastProcessFlow["default"], {
      id: id
    })
  }];

  if ((0, _utils.getUrlParam)().carqFlag == 'true') {
    tabs.splice(1, 4);
  }

  var newTabs = [];
  var contents = [];
  tabs.forEach(function (_ref2) {
    var key = _ref2.key,
        value = _ref2.value,
        content = _ref2.content;
    newTabs.push({
      key: key,
      value: value
    });
    contents.push({
      key: key,
      content: content
    });
  });
  return /*#__PURE__*/_react["default"].createElement(_vmGasModal["default"], _extends({
    tabs: tabs,
    title: "\u6C14\u74F6\u6863\u6848\u7BA1\u7406"
  }, resetProps));
};

var VtxGasCylinderFileModal = function VtxGasCylinderFileModal(props) {
  var label = props.label,
      id = props.id;

  var _useModal = (0, _useModal2["default"])(),
      showModal = _useModal.showModal,
      modalProps = _objectWithoutProperties(_useModal, _excluded2);

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, label ? /*#__PURE__*/_react["default"].createElement("a", {
    type: "link",
    onClick: showModal
  }, label) : /*#__PURE__*/_react["default"].createElement("span", null, "-"), modalProps.visible && /*#__PURE__*/_react["default"].createElement(Modal, _extends({
    id: id
  }, modalProps)));
};

Modal.propTypes = {
  id: _propTypes["default"].string.isRequired
};
VtxGasCylinderFileModal.propTypes = {
  id: _propTypes["default"].string.isRequired,
  label: _propTypes["default"].string.isRequired
};
VtxGasCylinderFileModal.Modal = Modal;
var _default = VtxGasCylinderFileModal;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
