"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _useProps2 = _interopRequireDefault(require("@vtx/ol-map/lib/use-props"));
var _CustomModal = _interopRequireDefault(require("../_component/CustomModal"));
var _Total = _interopRequireDefault(require("../_component/Total"));
var _Table = _interopRequireDefault(require("../_component/Table"));
var _service = _interopRequireDefault(require("../_mapUtil/service"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 结果
 * @description: 用于展示分析结果列表、结果图层等
 */

var Result = function Result() {
  var _useProps = (0, _useProps2["default"])(),
    map = _useProps.map,
    highLayer = _useProps.highLayer,
    loading = _useProps.loading,
    data = _useProps.data,
    dataSource = _useProps.dataSource,
    visible = _useProps.visible,
    setVisible = _useProps.setVisible;
  /**
   * @description: feature居中，气泡框打开
   * @param {*} code
   * @return {*}
   */
  var _onClick = function onClick(record) {
    _service["default"].setFieldListClick({
      record: {
        code: record.code
      },
      map: map,
      activeKey: record.values_.key,
      highLayer: highLayer
    });
  };
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_CustomModal["default"], {
    title: "\u4EA4\u53C9\u53E3\u67E5\u8BE2",
    map: map,
    onCancel: function onCancel() {
      var _highLayer$current;
      try {
        map.hideTemplate();
      } catch (err) {}
      highLayer === null || highLayer === void 0 || (_highLayer$current = highLayer.current) === null || _highLayer$current === void 0 || _highLayer$current.clearFeatures();
      setVisible(false);
    },
    visible: visible
  }, /*#__PURE__*/_react["default"].createElement(_Total["default"], {
    options: [{
      label: '交叉数',
      value: data.total || 0,
      unit: '个'
    }, {
      label: '管线数量',
      value: data.lineTotal || 0,
      unit: '条'
    }, {
      label: '管线总长',
      value: data.line_length || 0,
      unit: 'm'
    }]
  }), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
    indexColumn: false,
    columns: [{
      title: '序号',
      dataIndex: 'num',
      width: 50,
      onCell: function onCell(r) {
        return {
          rowSpan: r.lineTotal
        };
      }
    }, {
      title: '管线数量',
      dataIndex: 'lineTotal',
      width: 80,
      onCell: function onCell(r) {
        return {
          rowSpan: r.lineTotal
        };
      },
      align: 'right'
    }, {
      title: '管线总长(m)',
      dataIndex: 'lineLength',
      width: 100,
      onCell: function onCell(r) {
        return {
          rowSpan: r.lineTotal
        };
      },
      render: function render(text) {
        return /*#__PURE__*/_react["default"].createElement("div", null, Number(text).toFixed(2));
      },
      align: 'right'
    }, {
      title: '管线编码',
      dataIndex: 'code',
      width: 80,
      render: function render(text, record) {
        return /*#__PURE__*/_react["default"].createElement("a", {
          onClick: function onClick() {
            _onClick(record);
          }
        }, text);
      }
    }, {
      title: '管线类型',
      dataIndex: 'label',
      width: 80
    }],
    dataSource: dataSource,
    loading: loading
  })));
};
var _default = exports["default"] = Result;
//# sourceMappingURL=Result.js.map
