"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 _vmInfoCollection = _interopRequireDefault(require("../../../vm-info-collection"));
var _api = require("../../api");
require("./index.less");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var Panel = _antd.Collapse.Panel;
var BaseInfo = function BaseInfo(props) {
  var _a, _b;
  var id = props.id,
    actionType = props.actionType,
    _props$showFields = props.showFields,
    showFields = _props$showFields === void 0 ? [] : _props$showFields;
  var _useSettings = (0, _useSettings2["default"])(),
    _useSettings$theme = _useSettings.theme,
    theme = _useSettings$theme === void 0 ? 'light' : _useSettings$theme;
  // const { showFields } = BaseService.useFieldConfig();
  var _BaseService$useDetai = _api.BaseService.useDetailInfo(id),
    detail = _BaseService$useDetai.detail;
  var _BaseService$useServi = _api.BaseService.useServiceInfo(id),
    serviceInfo = _BaseService$useServi.serviceInfo;
  var carIdentity = []; //车辆身份信息
  var carConfig = []; //车辆配置信息
  var carAudit = []; //车辆年审信息
  var carSy = [];
  if (detail) {
    _api.carIdentityMap.forEach(function (_, itemValue) {
      showFields.forEach(function (ele) {
        if (ele.dataKey === itemValue) {
          carIdentity.push({
            label: ele === null || ele === void 0 ? void 0 : ele.displayName,
            key: ele.dataKey,
            value: detail[ele === null || ele === void 0 ? void 0 : ele.dataKey],
            componentType: itemValue.indexOf('hoto') > -1 ? 'image' : ''
          });
        }
      });
    });
    carIdentity.push({
      label: '车辆二维码',
      key: 'qrCode',
      value: detail.qrCode,
      componentType: 'qrCode'
    });
    _api.carConfigMap.forEach(function (_, configValue) {
      showFields.forEach(function (ele) {
        if (ele.dataKey === configValue) {
          carConfig.push({
            label: ele === null || ele === void 0 ? void 0 : ele.displayName,
            key: ele.dataKey,
            value: detail[ele === null || ele === void 0 ? void 0 : ele.dataKey],
            componentType: ele.dataKey.indexOf('hoto') > -1 ? 'image' : ''
          });
        }
      });
    });
    _api.carAuditMap.forEach(function (_, auditValue) {
      showFields.forEach(function (ele) {
        if (ele.dataKey === auditValue) {
          carAudit.push({
            label: ele === null || ele === void 0 ? void 0 : ele.displayName,
            key: ele.dataKey,
            value: detail[ele === null || ele === void 0 ? void 0 : ele.dataKey]
          });
        }
      });
    });
    _api.carSYMap.forEach(function (_, auditValue) {
      showFields.forEach(function (ele) {
        if (ele.dataKey === auditValue) {
          carSy.push({
            label: ele === null || ele === void 0 ? void 0 : ele.displayName,
            key: ele.dataKey,
            value: detail[ele === null || ele === void 0 ? void 0 : ele.dataKey]
          });
        }
      });
    });
    if ((actionType === null || actionType === void 0 ? void 0 : actionType.indexOf('ACTION_LJSY')) > -1) {
      if ((detail === null || detail === void 0 ? void 0 : detail.collectMethod) === 'TRANS_SHIPMENT') {
        carSy.push({
          label: '关联中转站',
          key: 'factoryNames',
          value: (_a = detail === null || detail === void 0 ? void 0 : detail.factoryNames) === null || _a === void 0 ? void 0 : _a.join(',')
        });
      } else {
        carSy.push({
          label: '关联处置场',
          key: 'disposeNames',
          value: (_b = detail === null || detail === void 0 ? void 0 : detail.disposeNames) === null || _b === void 0 ? void 0 : _b.join(',')
        });
      }
    }
  }
  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.Collapse, {
    defaultActiveKey: ['1']
  }, /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u8F66\u8F86\u8EAB\u4EFD\u4FE1\u606F",
    key: "1"
  }, /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: carIdentity,
    gap: 18,
    horizontal: true,
    ellipsis: true,
    width: '33.33%'
  })), /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u8F66\u8F86\u914D\u7F6E\u4FE1\u606F",
    key: "2"
  }, /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: carConfig,
    gap: 18,
    horizontal: true,
    ellipsis: true,
    width: '33.33%'
  })), /*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u8F66\u8F86\u5E74\u5BA1\u4FE1\u606F",
    key: "3"
  }, /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: carAudit,
    gap: 18,
    horizontal: true,
    ellipsis: true,
    width: '33.33%'
  })), (serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.length) > 0 && (/*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u8F66\u8F86\u670D\u52A1\u4FE1\u606F",
    key: "5"
  }, /*#__PURE__*/_react["default"].createElement(_vmTable["default"], {
    isIndex: false,
    columns: columns,
    dataSource: serviceInfo
  }))), ((actionType === null || actionType === void 0 ? void 0 : actionType.indexOf('ACTION_LJSY')) > -1 || (actionType === null || actionType === void 0 ? void 0 : actionType.indexOf('ACTION_LJZY')) > -1) && (/*#__PURE__*/_react["default"].createElement(Panel, {
    header: "\u8F66\u8F86\u4E1A\u52A1\u914D\u7F6E",
    key: "6"
  }, /*#__PURE__*/_react["default"].createElement(_vmInfoCollection["default"], {
    data: carSy,
    gap: 18,
    horizontal: true,
    ellipsis: true,
    width: '33.33%'
  })))));
};
var _default = exports["default"] = BaseInfo;
//# sourceMappingURL=index.js.map
