"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 _Table = _interopRequireDefault(require("../_component/Table"));
var _MyTabs = _interopRequireDefault(require("../_component/MyTabs"));
var _service = _interopRequireDefault(require("../_mapUtil/service"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
 * 结果
 * @description: 用于展示分析结果列表、结果图层等
 */

var Result = function Result() {
  var _useProps = (0, _useProps2["default"])(),
    map = _useProps.map,
    visible = _useProps.visible,
    setVisible = _useProps.setVisible,
    loading = _useProps.loading,
    tableData = _useProps.tableData,
    activeKey = _useProps.activeKey,
    highLayer = _useProps.highLayer;
  var _onClick = function onClick(code) {
    _service["default"].setFieldListClick({
      record: {
        code: code
      },
      map: map,
      activeKey: activeKey,
      highLayer: highLayer
    });
  };
  var columns = [{
    title: '编号/名称',
    dataIndex: 'code',
    render: function render(code, record) {
      return /*#__PURE__*/_react["default"].createElement("a", {
        onClick: function onClick() {
          _onClick(code);
        }
      }, code);
    }
  }, {
    title: '类别',
    dataIndex: 'category',
    width: 80
  }, {
    title: '类型',
    dataIndex: 'lineType',
    width: 80,
    render: function render(text) {
      return /*#__PURE__*/_react["default"].createElement("span", null, text === 1 ? '污水' : '供水');
    }
  }];
  /**
   * @description: 获取表格数据
   * @return {*}
   */
  var getItems = function getItems() {
    var items = [];
    var lineData = [],
      pointData = [];
    tableData === null || tableData === void 0 || tableData.map(function (v) {
      if ((v === null || v === void 0 ? void 0 : v.category) === '管点') {
        pointData.push(v);
      } else if ((v === null || v === void 0 ? void 0 : v.category) === '管线') {
        lineData.push(v);
      }
    });
    items = [{
      label: '管线',
      key: 'line',
      children: /*#__PURE__*/_react["default"].createElement(_Table["default"], {
        rowKey: "code",
        columns: columns || [],
        dataSource: lineData,
        loading: loading,
        scroll: {
          y: map.getViewport().clientHeight - 100,
          x: 200
        }
      })
    }];
    return items;
  };
  return /*#__PURE__*/_react["default"].createElement(_CustomModal["default"], {
    title: "\u6700\u77ED\u8DEF\u5F84\u5206\u6790",
    map: map,
    onCancel: function onCancel() {
      setVisible(false);
    },
    visible: visible
  }, /*#__PURE__*/_react["default"].createElement(_MyTabs["default"], {
    tabsList: getItems()
  }));
};
var _default = exports["default"] = Result;
//# sourceMappingURL=Result.js.map
