<template>
    <global-page-search @reset="handleReset" @confirm="handleConfirm">
        <up-form labelPosition="left" labelWidth="auto" :model="formData" ref="formRef">
            <up-form-item label="状态" prop="state" :borderBottom="true">
                <global-picker v-model="formData.state" pickAlign="right" clearable dictkey="te_state"></global-picker>
            </up-form-item>
            <up-form-item label="机号" prop="ac" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.ac" :options="deviceNumList" clearable filter></global-picker>
            </up-form-item>
            <up-form-item label="机型" prop="model" :borderBottom="true">
                <global-picker
                    v-model="formData.model"
                    pickAlign="right"
                    :options="getTypeSelect('技术支援-技术评估')"
                    clearable
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="航司" prop="aviation" :borderBottom="true">
                <global-picker
                    v-model="formData.aviation"
                    pickAlign="right"
                    :options="getAirlineSelect('技术支援-技术评估')"
                    clearable
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="ATA章节" prop="ata" :borderBottom="true">
                <global-picker v-model="formData.ata" pickAlign="right" :options="baseStore.getATASelect" clearable filter></global-picker>
            </up-form-item>
            <up-form-item label="日期" :borderBottom="true">
                <global-calendar
                    pickAlign="right"
                    v-model:startTime="formData.startDateTime"
                    v-model:endTime="formData.endDateTime"
                    clearable
                ></global-calendar>
            </up-form-item>
        </up-form>
    </global-page-search>
</template>

<script setup>
import useBaseStore from 'mocp/store/base'
import useTechnologyEvaluationStore from 'mocp/store/technology-evaluation'
import { storeToRefs } from 'pinia'
import { cloneDeep } from 'lodash'
import { ref } from 'vue'
import { getAirlineSelect, getTypeSelect } from 'mocp/utils/permission'

//获取下拉框选项
const baseStore = useBaseStore()
const {
    selectList: { deviceNumList }
} = useBaseStore()
const technologyEvaluationStore = useTechnologyEvaluationStore()
//获取查询表单数据
const { searchData } = storeToRefs(technologyEvaluationStore)
const formData = ref(cloneDeep(searchData.value))
const handleReset = () => {
    technologyEvaluationStore.resetForm()
    uni.$mocpJump.navigateBack()
    uni.$emit('technologyEvaluationReload')
}
const handleConfirm = () => {
    technologyEvaluationStore.setState('searchData', formData.value)
    uni.$mocpJump.navigateBack()
    uni.$emit('technologyEvaluationReload')
}
</script>
<style lang="scss" scoped></style>
