"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"] = void 0;
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireWildcard(require("react"));
var _ResultTitle = _interopRequireDefault(require("../ResultTitle"));
require("./index.less");
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
var _lodash = _interopRequireWildcard(require("lodash"));
var _current = _interopRequireDefault(require("./assets/current.svg"));
var _up = _interopRequireDefault(require("./assets/up.svg"));
var _down = _interopRequireDefault(require("./assets/down.svg"));
var _space = _interopRequireDefault(require("antd/lib/space"));
var _EventReportModal = _interopRequireDefault(require("../EventReportModal"));
var _olMap = require("@vtx/ol-map");
var _radio = _interopRequireDefault(require("antd/lib/radio"));
var _config3 = _interopRequireDefault(require("../../_mapUtil/config"));
var _EventDetailModal = _interopRequireDefault(require("../EventDetailModal"));
var _request = _interopRequireDefault(require("../../_mapUtil/request"));
var _ahooks = require("ahooks");
var _DetailItems = _interopRequireDefault(require("../DetailItems"));
var _utils = require("@vtx/utils");
var _components = require("@vtx/components");
var _icons = require("@ant-design/icons");
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; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _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 _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /* eslint-disable react/prop-types */
var prefixCls = 'ol-map-analysis-result-diagnosis';
var symbolMap = {
  '-1': _up["default"],
  '0': _current["default"],
  1: _down["default"]
};
var colorMap = {
  '-1': '#308BFA',
  '0': '#F7984C',
  1: '#00B5B4'
};
var ResultDiagnosis = function ResultDiagnosis(_ref) {
  var result = _ref.result,
    reason = _ref.reason,
    _ref$reasonTitle = _ref.reasonTitle,
    reasonTitle = _ref$reasonTitle === void 0 ? '诊断原因' : _ref$reasonTitle,
    _ref$showReport = _ref.showReport,
    showReport = _ref$showReport === void 0 ? true : _ref$showReport,
    measure = _ref.measure,
    _ref$skeletonNodes = _ref.skeletonNodes,
    skeletonNodes = _ref$skeletonNodes === void 0 ? [] : _ref$skeletonNodes,
    children = _ref.children,
    _ref$info = _ref.info,
    info = _ref$info === void 0 ? {} : _ref$info,
    question = _ref.question,
    reasonStr = _ref.reasonStr,
    _ref$theme = _ref.theme,
    theme = _ref$theme === void 0 ? 'light' : _ref$theme,
    customSkeleton = _ref.customSkeleton,
    _ref$showMap = _ref.showMap,
    showMap = _ref$showMap === void 0 ? true : _ref$showMap,
    _ref$waterPipes = _ref.waterPipes,
    waterPipes = _ref$waterPipes === void 0 ? [] : _ref$waterPipes,
    _ref$upstreamItems = _ref.upstreamItems,
    upstreamItems = _ref$upstreamItems === void 0 ? [] : _ref$upstreamItems,
    _ref$downstreamItems = _ref.downstreamItems,
    downstreamItems = _ref$downstreamItems === void 0 ? [] : _ref$downstreamItems,
    _ref$targetItem = _ref.targetItem,
    targetItem = _ref$targetItem === void 0 ? {} : _ref$targetItem,
    _ref$showTitle = _ref.showTitle,
    showTitle = _ref$showTitle === void 0 ? true : _ref$showTitle,
    updateWordOrderId = _ref.updateWordOrderId,
    wordOrderId = _ref.wordOrderId,
    downloadPDF = _ref.downloadPDF;
  var links = [];
  skeletonNodes.forEach(function (_ref2) {
    var childFacilityIds = _ref2.childFacilityIds,
      parentFacilityIds = _ref2.parentFacilityIds,
      diameter = _ref2.diameter,
      facilityId = _ref2.facilityId;
    (childFacilityIds || []).forEach(function (id) {
      if (!links.find(function (item) {
        return item.target === id && item.source === facilityId;
      })) {
        links.push({
          target: id,
          source: facilityId,
          value: diameter
        });
      }
    });
    (parentFacilityIds || []).forEach(function (id) {
      if (!links.find(function (item) {
        return item.source === id && item.target === facilityId;
      })) {
        links.push({
          target: facilityId,
          source: id,
          value: diameter
        });
      }
    });
  });
  var _useState = (0, _react.useState)(false),
    _useState2 = _slicedToArray(_useState, 2),
    visible = _useState2[0],
    setVisible = _useState2[1];
  var _useState3 = (0, _react.useState)(false),
    _useState4 = _slicedToArray(_useState3, 2),
    detailVisible = _useState4[0],
    setDetailVisible = _useState4[1];
  var _useSetState = (0, _ahooks.useSetState)({
      showReportRecord: false,
      showDisposalResult: false,
      processDefinitionKey: '',
      allowDownloadPdf: false
    }),
    _useSetState2 = _slicedToArray(_useSetState, 2),
    state = _useSetState2[0],
    setState = _useSetState2[1];
  var showDisposalResult = state.showDisposalResult,
    showReportRecord = state.showReportRecord,
    processDefinitionKey = state.processDefinitionKey,
    allowDownloadPdf = state.allowDownloadPdf;
  (0, _react.useEffect)(function () {
    _request["default"].get('/cloud/zhsw-znfx/api/gisAnalyze/getBusinessConfig', {
      body: {
        businessCode: 'EVENT_REPORT_URL'
      }
    }).then(function (res) {
      var _res$data;
      if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.configJson) {
        var _config = {};
        try {
          var _res$data2;
          _config = JSON.parse(res === null || res === void 0 || (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.configJson);
        } catch (error) {
          _config = {};
        }
        var _config2 = _config,
          show_report_record = _config2.show_report_record,
          show_disposal_result = _config2.show_disposal_result,
          url = _config2.url,
          _allowDownloadPdf = _config2.allowDownloadPdf;
        setState({
          showReportRecord: show_report_record,
          showDisposalResult: show_disposal_result,
          processDefinitionKey: (0, _utils.getUrlParam)('processDefinitionKey', url),
          allowDownloadPdf: _allowDownloadPdf
        });
      }
    });
  }, []);
  var _useRequest = (0, _ahooks.useRequest)(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
      var _res$data3;
      var res;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return _request["default"].get('/cloud/zhxt/case/info/get', {
              body: {
                id: wordOrderId,
                coordinateType: 'wgs84',
                processDefinitionKey: processDefinitionKey
              }
            });
          case 2:
            res = _context.sent;
            return _context.abrupt("return", ((res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.taskList) || []).find(function (item) {
              return item.operateTypeCode === 4;
            }) || {});
          case 4:
          case "end":
            return _context.stop();
        }
      }, _callee);
    })), {
      ready: !!(processDefinitionKey && wordOrderId && showDisposalResult),
      refreshDeps: [wordOrderId, processDefinitionKey]
    }),
    _useRequest$data = _useRequest.data,
    caseInfo = _useRequest$data === void 0 ? {} : _useRequest$data;
  // 递归处理
  var legendData = [];
  skeletonNodes.forEach(function (node) {
    var target = node.target;
    if (target === 0) {
      legendData.push({
        name: '当前设备',
        itemStyle: {
          color: colorMap[0],
          borderWidth: 0
        }
      });
    } else if (target === -1) {
      legendData.push({
        name: '上游设备',
        itemStyle: {
          color: colorMap[-1],
          borderWidth: 0
        }
      });
    } else if (target === 1) {
      legendData.push({
        name: '下游设备',
        itemStyle: {
          color: colorMap[1],
          borderWidth: 0
        }
      });
    }
  });
  var option = {
    tooltip: {},
    legend: {
      icon: 'circle',
      textStyle: {
        color: theme === 'light' ? '#2D2D2D' : '#fff',
        fontSize: 14
      },
      data: [].concat(_toConsumableArray(_lodash["default"].find(skeletonNodes, {
        target: -1
      }) ? [{
        name: '上游设备',
        itemStyle: {
          color: '#308BFA',
          borderWidth: 0
        }
      }] : []), _toConsumableArray(_lodash["default"].find(skeletonNodes, {
        target: 1
      }) ? [{
        name: '下游设备',
        itemStyle: {
          color: '#00B5B4',
          borderWidth: 0
        }
      }] : []), _toConsumableArray(_lodash["default"].find(skeletonNodes, {
        target: 0
      }) ? [{
        name: '当前设备',
        itemStyle: {
          color: '#F7984C',
          borderWidth: 0
        }
      }] : [])),
      top: '5%',
      left: 'center',
      show: true
    },
    series: [{
      categories: [{
        name: '上游设备'
      }, {
        name: '下游设备'
      }, {
        name: '当前设备'
      }],
      type: 'graph',
      layout: 'force',
      force: {
        repulsion: 1500,
        edgeLength: 120,
        layoutAnimation: true
      },
      symbolSize: 30,
      nodeScaleRatio: 1,
      //图标大小是否随鼠标滚动而变
      roam: true,
      //缩放
      draggable: true,
      //节点是否可以拖拽
      edgeSymbol: ['none', 'arrow'],
      //线2头标记

      label: {
        show: false
      },
      emphasis: {
        label: {
          show: false
        }
      },
      edgeLabel: {
        normal: {
          show: true,
          width: 58,
          height: 22,
          borderRadius: 12,
          backgroundColor: '#E1E5EA',
          align: 'center',
          verticalAlign: 'middle',
          textStyle: {
            fontSize: 12,
            color: '#2D2D2D'
          },
          formatter: '{c}mm'
        }
      },
      symbolKeepAspect: false,
      focusNodeAdjacency: false,
      // 指定的节点以及其所有邻接节点高亮
      itemStyle: {
        normal: {
          borderColor: '#29ACFC',
          borderWidth: 2,
          shadowColor: '#29ACFC',
          color: '#29ACFC',
          curveness: 0.08
        }
      },
      tooltip: {
        formatter: function formatter() {
          return '';
        }
      },
      lineStyle: {
        normal: {
          width: 2,
          curveness: 0.15,
          color: '#9DA9BA'
        }
      },
      data: skeletonNodes.map(function (_ref4) {
        var lineNo = _ref4.lineNo,
          target = _ref4.target,
          facilityId = _ref4.facilityId,
          roadName = _ref4.roadName;
        return {
          name: facilityId,
          symbol: "image://".concat(symbolMap[target]),
          tooltip: {
            formatter: "".concat(roadName || '').concat(lineNo)
          }
        };
      }),
      links: links
    }]
  };
  var _useState5 = (0, _react.useState)(showMap ? 'map' : 'chart'),
    _useState6 = _slicedToArray(_useState5, 2),
    type = _useState6[0],
    setType = _useState6[1];
  var mapRef = (0, _react.useRef)();
  var createdMap = function createdMap(map) {
    mapRef.current = map;
  };
  (0, _react.useEffect)(function () {
    if (mapRef.current && !(0, _lodash.isEmpty)(waterPipes)) {
      mapRef.current.fitView(waterPipes);
    }
  }, [mapRef, waterPipes]);
  var deviceList = [];
  if (!(0, _lodash.isEmpty)(targetItem)) {
    var device = targetItem.device;
    if (device) {
      var _device$installLocati;
      deviceList.push(_objectSpread(_objectSpread({
        target: 0
      }, device), {}, {
        geometryInfo: {
          coordType: 'wgs84',
          lngLats: device === null || device === void 0 || (_device$installLocati = device.installLocationDTO) === null || _device$installLocati === void 0 ? void 0 : _device$installLocati.lngLats,
          type: 'point'
        }
      }));
    }
  }
  upstreamItems.forEach(function (item) {
    var device = item.device;
    if (device) {
      var _device$installLocati2;
      deviceList.push(_objectSpread(_objectSpread({
        target: -1
      }, device), {}, {
        geometryInfo: {
          coordType: 'wgs84',
          lngLats: device === null || device === void 0 || (_device$installLocati2 = device.installLocationDTO) === null || _device$installLocati2 === void 0 ? void 0 : _device$installLocati2.lngLats,
          type: 'point'
        }
      }));
    }
  });
  downstreamItems.forEach(function (item) {
    var device = item.device;
    if (device) {
      var _device$installLocati3;
      deviceList.push(_objectSpread(_objectSpread({
        target: 1
      }, device), {}, {
        geometryInfo: {
          coordType: 'wgs84',
          lngLats: device === null || device === void 0 || (_device$installLocati3 = device.installLocationDTO) === null || _device$installLocati3 === void 0 ? void 0 : _device$installLocati3.lngLats,
          type: 'point'
        }
      }));
    }
  });
  var listAttach = caseInfo.disposeAttach && caseInfo.disposeAttach.length > 0 ? JSON.parse(caseInfo.disposeAttach) : [];
  var listPhoto = caseInfo.disposePhoto && caseInfo.disposePhoto.length > 0 ? JSON.parse(caseInfo.disposePhoto) : [];
  var files = listAttach.concat(listPhoto);
  var onCancel = (0, _ahooks.useMemoizedFn)(function (wordOrderId) {
    setVisible(false);
    if (updateWordOrderId && showReportRecord) {
      updateWordOrderId(wordOrderId);
    }
  });
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-wrap"),
    id: 'resultDiagnosis'
  }, downloadPDF && allowDownloadPdf && /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-download")
  }, /*#__PURE__*/_react["default"].createElement(_icons.FilePdfOutlined, {
    onClick: downloadPDF
  })), (!(0, _lodash.isEmpty)(skeletonNodes) || customSkeleton) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_ResultTitle["default"], {
    title: '拓扑结构',
    rightContent: showMap ? /*#__PURE__*/_react["default"].createElement(_radio["default"].Group, {
      size: "small",
      value: type,
      onChange: function onChange(e) {
        return setType(e.target.value);
      }
    }, /*#__PURE__*/_react["default"].createElement(_radio["default"].Button, {
      value: "map"
    }, "\u5730\u56FE"), /*#__PURE__*/_react["default"].createElement(_radio["default"].Button, {
      value: "chart"
    }, "\u56FE\u8868")) : null
  }), type === 'map' && /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      margin: '16px 0',
      display: 'flex',
      flexDirection: 'column',
      justifyContent: 'center'
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      gap: 8
    }
  }, (0, _lodash.unionBy)(legendData, 'name').map(function (item) {
    return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
      style: {
        width: 16,
        height: 16,
        borderRadius: '50%',
        background: item.itemStyle.color
      }
    }), /*#__PURE__*/_react["default"].createElement("div", null, item.name));
  })), /*#__PURE__*/_react["default"].createElement(_olMap.Map, {
    tk: "1adbb6e47668cb33757cd799548bf1f4",
    height: 400,
    createdMap: createdMap
  }, !(0, _lodash.isEmpty)(waterPipes) && /*#__PURE__*/_react["default"].createElement(_olMap.FeatureLayer, {
    data: waterPipes,
    id: "RESULT_LINE",
    labelField: "code",
    group: [{
      filter: function filter(v) {
        return v.networkType === 1;
      },
      style: {
        type: 'Polyline',
        style: {
          stroke: {
            color: _config3["default"].gwColorMap[1]
          }
        }
      }
    }, {
      filter: function filter(v) {
        return v.networkType === 2;
      },
      style: {
        type: 'Polyline',
        style: {
          stroke: {
            color: _config3["default"].gwColorMap[2]
          }
        }
      }
    }, {
      filter: function filter(v) {
        return v.networkType === 3;
      },
      style: {
        type: 'Polyline',
        style: {
          stroke: {
            color: _config3["default"].gwColorMap[3]
          }
        }
      }
    }],
    show: true
  }), !(0, _lodash.isEmpty)(deviceList) && /*#__PURE__*/_react["default"].createElement(_olMap.FeatureLayer, {
    data: deviceList,
    id: "RESULT_DEVICE",
    labelField: "name",
    show: true,
    group: [{
      filter: function filter(v) {
        return v.target === -1;
      },
      style: {
        type: 'Point',
        style: {
          stroke: {
            color: colorMap[-1],
            opacity: 1,
            width: 1
          },
          fill: {
            color: colorMap[-1],
            opacity: 1
          },
          radius: 7
        }
      }
    }, {
      filter: function filter(v) {
        return v.target === 0;
      },
      style: {
        type: 'Point',
        style: {
          stroke: {
            color: colorMap[0],
            opacity: 1,
            width: 1
          },
          fill: {
            color: colorMap[0],
            opacity: 1
          },
          radius: 7
        }
      }
    }, {
      filter: function filter(v) {
        return v.target === 1;
      },
      style: {
        type: 'Point',
        style: {
          stroke: {
            color: colorMap[1],
            opacity: 1,
            width: 1
          },
          fill: {
            color: colorMap[1],
            opacity: 1
          },
          radius: 7
        }
      }
    }]
  }))), type === 'chart' && (customSkeleton || /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option,
    style: {
      height: 400
    }
  }))), children, showTitle && /*#__PURE__*/_react["default"].createElement(_ResultTitle["default"], {
    title: '结果诊断',
    question: question
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-content")
  }, result && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-subtitle")
  }, "\u8BCA\u65AD\u7ED3\u679C"), /*#__PURE__*/_react["default"].createElement("div", null, result)), reason ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-subtitle")
  }, /*#__PURE__*/_react["default"].createElement("span", null, reasonTitle), showReport ? wordOrderId && showReportRecord ? /*#__PURE__*/_react["default"].createElement("a", {
    onClick: function onClick() {
      return setDetailVisible(true);
    }
  }, "\u4E0A\u62A5\u8BB0\u5F55") : /*#__PURE__*/_react["default"].createElement("a", {
    onClick: function onClick() {
      setVisible(true);
    }
  }, /*#__PURE__*/_react["default"].createElement(_space["default"], {
    align: "center"
  }, /*#__PURE__*/_react["default"].createElement("img", {
    src: require('./assets/report.svg'),
    width: 16,
    height: 16
  }), "\u4E0A\u62A5")) : null), /*#__PURE__*/_react["default"].createElement("div", null, reason)) : null, measure && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-subtitle")
  }, "\u5904\u7406\u63AA\u65BD"), /*#__PURE__*/_react["default"].createElement("div", null, measure))), wordOrderId && showDisposalResult ? /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      marginTop: 10
    }
  }, /*#__PURE__*/_react["default"].createElement(_ResultTitle["default"], {
    title: '处置结果'
  }), /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      marginTop: 10
    }
  }, /*#__PURE__*/_react["default"].createElement(_DetailItems["default"], {
    items: [{
      label: '处理意见',
      value: caseInfo === null || caseInfo === void 0 ? void 0 : caseInfo.suggestion
    }, {
      label: '附件',
      value: files.length > 0 ? /*#__PURE__*/_react["default"].createElement(_components.VtxUpload, {
        fileList: files,
        viewMode: true,
        listType: "text"
      }) : '-'
    }, {
      label: '处理人',
      value: caseInfo === null || caseInfo === void 0 ? void 0 : caseInfo.operateMan
    }, {
      label: '处理时间',
      value: caseInfo === null || caseInfo === void 0 ? void 0 : caseInfo.caseTime
    }]
  }))) : null, showReport && /*#__PURE__*/_react["default"].createElement(_EventReportModal["default"], {
    visible: visible,
    onCancel: onCancel,
    info: _objectSpread(_objectSpread({}, info), {}, {
      caseDesc: (0, _lodash.isString)(reason) ? reason : reasonStr
    }),
    theme: theme
  }), showReport && /*#__PURE__*/_react["default"].createElement(_EventDetailModal["default"], {
    visible: detailVisible,
    onCancel: function onCancel() {
      setDetailVisible(false);
    },
    id: wordOrderId,
    theme: theme
  }));
};
ResultDiagnosis.propTypes = {
  result: _propTypes["default"].string,
  reason: _propTypes["default"].string,
  measure: _propTypes["default"].string,
  skeletonNodes: _propTypes["default"].array,
  reasonTitle: _propTypes["default"].string,
  showReport: _propTypes["default"].bool,
  question: _propTypes["default"].element,
  info: _propTypes["default"].object
};
var _default = exports["default"] = ResultDiagnosis;
//# sourceMappingURL=index.js.map
