"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 _Table = _interopRequireDefault(require("../_component/Table"));
var _CustomModal = _interopRequireDefault(require("../_component/CustomModal"));
var _Export = _interopRequireDefault(require("../_component/Export"));
var _service = _interopRequireDefault(require("../_mapUtil/service"));
var _config = _interopRequireDefault(require("../_mapUtil/config"));
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,
    analysisLayer = _useProps.analysisLayer;
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_CustomModal["default"], {
    title: "\u8BBE\u65BD\u641C\u7D22",
    map: map,
    onCancel: function onCancel() {
      try {
        map.hideTemplate();
      } catch (err) {}
      setVisible(false);
    },
    visible: visible
  }, /*#__PURE__*/_react["default"].createElement(_Export["default"], {
    url: activeKey !== null && activeKey !== void 0 && activeKey.toUpperCase().includes('LINE') ? "".concat(_config["default"].publicUrlJCSS, "/api/line/exportExcel") : "".concat(_config["default"].publicUrlJCSS, "/api/point/exportExcel"),
    method: "POST",
    params: {
      codes: _service["default"].getField(tableData, 'code'),
      exportType: 2
    }
  }), /*#__PURE__*/_react["default"].createElement(_Table["default"], {
    columns: [{
      title: '编码',
      dataIndex: ['values_', 'code'],
      width: 100,
      render: function render(text) {
        return /*#__PURE__*/_react["default"].createElement("a", {
          onClick: function onClick() {
            analysisLayer.setCenterByCode(text);
            analysisLayer.selectFeature && map.showTemplate(analysisLayer.selectFeature);
          }
        }, text);
      }
    }],
    loading: loading,
    dataSource: tableData
  })));
};
var _default = exports["default"] = Result;
//# sourceMappingURL=Result.js.map
