<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="qa_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="dimension1" :borderBottom="true">
                <global-picker v-model="formData.dimension1" pickAlign="right" :options="getDimension1" clearable filter></global-picker>
            </up-form-item>
            <up-form-item label="责任单位" prop="liabilityBelong" :borderBottom="true">
                <global-picker v-model="formData.liabilityBelong" pickAlign="right" paramsType="RcQaLiabilityBelong" clearable filter></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 useQualityAnalysisStore from 'mocp/store/qualityAnalysis'
import { getAirlineSelect, getTerminalSelect, getTypeSelect } from 'mocp/utils/permission'

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