<template>
    <div class="module-container">
        <module-header title="路况信息"></module-header>
        <div class="module-body conditions-overview" v-loading="loading" :element-loading-background="loadingColor">
            <div class="main-conditions">
                <div class="condition-item">
                    <div class="condition-img">
                        <img src="~@/assets/images/operationOverview/router-icon.png" />
                        <div class="condition-type">路段</div>
                    </div>
                    <div class="condition-title">车流量</div>
                    <div class="condition-count"><span>825</span>万辆</div>
                    <div class="condition-compare">
                        <span class="compare-text">同比</span>
                        <span class="compare-count green">2.42%</span>
                        <img src="~@/assets/images/operationOverview/arrow-green.png" />
                    </div>
                </div>
                <div class="line"></div>
                <div class="condition-item">
                    <div class="condition-img">
                        <img src="~@/assets/images/operationOverview/sf-icon.png" />
                        <div class="condition-type">收费站</div>
                    </div>
                    <div class="condition-title">车流量</div>
                    <div class="condition-count"><span>525</span>万辆</div>
                    <div class="condition-compare">
                        <span class="compare-text">同比</span>
                        <span class="compare-count red">4.35%</span>
                        <img src="~@/assets/images/operationOverview/arrow-red.png" />
                    </div>
                </div>
            </div>
            <section-title title="值班人员"></section-title>
            <div class="staff-container">
                <div class="staff-item">
                    <div class="staff-img">
                        <img src="~@/assets/images/operationOverview/defaultPhoto.jpg" />
                    </div>
                    <div class="staff-info">
                        <div class="staff-name-info">
                            <span class="staff-name">张毅</span>
                            <span class="staff-title">- 调度员</span>
                        </div>
                        <div class="staff-org">重庆第一分中心</div>
                    </div>
                </div>
                <div class="staff-item">
                    <div class="staff-img">
                        <img src="~@/assets/images/operationOverview/defaultPhoto.jpg" />
                    </div>
                    <div class="staff-info">
                        <div class="staff-name-info">
                            <span class="staff-name">李思远</span>
                            <span class="staff-title"> - 调度员</span>
                        </div>
                        <div class="staff-org">重庆第一分中心</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import ModuleHeader from '@/components/common/moduleHeader.vue'
import SectionTitle from '@/components/common/sectionTitle.vue'
import { getBasicData } from "@/api/patrolAndRescue";
import { QueryMixin } from '../mixins/queryMixin'
export default {
    name: 'basic',
    components: { ModuleHeader, SectionTitle },
    mixins: [QueryMixin],
    data() {
        return {
            loadingColor: 'rgba(6, 46, 106, 0.3)',
            loading: false,
            query: {
                "roadIds": [],
            },
            basicData: {

            }
        }
    },
    methods: {
        getData() {
            this.loading = true;
            getBasicData(this.query) // 传入路段id数组，如果没有则不传
                .then((res) => {
                    if (res.state && res.value) {
                        this.basicData = { ...res.value }
                    }
                })
                .catch((err) => {
                    console.log(err);
                })
                .finally(() => {
                    this.loading = false
                })
        },
    },
}
</script>
<style scoped lang="scss">
@import "~/styles/viewport-convert.scss";

.module-container {
    width: 100%;
    height: 100%;
    background: linear-gradient(270deg, rgba(12, 22, 51, 0.3) 0%, rgba(10, 17, 26, 0.5) 100%);
    padding: 0 10px 10px 10px;
    box-sizing: border-box;

    .module-body {
        height: calc(100% - 34px);
        width: 100%;
        margin-top: 10px;
    }

    .conditions-overview {
        display: flex;
        flex-direction: column;


    }

    .main-conditions {
        display: flex;
        flex: 1;
        align-items: center;

        .condition-item {
            width: 50%;
            text-align: center;
        }

        .line {
            width: 0;
            height: 138px;
            border: 1px solid;
            border-image: linear-gradient(180deg, rgba(0, 227.00000166893005, 255, 0), rgba(0, 191.25, 255, 1), rgba(0, 227.00000166893005, 255, 0)) 1 1;
        }

        .condition-img {
            width: 122px;
            height: 40px;
            margin: 0 auto;
            position: relative;

            img {
                width: 100%;
                height: 100%;
            }

            .condition-type {
                position: absolute;
                left: 50%;
                top: 50%;
                transform: translateY(-50%);
                font-family: 'SairaRegular';
                font-weight: 700;
                font-size: 14px;
                color: #FFFFFF;
                font-style: italic;
                letter-spacing: 2px;
            }
        }

        .condition-title {
            font-weight: 400;
            font-size: 12px;
            color: #FFFFFF;
            margin: 5px 0;
            position: relative;
            display: inline-block;
        }

        .condition-title::before {
            content: "";
            position: absolute;
            width: 22px;
            height: 22px;
            top: 50%;
            left: -20px;
            transform: translateY(-50%);
            background: url("@/assets/images/operationOverview/triangle-left.png") no-repeat center center / contain;
        }

        .condition-title::after {
            content: "";
            position: absolute;
            width: 22px;
            height: 22px;
            top: 50%;
            right: -20px;
            transform: translateY(-50%);
            background: url("@/assets/images/operationOverview/triangle-right.png") no-repeat center center / contain;
        }

        .condition-count {
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 400;
            font-size: 12px;
            color: #FFFFFF;

            span {
                font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
                font-weight: 400;
                font-size: 18px;
                text-align: center;
                font-style: normal;
                text-transform: none;
                margin-right: 5px;
                font-weight: 400;
                background: linear-gradient(90deg, #01E6E6 0%, #019AE6 100%);
                background-clip: text;
                -webkit-text-fill-color: transparent;
                text-shadow: none;
            }
        }

        .condition-compare {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 6px;

            .compare-text {
                font-weight: 400;
                font-size: 14px;
                color: #FFFFFF;
            }

            .compare-count {
                font-family: D-DIN;
                font-weight: 700;
                font-size: 16px;
            }

            .compare-count.green {
                color: #55EDB0;
            }

            .compare-count.red {
                color: #FF3E81;
            }

            img {
                width: 16px;
                height: 16px;
            }
        }
    }

    .staff-container {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        height: 90px;

        .staff-item {
            width: 48%;
            background: rgba(51, 153, 255, 0.1);
            border-radius: 10px 10px 10px 10px;
            padding: 10px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            gap: 10px;
        }

        .staff-img {
            width: 60px;
            height: 60px;
            border-radius: 5px;
            background: #b9bfc4;
            margin: 0 auto;
            overflow: hidden;
        }

        .staff-info {
            height: 60px;
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
            align-items: flex-start;
        }

        .staff-name,
        .staff-title {
            font-weight: 700;
            font-size: 16px;
            color: #3399FF;
        }

        .staff-org {
            font-weight: 400;
            font-size: 14px;
            color: #B2D9FF;
        }
    }

}
</style>