| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- <template>
- <div class="c-monitor-dashboard">
- <audio
- v-show="false"
- ref="alarmNormal"
- muted
- src="@/assets/v1/alarmNormal.mp3"
- />
- <audio
- v-show="false"
- ref="alarmUrgent"
- muted
- src="@/assets/v1/alarmUrgent.mp3"
- />
- <div
- class="c-monitor-dashboard__main"
- :style="style"
- >
- <department-drawer
- ref="departmentDrawer"
- @change="onGroupChanged"
- />
- <Header ref="Header">
- <template #content>
- <div
- class="c-monitor-dashboard__mode has-active"
- @click="onClickBusiness"
- >
- 切换为运营大数据
- </div>
- </template>
- </Header>
- <NewNotice
- class="new-notice"
- :class="{ active: showNotice }"
- :notice="curNotice"
- :count="noticeCount"
- />
- <div class="l-flex--col center">
- <div class="l-flex--row">
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-block"
- style="width: 1040px; height: 450px"
- >
- <MessageNotice
- ref="MessageNotice"
- @new-alarm="onNewAlarm"
- />
- </div>
- <div class="l-flex__none dashboard-block l-flex--row">
- <div
- class="l-flex__none l-flex--col block-item"
- style="width: 510px; height: 450px"
- >
- <AssetStatistic />
- </div>
- <div
- class="l-flex__none l-flex--col block-item"
- style="width: 510px; height: 450px"
- >
- <ProgramStatistic />
- </div>
- </div>
- <div class="l-flex__none dashboard-block l-flex--row">
- <div
- class="l-flex__none l-flex--col block-item"
- style="width: 510px; height: 450px"
- >
- <ProgramRate />
- </div>
- <div
- class="l-flex__none l-flex--col block-item"
- style="width: 510px; height: 450px"
- >
- <ProgramTop />
- </div>
- </div>
- </div>
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-block"
- style="width: 1480px; height: 1390px"
- >
- <Map
- ref="map"
- :status-data="statusData"
- :device-list="deviceList"
- @closeAlarm="onCloseAlarm"
- >
- <template #default>
- <div
- class="c-department-button has-active"
- @click="onShowDepatment"
- >
- 概况
- </div>
- </template>
- </Map>
- </div>
- </div>
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-block"
- style="width: 1040px; height: 685px"
- >
- <Record ref="record" />
- </div>
- <div
- class="l-flex__none dashboard-block"
- style="width: 1040px; height: 685px"
- >
- <CameraScreen />
- </div>
- </div>
- </div>
- <div class="l-flex--row">
- <div class="l-flex--col l-flex__none">
- <div
- v-if="false"
- class="l-flex__none dashboard-block"
- style="width: 1040px; height: 450px"
- >
- <DeviceCalender :device-list="deviceList" />
- </div>
- <div
- v-else
- class="l-flex__none dashboard-block l-flex--row"
- >
- <div
- class="l-flex__none l-flex--col block-item"
- style="width: 510px; height: 450px"
- >
- <ProgramTop type="getTopOnlineSeconds" />
- </div>
- <div
- class="l-flex__none l-flex--col block-item"
- style="width: 510px; height: 450px"
- >
- <ProgramTop
- :type="topMap[topIndex]"
- @click.native="topIndex=(topIndex+1)%topMap.length"
- />
- </div>
- </div>
- </div>
- <div
- class="l-flex__none l-flex--col"
- style="width: 730px; height: 450px"
- >
- <AlarmLevel />
- </div>
- <div
- class="l-flex__none l-flex--col"
- style="width: 730px; height: 450px"
- >
- <AlarmRate />
- </div>
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-block"
- style="width: 1040px; height: 450px"
- >
- <AlarmType />
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { Index } from './config'
- import {
- getDevicesByQuery,
- getDeviceStatisticsByPath
- } from '@/api/device'
- import DeviceCalender from './DeviceCalender'
- import Map from './Map'
- import AlarmType from './AlarmType'
- import AlarmRate from './AlarmRate'
- import AlarmLevel from './AlarmLevel'
- import MessageNotice from './MessageNotice'
- import Record from './Record'
- // import SystemLoad from './SystemLoad'
- import Header from './Header'
- import ProgramRate from './ProgramRate'
- import ProgramTop from './ProgramTop'
- import AssetStatistic from './AssetStatistic'
- import ProgramStatistic from './ProgramStatistic'
- import CameraScreen from './CameraScreen'
- import NewNotice from './NewNotice'
- export default {
- components: {
- AssetStatistic,
- ProgramStatistic,
- Map,
- AlarmType,
- AlarmRate,
- MessageNotice,
- Record,
- DeviceCalender,
- AlarmLevel,
- Header,
- ProgramRate,
- ProgramTop,
- // SystemLoad,
- CameraScreen,
- NewNotice
- },
- data () {
- this.topMap = ['getPagePriceRank', 'getPageDurationRank', 'getPageCountRank']
- return {
- topIndex: 0,
- style: null,
- statusData: [
- { label: '设备总数', value: '-' },
- { label: '设备在线数', value: '-' },
- { label: '设备离线数', value: '-' },
- { label: '设备未启用数', value: '-' }
- ],
- deviceList: [],
- showNotice: false,
- curNotice: {},
- noticeCount: Index.noticeTimer,
- group: { path: this.$store.getters.org }
- }
- },
- computed: {
- mapDeviceList () {
- return this.deviceList.filter(i => i.longitude && i.latitude)
- }
- },
- created () {
- this.getDeviceStatistics()
- this.$timer = setInterval(this.getDeviceStatistics, Index.deviceTimer)
- },
- mounted () {
- this.checkScale()
- window.addEventListener('resize', this.checkScale)
- document.querySelector('body').setAttribute('version', '')
- },
- beforeDestroy () {
- clearInterval(this.$timer)
- clearInterval(this.$newAlarmTimer)
- window.removeEventListener('resize', this.checkScale)
- document.querySelector('body').setAttribute('version', __VERSION__)
- },
- methods: {
- onGroupChanged ({ path, name }) {
- if (!this.group || this.group.path !== path) {
- this.group = { path, name }
- this.getDeviceStatistics()
- }
- },
- onShowDepatment () {
- this.$refs.departmentDrawer.show()
- },
- checkScale () {
- this.style = {
- transform: `scale(${window.innerWidth / 3840}, ${
- window.innerHeight / 2160
- })`
- }
- },
- playAlarm (type) {
- const audio = this.$refs[type]
- if (!audio) { return }
- if (!audio.paused) {
- audio.currentTime = 0
- }
- audio.play()
- },
- onCloseAlarm (alarm) {
- this.$refs.MessageNotice.closeNewAlarm(alarm)
- },
- onNewAlarm (alarm) {
- const onlineMap = [32, 9]
- const offlineMap = [1, 15, 16, 17]
- if (onlineMap.includes(alarm.deviceErrorId)) {
- this.getDeviceStatistics()
- this.$refs.map?.closeOfflineAlarm(alarm, offlineMap)
- }
- if (offlineMap.includes(alarm.deviceErrorId)) {
- this.getDeviceStatistics()
- }
- if (alarm.level > 1) {
- this.$refs.map?.setNewAlarm(alarm)
- this.playAlarm('alarmUrgent')
- } else {
- this.playAlarm('alarmNormal')
- this.showNotice = true
- this.curNotice = alarm
- clearInterval(this.$newAlarmTimer)
- this.noticeCount = Index.noticeTimer / 1000
- this.$newAlarmTimer = setInterval(() => {
- this.noticeCount--
- if (this.noticeCount <= 0) {
- this.showNotice = false
- this.noticeCount = 0
- clearInterval(this.$newAlarmTimer)
- }
- }, 1000)
- }
- },
- getDeviceStatistics () {
- getDeviceStatisticsByPath(this.group.path).then(({ data }) => {
- const {
- deactivatedTotal,
- notConnectedTotal,
- offLineTotal,
- onLineTotal,
- total
- } = data
- this.statusData = [
- { label: '设备总数', value: total },
- { label: '设备在线数', value: onLineTotal },
- { label: '设备离线数', value: offLineTotal + notConnectedTotal },
- { label: '设备未启用数', value: deactivatedTotal }
- ]
- this.getDevices(total - deactivatedTotal)
- })
- },
- getDevices (total) {
- getDevicesByQuery(
- {
- pageNum: 1,
- pageSize: total,
- activate: 1,
- org: this.group.path
- },
- { custom: true }
- ).then(({ data }) => {
- this.deviceList = data
- })
- },
- onClickBusiness () {
- this.$router.push({
- name: 'v-business',
- params: { isFullScreen: this.$refs.Header.getFullScreen() ? '1' : '' }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .c-monitor-dashboard {
- height: 100%;
- overflow: hidden;
- &__main {
- width: 3840px;
- height: 2160px;
- background: url("~@/assets/v1/monitor_bg.png");
- transform-origin: left top;
- }
- &__mode {
- position: absolute;
- left: 135px;
- bottom: 10px;
- font-size: 32px;
- z-index: 999;
- }
- }
- .dashboard-block {
- & ~ & {
- margin-top: 20px;
- }
- }
- .l-flex--row {
- & ~ & {
- margin-top: 20px;
- }
- }
- .l-flex--col {
- & ~ & {
- margin-left: 20px;
- }
- }
- .new-notice {
- position: fixed;
- bottom: 0;
- right: 0;
- width: 640px;
- min-height: 360px;
- transition: all 1s;
- z-index: 999;
- transform: translateY(100%);
- &.active {
- transform: translateY(0);
- }
- }
- .c-department-button {
- position: absolute;
- top: 0;
- left: 0;
- font-size: 32px;
- line-height: 64px;
- z-index: 1;
- }
- </style>
|