<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="wdm_isOpen"></global-picker>
            </up-form-item>
            <up-form-item label="进度" prop="rxStatus" :borderBottom="true">
                <global-picker v-model="formData.rxStatus" pickAlign="right" clearable dictkey="wdm_rxStatus"></global-picker>
            </up-form-item>
            <up-form-item label="航站" prop="terminal" :borderBottom="true">
                <global-picker
                    pickAlign="right"
                    v-model="formData.terminal"
                    clearable
                    :options="getTerminalSelect('防风害管理')"
                    filter
                ></global-picker>
            </up-form-item>
            <up-form-item label="开始日期" :borderBottom="true">
                <global-calendar
                    pickAlign="right"
                    v-model:startTime="formData.proposedTimeBegin"
                    v-model:endTime="formData.proposedTimeEnd"
                    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 useWindDamageManagementStore from 'mocp/store/windDamageManagement'
import { getTerminalSelect } from 'mocp/utils/permission'

//获取下拉框选项
const windDamageManagementStore = useWindDamageManagementStore()
//获取查询表单数据
const { getSearchData } = storeToRefs(windDamageManagementStore)
const formData = ref(cloneDeep(getSearchData.value))
const handleReset = () => {
    windDamageManagementStore.resetForm()
    uni.$mocpJump.navigateBack()
    uni.$emit('windDamageManagementReload')
}
const handleConfirm = () => {
    windDamageManagementStore.setSearchData(formData.value)
    uni.$mocpJump.navigateBack()
    uni.$emit('windDamageManagementReload')
}
</script>
<style lang="scss" scoped></style>
