<template>
    <global-page
        ref="paging"
        :api="deicingListApi"
        :padding="24"
        auto
        isDataList
        loadingMoreEnabled
        refresherEnabled
        title="我的今天签单"
        :params="{
            tody: 1,
            userId: userStore.userInfo?.id
        }"
    >
        <template #default="{ item }">
            <view class="item" @tap="goDetails(item)">
                <view class="item-title">
                    <view class="left">
                        <text class="txt">{{ item.acreg }}</text>
                    </view>
                    <view class="right">
                        <text class="txt">{{ baseStore.getTerminalObject[item.station] }}</text>
                    </view>
                </view>
                <view class="item-content u-line-3">
                    <text class="txt">{{ item.aircaraftoperator }}</text>
                    <text class="txt">{{ item.model }}</text>
                </view>
                <view class="item-footer">
                    <view class="label">
                        <global-icon icon="calendar"></global-icon>
                        <text class="txt">
                            {{ timeStampFormat(item.createTime, { format: 'YYYY/MM/DD' }) }}
                        </text>
                    </view>
                </view>
            </view>
        </template>
    </global-page>
</template>

<script setup>
import { deicingListApi } from 'mocp/api/electronicBill'
import { timeStampFormat } from 'mocp/utils/tool'
import useBaseStore from 'mocp/store/base'
import useUserStore from 'mocp/store/user'
import { ref } from 'vue'
import { onUnload } from '@dcloudio/uni-app'
import { antiicingFile, deicingFile, formData } from './constants/add.compositions'

const baseStore = useBaseStore()
const userStore = useUserStore()
const goDetails = (data) => {
    Object.assign(formData, data)
    deicingFile.value = data.deicingFileList
    antiicingFile.value = data.antiicingFileList
    uni.$mocpJump.navigateTo('/panel/electronicBill/deicing/add')
}
//刷新
const paging = ref()
uni.$on('deicingReload', () => {
    paging.value?.reload()
})
onUnload(() => {
    uni.$off('deicingReload')
})
</script>
<style lang="scss" scoped>
@import 'mocpStatic/css/list.scss';
</style>
