<template>
  <div class="fire-search-container">
    <div class="search-row">
      <!-- 火情描述输入框 -->
      <div class="search-item" v-for="(items, index) in searchShowData" :key="index">
        <label class="search-label">{{ items.label }}</label>
        <el-input v-if="items.type === 'input'" v-model="items.content" clearable :disabled="!isShow"
          :placeholder="items.placeholder" class="inputs" />
        <el-select v-else-if="items.type === 'select'" v-model="items.content" :placeholder="items.placeholder"
          class="selects" clearable>
          <el-option v-for="building in items.options" :key="building.value" :label="building.label"
            :value="building.value" />
        </el-select>
        <!-- <el-autocomplete v-else-if="items.type === 'autocomplete'" v-model="items.content"
          :fetch-suggestions="querySearch" :trigger-on-focus="false" clearable class="inline-input w-50"
          placeholder="请输入" @input="getAllListInfoFn(items)" /> -->
        <el-date-picker v-else v-model="items.content" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
          @change="getAllListInfoFn" style="max-width: 220px;" class="picks" />
      </div>
    </div>
    <div class="operation-buttons" v-if="isShow">
      <!-- 操作按钮组 -->
      <div class="search-buttons">
        <el-button type="default" style="width: 45%;" @click="resetSearchForm">
          重置
        </el-button>
        <el-button type="primary" style="width: 45%;" @click="submitSearch">
          查询
        </el-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { computed, reactive, ref, watch } from 'vue';
import { ElInput, ElSelect, ElOption, ElButton, ElMessage, dayjs } from 'element-plus';
const props = defineProps({
  searchShowData: {
    default: [],
  }
})
//默认是有搜索和重置
const isShow = ref(true)
const emit = defineEmits(['searchFn', 'updateTree'])

// 提交搜索
const submitSearch = () => {
  emit('searchFn', searchForm.value)
};
// 定义一个重置搜索表单的函数
const resetSearchForm = () => {
  emit('updateTree', searchForm.value)
}
//选择时间触发函数
const getAllListInfoFn = () => {

}
</script>



<style scoped>
.fire-search-container {
  display: flex;
  flex-direction: row;
  /* gap: 15px; */
  color: #b3b3b4;
  /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); */
}

.search-row {
  /* background-color: #606266; */

  display: flex;
  /* flex: 1; */
  align-items: center;
  /* justify-items: center; */
  justify-content: flex-start;
  /* justify-content: space-between; */
  gap: 10px;
  flex-wrap: wrap;
}

.search-item {
  /* flex: 1; */
  display: flex;
  flex-direction: column;
}


.search-label {
  width: 80px;
  margin-right: 8px;
  /* color: #606266; */
  font-size: 14px;
}

/* 使用深度选择器覆盖Element Plus默认样式 */
:deep(.el-input__wrapper),
:deep(.el-select__wrapper) {
  border-radius: 4px;
}

.search-buttons {
  display: flex;
  gap: 10px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;

}

.operation-buttons {
  width: 20%;
  padding-left: 5%;


}

/* 响应式适配 */
@media (max-width: 768px) {
  .search-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-buttons {
    margin-left: 0;
    margin-top: 10px;
    width: 100%;
    justify-content: flex-end;
  }
}

.inputs,
.selects {
  width: 180px;
  border-radius: 0px !important;
}

:deep() .el-input__wrapper {
  background-color: #1c1c1f;
}
</style>