<template>
    <global-page-search @reset="handleReset" @confirm="handleConfirm">
        <up-form labelPosition="left" labelWidth="auto">
            <up-form-item label="机号" prop="machine_number" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.machine_number" :options="deviceNumList" clearable filter />
            </up-form-item>

            <up-form-item label="机型" prop="planeModel" :borderBottom="true">
                <global-picker v-model="formData.planeModel" pickAlign="right" :options="getTypeSelect('信息通报')" clearable filter />
            </up-form-item>

            <up-form-item label="航司" prop="aviation" :borderBottom="true">
                <global-picker v-model="formData.aviation" pickAlign="right" :options="getAirlineSelect('信息通报')" clearable filter />
            </up-form-item>

            <up-form-item label="航站" prop="termin" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.termin" clearable :options="getTerminalSelect('信息通报')" filter></global-picker>
            </up-form-item>

            <up-form-item label="填报日期" :borderBottom="true">
                <global-calendar pickAlign="right" v-model:startTime="formData.startTime" v-model:endTime="formData.stopTime" clearable />
            </up-form-item>

            <up-form-item label="保障阶段" prop="guarantee" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.guarantee" clearable paramsType="GuaranteeStage" filter></global-picker>
            </up-form-item>

            <up-form-item label="完成状态" prop="rlease_state" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.rlease_state" clearable paramsType="ReleaseStatu" filter></global-picker>
            </up-form-item>

            <up-form-item label="运行阶段" prop="function_Info" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.function_Info" clearable paramsType="OperationPhase" filter></global-picker>
            </up-form-item>

            <up-form-item label="故障状态" prop="failure_state" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.failure_state" clearable paramsType="RetentionBasis" filter></global-picker>
            </up-form-item>

            <up-form-item label="专业类别" prop="professional" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.professional" clearable paramsType="MajorCategory" filter></global-picker>
            </up-form-item>

            <up-form-item label="数据来源" prop="isType" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.isType" clearable dictkey="id_isType"></global-picker>
            </up-form-item>
            <up-form-item label="故障报告人" prop="reporter" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.reporter" clearable paramsType="FaultReporting"></global-picker>
            </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 useInforDisclosureStore from 'mocp/store/inforDisclosure'
import { getAirlineSelect, getTerminalSelect, getTypeSelect } from 'mocp/utils/permission'

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