<template> <div class="menjin"> <div class="block1"> <layout-title title="设备在线情况"/> <div class="options"> <div v-for="(item,index) in block1OptionsList" :key="index" class="option"> <div class="title active">{{ item.title }}</div> <div class="circular"> <img :src="item.img" alt=""> </div> <div class="label"> {{ item.label1 }}: <count-to :start-val="0" :end-val="+item.count1" :duration="3600"/> </div> <div v-if="item.label2" class="label"> {{ item.label2 }}: <count-to :start-val="0" :end-val="+item.count2" :duration="3600"/> </div> <div v-if="item.label3" class="label"> {{ item.label3 }}: <count-to :start-val="0" :end-val="+item.count3" :duration="3600"/> </div> </div> </div> </div> <div class="block2"> <layout-title title="口门进出数据"/> <div class="options"> <div v-for="(item,index) in block2OptionsList" :key="index" class="option"> <div class="title active">{{ item.title }}</div> <div class="items"> <div v-for="(item1,index1) in item.list" :key="index1" class="item"> <div class="label"> {{ item1.label }}:<count-to :start-val="0" :end-val="item1.count" :duration="3600"/> </div> </div> </div> </div> </div> </div> <div class="block3"> <layout-title title="口门进出记录"/> <div class="content"> <div class="options"> <div v-for="(item,index) in block3OptionsList" :key="index" :class="['title', {active:index === block3OptionsIndex}]" @click="block3OptionsClick(index)" > {{ item }} </div> </div> <div class="table"> <div class="tr"> <div class="td">卡口名称</div> <div class="td">车牌</div> <div class="td">时间</div> <div class="td">状态</div> </div> <div v-infinite-scroll="load" :infinite-scroll-disabled="disabled" class="scroll"> <div v-for="(item,index) in block3List" :key="index" class="tr"> <div v-if="block3OptionsIndex == 0" class="td line1">{{ item.USERNAME }}</div> <div v-if="block3OptionsIndex == 1" class="td">{{ item.LICENSE_PLATE }}</div> <div class="td">{{ item.TIME }}</div> <div v-if="block3OptionsIndex == 0" :class="['td',{green:item.STATE == '0'}]"> {{ item.STATE == '0' ? '进入' : '出港' }} </div> <div v-if="block3OptionsIndex == 0" :class="['td',{yellow:item.STATE == '0'}]">{{ item.EQUIPMENTNAME }} </div> <div v-if="block3OptionsIndex == 1" :class="['td',{green:item.STATE == '4'}]"> {{ item.STATE == '4' ? '进场' : '出场' }} </div> <div v-if="block3OptionsIndex == 1" :class="['td',{yellow:item.STATE == '4'}]">{{ item.COMING_REASON }} </div> </div> </div> </div> </div> </div> </div> </template> <script> import layoutTitle from './title.vue' import CountTo from 'vue-count-to' import { requestFN } from '@/utils/request' export default { components: { layoutTitle, CountTo }, props: { corpInfoId: { type: String, default: '' }, area: { type: String, default: '' }, gangkou: { type: String, default: '' } }, data() { return { block1OptionsList: [ { title: '车辆闸机数', img: require('../../../assets/map/menjin/ico2.png'), label1: '在线数', count1: 2 // label2: '离线数', // count2: 0 }, { title: '摄像头数', img: require('../../../assets/map/menjin/ico3.png'), label1: '摄像头数', count1: 0 } ], block2OptionsList: [ { title: '矿石作业区', list: [ { label: '进矿石作业区车辆数', count: 0 }, { label: '出矿石作业区车辆数', count: 0 }, { label: '矿石作业区场内车辆数', count: 0 } ] }, { title: '杂货作业区', list: [ { label: '进杂货作业区车辆数', count: 0 }, { label: '出杂货作业区车辆数', count: 0 }, { label: '杂货作业区场内车辆数', count: 0 } ] } ], block3OptionsList: ['矿石作业区', '杂货作业区'], block3OptionsIndex: 0, loading: false, currentPage: 1, count: 0, totalPage: 0, block3List: [] } }, computed: { noMore() { return this.currentPage >= this.totalPage }, disabled() { return this.loading || this.noMore } }, created() { this.getDoorManagement() }, methods: { load() { this.loading = true this.currentPage += 1 this.loadRecord(this.block3OptionsIndex) }, loadRecord(index) { this.getDoorWayRecords(index) }, getDoorManagement() { requestFN( '/map/getDoorManagement', { CORPINFO_ID: this.corpInfoId, GANGKOU: this.gangkou } ).then((data) => { this.block2OptionsList[0].list[0].count = data.czksCarToday.oreInAll this.block2OptionsList[0].list[1].count = data.czksCarToday.oreOutAll this.block2OptionsList[0].list[2].count = data.czksCarToday.oreInAll - data.czksCarToday.oreOutAll this.block2OptionsList[1].list[0].count = data.czksCarToday.groceryInAll this.block2OptionsList[1].list[1].count = data.czksCarToday.groceryOutAll this.block2OptionsList[1].list[2].count = data.czksCarToday.groceryInAll - data.czksCarToday.groceryOutAll }) }, block3OptionsClick(index) { this.block3List = [] this.block3OptionsIndex = index this.getDoorWayRecords(index) } } } </script> <style lang="scss" scoped> .menjin { .title { background-image: url("../../../assets/map/menjin/title_on.png"); background-size: 100% 100%; background-repeat: no-repeat; width: 113px; height: 26px; font-size: 14px; line-height: 26px; text-align: center; color: #fff; &.active { background-image: url("../../../assets/map/menjin/title.png"); } } .block1 { width: 410px; background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8)); .options { display: flex; justify-content: space-between; padding: 10px 15px; border: 1px solid; border-image: linear-gradient(to bottom, rgba(58, 122, 149, 0), rgba(58, 122, 149, 1)) 1; border-top: none; .option { display: flex; flex-direction: column; align-items: center; .circular { margin-top: 5px; background-image: url("../../../assets/map/menjin/img1.png"); background-size: 100% 100%; background-repeat: no-repeat; width: 50px; height: 50px; text-align: center; padding-top: 13px; img { width: 30px; height: 26px; animation: scale 2s infinite; } } .label { margin-top: 5px; font-size: 12px; color: #fff; } } } } .block2 { margin-top: 10px; width: 410px; background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8)); .options { padding: 10px 15px; border: 1px solid; border-image: linear-gradient(to bottom, rgba(58, 122, 149, 0), rgba(58, 122, 149, 1)) 1; border-top: none; .option { .items { display: flex; flex-wrap: wrap; margin-bottom: 10px; .item { margin-top: 10px; font-size: 12px; color: #fff; flex-basis: 50%; } } } } } .block3 { margin-top: 10px; width: 410px; background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8)); .content { border: 1px solid; border-image: linear-gradient(to bottom, rgba(58, 122, 149, 0), rgba(58, 122, 149, 1)) 1; border-top: none; padding: 10px; .options { display: flex; justify-content: flex-end; .title { cursor: pointer; } } .table { margin-top: 5px; .scroll { max-height: 200px; overflow-y: auto; &::-webkit-scrollbar { width: 5px; } &::-webkit-scrollbar-thumb { border-radius: 5px; background: rgba(2, 30, 81, 0.851); } &::-webkit-scrollbar-track { border-radius: 5px; background: rgba(255, 255, 255, 0.1); } .tr { &:nth-child(odd) { background-color: transparent; } } } .tr { display: flex; &:nth-child(odd) { background-color: rgba(42, 86, 158, 0.53); } .td { flex: 1; text-align: center; font-size: 12px; color: #fff; padding: 5px; &:nth-child(2) { flex-basis: 20%; } &:nth-child(3) { flex: none; flex-basis: 50px; } &.green { color: #7ccf41; } &.yellow { color: #ffcb05; } } } } } } } @keyframes scale { 0% { transform: scale(1); } 50% { transform: scale(0.8); } 100% { transform: scale(1); } } .line1 { width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } </style>