<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">
                                {{currentRow.tailnumber?currentRow.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(currentRow)">
                                {{currentRow.flightNo?currentRow.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 >
                                {{currentRow.fleet?currentRow.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(currentRow.leg,currentRow.totalLeg)}}
                            <!-- {{currentRow.totalLeg?currentRow.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(currentRow.dep)">
                                       {{currentRow.dep?currentRow.dep:'--'}}
                                    </view>
                               </uni-col>
                               <uni-col :span="6">
								   <uni-icons custom-prefix="iconfont" type="icon-feiji" size="14"></uni-icons>
                               </uni-col>
                                <uni-col :span="8">
                                    <view class= "font-color font-weight" @click="arr(currentRow.arr)">
                                       {{currentRow.arr?currentRow.arr:'--'}}
                                    </view>
                               </uni-col>
                            </uni-row>
                        </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-weight">
                               {{ currentRow.latestAcarsTime? moment.utc(currentRow.latestAcarsTime).format('YYYY-MM-DD'):'--' }}
                            </view>
                        </uni-col>
                    </uni-row>
                </uni-col>
            </uni-row>
            <uni-row style=" line-height: 36rpx;">
				更新时间：{{ eventListByReportTypeLegIdData[0]&&eventListByReportTypeLegIdData[0].msgTime? moment.utc(eventListByReportTypeLegIdData[0].msgTime).format('YYYY-MM-DD HH:mm:ss') :'--' }}
                <!-- 更新时间：{{eventListByReportTypeLegIdData}} -->
            </uni-row>
			
        </view>

    </view>
</template>

<script>
	import moment from "moment"
    export default {
        data() {
            return {
				moment,
            }
        },
        onLoad(option) {

        },
        props: {
            currentRow :{
                type: Object,
                default: () => ({})
            },
            eventListByReportTypeLegIdData:{
                type: Array,
                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(v){
             
				if(v){
					uni.navigateTo({
					    url: '/pages/modules/ahm/fraMonitoring/airportDetails?threeCode=' + v
					       
					})
				}
               
            },
            arr(v){
                if(v){
                	uni.navigateTo({
                	    url: '/pages/modules/ahm/fraMonitoring/airportDetails?threeCode=' + v
                	       
                	})
                }
            },
            clicktailnumber(){
             
            },
            clickflightNo(itemhea){
             
				let param ={
					tailNumber : itemhea.tailnumber,
					leg: itemhea.leg,
					fleet: itemhea.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>
