"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"));
var _MapLayer = _interopRequireDefault(require("../_component/MapLayer"));
var _ResultTitle = _interopRequireDefault(require("../_component/ResultTitle"));
var _config = require("./config");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 结果
 * @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(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_CustomModal["default"], {
    title: /*#__PURE__*/_react["default"].createElement(_ResultTitle["default"], {
      title: '最短路径分析',
      noline: true,
      question: /*#__PURE__*/_react["default"].createElement("span", null, "\u901A\u8FC7\u9009\u62E9\u5DF2\u8FDE\u901A\u7BA1\u70B9\u7684\u8D77\u70B9\u7EC8\u70B9\uFF0C\u5E73\u53F0\u5206\u6790\u51FA\u8BE5\u6761\u4EF6\u4E0B\u6700\u77ED\u8DEF\u5F84\u7684\u7BA1\u7EBF\u60C5\u51B5", ' ')
    }),
    map: map,
    onCancel: function onCancel() {
      setVisible(false);
    },
    visible: visible
  }, /*#__PURE__*/_react["default"].createElement(_MyTabs["default"], {
    tabsList: getItems()
  })), /*#__PURE__*/_react["default"].createElement(_MapLayer["default"], {
    emptyConfigData: Object.keys(_config.InfiltrationType).map(function (key) {
      return {
        name: _config.InfiltrationTypeName[_config.InfiltrationType[key]],
        key: "INFILTRATION_GW_".concat(_config.InfiltrationType[key]),
        color: _config.InfiltrationTypeColor[_config.InfiltrationType[key]],
        icon: _config.InfiltrationTypeIcon[_config.InfiltrationType[key]],
        filter: function filter(f) {
          return f.infiltrationType === _config.InfiltrationType[key];
        }
      };
    })
  }));
};
var _default = exports["default"] = Result;
//# sourceMappingURL=Result.js.map
