"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 _vtxModal = _interopRequireDefault(require("@vtx/components/lib/vtx-modal"));
var _space = _interopRequireDefault(require("antd/lib/space"));
var _select = _interopRequireDefault(require("antd/lib/select"));
var _button = _interopRequireDefault(require("antd/lib/button"));
var _col = _interopRequireDefault(require("antd/lib/col"));
var _row = _interopRequireDefault(require("antd/lib/row"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireWildcard(require("react"));
var _GwDetail = _interopRequireDefault(require("../_component/GwDetail"));
var _AnalysisDetailWrap = _interopRequireDefault(require("../_component/AnalysisDetailWrap"));
var _config = require("./config");
var echarts = _interopRequireWildcard(require("echarts"));
var _useGetDeviceData2 = _interopRequireDefault(require("../_mapUtil/useGetDeviceData"));
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
var _moment = _interopRequireDefault(require("moment"));
var _ahooks = require("ahooks");
var _service = require("./service");
var _lodash = _interopRequireWildcard(require("lodash"));
var _StreamInfoWrap = _interopRequireDefault(require("../_component/StreamInfoWrap"));
var _ResultDiagnosis = _interopRequireDefault(require("../_component/ResultDiagnosis"));
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 && Object.prototype.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(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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 _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(arr) { if (Array.isArray(arr)) return arr; }
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(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(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(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; }
// eslint-disable-next-line react/prop-types
var DeviceMonitor = function DeviceMonitor(_ref) {
  var _data$find, _data$find2;
  var deviceFacilityId = _ref.deviceFacilityId,
    _ref$rainItem = _ref.rainItem,
    rainItem = _ref$rainItem === void 0 ? {} : _ref$rainItem,
    influenceHour = _ref.influenceHour;
  var startDate = (0, _react.useMemo)(function () {
    return (0, _moment["default"])(rainItem === null || rainItem === void 0 ? void 0 : rainItem.startDate).subtract(influenceHour, 'h').startOf().valueOf();
  }, [influenceHour, rainItem === null || rainItem === void 0 ? void 0 : rainItem.startDate]);
  var endDate = (0, _react.useMemo)(function () {
    return (0, _moment["default"])(rainItem === null || rainItem === void 0 ? void 0 : rainItem.endDate).add(1 + influenceHour, 'h').startOf().valueOf();
  }, [influenceHour, rainItem === null || rainItem === void 0 ? void 0 : rainItem.endDate]);
  var _useGetDeviceData = (0, _useGetDeviceData2["default"])({
      monitorItemCodes: 'w_liquid_level,w_flow_now',
      facilityId: deviceFacilityId,
      startTime: startDate,
      endTime: endDate
    }),
    _useGetDeviceData$dat = _useGetDeviceData.data,
    data = _useGetDeviceData$dat === void 0 ? [] : _useGetDeviceData$dat;
  var _useRequest = (0, _ahooks.useRequest)(function () {
      return (0, _service.getEchartsRainData)({
        facilityId: deviceFacilityId,
        startDate: (0, _moment["default"])(startDate).format('YYYY-MM-DD HH:mm:ss'),
        endDate: (0, _moment["default"])(endDate).format('YYYY-MM-DD HH:mm:ss')
      });
    }, {
      refreshDeps: [deviceFacilityId, startDate, endDate]
    }),
    _useRequest$data = _useRequest.data,
    rainData = _useRequest$data === void 0 ? [] : _useRequest$data;
  var ywData = ((_data$find = data.find(function (item) {
    return item.monitorItemCode === 'w_liquid_level';
  })) === null || _data$find === void 0 ? void 0 : _data$find.values) || [];
  var ywDataObj = _lodash["default"].keyBy(ywData, 'x');
  var lsData = ((_data$find2 = data.find(function (item) {
    return item.monitorItemCode === 'w_flow_now';
  })) === null || _data$find2 === void 0 ? void 0 : _data$find2.values) || [];
  var lsDataObj = _lodash["default"].keyBy(lsData, 'x');
  var rainXData = [];
  var rainDataObj = {};
  rainData.forEach(function (item) {
    rainXData.push.apply(rainXData, _toConsumableArray(Object.keys(item)));
    Object.assign(rainDataObj, item);
  });
  var ywXData = _lodash["default"].map(ywData, 'x');
  var lsXData = _lodash["default"].map(lsData, 'x');
  var xData = _lodash["default"].union(rainXData, ywXData, lsXData).sort();
  var ywYData = [];
  var lsYData = [];
  var rainYData = [];
  xData.forEach(function (x) {
    var _ywDataObj$x, _lsDataObj$x;
    ywYData.push(((_ywDataObj$x = ywDataObj[x]) === null || _ywDataObj$x === void 0 ? void 0 : _ywDataObj$x.yformat) || 0);
    lsYData.push(((_lsDataObj$x = lsDataObj[x]) === null || _lsDataObj$x === void 0 ? void 0 : _lsDataObj$x.yformat) || 0);
    rainYData.push(rainDataObj[x] || 0);
  });
  var option = {
    grid: {
      top: '20%',
      left: '10%',
      right: '5%',
      bottom: '20%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      left: 'center',
      top: 30,
      itemWidth: 18,
      itemHeight: 6,
      itemGap: 32,
      textStyle: {
        color: '#222',
        fontSize: 14
      },
      data: ['液位', '流量', '雨量']
    },
    xAxis: {
      type: 'category',
      data: xData.map(function (x) {
        return (0, _moment["default"])(x).format('MM-DD HH:mm');
      }),
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        show: true,
        textStyle: {
          fontSize: 12,
          color: 'rgba(0, 0, 0, 0.6)' //X轴文字颜色
        },
        formatter: function formatter(value) {
          return value.replace(' ', '\n');
        }
      }
    },
    yAxis: ['液位（m）', '流量（m³/h）', '雨量(mm)'].map(function (key) {
      return {
        type: 'value',
        name: key,
        position: ['液位（m）', '流量（m³/h）'].includes(key) ? 'left' : 'right',
        offset: key === '液位（m）' ? 70 : key === '流量（m³/h）' ? 0 : 0,
        nameTextStyle: {
          color: 'rgba(0, 0, 0, 0.6)',
          fontSize: 12
        },
        inverse: key === '雨量(mm)',
        nameLocation: key === '雨量(mm)' ? 'start' : 'end',
        axisLine: {
          show: false
        },
        axisTick: {
          show: false
        },
        axisLabel: {
          color: 'rgba(0, 0, 0, 0.6)',
          fontSize: 14
        },
        splitLine: {
          show: true,
          lineStyle: {
            color: 'rgba(0, 0, 0, 0.2)',
            type: 'dashed'
          }
        }
      };
    }),
    dataZoom: [{}],
    series: _toConsumableArray(['液位', '流量', '雨量'].map(function (name, index) {
      var color = '#00DC77';
      var areaColor = 'rgba(0, 220, 119, 0.7)';
      var areaColor1 = 'rgba(0, 220, 119, 0)';
      var newData = ywYData;
      if (name === '流量') {
        color = '#FF8D2C';
        areaColor = 'rgba(255, 141, 44, 0.7)';
        areaColor1 = 'rgba(255, 141, 44, 0)';
        newData = lsYData;
      } else if (name === '雨量') {
        color = '#0E9CFF';
        areaColor = 'rgba(14, 156, 255, 0.7)';
        areaColor1 = 'rgba(14, 156, 255, 0)';
        newData = rainYData;
      }
      return {
        yAxisIndex: index,
        name: name,
        type: 'line',
        smooth: true,
        symbol: 'circle',
        //标记的图形为实心圆
        symbolSize: 6,
        //标记的大小
        itemStyle: {
          //折线拐点标志的样式
          color: 'white',
          borderWidth: '1',
          borderColor: color
        },
        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          // 折线点的阴影
          {
            offset: 0,
            color: areaColor1
          }, {
            offset: 1,
            color: areaColor
          }])
        },
        lineStyle: {
          color: color
        },
        data: newData
      };
    }))
  };
  return /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    style: {
      width: '100%',
      height: 280
    },
    option: option
  });
};

// eslint-disable-next-line react/prop-types
var Analysis = function Analysis(_ref2) {
  var _ref2$info = _ref2.info,
    info = _ref2$info === void 0 ? {} : _ref2$info,
    _ref2$historyRain = _ref2.historyRain,
    historyRain = _ref2$historyRain === void 0 ? [] : _ref2$historyRain,
    rainId = _ref2.rainId,
    setRainId = _ref2.setRainId,
    rainItem = _ref2.rainItem;
  var infiltrationType = info.infiltrationType,
    roadName = info.roadName,
    lineNo = info.lineNo,
    result = info.result,
    influenceHour = info.influenceHour,
    id = info.facility.id;
  var _ref3 = (result === null || result === void 0 ? void 0 : result.config) || {},
    infiltrationFlowThreshold = _ref3.infiltrationFlowThreshold,
    infiltrationWaterLevelThreshold = _ref3.infiltrationWaterLevelThreshold;
  var _useRequest2 = (0, _ahooks.useRequest)(function () {
      return (0, _service.getDataByRain)({
        facilityId: id,
        rainId: rainId
      });
    }, {
      refreshDeps: [id, rainId]
    }),
    _useRequest2$data = _useRequest2.data,
    data = _useRequest2$data === void 0 ? {} : _useRequest2$data;
  var sunnyAvgFlow = data.sunnyAvgFlow,
    sunnyAvgWaterLevel = data.sunnyAvgWaterLevel,
    rainyAvgFlow = data.rainyAvgFlow,
    rainyAvgWaterLevel = data.rainyAvgWaterLevel,
    flowRatio = data.flowRatio,
    waterLevelRatio = data.waterLevelRatio;
  var list = [{
    label: '晴天平均液位',
    value: sunnyAvgWaterLevel,
    unit: 'm',
    img: require('./assets/sunny.png')
  }, {
    label: '雨天平均液位',
    value: rainyAvgWaterLevel,
    img: require('./assets/rain.png'),
    unit: 'm',
    bgColor: '#E5F6FA'
  }, {
    label: '比值',
    value: waterLevelRatio,
    img: require('./assets/ratio.png'),
    bgColor: '#E4F4FF',
    isError: waterLevelRatio && infiltrationType !== _config.InfiltrationType.ZC ? waterLevelRatio > infiltrationWaterLevelThreshold : false
  }, {
    label: '晴天平均流量',
    value: sunnyAvgFlow,
    img: require('./assets/sunny.png'),
    unit: 'm³/h'
  }, {
    label: '雨天平均流量',
    value: rainyAvgFlow,
    img: require('./assets/rain.png'),
    bgColor: '#E5F6FA',
    unit: 'm³/h'
  }, {
    label: '比值',
    value: flowRatio,
    img: require('./assets/ratio.png'),
    bgColor: '#E4F4FF',
    isError: flowRatio && infiltrationType !== _config.InfiltrationType.ZC ? flowRatio > infiltrationFlowThreshold : false
  }];
  return /*#__PURE__*/_react["default"].createElement(_AnalysisDetailWrap["default"], {
    roadName: roadName,
    lineNo: lineNo,
    header: '入流入渗分析',
    extra: /*#__PURE__*/_react["default"].createElement(_select["default"], {
      size: "small",
      style: {
        width: 200
      },
      value: rainId,
      onChange: function onChange(e) {
        return setRainId(e);
      },
      onClick: function onClick(e) {
        return e.stopPropagation();
      },
      dropdownMatchSelectWidth: false
    }, historyRain.map(function (_ref4) {
      var id = _ref4.id,
        durationHour = _ref4.durationHour,
        hourMaxRain = _ref4.hourMaxRain,
        startDate = _ref4.startDate;
      return /*#__PURE__*/_react["default"].createElement(_select["default"].Option, {
        key: id
      }, "".concat((0, _moment["default"])(startDate).format('YYYY-MM-DD'), " \u964D\u96E8").concat(durationHour, "\u5C0F\u65F6 \u6700\u5927\u5C0F\u65F6\u96E8\u91CF").concat(hourMaxRain, "mm"));
    }))
  }, /*#__PURE__*/_react["default"].createElement(_row["default"], {
    gutter: [20, 10]
  }, list.map(function (_ref5, index) {
    var label = _ref5.label,
      value = _ref5.value,
      img = _ref5.img,
      bgColor = _ref5.bgColor,
      unit = _ref5.unit,
      isError = _ref5.isError;
    return /*#__PURE__*/_react["default"].createElement(_col["default"], {
      key: index,
      span: 8
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "ol-map-analysis-infiltration-modal-analysis-item",
      style: {
        background: bgColor
      }
    }, /*#__PURE__*/_react["default"].createElement(_space["default"], {
      align: "center"
    }, /*#__PURE__*/_react["default"].createElement("img", {
      src: img,
      width: 20,
      height: 20
    }), label), value ? /*#__PURE__*/_react["default"].createElement("span", {
      style: {
        color: isError ? '#FF1C1C' : ''
      }
    }, "".concat(value).concat(unit || '')) : '-'));
  })), /*#__PURE__*/_react["default"].createElement(DeviceMonitor, {
    deviceFacilityId: info.deviceFacilityId,
    rainItem: rainItem,
    influenceHour: influenceHour
  }));
};
var DetailModal = function DetailModal(_ref6) {
  var _info$facility;
  var visible = _ref6.visible,
    info = _ref6.info,
    onCancel = _ref6.onCancel,
    historyRain = _ref6.historyRain,
    defaultRainId = _ref6.defaultRainId;
  var _info$result = info.result,
    result = _info$result === void 0 ? {} : _info$result,
    infiltrationType = info.infiltrationType,
    startDate = info.startDate,
    endDate = info.endDate,
    lineNo = info.lineNo,
    roadName = info.roadName,
    flowRatio = info.flowRatio,
    waterLevelRatio = info.waterLevelRatio,
    influenceHour = info.influenceHour;
  var upstreamItems = result.upstreamItems,
    downstreamItems = result.downstreamItems,
    _result$config = result.config,
    config = _result$config === void 0 ? {} : _result$config,
    skeletonNodes = result.skeletonNodes,
    targetItem = result.targetItem;
  var infiltrationHandleMeasure = config.infiltrationHandleMeasure,
    brokenHandleMeasure = config.brokenHandleMeasure,
    infiltrationFlowThreshold = config.infiltrationFlowThreshold,
    infiltrationWaterLevelThreshold = config.infiltrationWaterLevelThreshold,
    brokenFlowThreshold = config.brokenFlowThreshold,
    brokenWaterLevelThreshold = config.brokenWaterLevelThreshold;
  var measureConfig = _defineProperty(_defineProperty({}, _config.InfiltrationType.PSGD, infiltrationHandleMeasure), _config.InfiltrationType.RLRS, brokenHandleMeasure);
  var _startDate = (0, _moment["default"])(startDate).format('YYYY-MM-DD HH:mm:ss');
  var _endDate = (0, _moment["default"])(endDate).format('YYYY-MM-DD HH:mm:ss');
  var reason = (0, _react.useMemo)(function () {
    var reason = '';
    if ([_config.InfiltrationType.PSGD, _config.InfiltrationType.RLRS].includes(infiltrationType)) {
      var getReason = function getReason(_ref7) {
        var flowRatio = _ref7.flowRatio,
          waterLevelRatio = _ref7.waterLevelRatio;
        var strList = [];
        if (flowRatio > infiltrationFlowThreshold) {
          var str = "\u96E8\u5929\u6D41\u91CF\u8F83\u6674\u5929".concat(flowRatio > brokenFlowThreshold ? '大幅度上升' : '小幅度上升');
          strList.push(str);
        }
        if (waterLevelRatio > infiltrationWaterLevelThreshold) {
          var _str = "\u96E8\u5929\u6DB2\u4F4D\u8F83\u6674\u5929".concat(waterLevelRatio > brokenWaterLevelThreshold ? '大幅度上升' : '小幅度上升');
          strList.push(_str);
        }
        return strList.join(',');
      };
      if ((0, _lodash.isEmpty)(upstreamItems) && (0, _lodash.isEmpty)(downstreamItems)) {
        reason = "".concat(_startDate, "\u81F3").concat(_endDate, "\u671F\u95F4\uFF0C").concat(getReason({
          flowRatio: flowRatio,
          waterLevelRatio: waterLevelRatio
        }), "\uFF0C\u6545").concat(roadName || '', " ").concat(lineNo, " \u53EF\u80FD\u5B58\u5728").concat(_config.InfiltrationTypeName[infiltrationType], "\u98CE\u9669");
      } else {
        var getText = function getText(_ref8) {
          var lineNo = _ref8.lineNo,
            flowRatio = _ref8.flowRatio,
            waterLevelRatio = _ref8.waterLevelRatio,
            roadName = _ref8.roadName;
          return "".concat(roadName || '', " ").concat(lineNo, "\u5728").concat(_startDate, "\u81F3").concat(_endDate, "\u671F\u95F4\uFF0C").concat(getReason({
            flowRatio: flowRatio,
            waterLevelRatio: waterLevelRatio
          }));
        };
        reason = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", null, "1\u3001", getText({
          lineNo: lineNo,
          flowRatio: flowRatio,
          infiltrationType: infiltrationType,
          roadName: roadName,
          waterLevelRatio: waterLevelRatio
        })), [].concat(_toConsumableArray((upstreamItems || []).map(function (item) {
          return _objectSpread(_objectSpread({}, item), {}, {
            isUp: true
          });
        })), _toConsumableArray((downstreamItems || []).map(function (item) {
          return _objectSpread(_objectSpread({}, item), {}, {
            isUp: false
          });
        }))).filter(function (_ref9) {
          var infiltrationType = _ref9.infiltrationType;
          return infiltrationType !== _config.InfiltrationType.ZC;
        }).map(function (_ref10, index) {
          var lineNo = _ref10.lineNo,
            flowRatio = _ref10.flowRatio,
            infiltrationType = _ref10.infiltrationType,
            facilityId = _ref10.facilityId,
            isUp = _ref10.isUp,
            waterLevelRatio = _ref10.waterLevelRatio,
            roadName = _ref10.roadName;
          return /*#__PURE__*/_react["default"].createElement("div", {
            key: facilityId
          }, "".concat(index + 2, "\u3001").concat(isUp ? '上游节点' : '下游节点', "\uFF1A").concat(getText({
            lineNo: lineNo,
            flowRatio: flowRatio,
            infiltrationType: infiltrationType,
            waterLevelRatio: waterLevelRatio,
            roadName: roadName
          })));
        }), /*#__PURE__*/_react["default"].createElement("div", null, "\u6545".concat((targetItem === null || targetItem === void 0 ? void 0 : targetItem.roadName) || '', " ").concat(targetItem === null || targetItem === void 0 ? void 0 : targetItem.lineNo, "\u7BA1\u6BB5\u53EF\u80FD\u5B58\u5728").concat(_config.InfiltrationTypeName[infiltrationType], "\u98CE\u9669\u3002")));
      }
    }
    return reason;
  }, []);
  var _useState = (0, _react.useState)(defaultRainId),
    _useState2 = _slicedToArray(_useState, 2),
    rainId = _useState2[0],
    setRainId = _useState2[1];
  var rainItem = (0, _react.useMemo)(function () {
    return _lodash["default"].find(historyRain, {
      id: rainId
    });
  }, [rainId, historyRain]);
  return /*#__PURE__*/_react["default"].createElement(_vtxModal["default"], {
    title: /*#__PURE__*/_react["default"].createElement(_vtxModal["default"].Title, {
      text: "\u5165\u6D41\u5165\u6E17\u5206\u6790 >",
      subtitle: "\u8BE6\u60C5"
    }),
    width: 1366,
    footer: /*#__PURE__*/_react["default"].createElement(_button["default"], {
      onClick: onCancel
    }, "\u5173\u95ED"),
    visible: visible,
    onCancel: onCancel
  }, /*#__PURE__*/_react["default"].createElement(_row["default"], {
    gutter: [24, 0]
  }, /*#__PURE__*/_react["default"].createElement(_col["default"], {
    span: 16
  }, /*#__PURE__*/_react["default"].createElement(_GwDetail["default"], {
    id: info === null || info === void 0 || (_info$facility = info.facility) === null || _info$facility === void 0 ? void 0 : _info$facility.id
  }), /*#__PURE__*/_react["default"].createElement(Analysis, {
    info: info,
    historyRain: historyRain,
    rainId: rainId,
    setRainId: setRainId,
    rainItem: rainItem
  }), (0, _lodash.isEmpty)(upstreamItems) ? null : upstreamItems.map(function (_ref11) {
    var deviceFacilityId = _ref11.deviceFacilityId,
      lineNo = _ref11.lineNo,
      infiltrationType = _ref11.infiltrationType;
    return /*#__PURE__*/_react["default"].createElement(_StreamInfoWrap["default"], {
      isUp: true,
      key: deviceFacilityId,
      lineNo: lineNo,
      isError: infiltrationType !== _config.InfiltrationType.ZC
    }, /*#__PURE__*/_react["default"].createElement(DeviceMonitor, {
      deviceFacilityId: deviceFacilityId,
      rainItem: rainItem,
      influenceHour: influenceHour
    }));
  }), (0, _lodash.isEmpty)(downstreamItems) ? null : downstreamItems.map(function (_ref12) {
    var deviceFacilityId = _ref12.deviceFacilityId,
      lineNo = _ref12.lineNo,
      infiltrationType = _ref12.infiltrationType;
    return /*#__PURE__*/_react["default"].createElement(_StreamInfoWrap["default"], {
      isUp: false,
      key: deviceFacilityId,
      lineNo: lineNo,
      isError: infiltrationType !== _config.InfiltrationType.ZC
    }, /*#__PURE__*/_react["default"].createElement(DeviceMonitor, {
      deviceFacilityId: deviceFacilityId,
      rainItem: rainItem,
      influenceHour: influenceHour
    }));
  })), /*#__PURE__*/_react["default"].createElement(_col["default"], {
    span: 8
  }, /*#__PURE__*/_react["default"].createElement(_ResultDiagnosis["default"], {
    result: infiltrationType === _config.InfiltrationType.ZC ? "".concat(_startDate, "\u81F3").concat(_endDate, "\u671F\u95F4\uFF0C\u96E8\u5929\u6DB2\u4F4D\u3001\u6D41\u91CF\u5747\u4F4D\u4E8E\u6B63\u5E38\u533A\u95F4\uFF0C\u6545\u8BE5\u7BA1\u6BB5\u6B63\u5E38") : '',
    reason: reason,
    measure: measureConfig[infiltrationType],
    skeletonNodes: skeletonNodes
  }))));
};
DetailModal.propTypes = {
  visible: _propTypes["default"].bool,
  info: _propTypes["default"].object,
  onCancel: _propTypes["default"].func,
  historyRain: _propTypes["default"].array,
  defaultRainId: _propTypes["default"].string
};
var _default = exports["default"] = DetailModal;
//# sourceMappingURL=DetailModal.js.map
