<template>
    <div
        class="tooltip"
        ref="tooltip">
        <p>
            <span>销售订单号: </span>
            <span>{{ carStationInfo.hasOwnProperty('saleOrderNo') && carStationInfo.saleOrderNo !== null ? carStationInfo.saleOrderNo : '暂无' }}</span>
        </p>
        <p>
            <span>主计划工单号: </span>
            <span>{{ carStationInfo.hasOwnProperty('planOrderNo') && carStationInfo.planOrderNo !== null ? carStationInfo.planOrderNo : '暂无' }}</span>
        </p>
        <p>
            <span>车间计划工单号: </span>
            <span>{{ carStationInfo.hasOwnProperty('code') && carStationInfo.code !== null ? carStationInfo.code : '暂无' }}</span>
        </p>
        <p>
            <span>车型: </span>
            <span>{{ carStationInfo.hasOwnProperty('busType') && carStationInfo.busType !== null ? carStationInfo.busType : '暂无' }}</span>
        </p>
        <p>
            <span>订单数量: </span>
            <span>{{ carStationInfo.hasOwnProperty('orderSize') && carStationInfo.orderSize !== null ? carStationInfo.orderSize : '暂无' }}</span>
        </p>
        <p>
            <span>单位: </span>
            <span>{{ carStationInfo.hasOwnProperty('unit') && carStationInfo.unit !== null ? carStationInfo.unit : '暂无' }}</span>
        </p>
        <p>
            <span>车间: </span>
            <span>{{ carStationInfo.hasOwnProperty('shop') && carStationInfo.shop !== null ? carStationInfo.shop : '暂无' }}</span>
        </p>
        <p>
            <span>产线: </span>
            <span>{{ carStationInfo.hasOwnProperty('line') &&  carStationInfo.line !== null ? arStationInfo.line : '暂无' }}</span>
        </p>
        <!-- <p><span>计划完工时间: </span><span>{{ query.saleOrderNo }}</span></p> -->
        <div
            class="close-btn"
            @click="closeTooltip">
            <i class="el-icon-circle-close"></i>
        </div>
    </div>
</template>
<script>
/**
 * @author MARS  <wangyunfan@vtstar.net>
 * @fileoverview Tooltip封装
 */
export default {
    props: {
        query: {
            type: Object,
            default: () => {}
        }
    },
    data () {
        return {
            carStationInfo: {}
        }
    },
    watch: {
        query: {
            handler (newVal, oldVal) {
                this.carStationInfo = _.cloneDeep(newVal)
            },
            deep: true
        }
    },
    methods: {
        closeTooltip () {
            this.$refs.tooltip.style.visibility = 'hidden'
        }
    }
}
</script>
<style lang="scss">
.tooltip {
    position: absolute;
    padding: 20px 0 0 0;
    width: 260px;
    height: 246px;
    border-radius: 9px;
    background: #000000;
    opacity: 0.8;
    color: #ffffff;
    visibility: hidden;
    top: 0;
    left: 0;

    p {
        margin: 5px 0;
        font-size: 14px;
        font-weight: bold;
        overflow: hidden;

        span:nth-child(1) {
            display: block;
            width: 120px;
            float: left;
            text-align: right;
        }
        span:nth-child(2) {
            display: block;
            float: left;
            width: 110px;
            margin-left: 15px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
    }

    .close-btn {
        position: relative;
        top: 15px;
        cursor: pointer;
        text-align: center;
        color: #ffffff;
        font-weight: bold;
        font-size: 18px;
    }
}
</style>
