| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <template>
- <div class="c-record-dashboard">
- <div
- class="c-record-dashboard__main"
- :style="style"
- >
- <DeviceInfo
- v-if="showDeviceInfo"
- :device="currentDeviceInfo"
- @fullscreenChange="onDeviceInfoClose"
- />
- <AlarmInfo
- v-if="showAlarmInfo"
- :alarm="currentAlarmInfo"
- @fullscreenChange="onAlarmInfoClose"
- />
- <DeviceSort
- v-if="showDeviceSort"
- :list="deviceList"
- @fullscreenChange="onDeviceSortClose"
- @save="onDeviceSortSave"
- />
- <LinkState
- v-if="showLinkState"
- :device="currentLinkState"
- @fullscreenChange="onLinkStateClose"
- />
- <Header />
- <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-item"
- style="width: 404px; height: 281px"
- >
- <DeviceStatus :items="statusData" />
- </div>
- <div
- class="l-flex__none dashboard-item"
- style="width: 404px; height: 281px"
- >
- <Map :device-list="deviceList" />
- </div>
- </div>
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-item"
- style="width: 904px; height: 586px"
- >
- <Record
- ref="record"
- @openDeviceInfo="openDeviceInfo"
- @openDeviceSort="openDeviceSort"
- @openLinkState="openLinkState"
- />
- </div>
- </div>
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-item"
- style="width: 404px; height: 281px"
- >
- <MessageNotice @openAlarmInfo="openAlarmInfo" />
- </div>
- <div
- class="l-flex__none dashboard-item"
- style="width: 404px; height: 281px"
- >
- <AlarmLevel :items="exceptionLevelStatisticArray" />
- </div>
- </div>
- </div>
- <div class="l-flex--row">
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-item"
- style="width: 404px; height: 284px"
- >
- <AlarmType />
- </div>
- </div>
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-item"
- style="width: 904px; height: 284px"
- >
- <DeviceCalender :device-list="deviceList" />
- </div>
- </div>
- <div class="l-flex--col l-flex__none">
- <div
- class="l-flex__none dashboard-item"
- style="width: 404px; height: 284px"
- >
- <AlarmRate />
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {
- getDevices,
- getDeviceStatistics
- } from '@/api/device'
- import DeviceStatus from './DeviceStatus'
- import DeviceCalender from './DeviceCalender'
- import Map from './Map'
- import AlarmType from './AlarmType'
- import AlarmRate from './AlarmRate'
- import AlarmLevel from './AlarmLevel'
- import DeviceInfo from './DeviceInfo'
- import AlarmInfo from './AlarmInfo'
- import MessageNotice from './MessageNotice'
- import Record from './Record'
- import DeviceSort from './DeviceSort'
- import Header from './Header'
- import LinkState from './LinkState'
- export default {
- components: {
- DeviceSort,
- DeviceInfo,
- AlarmInfo,
- DeviceStatus,
- Map,
- AlarmType,
- AlarmRate,
- MessageNotice,
- Record,
- DeviceCalender,
- AlarmLevel,
- Header,
- LinkState
- },
- data () {
- return {
- loading: false,
- style: null,
- statusData: [
- { label: '设备总数', value: '-' },
- { label: '设备在线数', value: '-' },
- { label: '设备离线数', value: '-' },
- { label: '设备未启用数', value: '-' }
- ],
- exceptionLevelStatisticArray: [
- { label: '预警等级总数', value: '-' },
- { label: '紧急等级', value: '-' },
- { label: '提示等级', value: '-' },
- { label: '普通等级', value: '-' }
- ],
- deviceList: [],
- showDeviceInfo: false,
- currentDeviceInfo: null,
- showAlarmInfo: false,
- currentAlarmInfo: null,
- showDeviceSort: false,
- currentDeviceSort: null,
- showLinkState: false,
- currentLinkState: null
- }
- },
- created () {
- this.getDeviceStatistics()
- this.$timer = setInterval(this.getDeviceStatistics, 60000)
- },
- mounted () {
- this.checkScale()
- window.addEventListener('resize', this.checkScale)
- },
- beforeDestroy () {
- clearInterval(this.$timer)
- window.removeEventListener('resize', this.checkScale)
- },
- methods: {
- checkScale () {
- this.style = {
- transform: `scale(${window.innerWidth / 1920}, ${window.innerHeight / 1080})`
- }
- },
- openLinkState (item) {
- this.currentLinkState = item
- this.showLinkState = true
- },
- onLinkStateClose () {
- this.currentLinkState = null
- this.showLinkState = false
- },
- openDeviceInfo (item) {
- this.showDeviceInfo = true
- this.currentDeviceInfo = item
- },
- onDeviceInfoClose () {
- this.currentDeviceInfo = null
- this.showDeviceInfo = false
- },
- openDeviceSort () {
- this.showDeviceSort = true
- },
- onDeviceSortClose () {
- this.showDeviceSort = false
- },
- onDeviceSortSave (deviceList) {
- this.deviceList = deviceList
- this.showDeviceSort = false
- this.$refs.record.refresh()
- },
- openAlarmInfo (alarm) {
- this.currentAlarmInfo = alarm
- this.showAlarmInfo = true
- },
- onAlarmInfoClose () {
- this.currentAlarmInfo = null
- this.showAlarmInfo = false
- },
- getDeviceStatistics () {
- getDeviceStatistics().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) {
- getDevices({
- pageNum: 1,
- pageSize: total,
- activate: 1
- }, { custom: true }).then(({ data }) => {
- this.deviceList = data
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .c-record-dashboard {
- height: 100%;
- overflow: hidden;
- &__main {
- width: 1920px;
- height: 1080px;
- background: url("~@/assets/v0/bg.png");
- transform-origin: left top;
- }
- }
- .dashboard-item {
- & ~ & {
- margin-top: 24px;
- }
- }
- .l-flex--row {
- & ~ & {
- margin-top: 24px;
- }
- }
- .l-flex--col {
- & ~ & {
- margin-left: 24px;
- }
- }
- </style>
|