<template>
    <global-page
        ref="paging"
        :api="noRoutineWorkListApi"
        :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 { noRoutineWorkListApi } from 'mocp/api/electronicBill'
import { timeStampFormat } from 'mocp/utils/tool'
import useBaseStore from 'mocp/store/base'
import useUserStore from 'mocp/store/user'
import { formData } from './constants/add.compositions'
import { onUnload } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { getQtgj } from './constants/sign.functionals'

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