<template>
  <div class="search-box">
    <section class="select-box">
      <div class="select-box--item">
        <span>检查类型：</span>
        <el-select v-model="selectTaskType" placeholder="请选择检查类型">
          <el-option v-for="item in TASK_TYPE_OPTIONS" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </div>
      <div class="select-box--item">
        <span>生效状态：</span>
        <el-select v-model="selectActiveStatus" placeholder="请选择生效状态">
          <el-option v-for="item in ACTIVE_STATUS_OPTIONS" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </div>
      <div class="select-box--item">
        <span>任务阶段：</span>
        <el-select v-model="selectTaskStage" placeholder="请选择任务阶段">
          <el-option v-for="item in TASK_STAGE_OPTIONS" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
      </div>
    </section>
    <section class="search-btn">
      <el-button type="primary">查询</el-button>
      <el-button>重置</el-button>
    </section>
  </div>
</template>

<script lang="ts" setup>
  import { ref, computed } from 'vue';
  import {
    TASK_TYPE_OPTIONS,
    TASK_STAGE_OPTIONS_DOING,
    TASK_STAGE_OPTIONS_DONE,
    TASK_STAGE_OPTIONS_MANAGEMENT,
  } from '../constants/task-execution';
  import { ACTIVE_STATUS_OPTIONS_DEFAULT, ACTIVE_STATUS_OPTIONS_MANAGEMENT } from '@/views/disaster/constant';
  const selectTaskType = ref('');
  const selectActiveStatus = ref('');
  const selectTaskStage = ref('');
  const props = defineProps<{
    type: 'doing' | 'done' | 'management';
  }>();
  const ACTIVE_STATUS_OPTIONS = computed(() => {
    return props.type === 'management' ? ACTIVE_STATUS_OPTIONS_MANAGEMENT : ACTIVE_STATUS_OPTIONS_DEFAULT;
  });
  const TASK_STAGE_OPTIONS = computed(() => {
    return props.type === 'management'
      ? TASK_STAGE_OPTIONS_MANAGEMENT
      : props.type === 'doing'
      ? TASK_STAGE_OPTIONS_DOING
      : TASK_STAGE_OPTIONS_DONE;
  });
</script>

<style lang="scss" scoped>
  @use '@/views/disaster/style/search.scss' as *;
</style>
