"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

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

var _components = require("@vtx/components");

var _antd = require("antd");

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

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

var _api = require("./api");

var _vtxGasEnterpriseModal = _interopRequireDefault(require("../vtx-gas-enterprise-modal"));

var _vtxGasSupplyStationModal = _interopRequireDefault(require("../vtx-gas-supply-station-modal"));

var _vtxGasFillingStationModal = _interopRequireDefault(require("../vtx-gas-filling-station-modal"));

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

var _dayjs = _interopRequireDefault(require("dayjs"));

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

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

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 = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

var BaseContent = function BaseContent(props) {
  var id = props.id;

  var _useState = (0, _react.useState)({}),
      _useState2 = _slicedToArray(_useState, 2),
      info = _useState2[0],
      setInfo = _useState2[1];

  (0, _react.useEffect)(function () {
    if (id) {
      (0, _api.getInfo)(id).then(function (data) {
        setInfo(data);
      });
    }
  }, [id]);
  var photoId = '';
  var companyName = info.companyName,
      storageAndDistributionStationName = info.storageAndDistributionStationName,
      supplyStationName = info.supplyStationName,
      name = info.name,
      phone = info.phone,
      jobStr = info.jobStr,
      workCode = info.workCode,
      sex = info.sex,
      createTime = info.createTime,
      remark = info.remark,
      trainingCertificateNumber = info.trainingCertificateNumber,
      contractNumber = info.contractNumber,
      contractValidityPeriod = info.contractValidityPeriod,
      companyId = info.companyId,
      storageAndDistributionStationId = info.storageAndDistributionStationId,
      supplyStationId = info.supplyStationId,
      trainingCertificateFile = info.trainingCertificateFile,
      contractFile = info.contractFile,
      trainingCertificateValidityPeriod = info.trainingCertificateValidityPeriod,
      birthday = info.birthday,
      commAddress = info.commAddress,
      onboardinTrainingDay = info.onboardinTrainingDay,
      degreeStr = info.degreeStr,
      jobTitle = info.jobTitle,
      isSafer = info.isSafer,
      gasCommunityNames = info.gasCommunityNames,
      reward = info.reward,
      sendCertOrganName = info.sendCertOrganName,
      sendCertDay = info.sendCertDay,
      trainingDay = info.trainingDay;

  if (info.photo) {
    photoId = JSON.parse(info.photo)[0].id;
  }

  return /*#__PURE__*/_react["default"].createElement(_antd.Form, {
    layout: "inline"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout, {
    mode: "view"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.Pane, {
    title: "\u57FA\u672C\u4FE1\u606F"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u59D3\u540D"
  }, name || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u4EE3\u7801",
    name: "workCode"
  }, workCode || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u6027\u522B"
  }, sex === 1 ? '男' : '女'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5E74\u9F84"
  }, (0, _dayjs["default"])().diff((0, _dayjs["default"])(birthday), 'year')), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u8D1F\u8D23\u4F01\u4E1A",
    weightss: 2,
    name: "companyName"
  }, /*#__PURE__*/_react["default"].createElement(_vtxGasEnterpriseModal["default"], {
    label: companyName,
    id: companyId
  })), (0, _utils.getUrlParam)().carqFlag == 'true' ? '' : /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u6240\u5C5E\u50A8\u914D\u7AD9",
    weights: 2,
    name: "storageAndDistributionStationName"
  }, /*#__PURE__*/_react["default"].createElement(_vtxGasFillingStationModal["default"], {
    label: storageAndDistributionStationName,
    id: storageAndDistributionStationId
  })), (0, _utils.getUrlParam)().carqFlag == 'true' ? '' : /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u8D1F\u8D23\u4F9B\u5E94\u7AD9"
  }, /*#__PURE__*/_react["default"].createElement(_vtxGasSupplyStationModal["default"], {
    label: supplyStationName,
    id: supplyStationId
  })), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u8054\u7CFB\u7535\u8BDD",
    name: "phone"
  }, phone || '--'), (0, _utils.getUrlParam)().carqFlag == 'true' ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u901A\u8BAF\u5730\u5740",
    name: "phone"
  }, commAddress || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5165\u804C\u57F9\u8BAD\u65F6\u95F4",
    name: "phone"
  }, onboardinTrainingDay || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u6587\u5316\u7A0B\u5EA6",
    name: "phone"
  }, degreeStr || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u804C\u79F0",
    name: "phone"
  }, jobTitle || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u662F\u5426\u4E3A\u9A7B\u6751\u5B89\u5168\u5458",
    name: "phone"
  }, isSafer ? '是' : '否'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u8D1F\u8D23\u71C3\u6C14\u5C0F\u533A",
    name: "phone"
  }, gasCommunityNames || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u53D7\u8868\u5F70\u6216\u5956\u52B1\u60C5\u51B5",
    name: "phone"
  }, reward || '--')) : '', /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5C97\u4F4D\uFF08\u89D2\u8272\uFF09",
    name: "jobStr"
  }, jobStr || '--'), (0, _utils.getUrlParam)().carqFlag == 'true' ? /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5165\u804C\u65F6\u95F4",
    weights: 2
  }, createTime || '--') : /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5EFA\u6863\u65F6\u95F4",
    weights: 2
  }, createTime || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u7167\u7247",
    weights: 2
  }, photoId ? /*#__PURE__*/_react["default"].createElement(_components.VtxImage, {
    src: "/cloudFile/common/downloadFile?id=".concat(photoId),
    style: {
      width: '200px',
      height: '200px'
    }
  }) : '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5907\u6CE8",
    weights: 2
  }, remark || '--')), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.Divider, null), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.Pane, {
    title: "\u8D44\u8D28\u4FE1\u606F"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u4ECE\u4E1A\u4EBA\u5458\u57F9\u8BAD\u8BC1\u7F16\u53F7"
  }, trainingCertificateNumber || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u6709\u6548\u671F\u81F3"
  }, trainingCertificateValidityPeriod || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u8BC1\u4E66",
    weights: 2
  }, trainingCertificateFile ? /*#__PURE__*/_react["default"].createElement(_components.VtxUpload, {
    fileList: JSON.parse(trainingCertificateFile),
    className: "vtx-gas-upload",
    maxNum: 1,
    viewMode: true
  }) : '--'), (0, _utils.getUrlParam)().carqFlag == 'true' ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u53D1\u8BC1\u673A\u5173\u540D\u79F0"
  }, sendCertOrganName || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u53D1\u8BC1\u65F6\u95F4"
  }, sendCertDay || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u57F9\u8BAD\u65F6\u95F4"
  }, trainingDay || '--')) : '', /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5408\u540C\u7F16\u53F7"
  }, contractNumber || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u6709\u6548\u671F\u81F3"
  }, contractValidityPeriod || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u5408\u540C",
    weights: 2
  }, contractFile ? /*#__PURE__*/_react["default"].createElement(_components.VtxUpload, {
    fileList: JSON.parse(contractFile),
    maxNum: 1,
    className: "vtx-gas-upload",
    viewMode: true
  }) : '--'))));
};

BaseContent.propTypes = {
  id: _propTypes["default"].string.isRequired,
  name: _propTypes["default"].string.isRequired
};
var _default = BaseContent;
exports["default"] = _default;
//# sourceMappingURL=base.js.map
