feiyu02
2025-05-15 026f17ebafb85250d9ae9b71b80ae5f07341c172
src/components/monitor/FactorRadio.vue
@@ -1,5 +1,5 @@
<template>
  <BaseCard class="map-factor-selector">
  <BaseCard>
    <template #content>
      <el-radio-group v-model="radio" size="default" @change="handleChange">
        <el-radio v-for="(item, i) in options" :key="i" :value="item.value">{{
@@ -12,21 +12,25 @@
<script>
// 监测因子单选框
import { radioOptions } from '@/constant/radio-options';
import { radioOptions, defaultOptions } from '@/constant/radio-options';
import { TYPE0 } from '@/constant/device-type';
export default {
  props: {
    modelValue: {
      type: String,
      default: defaultOptions(TYPE0).value
    },
    deviceType: {
      type: String,
      // type0: 车载或无人机; type1:无人船
      default: TYPE0
    }
  },
  emits: ['change'],
  emits: ['change', 'update:modelValue'],
  data() {
    return {
      radio: radioOptions(TYPE0)[0].value
      radio: defaultOptions(TYPE0).value
    };
  },
  computed: {
@@ -38,12 +42,20 @@
    deviceType(nV, oV) {
      if (nV != oV) {
        this.radio = this.options[0].value;
        this.$emit('update:modelValue', this.radio)
      }
    },
    modelValue(nV, oV){
      if (nV != oV) {
        this.radio = nV
      }
    }
  },
  method: {
  methods: {
    handleChange(value) {
      this.$emit('change', value);
      const item = this.options.find((v) => v.value == value);
      this.$emit('change', item.value, item);
      this.$emit('update:modelValue', item.value)
      // todo 地图3d图像切换展示监测因子
    }
  }
@@ -52,6 +64,7 @@
<style scoped>
.el-radio {
  --el-radio-text-color: white;
  --el-color-primary: #23dad1;
  margin-right: 10px;
  height: initial;
}