"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;
var _react = _interopRequireWildcard(require("react"));
var _index = _interopRequireDefault(require("./index.less"));
var _FormModal = _interopRequireDefault(require("../../../../FormModal"));
var _timeline = _interopRequireDefault(require("antd/lib/timeline"));
var _CheckCircleOutlined = _interopRequireDefault(require("@ant-design/icons/CheckCircleOutlined"));
var _CreateTicket = require("../../ServiceComponents/CreateTicket");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
/**
 * 12345工单信息导入内容
 */

var MyModal = function MyModal(props) {
  var myForm = (0, _react.useRef)();
  var _props$dataList = props.dataList,
    dataList = _props$dataList === void 0 ? [] : _props$dataList,
    title = props.title;
  var getItems = function getItems() {
    var itemList = [];
    if (dataList !== null && dataList !== void 0 && dataList.length) {
      dataList.map(function (item) {
        for (var key in item) {
          var paramName = Math.random();
          if (key.indexOf('意见') !== -1 || key.indexOf('信息') !== -1 || key.indexOf('描述') !== -1) {
            itemList.push({
              type: 'textArea',
              label: key,
              paramName: paramName,
              formItemLayout: {
                initialValue: item === null || item === void 0 ? void 0 : item[key]
              },
              weights: 3
            });
          } else {
            itemList.push({
              type: 'input',
              label: key,
              paramName: paramName,
              formItemLayout: {
                initialValue: item === null || item === void 0 ? void 0 : item[key]
              }
            });
          }
        }
      });
    }
    var hrefCodes = {
      批转信息: 'endorseInfo',
      公示信息: 'publicInfo'
    };
    return title ? [{
      type: 'card',
      // label: title,
      label: /*#__PURE__*/_react["default"].createElement(_CreateTicket.MyAnchor, {
        title: title,
        href: hrefCodes === null || hrefCodes === void 0 ? void 0 : hrefCodes[title]
      }),
      items: itemList || []
    }] : itemList;
  };
  var items = getItems() || [];
  return /*#__PURE__*/_react["default"].createElement(_FormModal["default"], {
    width: 1200,
    column: 3,
    ref: myForm,
    visible: true,
    disabled: true,
    title: "",
    items: items,
    isShowModal: false,
    footerShow: false,
    formStyle: {
      width: '100%'
    }
  });
};
var ProcessInfo = function ProcessInfo(props) {
  var _props$dataList2 = props.dataList,
    dataList = _props$dataList2 === void 0 ? [] : _props$dataList2,
    timeLabel = props.timeLabel;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: _index["default"].processInfoWrap
  }, /*#__PURE__*/_react["default"].createElement(_timeline["default"], null, dataList !== null && dataList !== void 0 && dataList.length ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, dataList.map(function (val, idx) {
    return /*#__PURE__*/_react["default"].createElement(_timeline["default"].Item, {
      key: idx,
      dot: /*#__PURE__*/_react["default"].createElement(_CheckCircleOutlined["default"], null)
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: _index["default"].processItem
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: _index["default"].processTime
    }, val === null || val === void 0 ? void 0 : val[timeLabel]), /*#__PURE__*/_react["default"].createElement("div", {
      className: _index["default"].processDetail
    }, /*#__PURE__*/_react["default"].createElement(MyModal, {
      dataList: [val]
    }))));
  })) : null));
};
var ProcessModal = function ProcessModal(props) {
  var dataList = props.dataList,
    title = props.title;
  var timeLabels = {
    办理反馈信息: '办结时间',
    '评价信息（群众评价）': '评价时间',
    '评价信息（回访评价）': '回访时间'
  };
  var hrefCodes = {
    办理反馈信息: 'feedBack',
    '评价信息（群众评价）': 'massAppraise',
    '评价信息（回访评价）': 'returnAppraise'
  };
  var items = [{
    type: 'card',
    label: /*#__PURE__*/_react["default"].createElement(_CreateTicket.MyAnchor, {
      title: title,
      href: hrefCodes === null || hrefCodes === void 0 ? void 0 : hrefCodes[title]
    }),
    // label: title,
    items: [{
      type: 'blank',
      content: /*#__PURE__*/_react["default"].createElement(ProcessInfo, {
        dataList: dataList,
        timeLabel: timeLabels === null || timeLabels === void 0 ? void 0 : timeLabels[title]
      })
    }]
  }];
  return /*#__PURE__*/_react["default"].createElement(_FormModal["default"], {
    width: 1200,
    column: 3,
    visible: true,
    title: "",
    items: items,
    disabled: true,
    isShowModal: false,
    footerShow: false,
    formStyle: {
      width: '100%'
    }
  });
};
function _default(props) {
  var _props$importData = props.importData,
    importData = _props$importData === void 0 ? [] : _props$importData;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: _index["default"].importDataWrap
  }, importData.map(function (item, index) {
    for (var key in item) {
      if (key === '批转信息') {
        var _item$key, _item$key2;
        var length = (item === null || item === void 0 || (_item$key = item[key]) === null || _item$key === void 0 ? void 0 : _item$key.length) || 0;
        var data = length ? [item === null || item === void 0 || (_item$key2 = item[key]) === null || _item$key2 === void 0 ? void 0 : _item$key2[length - 1]] : [];
        return /*#__PURE__*/_react["default"].createElement(MyModal, {
          key: index,
          dataList: data,
          title: key
        });
      } else if (key === '公示信息') {
        return /*#__PURE__*/_react["default"].createElement(MyModal, {
          key: index,
          dataList: item === null || item === void 0 ? void 0 : item[key],
          title: key
        });
      } else {
        return /*#__PURE__*/_react["default"].createElement(ProcessModal, {
          key: index,
          dataList: item === null || item === void 0 ? void 0 : item[key],
          title: key
        });
      }
    }
  }));
}
//# sourceMappingURL=ImportDetails.js.map
