"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 _react = _interopRequireWildcard(require("react"));

var _tooltip = _interopRequireDefault(require("../../../../tooltip"));

var _common = require("../../../common");

var _openData = require("../../../../../utils/open-data");

var _style = require("./style");

var _getLocale = require("../../../../../utils/getLocale");

var _UserSelectorPop = _interopRequireDefault(require("../../../../../components-v1/userSelector/UserSelectorPop"));

var _requestV = require("../../../../../utils/request-v1");

var _mblog = require("../../../../../utils/mblog");

var _ConfirmPop = _interopRequireDefault(require("../../../../delete-confirm-pop/ConfirmPop"));

var _textarea = _interopRequireDefault(require("../../../../../components-v1/textarea"));

var _avatar = _interopRequireDefault(require("../../../../../components-v1/avatar"));

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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

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

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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

var ReviewBody = /*#__PURE__*/function (_PureComponent) {
  _inherits(ReviewBody, _PureComponent);

  var _super = _createSuper(ReviewBody);

  function ReviewBody(props) {
    var _this;

    _classCallCheck(this, ReviewBody);

    _this = _super.call(this, props);

    _this.renderCreateTaskView = /*#__PURE__*/function () {
      var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e, data, workId) {
        var param, res;
        return regeneratorRuntime.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                e.stopPropagation();
                param = {
                  objId: workId || data.ObjId,
                  objType: 4
                };

                if (workId) {
                  // @ts-ignore
                  param.WorkMileStoneId = data.ObjId;
                } // @ts-ignore


                _context.next = 5;
                return window.openCreateTaskPop(e.target, {
                  createParams: param,
                  dialogOption: {
                    zIndex: 1501
                  },
                  createTaskOption: {
                    allowObjectOptions: false
                  }
                });

              case 5:
                res = _context.sent;

                _this._getTaskListData(res); // createTask && createTask(e, node, { leftBias: isOkrPanel ? -75 : 750, topBias: isOkrPanel ? 260 : -340, isSettingContainer: true }, data, parent, true, workId);


              case 7:
              case "end":
                return _context.stop();
            }
          }
        }, _callee);
      }));

      return function (_x, _x2, _x3) {
        return _ref.apply(this, arguments);
      };
    }();

    _this.getReviewData = function () {
      var _this$props = _this.props,
          ObjData = _this$props.ObjData,
          EditType = _this$props.EditType;
      var initData = _this.state.data;
      _this.localStorageKey = "ReviewData_".concat(ObjData.ObjId);
      var localData = localStorage.getItem(_this.localStorageKey); // 编辑类型：0-新建，1-编辑
      // 新增时：初始化数据或从本地缓存获取数据
      // 编辑时：从接口获取数据
      // let data = EditType === 0 ? (localData ? JSON.parse(localData) : initData) : this.getReviewDataById()

      if (EditType) {
        // 编辑
        _this.getReviewDataById();
      } else {
        var _data = localData ? JSON.parse(localData) : initData;

        _this._initReviewData(_data);
      }
    };

    _this.getReviewDataById = function () {
      var self = _assertThisInitialized(_this);

      var replayId = _this.props.ReplayId;
      var url = (0, _requestV.getApiUrl)("replay/getById?replayId=".concat(replayId));
      (0, _requestV.taker)(url, "GET").then(function (res) {
        if (res.Code == 1) {
          self._formatReviewData(res.Data);
        }
      });
    };

    _this._formatReviewData = function (reviewData) {
      var data = _objectSpread({}, _this.state.data);

      data.replayId = reviewData.replayId;
      data.objId = reviewData.objId;
      data.objType = reviewData.objType;
      data.gains = reviewData.gains;
      data.drawbackList = reviewData.drawbackList;
      data.taskList = reviewData.tasks || [];
      data.taskIds = reviewData.taskList && reviewData.taskList.map(function (item) {
        return item.taskId;
      }).join(",");
      data.participantIds = reviewData.participants && reviewData.participants.map(function (item) {
        return item.userId;
      }).join(",");
      data.isStandardMode = reviewData.isStandardMode;
      data.Drawback = reviewData.isStandardMode ? reviewData.drawbackList[0].drawback : "";
      var reviewMebers = reviewData.participants || [];
      reviewMebers.forEach(function (item, index) {
        data.reviewMebers.push({
          Id: item.userId,
          Name: item.name,
          DepartmentName: item.departmentName,
          UserAvatar: {
            Small: item.avatar.small || "",
            Color: item.avatar.color || ""
          }
        });
      });

      _this.setState({
        data: data
      });

      _this.props.onChange(data);
    };

    _this._initReviewData = function (data) {
      var onChange = _this.props.onChange;

      if (data.isStandardMode) {
        // 标准模式
        data.drawbackList = [{
          drawbackId: 0,
          drawback: "",
          cause: "",
          measures: ""
        }];
      } else {
        // 高级模式
        data.Drawback = "";
      }

      onChange(data);

      _this.setState({
        data: data
      });
    };

    _this._handlerReviewWorthChange = function (value) {
      var data = _objectSpread({}, _this.state.data);

      _this._updateReviewData(data, "gains", value);
    };

    _this._addReviewProblem = function () {
      var data = _objectSpread({}, _this.state.data);

      data.drawbackList.push({
        drawbackId: 0,
        drawback: "",
        cause: "",
        measures: ""
      });

      _this._updateReviewData(data);
    };

    _this._handlerDeleteReviewProblem = function (index) {
      var data = _objectSpread({}, _this.state.data);

      data.drawbackList.splice(index, 1);

      _this._updateReviewData(data);
    };

    _this._handlerAdvancedModeProblemChange = function (type, value, index) {
      var data = _objectSpread({}, _this.state.data);

      data.drawbackList[index][type] = value;

      _this._updateReviewData(data);
    };

    _this._handlerStandardModeProblemChange = function (value) {
      var data = _objectSpread({}, _this.state.data); // console.log(htmlEncodeByRegExp(value))


      _this._updateReviewData(data, "Drawback", value);
    };

    _this._renderReviewProblemView = function () {
      var data = _this.state.data;

      if (data.isStandardMode) {
        return /*#__PURE__*/_react["default"].createElement(_style.ReviewProblem, null, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalog, null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Problems")), /*#__PURE__*/_react["default"].createElement(_textarea["default"], {
          maxLength: 5000,
          value: (0, _mblog.htmlDecodeByRegExp)(data.Drawback),
          initialHeight: 56,
          style: {
            marginLeft: "8px"
          },
          onChange: function onChange(value) {
            return _this._handlerStandardModeProblemChange(value);
          },
          placeholder: "<p>".concat((0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Pldescribe"), "</p>")
        }));
      }

      return data.drawbackList.map(function (item, index) {
        return /*#__PURE__*/_react["default"].createElement(_style.ReviewProblem, {
          key: index
        }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalog, {
          className: "drawback"
        }, /*#__PURE__*/_react["default"].createElement("span", null, "".concat((0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Problems")).concat(index + 1)), /*#__PURE__*/_react["default"].createElement(_ConfirmPop["default"], {
          className: "review-delete-tips",
          onSubmit: function onSubmit() {
            return _this._handlerDeleteReviewProblem(index);
          },
          confirmTipText: "\u786E\u5B9A\u5220\u9664\u6574\u4E2A\u95EE\u9898\u4E0E\u4E0D\u8DB3".concat(index + 1, "\u5417\uFF1F"),
          align: "bottom right"
        }, /*#__PURE__*/_react["default"].createElement("span", {
          className: "delete-replay"
        }, (0, _getLocale.getLocale)("Mod_Delete")))), /*#__PURE__*/_react["default"].createElement(_textarea["default"], {
          ref: "textareaView".concat(index + 1),
          maxLength: 5000,
          value: (0, _mblog.htmlDecodeByRegExp)(item.drawback),
          initialHeight: 56,
          style: {
            marginLeft: "8px"
          },
          onChange: function onChange(value) {
            return _this._handlerAdvancedModeProblemChange("drawback", value, index);
          },
          placeholder: "<p>".concat((0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Pldescribe"), "</p>")
        })), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalogSecond, null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Rootcause")), /*#__PURE__*/_react["default"].createElement(_textarea["default"], {
          maxLength: 5000,
          value: (0, _mblog.htmlDecodeByRegExp)(item.cause),
          autoResizing: true,
          style: {
            marginLeft: "8px"
          },
          onChange: function onChange(value) {
            return _this._handlerAdvancedModeProblemChange("cause", value, index);
          },
          placeholder: "<p>".concat((0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Pleasefillproblem"), "</p>")
        })), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalogSecond, null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Correspond")), /*#__PURE__*/_react["default"].createElement(_textarea["default"], {
          maxLength: 5000,
          value: (0, _mblog.htmlDecodeByRegExp)(item.measures),
          autoResizing: true,
          style: {
            marginLeft: "8px"
          },
          onChange: function onChange(value) {
            return _this._handlerAdvancedModeProblemChange("measures", value, index);
          },
          placeholder: "<p>".concat((0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Pleabovereasons"), "</p>")
        })));
      });
    };

    _this._handlerUserSelect = function (users, depts) {
      var data = _objectSpread({}, _this.state.data);

      var EditType = _this.props.EditType;
      var participantsConcatArr = [].concat(_toConsumableArray(data.reviewParticipantsList), _toConsumableArray(users)); // 人员

      var departmentConcatArr = [].concat(_toConsumableArray(data.reviewDepartmentsList), _toConsumableArray(depts)); // 部门

      var usersConcatArr = [].concat(_toConsumableArray(data.reviewMebers), _toConsumableArray(users), _toConsumableArray(depts));
      data.reviewParticipantsList = _this.deduplicationFunc(participantsConcatArr);
      var prevParticipantIds = data.reviewMebers.map(function (item) {
        return item.Id;
      }).join(",");
      var participantIds = EditType === 0 ? data.reviewParticipantsList.map(function (item) {
        return item.Id;
      }).join(",") : prevParticipantIds ? "".concat(prevParticipantIds, ",").concat(data.reviewParticipantsList.map(function (item) {
        return item.Id;
      }).join(",")) : data.reviewParticipantsList.map(function (item) {
        return item.Id;
      }).join(",");
      participantIds = participantIds.charAt(participantIds.length - 1) == "," ? participantIds.slice(0, participantIds.length - 1) : participantIds;
      data.reviewDepartmentsList = _this.deduplicationFunc(departmentConcatArr);
      var departmentIds = data.reviewDepartmentsList.map(function (item) {
        return item.Id;
      }).join(",");
      data.reviewMebers = _this.deduplicationFunc(usersConcatArr);

      _this._updateReviewData(data, "participantIds", participantIds);

      _this._updateReviewData(data, "departmentIds", departmentIds);
    };

    _this.deduplicationFunc = function (targetArr) {
      var resultArr = [];
      targetArr.forEach(function (item) {
        var res = resultArr.filter(function (element) {
          return item.Id === element.Id;
        });
        resultArr.forEach(function (element) {
          if (item.Id === element.Id) {
            element = item;
          }
        });

        if (res.length === 0) {
          resultArr.push(item);
        }
      });
      return resultArr;
    };

    _this._handlerDeleteMember = function (index) {
      var data = _objectSpread({}, _this.state.data);

      var reviewMebers = _toConsumableArray(data.reviewMebers);

      reviewMebers.splice(index, 1);
      var participantIds = reviewMebers.map(function (item) {
        return item.Id;
      }).join(",");

      _this._updateReviewData(data, "participantIds", participantIds);

      _this._updateReviewData(data, "reviewMebers", reviewMebers);
    };

    _this._renderReviewMembers = function (reviewMebers, EditType) {
      return reviewMebers.map(function (item, index) {
        return /*#__PURE__*/_react["default"].createElement(_style.AvatarWrapper, {
          key: item.Id
        }, /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
          overlay: /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
            name: item.Name || item.DepartmentName,
            id: item.Id
          }),
          placement: "top",
          align: {
            offset: [0, 5]
          }
        }, /*#__PURE__*/_react["default"].createElement("div", {
          className: item.UserAvatar ? "" : "depts"
        }, item.UserAvatar ? /*#__PURE__*/_react["default"].createElement(_avatar["default"], {
          size: _avatar["default"].size(6),
          name: item.Name,
          userId: item.Id,
          color: item.UserAvatar.Color,
          src: item.UserAvatar.Small
        }) : /*#__PURE__*/_react["default"].createElement("div", {
          className: "depts-name"
        }, /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
          name: item.DepartmentName,
          id: item.Id
        })))), /*#__PURE__*/_react["default"].createElement(_style.IconCloseContainer, {
          onClick: function onClick() {
            return _this._handlerDeleteMember(index);
          }
        }, /*#__PURE__*/_react["default"].createElement(_style.IconClose, null, "\xD7")));
      });
    };

    _this._getTaskListData = function (taskData) {
      var data = _objectSpread({}, _this.state.data);

      var taskIds = data.taskIds;
      var taskList = data.taskList;
      taskIds = taskIds ? "".concat(taskIds, ",").concat(taskData.taskId) : taskData.taskId;
      taskList.push({
        taskId: taskData.taskId,
        taskName: taskData.taskName,
        status: taskData.status
      });

      _this._updateReviewData(data, "taskIds", taskIds);

      _this._updateReviewData(data, "taskList", taskList);
    };

    _this._renderActionPlans = function (taskList) {
      return taskList.map(function (item, index) {
        return (
          /*#__PURE__*/
          // <ToolTip title={item.taskName}>
          _react["default"].createElement(_style.ReviewContent, {
            className: "action-plan",
            key: item.taskId,
            onClick: function onClick() {
              return window.open("".concat(location.pathname, "#more/taskinfo?id=").concat(item.taskId));
            }
          }, /*#__PURE__*/_react["default"].createElement(_style.IconRunning, {
            className: _common.taskStatusIcon[item.status]
          }), /*#__PURE__*/_react["default"].createElement("span", {
            dangerouslySetInnerHTML: {
              __html: (0, _mblog.htmlEncodeByRegExp)(item.taskName)
            }
          })) // </ToolTip>

        );
      });
    };

    _this._switchMode = function () {
      var data = _objectSpread({}, _this.state.data);

      data.isStandardMode = !data.isStandardMode;

      if (data.isStandardMode) {
        data.Drawback = data.drawbackList.length > 0 ? data.drawbackList[0].drawback : "";
      } else if (data.drawbackList.length > 0) {
        data.drawbackList[0].drawback = data.Drawback;
      } else {
        data.drawbackList.push({
          drawbackId: 0,
          drawback: data.Drawback,
          cause: "",
          measures: ""
        });
      }

      _this._updateReviewData(data);
    };

    _this._updateReviewData = function (data, key, value) {
      var onChange = _this.props.onChange;

      if (key) {
        data[key] = value;
      }

      localStorage.setItem(_this.localStorageKey, JSON.stringify(data));
      onChange(data);

      _this.setState({
        data: data
      });
    };

    _this.stopPropagation = function (e) {
      e.nativeEvent.stopImmediatePropagation();
      e.stopPropagation();
    };

    _this.state = {
      data: {
        replayId: 0,
        objId: String(props.ObjData.ObjId),
        objType: props.ObjData.ObjType,
        gains: "",
        // 价值与收获
        Drawback: "",
        drawbackList: [{
          drawbackId: 0,
          drawback: "",
          cause: "",
          measures: ""
        }],
        // 问题与不足
        participantIds: "",
        // 参与人员
        reviewParticipantsList: [],
        departmentIds: "",
        reviewDepartmentsList: [],
        reviewMebers: [],
        taskIds: "",
        // 行动计划
        taskList: [],
        isStandardMode: true // 模式判断

      },
      // 复盘数据
      popContainer: document.body
    };
    return _this;
  }

  _createClass(ReviewBody, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.getReviewData();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var _this2 = this;

      var isMissDrawBack = this.props.isMissDrawBack;
      var drawbackList = this.state.data.drawbackList;
      var isStandardMode = this.state.data.isStandardMode;

      if (isMissDrawBack && !isStandardMode) {
        drawbackList.forEach(function (item, index) {
          var textareaRefName = "textareaView".concat(index + 1);

          if ((item.cause.trim().length > 0 || item.measures.trim().length > 0) && item.drawback.trim().length <= 0) {
            // @ts-ignore
            _this2.refs[textareaRefName].refs.textarea.style.borderColor = "#CC2929"; // @ts-ignore

            _this2.refs[textareaRefName].refs.textarea.style.background = "rgba(204,41,41,.05) !important";
          } else {
            // @ts-ignore
            _this2.refs[textareaRefName].refs.textarea.style.borderColor = "#E4EBF0"; // @ts-ignore

            _this2.refs[textareaRefName].refs.textarea.style.background = "#FFFFFF";
          }
        });
      }
    } // 获取复盘数据
    // 新增 EditType === 0 (localData ? JSON.parse(localData) : initData)
    // 编辑 EditType === 1 this.getReviewDataById()

  }, {
    key: "render",
    value: function render() {
      var _this3 = this;

      var screenHeight = window.screen.height;
      var _this$props2 = this.props,
          ObjData = _this$props2.ObjData,
          EditType = _this$props2.EditType; // console.log(ObjData);

      var _this$state = this.state,
          data = _this$state.data,
          popContainer = _this$state.popContainer;
      var maxHeight = 595;
      screenHeight <= 768 ? maxHeight = 300 : maxHeight = 500;
      return /*#__PURE__*/_react["default"].createElement(_style.ReviewBodyContainer, null, /*#__PURE__*/_react["default"].createElement(_style.ReviewBodyScroll, {
        maxHeight: maxHeight
      }, /*#__PURE__*/_react["default"].createElement(_style.ReviewTarget, null, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalog, null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Reviewobject")), /*#__PURE__*/_react["default"].createElement(_style.ReviewContent, {
        className: "target-name"
      }, /*#__PURE__*/_react["default"].createElement(_style.IconTarget, {
        className: ObjData.ObjType == 65 ? "review-kr" : "tu-icon-OKR"
      }, ObjData.ObjType == 65 ? "KR".concat(ObjData.ObjIndex == 0 ? "" : ObjData.ObjIndex) : ""), /*#__PURE__*/_react["default"].createElement("p", {
        className: "okr-name"
      }, (0, _openData.parseString)((0, _mblog.htmlDecodeByRegExp)(ObjData.ObjName))))), /*#__PURE__*/_react["default"].createElement(_style.ReviewWorth, null, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalog, null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Value")), /*#__PURE__*/_react["default"].createElement(_textarea["default"], {
        maxLength: 5000,
        value: (0, _mblog.htmlDecodeByRegExp)(data.gains),
        initialHeight: 56,
        style: {
          marginLeft: "8px"
        },
        onChange: function onChange(value) {
          return _this3._handlerReviewWorthChange(value);
        },
        placeholder: "<p>\u6211\u4EEC\u4ECE\u8FC7\u7A0B\u4E2D\u5B66\u5230\u4E86\u4EC0\u4E48\u65B0\u4E1C\u897F\uFF1F</p><p>".concat((0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Ifsomeone"), "</p>")
      })), this._renderReviewProblemView(), !data.isStandardMode && /*#__PURE__*/_react["default"].createElement(_style.AddReviewProblem, {
        onClick: this._addReviewProblem,
        className: data.drawbackList.length == 0 ? "none-drawback" : ""
      }, /*#__PURE__*/_react["default"].createElement(_style.IconAdd, {
        className: "tu-icon-add"
      }), /*#__PURE__*/_react["default"].createElement("span", null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Addproandd"))), /*#__PURE__*/_react["default"].createElement(_style.ReviewAction, {
        ref: "creatActionPlan"
      }, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalog, null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Lmproveplan")), /*#__PURE__*/_react["default"].createElement(_style.ReviewContent, null, this._renderActionPlans(data.taskList), /*#__PURE__*/_react["default"].createElement(_style.BtnCreateTask, {
        onClick: function onClick(e) {
          return _this3.renderCreateTaskView(e, ObjData, ObjData.workId);
        }
      }, /*#__PURE__*/_react["default"].createElement(_style.IconAdd, {
        className: "tu-icon-add"
      }), (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Createplan")))), /*#__PURE__*/_react["default"].createElement(_style.ReviewMember, null, /*#__PURE__*/_react["default"].createElement(_style.ReviewCatalog, null, (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Participants")), /*#__PURE__*/_react["default"].createElement(_style.ReviewContent, {
        className: "review-meber"
      }, this._renderReviewMembers(data.reviewMebers, EditType), /*#__PURE__*/_react["default"].createElement(_UserSelectorPop["default"], {
        align: "top left",
        container: popContainer,
        onSubmit: function onSubmit(users, depts) {
          _this3.stopPropagation;

          _this3._handlerUserSelect(users, depts);
        }
      }, /*#__PURE__*/_react["default"].createElement("div", {
        className: "add-meber"
      }, /*#__PURE__*/_react["default"].createElement(_style.IconAdd, {
        className: "tu-icon-add"
      }))))), /*#__PURE__*/_react["default"].createElement(_style.ReviewMode, null, /*#__PURE__*/_react["default"].createElement("span", {
        onClick: this._switchMode
      }, /*#__PURE__*/_react["default"].createElement(_style.IconSwitch, {
        className: "tu-icon-change"
      }), /*#__PURE__*/_react["default"].createElement("span", null, data.isStandardMode ? (0, _getLocale.getLocale)("OKR_MyO_Pop_Advancedmode") : (0, _getLocale.getLocale)("OKR_MyO_KRP_Pop_Butt_Standard"))))));
    }
  }]);

  return ReviewBody;
}(_react.PureComponent);

exports["default"] = ReviewBody;