<template>
    <view style="background-color: #f0f0f0; padding: 10px;">
        <view style="background-color: #ffffff;padding: 10px;font-size: 22rpx;">
            <uni-row style="line-height: 36rpx;">
                <uni-col :span="12">
                    <uni-row>
                        <uni-col :span="8">
                            机号：
                        </uni-col>
                        <uni-col :span="16">
                            <view class= "font-color font-weight" @click="clicktailnumber(itemhea)">
                                {{itemhea.tailnumber?itemhea.tailnumber:'--'}}
                            </view>
                        </uni-col>
                    </uni-row>
                </uni-col>
                <uni-col :span="12">
                    <uni-row>
                        <uni-col :span="8">
                            航班：
                        </uni-col>
                        <uni-col :span="16">
                            <view class= "font-color font-weight" @click="clickflightNo(itemhea)">
                                {{itemhea.flightNo?itemhea.flightNo:'--'}}
                            </view>
                        </uni-col>
                    </uni-row>
                </uni-col>
            </uni-row>
            <uni-row style="line-height: 36rpx;">
                <uni-col :span="12">
                    <uni-row>
                        <uni-col :span="8">
                            机队：
                        </uni-col>
                        <uni-col :span="16">
                            <view >
                                {{fleet?fleet:'--'}}
                            </view>
                        </uni-col>
                    </uni-row>
                </uni-col>
                <uni-col :span="12">
                    <uni-row>
                        <uni-col :span="8">
                            航段：
                        </uni-col>
                        <uni-col :span="16">
							{{legHandler(itemhea.leg,itemhea.totalLeg)}}
                        </uni-col>
                    </uni-row>
                </uni-col>
            </uni-row>
            <uni-row style="line-height: 36rpx;">
                <uni-col :span="12">
                    <uni-row>
                        <uni-col :span="8">
                            机场：
                        </uni-col>
                        <uni-col :span="16">
                            <uni-row>
                               <uni-col :span="8">
                                   <view class= "font-color font-weight" @click="dep(itemhea.dep)">
                                       {{itemhea.dep?itemhea.dep:'--'}}
                                    </view>
                               </uni-col>
                               <uni-col :span="6">
								   <uni-icons custom-prefix="iconfont" type="icon-feiji" size="14"></uni-icons>
                                   <!-- <uni-icons type="afterfly" size="12" color="#000000"></uni-icons> -->
                               </uni-col>
                                <uni-col :span="8">
                                    <view class= "font-color font-weight" @click="arr(itemhea.arr)">
                                       {{itemhea.arr?itemhea.arr:'--'}}
                                    </view>
                               </uni-col>
                            </uni-row>
                        </uni-col>
                    </uni-row>
                </uni-col>

            </uni-row>
            <uni-row style="line-height: 36rpx;"> 
                更新时间：{{ latestAcarsTime?latestAcarsTime:'--' }}
            </uni-row>
        </view>

    </view>
</template>

<script>
    export default {
        data() {
            return {

            }
        },
        onLoad(option) {

        },
        props: {
            itemhea :{
                type: Object,
                default: () => {}
            },
            fleet:{
               type: String,
               default: ''
            },
            latestAcarsTime:{
               type: String,
               default: ''
            },

            //
            eventListByReportTypeLegIdData:{
                type: String,
                default: ''
            }
        },
        methods: {
			//计算航段
			legHandler(leg, totalLeg) {
				if (!leg) {
					leg === 0 ? leg = 0 : leg = totalLeg = 0;
				}
				if (!totalLeg) {
					totalLeg === 0 ? totalLeg = 0 : leg = totalLeg = 0;
				}
				return  Math.min(0, leg - totalLeg);
			},
            dep(dep){
                uni.navigateTo({
                    url: '/pages/modules/ahm/fraMonitoring/airportDetails?threeCode=' + dep
                       
                })
            },
            arr(arr){
                uni.navigateTo({
                    url: '/pages/modules/ahm/fraMonitoring/airportDetails?threeCode=' + arr
                       
                })
            },
            clicktailnumber(item){
				
                let param = {
                	tailnumber : item.tailnumber,
                	fleet  : item.fleet,
                	latestAcarsTime :  this.latestAcarsTime
                } 
                uni.navigateTo({
                	url: '/pages/modules/ahm/fraMonitoring/historyLeg?param=' +
                			encodeURIComponent(JSON.stringify(param))
                })
            },
            clickflightNo(itemhea){
              
				let param ={
					tailNumber : itemhea.tailnumber,
					leg: itemhea.leg,
					fleet: this.fleet,
					totalLeg: itemhea.totalLeg,
				}
				uni.navigateTo({
					url: '/pages/modules/ahm/fraMonitoring/flightLegDetails?param=' +
							encodeURIComponent(JSON.stringify(param))
				
				})
            }
        },
        created() {
            
        }
    }
</script>

<style scoped lang="scss">
    .font-color{
        color: #0299E3;
    }
    .font-weight{
        font-weight:600
    }
</style>
