"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _antd = require("antd");
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _api = require("../../api");
var _components = require("@vtx/components");
require("./index.less");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var Panel = _antd.Collapse.Panel;
var TabPane = _antd.Tabs.TabPane;
var BaseInfo = function BaseInfo(props) {
  var _a;
  var id = props.id,
    detail = props.detail;
  var _useSettings = (0, _useSettings2["default"])(),
    _useSettings$theme = _useSettings.theme,
    theme = _useSettings$theme === void 0 ? 'light' : _useSettings$theme;
  var _BaseService$useField = _api.BaseService.useFieldConfig(id),
    showFields = _BaseService$useField.showFields;
  var _BaseService$getHisto = _api.BaseService.getHistoryContract(id),
    serviceList = _BaseService$getHisto.serviceList;
  var getVisible = function getVisible(dataKey) {
    var _a;
    return (_a = showFields === null || showFields === void 0 ? void 0 : showFields.find(function (ele) {
      return ele.dataKey === dataKey;
    })) === null || _a === void 0 ? void 0 : _a.addVisible;
  };
  var getName = function getName(dataKey) {
    var _a;
    return (_a = showFields === null || showFields === void 0 ? void 0 : showFields.find(function (ele) {
      return ele.dataKey === dataKey;
    })) === null || _a === void 0 ? void 0 : _a.displayName;
  };
  var columns = [{
    title: '服务标段',
    dataIndex: 'tenderName'
  }, {
    title: '所属合同',
    dataIndex: 'contractName'
  }, {
    title: '中标单位',
    dataIndex: 'bidWinningOrgName'
  }, {
    title: '服务时间',
    dataIndex: 'contractDate',
    render: function render(_, record) {
      return "".concat(record.serviceTimeBegin, "~").concat(record.serviceTimeEnd);
    }
  }];
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: theme !== 'light' ? 'detail-main' : '',
    style: {
      height: 620,
      padding: '12px 24px',
      overflowY: 'auto'
    }
  }, /*#__PURE__*/_react["default"].createElement(_antd.Tabs, {
    defaultActiveKey: "1"
  }, /*#__PURE__*/_react["default"].createElement(TabPane, {
    tab: "\u57FA\u672C\u4FE1\u606F",
    key: "1"
  }, /*#__PURE__*/_react["default"].createElement(_antd.Form, {
    layout: "inline"
  }, /*#__PURE__*/_react["default"].createElement(_antd.Collapse, {
    defaultActiveKey: ['1', '2', '3', '4'],
    style: {
      width: '100%'
    }
  }, /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u57FA\u7840\u4FE1\u606F",
    key: "1"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout, {
    mode: "view"
  }, ['staffCode', 'staffName', 'genderName', 'employmentTypeName', 'unitName', 'jobStatusName', 'entryDay', 'separationDate', 'trial', 'idNumber', 'birthDay', 'age', 'maritalStatusName', 'politicalOutlookName', 'nationName', 'educationName'].filter(function (item) {
    return getVisible(item);
  }).map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
      label: getName(item),
      key: index
    }, (detail === null || detail === void 0 ? void 0 : detail[item]) || '--');
  }), getVisible('headlessPhotoId') && (/*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: getName('headlessPhotoId')
  }, detail.headlessPhotoId ? (/*#__PURE__*/_react["default"].createElement(_components.VtxImage, {
    src: "/cloudFile/common/downloadFile?id=".concat(detail.headlessPhotoId),
    style: {
      width: '100px',
      height: '100px'
    }
  })) : '--')), getVisible('idCardFrontPhotoId') && (/*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: getName('idCardFrontPhotoId')
  }, detail.idCardFrontPhotoId ? (/*#__PURE__*/_react["default"].createElement(_components.VtxImage, {
    src: "/cloudFile/common/downloadFile?id=".concat(detail.idCardFrontPhotoId),
    style: {
      width: '100px',
      height: '100px'
    }
  })) : '--')), getVisible('idCardBackPhotoId') && (/*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: getName('idCardBackPhotoId')
  }, detail.idCardBackPhotoId ? (/*#__PURE__*/_react["default"].createElement(_components.VtxImage, {
    src: "/cloudFile/common/downloadFile?id=".concat(detail.idCardBackPhotoId),
    style: {
      width: '100px',
      height: '100px'
    }
  })) : '--')), getVisible('photoIds') && (/*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: getName('photoIds')
  }, detail.photoIds && ((_a = JSON.parse(detail.photoIds)) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (/*#__PURE__*/_react["default"].createElement(_components.VtxUpload, {
    listType: "text",
    action: "/cloudFile/common/uploadFile",
    downloadUrl: "/cloudFile/common/downloadFile?id=",
    viewMode: true,
    fileList: JSON.parse(detail.photoIds),
    flag: new Date().getTime()
  })) : '-')), (detail === null || detail === void 0 ? void 0 : detail.jobStatusCode) === 'RetainOffice' && (/*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.Row, null, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u505C\u85AA\u7559\u804C\u5F00\u59CB\u65E5\u671F"
  }, detail.leaveWithoutPayStartTime || '--'), /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u505C\u85AA\u7559\u804C\u7ED3\u675F\u65E5\u671F"
  }, detail.leaveWithoutPayEndTime || '--'))), (detail === null || detail === void 0 ? void 0 : detail.jobStatusCode) === 'Retire' && (/*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u9000\u4F11\u65E5\u671F"
  }, detail.retirementTime || '--')), (detail === null || detail === void 0 ? void 0 : detail.jobStatusCode) === 'Semiretired' && (/*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.Row, null, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
    label: "\u8FD4\u8058\u65E5\u671F"
  }, detail.reemploymentTime || '--'))))), /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u8054\u7CFB\u4FE1\u606F",
    key: "2"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout, {
    mode: "view"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.Row, null, ['email', 'contactNumber', 'localHouseholdName', 'nativePlaceName', 'householdTypeName', 'homeAddress', 'emergencyContact', 'emergencyContactNumber'].filter(function (item) {
    return getVisible(item);
  }).map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
      label: getName(item),
      key: index
    }, (detail === null || detail === void 0 ? void 0 : detail[item]) || '--');
  })))), /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u7528\u5DE5\u4FE1\u606F",
    key: "3"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout, {
    mode: "view"
  }, ['divisionName', 'tenderName', 'outSourcingUnitName', 'positionName', 'rankName', 'homeAddress', 'haveHonorName', 'honorName', 'socialSecurityTypeName', 'socialSecurityStatusName', 'providentFundStatusName', 'haveOtherInsuranceName', 'otherInsuranceName', 'socialSecurityUnitName', 'bankNo', 'bank', 'basicSalary', 'name'].filter(function (item) {
    return getVisible(item);
  }).map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
      label: getName(item),
      key: index
    }, (detail === null || detail === void 0 ? void 0 : detail[item]) || '--');
  }))), /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u5065\u5EB7\u4FE1\u606F",
    key: "4"
  }, /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout, {
    mode: "view"
  }, ['hypertensionLevelName', 'hasHeartDiseaseName'].filter(function (item) {
    return getVisible(item);
  }).map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_components.VtxFormLayout.FormItem, {
      label: getName(item),
      key: index
    }, (detail === null || detail === void 0 ? void 0 : detail[item]) || '--');
  }))), /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u4EBA\u5458\u670D\u52A1\u4FE1\u606F",
    key: "5"
  }, (serviceList === null || serviceList === void 0 ? void 0 : serviceList.length) ? (/*#__PURE__*/_react["default"].createElement(_vmTable["default"], {
    pagination: false,
    size: "middle",
    columns: columns,
    dataSource: serviceList
  })) : (/*#__PURE__*/_react["default"].createElement("div", {
    className: "service_desc"
  }, "\u6682\u65E0\u670D\u52A1\u4FE1\u606F"))))))));
};
var _default = exports["default"] = BaseInfo;
//# sourceMappingURL=index.js.map
