月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-09-11 48a6eb2109a41f8e10d5a2b67ea17899d3ef3586
src/views/plotting/plotting.vue
@@ -37,6 +37,7 @@
          class="plotting_list_tr"
          v-for="(item, i) in list"
          :key="i"
          @click.stop="resultShow(item)"
        >
          <div class="plotting_list_tr_name">
            <img
@@ -48,11 +49,11 @@
          <div class="plotting_list_tr_btn">
            <div
              class="tr_btn dw"
              @click="setLayerLocation(item)"
              @click.stop="setLayerLocation(item)"
            ></div>
            <div
              class="tr_btn sc"
              @click="setLayerRemove(item)"
              @click.stop="setLayerRemove(item)"
            ></div>
          </div>
        </div>
@@ -70,8 +71,11 @@
  reactive,
  defineProps,
  defineEmits,
  watch,
} from "vue";
import { useStore } from "vuex"; // 引入useStore 方法
const emits = defineEmits(["setCloseplotting"]);
const store = useStore(); // 该方法用于返回store 实例
let list = ref([]);
const drawFlag = ref(null);
const plotNum = ref({
@@ -98,6 +102,12 @@
    if (entities[i].name == res.name) {
      Viewer.entities.remove(entities[i]);
      list.value.splice(i, 1);
      let obj = {
        isshow: false,
        entitiesData: {},
        getData: {},
      };
      store.state.plottingInquireData = obj;
      break;
    }
  }
@@ -217,6 +227,34 @@
const setCloseplotting = () => {
  emits("setCloseplotting", false);
};
const resultShow = (res) => {
  console.log(res);
  let obj = {
    isshow: true,
    entitiesData: res,
    getData: {},
  };
  // store.commit("SET_plotting", obj);
  store.state.plottingInquireData = obj;
};
watch(
  () => store.state.plottingInquireData,
  (nVal, oVal) => {
    if (nVal.isshow == false) {
      //列表删除联动
      if (nVal.entitiesData != {} && nVal.entitiesData.name) {
        for (var i in list.value) {
          if (list.value[i].name == nVal.entitiesData.name) {
            console.log(list.value[i].name);
            list.value.splice(i, 1);
            break;
          }
        }
      }
    }
  },
  { deep: true }
);
</script>
<style lang="less" scoped>
@@ -322,6 +360,7 @@
      align-items: center;
      justify-content: space-between;
      padding: 0 25px;
      cursor: pointer;
      .plotting_list_tr_name {
        display: flex;
        align-items: center;