"use strict";
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;
var _react = _interopRequireWildcard(require("react")),
  _propTypes = _interopRequireDefault(require("prop-types")),
  _processor = require("../../../utils//processor"),
  _request = require("../../../utils//request"),
  _urlConsts = require("../../../consts/urlConsts"),
  _amosWebsocket = _interopRequireDefault(require("amos-websocket")),
  _amosAntd = require("amos-antd"),
  _amosFramework = require("amos-framework"),
  _amosJsplumb = require("amos-jsplumb"),
  _rayEventpool = require("ray-eventpool"),
  _dt2react = _interopRequireDefault(require("dt2react")),
  _amosIcon = _interopRequireDefault(require("amos-icon")),
  _TopoStagePlumb = _interopRequireDefault(require("./TopoStagePlumb")),
  _ConfigPanel = _interopRequireDefault(require("./ConfigPanel")),
  _DragableCard = _interopRequireDefault(require("./DragableCard")),
  _ChooseEquipmentPanel = _interopRequireDefault(require("./equipmentChoose/ChooseEquipmentPanel")),
  _ChooseBackgroundPanel = _interopRequireDefault(require("./uploadPicture/ChooseBackgroundPanel")),
  _stageConst = require("./modelConf/stageConst");
require("./topo.scss");
var _deviceService = require("./../../../services/deviceService"),
  _UploadSinglePicModal = _interopRequireDefault(require("./uploadPicture/UploadSinglePicModal")),
  _TopoConfigPanel = _interopRequireDefault(require("./topoconfig/TopoConfigPanel"));

function _interopRequireDefault(e) {
  return e && e.__esModule ? e : {
    default: e
  }
}

function _getRequireWildcardCache() {
  if ("function" != typeof WeakMap) return null;
  var e = new WeakMap;
  return _getRequireWildcardCache = function() {
    return e
  }, e
}

function _interopRequireWildcard(e) {
  if (e && e.__esModule) return e;
  if (null === e || "object" !== _typeof(e) && "function" != typeof e) return {
    default: e
  };
  var t = _getRequireWildcardCache();
  if (t && t.has(e)) return t.get(e);
  var n, o, r = {},
    i = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (n in e) Object.prototype.hasOwnProperty.call(e, n) && ((o = i ? Object.getOwnPropertyDescriptor(e, n) : null) && (o.get || o.set) ? Object.defineProperty(r, n, o) : r[n] = e[n]);
  return r.default = e, t && t.set(e, r), r
}

function _typeof(e) {
  return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
    return typeof e
  } : function(e) {
    return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
  })(e)
}

function _extends() {
  return (_extends = Object.assign || function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var n, o = arguments[t];
      for (n in o) Object.prototype.hasOwnProperty.call(o, n) && (e[n] = o[n])
    }
    return e
  }).apply(this, arguments)
}

function ownKeys(t, e) {
  var n, o = Object.keys(t);
  return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function(e) {
    return Object.getOwnPropertyDescriptor(t, e).enumerable
  })), o.push.apply(o, n)), o
}

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

function _toConsumableArray(e) {
  return _arrayWithoutHoles(e) || _iterableToArray(e) || _unsupportedIterableToArray(e) || _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(e, t) {
  if (e) {
    if ("string" == typeof e) return _arrayLikeToArray(e, t);
    var n = Object.prototype.toString.call(e).slice(8, -1);
    return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? _arrayLikeToArray(e, t) : void 0
  }
}

function _iterableToArray(e) {
  if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e)
}

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

function _arrayLikeToArray(e, t) {
  (null == t || t > e.length) && (t = e.length);
  for (var n = 0, o = new Array(t); n < t; n++) o[n] = e[n];
  return o
}

function _classCallCheck(e, t) {
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}

function _defineProperties(e, t) {
  for (var n = 0; n < t.length; n++) {
    var o = t[n];
    o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
  }
}

function _createClass(e, t, n) {
  return t && _defineProperties(e.prototype, t), n && _defineProperties(e, n), e
}

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

function _setPrototypeOf(e, t) {
  return (_setPrototypeOf = Object.setPrototypeOf || function(e, t) {
    return e.__proto__ = t, e
  })(e, t)
}

function _createSuper(n) {
  var o = _isNativeReflectConstruct();
  return function() {
    var e, t = _getPrototypeOf(n);
    return _possibleConstructorReturn(this, o ? (e = _getPrototypeOf(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments))
  }
}

function _possibleConstructorReturn(e, t) {
  return !t || "object" !== _typeof(t) && "function" != typeof t ? _assertThisInitialized(e) : t
}

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

function _isNativeReflectConstruct() {
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  if (Reflect.construct.sham) return !1;
  if ("function" == typeof Proxy) return !0;
  try {
    return Date.prototype.toString.call(Reflect.construct(Date, [], function() {})), !0
  } catch (e) {
    return !1
  }
}

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

function _defineProperty(e, t, n) {
  return t in e ? Object.defineProperty(e, t, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = n, e
}
var eventListeners = {
    connection: _amosJsplumb.handlers.onConnectionEventHandler,
    endpointClick: _amosJsplumb.handlers.onEndPointClick
  },
  keyDelete = 46,
  TopoContent = function() {
    _inherits(n, _react.Component);
    var t = _createSuper(n);

    function n(e) {
      var u;
      _classCallCheck(this, n), _defineProperty(_assertThisInitialized(u = t.call(this, e)), "onWindowResize", function(e) {
        u.getOffset()
      }), _defineProperty(_assertThisInitialized(u), "onSceneCreated", function(e) {
        u.jsPlumbInstance = e, u.jsPlumbInstance.bind("connection", function(e) {
          u.addConnections.push(e.connection), e.connection.bind("click", function(e) {
            (u.selectedConnection = e).toggleType("selected")
          })
        })
      }), _defineProperty(_assertThisInitialized(u), "onAddConnection", function(e, t, n) {
        var o = u.state.connections,
          e = {
            id: e,
            sourceId: parseInt(t),
            targetId: parseInt(n)
          },
          r = !1;
        o.map(function(e) {
          e.sourceId === parseInt(t) && e.targetId === parseInt(n) && (r = !0)
        }), r || u.setState({
          connections: [].concat(_toConsumableArray(u.state.connections), [e])
        })
      }), _defineProperty(_assertThisInitialized(u), "onRemoveConnection", function(t, e) {
        var n;
        window.confirm("Remove connection '".concat(t, "'?")) && "number" == typeof t && (n = "".concat(_urlConsts.OltSerUrl.deleteLinkById, "/").concat(t), _processor.AmosFetch.del(n).then(function(e) {
          if (e.ok) return e.text();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          u.setState({
            connections: u.state.connections.filter(function(e) {
              return e.id !== t
            })
          })
        }))
      }), _defineProperty(_assertThisInitialized(u), "onRemoveNode", function(t) {
        var e = u.state.nodes.filter(function(e) {
          return e.id !== t
        });
        u.setState({
          nodes: e
        })
      }), _defineProperty(_assertThisInitialized(u), "deleteLink", function(e) {
        var t, n, o;
        !e || e.keyCode !== keyDelete || void 0 !== (t = u.selectedConnection) && (e = u.state.connections, n = [], e && e.map(function(e) {
          t.targetId === e.targetId && t.sourceId === e.sourceId ? o = e.id : n.push(e)
        }), e = "".concat(_urlConsts.OltSerUrl.deleteLinkById, "/").concat(o), u.jsPlumbInstance.deleteConnection(t), void 0 !== o && _processor.AmosFetch.del(e).then(function(e) {
          if (e.ok) return e.text();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          u.setState({
            connections: n
          })
        }), u.selectedConnection = void 0)
      }), _defineProperty(_assertThisInitialized(u), "onPlumbClick", function(e) {}), _defineProperty(_assertThisInitialized(u), "getSubgraphData", function(e, t) {
        e = "".concat(_urlConsts.OltSerUrl.fetchSubgraphInfoById, "/").concat(e);
        _processor.AmosFetch.get(e).then(function(e) {
          if (e.ok) return e.json();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          var t, o;
          "SUCCESS" === e.result && (null === (t = e.dataList) ? u.setState({
            connections: [],
            nodes: []
          }) : (e = t.connections, (o = t.nodes).map(function(e) {
            var t;
            e.config = JSON.parse(e.config), void 0 !== e.equipmentId && (e.config.equipmentId = e.equipmentId), void 0 !== e.config.id ? (t = [e.nodeId, e.config.id], e.config.id = t[0], e.nodeId = t[1]) : e.config.id = e.nodeId, e.config.data && "VFE" === e.config.data.model && (e.config.nodeType = "ninghua")
          }), e.map(function(t) {
            var e = o.filter(function(e) {
                return e.nodeId === t.sourceId
              })[0],
              n = o.filter(function(e) {
                return e.nodeId === t.targetId
              })[0];
            t.sourceId = void 0 === e ? t.sourceId : e.id, t.targetId = void 0 === n ? t.targetId : n.id
          }), u.setState({
            connections: e,
            nodes: o,
            destroy: !1
          }), u.chooseBackground({})))
        })
      }), _defineProperty(_assertThisInitialized(u), "getOffset", function() {
        var e = u.topoView,
          e = _dt2react.default.getOffset(e) || {};
        u.setState({
          viewLocation: e
        })
      }), _defineProperty(_assertThisInitialized(u), "getNeeddata", function(t) {
        var e = u.state.nodes;
        console.log("nodes:"), console.log(e);
        var n = !1;
        0 !== e.length && (e.map(function(e) {
          e.config.equipmentId === t.eqpId && (e.config.realTimeData = t, n = !0)
        }), n && u.setState({
          nodes: e
        })), console.log(e)
      }), _defineProperty(_assertThisInitialized(u), "handleData", function(e) {
        console.log("我应该是实时数据："), console.log(e), u.getNeeddata(e)
      }), _defineProperty(_assertThisInitialized(u), "questdeleteNode", function(e) {
        var t;
        void 0 !== e && (t = u.confirmDeleteAction, _amosAntd.Modal.confirm({
          title: "确认删除",
          content: "是否删除所选信息？",
          okText: "确定",
          cancelText: "取消",
          onOk: function() {
            t(e)
          },
          onCancel: function() {}
        }))
      }), _defineProperty(_assertThisInitialized(u), "confirmDeleteAction", function(t) {
        u.setState({
          hiddenProperty: !0
        });
        var e = u.state,
          n = e.connections,
          e = e.nodes,
          o = [];
        e.map(function(e) {
          e.nodeId === t ? u.deleteNodeById(e.id, e.equipmentId) : o.push(e)
        });
        var r = [],
          i = [];
        n.map(function(e) {
          e.sourceId !== t && e.targetId !== t ? r.push(e) : void 0 !== e.id && i.push(e.id)
        }), u.deleteConnectionById(i), u.setState({
          connections: r,
          nodes: o
        })
      }), _defineProperty(_assertThisInitialized(u), "deleteNodeById", function(i, a) {
        u.setState({
          destroy: !0
        });
        var e = "".concat(_urlConsts.OltSerUrl.deleteNodeById, "/").concat(i);
        _processor.AmosFetch.del(e).then(function(e) {
          if (e.ok) return e.text();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          var t = u.state,
            n = t.daviceList,
            t = t.useList,
            o = [];
          t.map(function(e) {
            (e.id === a ? n : o).push(e)
          }), u.setState({
            destroy: !1,
            daviceList: n,
            useList: o
          });
          var r = u.jsPlumbInstance;
          u.state.nodes.map(function(e) {
            e.id === i && r.deleteEndpoint(r.getEndpoint("".concat(e.id)))
          })
        })
      }), _defineProperty(_assertThisInitialized(u), "deleteConnectionById", function(e) {
        0 !== e.length && (e = "".concat(_urlConsts.OltSerUrl.deleteConnectionById, "/").concat(e), _processor.AmosFetch.del(e).then(function(e) {
          if (e.ok) return e.text();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {}))
      }), _defineProperty(_assertThisInitialized(u), "handleCriterias", function() {
        var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
        e.orgCode = u.props.orgCode, (0, _deviceService.fetchTopoEquipmentAction)(e).then(function(e) {
          null !== e ? u.setState({
            daviceList: e.noUseList,
            useList: e.useList
          }) : u.setState({
            daviceList: [],
            useList: []
          })
        })
      }), _defineProperty(_assertThisInitialized(u), "startDrag", function(e, t, n) {
        u.setState({
          dragType: t,
          dragData: n
        })
      }), _defineProperty(_assertThisInitialized(u), "enableDrag", function(e) {
        e.preventDefault()
      }), _defineProperty(_assertThisInitialized(u), "stopDrag", function(e) {
        var t, n, o, r, i, a, s = u.state,
          c = (s.viewLocation, s.dragType),
          d = s.dragData;
        0 !== Object.keys(d).length && (t = _amosJsplumb.tools.uuid(), n = _amosJsplumb.domTools.getNodeOffset(e), o = c, s = {
          config: {
            id: t,
            label: d.name,
            type: "giot" === o ? "source" : "both",
            nodeType: o,
            data: d,
            style: n
          }
        }, u.nodeId = t, s.nodeId = t, c = (e = u.state).daviceList, r = e.useList, i = s.config.data.id, a = [], c.map(function(e) {
          (e.id === i ? r : a).push(e)
        }), u.setState({
          nodes: [].concat(_toConsumableArray(u.state.nodes), [s]),
          dragData: {},
          destroy: !0,
          daviceList: a,
          useList: r
        }), u.saveSubgraphData([].concat(_toConsumableArray(u.state.nodes), [s])))
      }), _defineProperty(_assertThisInitialized(u), "showProperty", function(t) {
        var e = u.state.nodes;
        u.nodeId = t, e.map(function(e) {
          e.nodeId === t && (e = e.equipmentId, (0, _deviceService.fetchTopoDeviceAction)(e).then(function(e) {
            u.changePanelWidth(!0), u.setState({
              currentDeviceConfig: e,
              isNodeSelected: !0,
              expandIconRight: "300px"
            })
          }))
        })
      }), _defineProperty(_assertThisInitialized(u), "generatePanelByDevice", function(e) {
        var t, n;
        void 0 !== e && (t = _dt2react.default.getOffset(e), n = _dt2react.default.getOffset(u.topoView), void 0 !== t && void 0 !== n && (o = n.height - 155, _dt2react.default.addStyle(e, "height", "".concat(o, "px"))));
        var o = u.state.daviceList,
          r = [];
        return void 0 !== o && o.map(function(e) {
          r.push(_react.default.createElement(_DragableCard.default, {
            cardData: e,
            key: e.id,
            startDrag: u.startDrag
          }))
        }), r
      }), _defineProperty(_assertThisInitialized(u), "saveSubgraphData", function(t) {
        u.jsPlumbInstance.getManagedElements();
        var e = u.state,
          o = e.nodes,
          n = e.connections,
          o = void 0 === t || void 0 === t.length ? o : t,
          e = u.props,
          r = e.subviewId,
          e = e.currentNode;
        o.map(function(e) {
          var t;
          void 0 !== e.config.id && (t = [e.nodeId, e.config.id], e.config.id = t[0], e.nodeId = t[1], e.config.realTimeData = void 0), e.config = JSON.stringify(e.config)
        }), n.map(function(t) {
          var e = o.filter(function(e) {
              return e.id === parseInt(t.sourceId)
            })[0],
            n = o.filter(function(e) {
              return e.id === parseInt(t.targetId)
            })[0];
          t.sourceId = void 0 === e ? t.sourceId : e.nodeId, t.targetId = void 0 === n ? t.targetId : n.nodeId, t.id = 0
        });
        e = {
          id: r,
          nodes: o,
          connections: n,
          orgCode: e.orgId
        };
        _processor.AmosFetch.post(_urlConsts.OltSerUrl.addSubgraphData, {
          data: e
        }).then(function(e) {
          if (e.ok) return e.text();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          "SUCCESS" === JSON.parse(e).result ? (void 0 !== t && void 0 !== t.length || _amosFramework.message.success("保存成功！"), u.getSubgraphData(r)) : _amosFramework.message.danger("保存失败！")
        })
      }), _defineProperty(_assertThisInitialized(u), "updateNodeConfig", function(t, n) {
        u.state.nodes.map(function(e) {
          e.nodeId === t && (e.equipmentParam = JSON.stringify(n))
        }), u.saveSubgraphData()
      }), _defineProperty(_assertThisInitialized(u), "send", function() {
        var e = {
          subviewId: u.props.subviewId
        };
        u.aws.getWebSocket().send(JSON.stringify(e))
      }), _defineProperty(_assertThisInitialized(u), "doHiddenProperty", function(e) {
        u.setState({
          hiddenProperty: !0
        })
      }), _defineProperty(_assertThisInitialized(u), "exit", function() {
        u.props.updateView("1", u.props.currentNode)
      }), _defineProperty(_assertThisInitialized(u), "chooseBackground", function(e) {
        var t = e.imgName,
          n = e.percent,
          o = e.layout,
          r = u.topoView;
        null == t || null == r || (u.currentImgUrl = t);
        e = u.currentImgUrl;
        e.includes(".") ? (void 0 !== o && (u.currentImgLayout = o), 1 === (t = u.currentImgLayout) ? (o = 'url("'.concat(_urlConsts.OltSerUrl.fetchDeviceImg, "/graph/").concat(e, '") no-repeat'), _dt2react.default.addStyle(r, "background", o), _dt2react.default.addStyle(r, "background-size", "100% 100%")) : 2 === t && (t = 'url("'.concat(_urlConsts.OltSerUrl.fetchDeviceImg, "/graph/").concat(e, '")'), _dt2react.default.addStyle(r, "background", t))) : _dt2react.default.addStyle(r, "background", e), void 0 !== n ? (_dt2react.default.addStyle(r, "opacity", n), u.currentPercent = n) : _dt2react.default.addStyle(r, "opacity", u.currentPercent)
      }), _defineProperty(_assertThisInitialized(u), "oneOpenOrClose", function(t) {
        var e = u.props.subviewId,
          e = "".concat(_urlConsts.OltSerUrl.oneOpenOrClose, "/").concat(e, "/").concat(t);
        _processor.AmosFetch.get(e).then(function(e) {
          if (e.ok) return e.json();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          "SUCCESS" === e.result && u.setState({
            checked: t
          })
        })
      }), _defineProperty(_assertThisInitialized(u), "changePanelWidth", function(e) {
        e ? u.setState({
          configPanelWith: "calc(100% - 300px)",
          expandIconRight: "300px"
        }) : u.setState({
          configPanelWith: "100%",
          expandIconRight: "0"
        })
      }), _defineProperty(_assertThisInitialized(u), "changeLeftPanelWidth", function(e) {
        e ? u.setState({
          devicePanelStyle: "topo-content-stage"
        }) : u.setState({
          devicePanelStyle: "topo-no-left-content-stage"
        })
      }), _defineProperty(_assertThisInitialized(u), "mapFocus", function() {
        window.topoNodefocus ? window.topoNodefocus = !1 : u.setState({
          isNodeSelected: !1
        })
      }), _defineProperty(_assertThisInitialized(u), "onZoom", function(e) {
        u.setState({
          zoom: e
        })
      }), _defineProperty(_assertThisInitialized(u), "onDropHandler", function(n, o, r) {
        var e = u.state.nodes;
        e.forEach(function(e) {
          var t;
          e.id === n && (t = {
            left: o,
            top: r
          }, e.config.style = t)
        }), u.setState({
          nodes: e
        })
      }), _defineProperty(_assertThisInitialized(u), "beforeDrop", function(e) {
        var t = u.jsPlumbInstance;
        e.targetId = e.dropEndpoint.elementId;
        t = t.getConnections({
          source: e.sourceId,
          target: e.targetId
        });
        if (e.targetId === e.sourceId) _amosFramework.message.danger("不可以自己连接自己");
        else {
          if (0 === t.length) return u.setState({
            info: e
          }), !0;
          _amosFramework.message.danger("两个节点之间只能有一条连接")
        }
      }), u.addConnections = [], u.currentImgUrl = u.props.imgName, u.currentPercent = u.props.currentNode.imgOpacity, u.currentImgLayout = u.props.currentNode.imgLayout, u.state = {
        communityOptions: [],
        equiptemplateIndustryOptions: [],
        daviceList: [],
        useList: [],
        dragType: "custom",
        connections: [],
        nodes: [],
        zoom: 1,
        viewLocation: {},
        finalCriterias: [],
        dragData: {},
        checked: u.props.currentNode.enableMonitor,
        hiddenProperty: !0,
        visibility: "0",
        destroy: !1,
        isNodeSelected: !1,
        currentDeviceConfig: {},
        configPanelWith: "calc(100% - 300px)",
        devicePanelStyle: "topo-content-stage",
        expandIconRight: "0"
      };
      e = (0, _request.getToken)();
      return u.websocketUrl = "".concat(_urlConsts.realTimeMetricWsURL, "equipment-metric.ws?token=").concat(e), u
    }
    return _createClass(n, [{
      key: "componentWillMount",
      value: function() {
        var n = this;
        _processor.AmosFetch.get(_urlConsts.OltSerUrl.communityProtocol).then(function(e) {
          if (e.ok) return e.json();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          var t;
          "SUCCESS" === e.result && (t = [], e && e.dataList.map(function(e) {
            t.push({
              value: e.id,
              label: e.name,
              selected: !1,
              style: "all-filter-btn"
            })
          }), n.setState({
            communityOptions: t
          }))
        }), _processor.AmosFetch.get(_urlConsts.OltSerUrl.equiptemplateIndustry).then(function(e) {
          if (e.ok) return e.json();
          throw new Error("从服务端获取数据失败！")
        }).then(function(e) {
          var t;
          "SUCCESS" === e.result && (t = [], e && e.dataList.map(function(e) {
            t.push({
              value: e.id,
              label: e.name,
              selected: !1,
              style: "all-filter-btn"
            })
          }), n.setState({
            equiptemplateIndustryOptions: t
          }))
        })
      }
    }, {
      key: "componentDidMount",
      value: function() {
        var n = this,
          e = this.props.subviewId;
        this.handleCriterias(), this.getOffset(), window.addEventListener("resize", this.onWindowResize), this.getSubgraphData(e), this.chooseBackground({}), this.pubsub_eledel = _rayEventpool.PubSub.subscribe(_stageConst.TOPO_ELE_DEL_TOPIC.eleDel, function(e, t) {
          t = t.id;
          n.nodeId === t && n.questdeleteNode(t)
        }), this.pubsub_eleshow = _rayEventpool.PubSub.subscribe(_stageConst.TOPO_SHOW_PROPERTY_TOPIC.eleShow, function(e, t) {
          t = t.id;
          n.showProperty(t)
        }), this.pubsub_eleSelect = _rayEventpool.PubSub.subscribe(_stageConst.TOPO_ENABLE_CLICK_TOPIC.eleShow, function(e, t) {
          t = t.id;
          n.nodeId = t, n.showProperty(t)
        })
      }
    }, {
      key: "componentWillReceiveProps",
      value: function(e) {
        var t = e.subviewId,
          e = e.imgName;
        this.jsPlumbInstance.reset(), this.setState({
          destroy: !0,
          hiddenProperty: !0
        }), this.getSubgraphData(t), e !== this.props.imgName && this.chooseBackground({
          imgName: e
        })
      }
    }, {
      key: "componentWillUnmount",
      value: function() {
        window.removeEventListener("resize", this.onWindowResize), _rayEventpool.PubSub.unsubscribe(this.pubsub_eleshow), _rayEventpool.PubSub.unsubscribe(this.pubsub_eledel), _rayEventpool.PubSub.unsubscribe(this.pubsub_eleSelect)
      }
    }, {
      key: "render",
      value: function() {
        var t, n = this,
          e = this.state,
          o = e.configPanelWith,
          r = e.communityOptions,
          i = e.zoom,
          a = e.nodes,
          s = e.connections,
          c = e.expandIconRight,
          d = e.equiptemplateIndustryOptions,
          u = e.destroy,
          l = e.isNodeSelected,
          p = e.currentDeviceConfig,
          f = e.devicePanelStyle,
          h = this.props,
          _ = (h.subviewId, h.subviewName),
          y = h.currentNode,
          e = (h.imgName, {
            nodes: a,
            connections: s
          }),
          h = {
            onDrop: this.onDropHandler
          },
          s = _objectSpread(_objectSpread({}, eventListeners), {}, {
            beforeDrop: this.beforeDrop
          }),
          g = this.nodeId,
          y = y;
        y.title = _, y.num = a.length - 1, void 0 !== a && a.map(function(e) {
          e.nodeId === g && (t = e.equipmentId, e.equipmentParam)
        });
        a = g && a.filter(function(e) {
          return e.config.id === g
        });
        return a && 1 === a.length && (a = a[0].config), _react.default.createElement("div", {
          className: "topo-content"
        }, _react.default.createElement("div", {
          className: "dispatch-mask",
          ref: function(e) {
            return n.dispatchMask = e
          }
        }, _react.default.createElement(_amosWebsocket.default, {
          ref: function(e) {
            return n.aws = e
          },
          url: this.websocketUrl,
          onMessage: this.handleData,
          onOpen: this.send,
          reconnect: !0,
          debug: !0
        })), _react.default.createElement("div", {
          className: "topo-content-view",
          style: {
            width: o
          }
        }, _react.default.createElement(_ChooseEquipmentPanel.default, {
          communityOptions: r,
          handleCriterias: this.handleCriterias,
          generatePanelByDevice: this.generatePanelByDevice,
          equiptemplateIndustryOptions: d,
          changeLeftPanelWidth: this.changeLeftPanelWidth
        }), _react.default.createElement("div", {
          className: "topo-content-header"
        }, _react.default.createElement("label", {
          style: {
            "font-size": "15px"
          }
        }, "●", _), _react.default.createElement("div", {
          className: "edit-view-root"
        }, _react.default.createElement("div", {
          className: "tree-header-extra-item-edit",
          onClick: this.exit,
          title: "退出"
        }, _react.default.createElement("img", {
          src: require("./../../../assets/iot/topo/exit.png"),
          alt: ""
        }))), _react.default.createElement("div", {
          className: "save-view",
          onClick: this.saveSubgraphData,
          title: "保存"
        }, _react.default.createElement("img", {
          src: require("./../../../assets/iot/topo/save.png"),
          alt: ""
        })), _react.default.createElement("div", {
          className: "start-stop-view"
        }, _react.default.createElement(_amosFramework.Switch, {
          onLabel: "启",
          offLabel: "停",
          onOff: this.state.checked,
          onChange: function(e) {
            return n.oneOpenOrClose(e)
          }
        }))), _react.default.createElement("div", {
          style: {
            height: "100%"
          }
        }, _react.default.createElement("div", {
          onDragOver: function(e) {
            return n.enableDrag(e)
          },
          onDrop: function(e) {
            return n.stopDrag(e)
          },
          ref: function(e) {
            return n.topoView = e
          },
          onKeyDown: this.deleteLink,
          className: f,
          onFocus: this.mapFocus,
          tabIndex: "-1"
        }, _react.default.createElement(_TopoStagePlumb.default, {
          eventListeners: s,
          onPlumbClick: this.onPlumbClick,
          onSceneCreated: this.onSceneCreated,
          zoom: i,
          dataSource: e,
          destroy: u,
          onAddConnection: this.onAddConnection,
          onRemoveConnection: this.onRemoveConnection,
          onRemoveNode: this.onRemoveNode,
          onZoom: this.onZoom,
          nodeProps: h
        })))), _react.default.createElement(_TopoConfigPanel.default, _extends({
          isNodeSelected: l,
          subviewInfo: y,
          currentDeviceConfig: p,
          config: a,
          equipmentId: t,
          nodeId: g,
          getSubgraphData: this.getSubgraphData,
          showProperty: this.showProperty,
          chooseBackground: this.chooseBackground,
          changePanelWidth: this.changePanelWidth,
          expandIconRight: c
        }, this.props)))
      }
    }]), n
  }();
TopoContent.displayName = "TopoContent", TopoContent.propTypes = {
  subviewId: _propTypes.default.string,
  subviewName: _propTypes.default.string,
  currentNode: _propTypes.default.object,
  selectedKeys: _propTypes.default.array,
  editTreeData: _propTypes.default.func,
  updateView: _propTypes.default.func,
  imgName: _propTypes.default.string,
  orgCode: _propTypes.default.any
};
var _default = TopoContent;
exports.default = TopoContent, module.exports = exports.default;
