<template>
    <global-page-search @reset="handleReset" @confirm="handleConfirm">
        <up-form labelPosition="left" labelWidth="auto">
            <up-form-item label="状态" prop="state" :borderBottom="true">
                <global-picker v-model.number="formData.state" pickAlign="right" clearable paramsType="McoCurrentState"></global-picker>
            </up-form-item>
            <up-form-item label="机号" prop="machineNumber" :borderBottom="true">
                <global-picker pickAlign="right" v-model="formData.machineNumber" :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('技术支援-MCO管理')"
                    clearable
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="航站" prop="terminal" :borderBottom="true">
                <global-picker
                    pickAlign="right"
                    v-model="formData.terminal"
                    clearable
                    :options="getTerminalSelect('技术支援-MCO管理')"
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="专业类别" prop="majorCategory" :borderBottom="true">
                <global-picker v-model="formData.majorCategory" pickAlign="right" paramsType="MajorCategory" clearable></global-picker>
            </up-form-item>
            <up-form-item label="执行日期（开始）" prop="startTime" :borderBottom="true">
                <global-date v-model="formData.startTime" pickAlign="right" clearable></global-date>
            </up-form-item>
            <up-form-item label="执行日期（结束）" prop="stopTime" :borderBottom="true">
                <global-date v-model="formData.stopTime" pickAlign="right" clearable></global-date>
            </up-form-item>
            <up-form-item label="故障描述" prop="faultDescription" :borderBottom="true">
                <up-input v-model="formData.faultDescription" inputAlign="right" border="none" placeholder="请输入" clearable></up-input>
            </up-form-item>
            <up-form-item label="试车" prop="testRun" :borderBottom="true">
                <global-picker v-model.number="formData.testRun" pickAlign="right" clearable dictkey="mco_choose"></global-picker>
            </up-form-item>
            <up-form-item label="放空停" prop="airStop" :borderBottom="true">
                <global-picker v-model.number="formData.airStop" pickAlign="right" clearable dictkey="mco_choose"></global-picker>
            </up-form-item>
            <up-form-item label="必检" prop="inspect" :borderBottom="true">
                <global-picker v-model.number="formData.inspect" pickAlign="right" clearable dictkey="mco_choose"></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 useMcoStore from 'mocp/store/mco'
import { getTerminalSelect, getTypeSelect } from 'mocp/utils/permission'

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