<!--
 * @Author: chris
 * @Date: 2025-08-08 16:17:37
 * @LastEditors: chris
 * @LastEditTime: 2025-09-05 11:02:44
-->
<template>
  <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
    <el-form-item label="设备名称" prop="orchardName">
      <el-input v-model="queryParams.orchardName" placeholder="请输入设备名称" clearable style="width: 240px" @keyup.enter="handleQuery" />
    </el-form-item>
    <el-form-item label="状态" prop="status">
      <el-select v-model="queryParams.status" placeholder="设备状态" clearable style="width: 240px">
        <el-option v-for="dict in pestStatus" :key="dict.value" :label="dict.label" :value="dict.value" />
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
      <el-button icon="Refresh" @click="resetQuery">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import { useDict } from '@/utils/dict'

// 定义props
const props = defineProps({
  queryParams: { type: Object, required: true },
})

// 定义事件
const emits = defineEmits(['query', 'reset', 'update:dateRange'])

// 字典数据
const { pest_status: pestStatus } = useDict('pest_status')

// 搜索按钮操作
function handleQuery() {
  emits('query')
}

// 重置按钮操作
function resetQuery() {
  emits('update:dateRange', [])
  emits('reset')
}
</script>