<!--
 * @Author: chris
 * @Date: 2025-08-20 17:06:41
 * @LastEditors: chris
 * @LastEditTime: 2025-09-29 15:13:15
-->
<script setup>
const props = defineProps({
  options: {
    type: Array,
    default: () => []
  }
})

const emits = defineEmits(['pestChange'])

const pestTypes = ref([])

watch(() => props.options, (newVal) => {
  pestTypes.value = newVal.map(item => item.name)
})

function handlePestChange(newVal) {
  emits('pestChange', newVal)
}
</script>

<template>
  <el-row class="chart-action">
    <el-col :span="12" :offset="18">
      <el-select v-model="pestTypes" @change="handlePestChange" multiple placeholder="请选择" style="width: 240px;">
        <el-option
          v-for="item in props.options"
          :key="item.id"
          :label="item.name"
          :value="item.name"
        />
      </el-select>
    </el-col>
  </el-row>
</template>

<style lang="scss" scoped>
</style>
