<template>
    <up-collapse-item title="技术评估（2）">
        <global-page
            :fixed="false"
            :height="height"
            :showNavbar="false"
            :custom="false"
            isDataList
            refresherEnabled
            loadingMoreEnabled
            :api="getTechnicalEvaluationApi"
            auto
        >
            <template #="{ dataList }">
                <view class="item" v-for="item in dataList" :key="item.id" @tap="goDetails(item)">
                    <view class="item-title">
                        <view class="left">
                            <custom-state :value="useGetDictByValue('te_state', item.state)"></custom-state>
                        </view>
                        <view class="right">
                            <text class="txt u-line-1" v-if="item.ac">{{ item.ac }}</text>
                            <text class="txt u-line-1" v-if="item.model">{{ item.model }}</text>
                            <text class="txt u-line-1" v-if="item.aviation">
                                {{ useGetDictByValue('', item.aviation, { data: baseStore.getAirlineSelect }) }}
                            </text>
                        </view>
                    </view>
                    <view class="item-content u-line-3">
                        {{ item.description || '无' }}
                    </view>
                    <view class="item-footer">
                        <view class="label">
                            <global-icon icon="calendar"></global-icon>
                            <text class="txt">
                                {{ Day(item.dateTime).format('YYYY/MM/DD') }}
                            </text>
                        </view>
                    </view>
                </view>
            </template>
        </global-page>
    </up-collapse-item>
</template>

<script setup>
import useBaseStore from 'mocp/store/base'
import { useGetDictByValue } from 'mocp/hooks/use-dict/useDict'
import Day from 'mocp/utils/dayjs'
import { getTechnicalEvaluationApi } from 'mocp/api/technology-evaluation'
import useTechnologyEvaluationStore from 'mocp/store/technology-evaluation'

const baseStore = useBaseStore()
const ps = defineProps({
    height: {
        type: String,
        default: ''
    }
})
const technologyEvaluationStore = useTechnologyEvaluationStore()
const goDetails = (data) => {
    uni.$mocpJump.navigateTo('/panel/technology-evaluation/details', { id: data.id }).then(() => {
        technologyEvaluationStore.setState('details', data)
    })
}
</script>
<style lang="scss" scoped></style>
