月球大数据地理空间分析展示平台-【前端】-月球2期前端
surprise
2023-10-23 538d7313f98da3c304365f1c2b22c3e23d91db35
src/views/search/search.vue
@@ -4,7 +4,7 @@
      <el-input
        v-model="searchValue"
        class="searchInput"
        placeholder="请输入地名"
        placeholder="请输入地名或经纬度"
      >
        <template #suffix>
          <el-icon
@@ -115,6 +115,7 @@
// import config from "../../../public/config/config.js";
import { dataQuery_selectByPage } from "@/api/api.js";
import { ElMessage } from "element-plus";
import menuTool from "@/assets/js/Map/menuTool";
let searchValue = ref("");
const searchFLag = ref(false);
const tableData = ref([]);
@@ -129,25 +130,26 @@
const NumhandleChange = (value: number) => {};
const handleChange = (val: string[]) => {};
const setPoitCannel = () => {
  if (imageLabel) {
    imageLabel.deleteObject();
    imageLabel = null;
  }
  // if (imageLabel) {
  // imageLabel.deleteObject();
  // imageLabel = null;
  // }
  menuTool.setClearLocation("地名定位");
};
const setPointLocal = (res) => {
  if (imageLabel) {
    setPoitCannel();
  }
  setPoitCannel();
  var position = { X: res.lon, Y: res.lat, Altitude: 10 };
  imageLabel = window.sgworld.Creator.CreateImageLabel(
    position,
    config.StaticFileBaseUrl + "/Workers/image/location.png",
    {},
    0,
    "标签点"
  );
  var id = imageLabel.item.id;
  window.sgworld.Navigate.flyToObj(imageLabel.item);
  menuTool.setLocationPoint([res.lon, res.lat], "地名定位");
  // imageLabel = window.sgworld.Creator.CreateImageLabel(
  //   position,
  //   config.StaticFileBaseUrl + "/Workers/image/location.png",
  //   {},
  //   0,
  //   "标签点"
  // );
  // var id = imageLabel.item.id;
  // window.sgworld.Navigate.flyToObj(imageLabel.item);
  // window.earthCtrl.camera.flyTo(res.log, res.lat, 300, 9.5, -45, 0.0, 5);
};
const setInputCahgne = () => {
@@ -192,25 +194,40 @@
  searchValue.value = "";
  setPoitCannel();
  menuTool.setLocalPositionClose();
};
const setSearchClick = async () => {
  if (!searchValue.value) return;
  if (searchValue.value.indexOf(",") > -1) {
    var coord = searchValue.value.split(",");
  var obj = {
    filter: "name like '" + searchValue.value + "'",
    pageIndex: listData.value.pageIndex,
    pageSize: listData.value.pageSize,
    name: "lunarplacename",
    hasGeom: 1,
  };
  const data = await dataQuery_selectByPage(obj);
  if (data.code != 200) {
    return ElMessage(data.msg);
    var ruleForm = {
      lon: coord[0],
      lat: coord[1],
      alt: coord[2],
    };
    menuTool.setLocalPosition(ruleForm);
  } else {
    var obj = {
      filter:
        "name like '" +
        searchValue.value +
        "' or enName like " +
        searchValue.value,
      pageIndex: listData.value.pageIndex,
      pageSize: listData.value.pageSize,
      name: "lunarplacename",
      hasGeom: 1,
    };
    const data = await dataQuery_selectByPage(obj);
    if (data.code != 200) {
      return ElMessage(data.msg);
    }
    tableData.value = data.result;
    listData.value.count = data.count;
    listData.value.page = Math.ceil(data.count / 10);
    searchFLag.value = true;
  }
  tableData.value = data.result;
  listData.value.count = data.count;
  listData.value.page = Math.ceil(data.count / 10);
  searchFLag.value = true;
};
onMounted(() => {});
@@ -221,7 +238,7 @@
  // height: auto;
  position: absolute;
  top: 0;
  right: -270px;
  right: -255px;
  z-index: 101;
}
.searchInput {