riku
2025-03-07 2592dc279ec82bf3649a4dbe644c6416263a10ef
src/views/satellitetelemetry/component/SatelliteSearchBar.vue
@@ -1,24 +1,21 @@
<template>
  <el-row>
    <el-col :span="20">
      <el-form label-position="right" label-width="60px" :inline="false">
        <el-form-item label="区域">
          <OptionLocation2
            :level="3"
            :initValue="true"
            :checkStrictly="false"
            :allOption="true"
            v-model="location"
          ></OptionLocation2>
        </el-form-item>
        <OptionGridGroup
          ref="gridGroupRef"
          v-model="gridGroup"
        ></OptionGridGroup>
      </el-form>
    </el-col>
    <el-col :span="4">
      <el-form-item>
  <!-- <el-row> -->
  <!-- <el-col :span="20"> -->
  <el-form label-position="right" label-width="60px" :inline="false">
    <el-form-item label="区域">
      <OptionLocation2
        :level="3"
        :initValue="true"
        :checkStrictly="false"
        :allOption="true"
        v-model="location"
      ></OptionLocation2>
    </el-form-item>
    <OptionGridGroup ref="gridGroupRef" v-model="gridGroup"></OptionGridGroup>
  </el-form>
  <!-- </el-col> -->
  <!-- <el-col :span="4"> -->
  <!-- <el-form-item>
        <el-button
          :loading="loading"
          :disabled="!gridGroup"
@@ -29,9 +26,9 @@
        >
          查询
        </el-button>
      </el-form-item>
    </el-col>
  </el-row>
      </el-form-item> -->
  <!-- </el-col> -->
  <!-- </el-row> -->
</template>
<script setup>
import { ref, watch } from 'vue';
@@ -43,12 +40,13 @@
const location = ref(undefined);
const gridGroup = ref(undefined);
const gridGroupRef = ref(null);
const area = ref({});
const emits = defineEmits(['search']);
watch(location, (nv, ov) => {
  if (nv != ov) {
    const area = {
    area.value = {
      provinceCode: nv.pCode,
      provinceName: nv.pName,
      cityCode: nv.cCode,
@@ -58,13 +56,14 @@
      townCode: nv.tCode,
      townName: nv.tName
    };
    gridGroupRef.value.fetchGridGroup(area);
    gridGroupRef.value.fetchGridGroup(area.value, 'origin');
  }
});
watch(gridGroup, (nv, ov) => {
  // 首次进入自动触发一次查询事件
  if (ov == undefined && nv != ov) {
  // 自动触发一次查询事件
  // if (ov == undefined && nv != ov) {
  if (nv != ov) {
    handleClick();
  }
});
@@ -72,4 +71,6 @@
function handleClick() {
  emits('search', gridGroup.value);
}
defineExpose({ area });
</script>