<template>
    <global-page-search @reset="handleReset" @confirm="handleConfirm">
        <up-form labelPosition="left" labelWidth="auto">
            <up-form-item label="状态" prop="isOpen" :borderBottom="true">
                <global-picker v-model="formData.isOpen" pickAlign="right" clearable dictkey="ta_isOpen"></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="acType" :borderBottom="true">
                <global-picker
                    v-model="formData.acType"
                    pickAlign="right"
                    :options="getTypeSelect('机械不正常事件-工程分析')"
                    clearable
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="航司" prop="acOwn" :borderBottom="true">
                <global-picker
                    v-model="formData.acOwn"
                    pickAlign="right"
                    :options="getAirlineSelect('机械不正常事件-工程分析')"
                    clearable
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="航站" prop="acTerminal" :borderBottom="true">
                <global-picker
                    pickAlign="right"
                    v-model="formData.acTerminal"
                    clearable
                    :options="getTerminalSelect('机械不正常事件-工程分析')"
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="专业类别" prop="majorClass" :borderBottom="true">
                <global-picker v-model="formData.majorClass" pickAlign="right" paramsType="MajorCategory" clearable></global-picker>
            </up-form-item>
            <up-form-item label="ATA章节" prop="ataChapter" :borderBottom="true">
                <global-picker v-model="formData.ataChapter" pickAlign="right" :options="baseStore.getATAChecked()" clearable filter />
            </up-form-item>
        </up-form>
    </global-page-search>
</template>

<script setup>
import useBaseStore from 'mocp/store/base'
import { storeToRefs } from 'pinia'
import { cloneDeep } from 'lodash'
import { ref } from 'vue'
import useEngineeringEvaluationStore from 'mocp/store/engineeringEvaluation'
import { getAirlineSelect, getTerminalSelect, getTypeSelect } from 'mocp/utils/permission'

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