<template>
    <div class="module-container">
        <module-header title="基本概览"></module-header>
        <div class="module-body basic-overview" v-loading="loading" :element-loading-background="loadingColor">
            <section-title title="巡查基础概况"></section-title>
            <div class="overview-item">
                <div class="overview-item-total overview-item-01">
                    <div class="num">{{ basicData.patrolPoint }}<span>个</span></div>
                    <div class="title">巡查驻点</div>
                </div>
                <div class="overview-item-type">
                    <div class="info-type">
                        <img src="~@/assets/images/patrolAndRescue/xjry.png" alt="" />
                        <div class="info-total">
                            <div class="num">{{ basicData.patrolUser }}</div>
                            <div class="text">巡查人员</div>
                        </div>
                    </div>
                    <div class="gap-line"></div>
                    <div class="info-current">当前巡查人员<span>{{ basicData.nowPatrolUser }}</span> 人</div>
                </div>
                <div class="overview-item-type">
                    <div class="info-type">
                        <img src="~@/assets/images/patrolAndRescue/xjcl.png" alt="" />
                        <div class="info-total">
                            <div class="num">{{ basicData.patrolCar }}</div>
                            <div class="text">巡查车辆</div>
                        </div>
                    </div>
                    <div class="gap-line"></div>
                    <div class="info-current">当前巡查车辆<span>{{ basicData.nowPatrolCar }}</span> 辆</div>
                </div>
            </div>
            <section-title title="救援基础概况"></section-title>
            <div class="overview-item">
                <div class="overview-item-total overview-item-02">
                    <div class="num">{{ basicData.rescuePoint }}<span>个</span></div>
                    <div class="title">救援驻点</div>
                </div>
                <div class="overview-item-type overview-item-02">
                    <div class="info-type">
                        <img src="~@/assets/images/patrolAndRescue/jyry.png" alt="" />
                        <div class="info-total">
                            <div class="num">{{ basicData.rescueUser }}</div>
                            <div class="text">救援人员</div>
                        </div>
                    </div>
                    <div class="gap-line"></div>
                    <div class="info-current">当前救援人员<span>{{ basicData.nowRescueUser }}</span> 人</div>
                </div>
                <div class="overview-item-type overview-item-02">
                    <div class="info-type">
                        <img src="~@/assets/images/patrolAndRescue/jycl.png" alt="" />
                        <div class="info-total">
                            <div class="num">{{ basicData.rescueCar }}</div>
                            <div class="text">救援车辆</div>
                        </div>
                    </div>
                    <div class="gap-line"></div>
                    <div class="info-current">当前救援车辆<span>{{ basicData.nowRescueCar }}</span> 辆</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: {
                "patrolPoint": 0,
                "patrolUser": 0,
                "nowPatrolUser": 0,
                "patrolCar": 0,
                "nowPatrolCar": 0,
                "rescuePoint": 0,
                "rescueUser": 0,
                "nowRescueUser": 0,
                "rescueCar": 0,
                "nowRescueCar": 0
            }
        }
    },
    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;
    }

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

        .overview-item {
            width: 100%;
            flex: 1;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;

        }

        .overview-item-total {
            width: vw(126);
            height: vw(126);
            background: url('@/assets/images/patrolAndRescue/pic01.png') no-repeat;
            background-size: 100% 100%;

            .num {
                font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
                font-weight: 400;
                font-size: 30px;
                line-height: 30px;
                text-align: center;
                font-style: normal;
                text-transform: none;
                color: #00AAFF;
                text-align: right;
                font-weight: bold;
                margin-top: 20px;

                span {
                    margin-left: 5px;
                }
            }

            .title {
                text-align: right;
                font-size: 14px;
                color: #CCE6FF;
                line-height: 18px;
                margin-top: -4px;
            }
        }

        .overview-item-total.overview-item-02 {
            background: url('@/assets/images/patrolAndRescue/pic02.png') no-repeat;
            background-size: 100% 100%;

            .num {
                color: #00EB89;
            }
        }

        .overview-item-type {

            .info-type {
                display: flex;
                align-items: center;

                img {
                    width: 40px;
                    height: 40px;
                    margin-right: 6px;
                }

                .info-total {
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;

                    .num {
                        font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
                        font-size: 24px;
                        font-weight: bold;
                        color: #00AAFF;
                    }

                    .text {
                        font-size: 12px;
                        color: #CCE6FF;
                    }
                }
            }

            .gap-line {
                width: 100%;
                height: 1px;
                background: rgba(51, 153, 255, 0.2);
                margin: 10px 0;
            }

            .info-current {
                font-size: 12px;
                color: #CCE6FF;
                line-height: 18px;
                margin-top: 10px;

                span {
                    font-size: 14px;
                    font-weight: bold;
                    color: #00AAFF;
                    padding: 0 5px;
                }
            }
        }

        .overview-item-type.overview-item-02 {
            .info-total {
                .num {
                    color: #00EB89;
                }
            }

            .info-current {
                span {
                    color: #00EB89;
                }
            }
        }
    }
}
</style>