<template>
    <global-page-search @reset="handleReset" @confirm="handleConfirm">
        <up-form labelPosition="left" labelWidth="auto">
            <up-form-item label="申请状态" prop="applyStatus" :borderBottom="true">
                <global-picker v-model="formData.applyStatus" pickAlign="right" clearable dictkey="np_applyStatus"></global-picker>
            </up-form-item>
            <up-form-item label="包号" prop="packageNo" :borderBottom="true">
                <up-input v-model="formData.packageNo" inputAlign="right" border="none" placeholder="请输入" clearable></up-input>
            </up-form-item>
            <up-form-item label="数据来源" prop="sourceType" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.sourceType" dictkey="np_sourceType" clearable></global-picker>
            </up-form-item>
            <up-form-item label="定检类型" prop="checkLevel" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.checkLevel" dictkey="np_checkLevel" clearable></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="airline" :borderBottom="true">
                <global-picker
                    v-model="formData.airline"
                    pickAlign="right"
                    :options="getAirlineSelect('定检管理-非计划管理')"
                    clearable
                    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.startTimeEnd"
                    clearable
                ></global-calendar>
            </up-form-item>
            <up-form-item label="申请时间" :borderBottom="true">
                <global-calendar
                    pickAlign="right"
                    v-model:startTime="formData.applyTimeStart"
                    v-model:endTime="formData.applyTimeEnd"
                    clearable
                ></global-calendar>
            </up-form-item>
        </up-form>
    </global-page-search>
</template>

<script setup>
import { storeToRefs } from 'pinia'
import { cloneDeep } from 'lodash'
import { ref } from 'vue'
import useUnplanWarningStore from 'mocp/store/unplanWarning'
import { getAirlineSelect, getTypeSelect } from 'mocp/utils/permission'

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