<!--
 * @Author: chris
 * @Date: 2025-08-08 16:17:37
 * @LastEditors: chris
 * @LastEditTime: 2025-09-18 14:50:47
-->
<template>
  <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
    <el-form-item label="设备类型" prop="deviceType">
      <el-select v-model="queryParams.type" placeholder="设备类型" clearable style="width: 240px">
        <el-option v-for="dict in props.deviceTypes" :key="dict.value" :label="dict.label" :value="dict.value" />
      </el-select>
    </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 props.statusOptions" :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>

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

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

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

// 重置按钮操作
function resetQuery() {
  emits('reset')
}
</script>