|
|
@@ -28,8 +28,8 @@
|
|
|
<script>
|
|
|
import { getReceivingCardTopology } from '@/api/external'
|
|
|
import {
|
|
|
- addListener,
|
|
|
- removeListener
|
|
|
+ addListener/* ,
|
|
|
+ removeListener */
|
|
|
} from '@/views/device/detail/monitor'
|
|
|
|
|
|
export default {
|
|
|
@@ -47,70 +47,71 @@ export default {
|
|
|
message: ''
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- topology () {
|
|
|
- return this.info?.topology
|
|
|
- },
|
|
|
- version () {
|
|
|
- return this.topology?.version
|
|
|
- }
|
|
|
- },
|
|
|
watch: {
|
|
|
info: {
|
|
|
handler () {
|
|
|
- this.setDefaults(this.topology?.rxcList)
|
|
|
+ this.setDefaults(this.info?.topology?.screenList)
|
|
|
},
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
- activated () {
|
|
|
- this.check()
|
|
|
- },
|
|
|
- deactivated () {
|
|
|
- removeListener('topology', this.onUpdate)
|
|
|
- },
|
|
|
+ // activated () {
|
|
|
+ // this.check()
|
|
|
+ // },
|
|
|
+ // deactivated () {
|
|
|
+ // removeListener('topology', this.onUpdate)
|
|
|
+ // },
|
|
|
methods: {
|
|
|
- setDefaults (cards) {
|
|
|
+ setDefaults (screenList) {
|
|
|
let maxRow = 0
|
|
|
let maxCol = 0
|
|
|
- if (cards) {
|
|
|
- this.cards = cards.sort((a, b) => {
|
|
|
- if (a.port === b.port) {
|
|
|
- return a.sub - b.sub
|
|
|
- }
|
|
|
- return a.port - b.port
|
|
|
- }).map(({ version, port, sub, row_index, col_index }, index) => {
|
|
|
- maxRow = Math.max(maxRow, row_index)
|
|
|
- maxCol = Math.max(maxCol, col_index)
|
|
|
- let dirc = ''
|
|
|
- let tip = sub === 1 ? 'S' : ''
|
|
|
- const next = cards[index + 1]
|
|
|
- if (next) {
|
|
|
- if (port === next.port) {
|
|
|
- if (row_index > next.row_index) {
|
|
|
- dirc = 'bottom'
|
|
|
- } else if (row_index < next.row_index) {
|
|
|
- dirc = 'top'
|
|
|
- } else {
|
|
|
- dirc = col_index < next.col_index ? 'right' : 'left'
|
|
|
- }
|
|
|
- } else {
|
|
|
- tip = 'E'
|
|
|
- }
|
|
|
- } else {
|
|
|
- tip = 'E'
|
|
|
- }
|
|
|
- return {
|
|
|
- key: `${port}-${sub}`,
|
|
|
- style: {
|
|
|
- gridRow: row_index,
|
|
|
- gridColumn: col_index
|
|
|
- },
|
|
|
- status: 'unknown',
|
|
|
- text: '未知',
|
|
|
- version, tip, dirc
|
|
|
- }
|
|
|
+ if (screenList) {
|
|
|
+ const cards = []
|
|
|
+ const status = this.info.status
|
|
|
+ screenList.forEach(({ outCardList }) => {
|
|
|
+ outCardList.forEach(({ sendCardList }) => {
|
|
|
+ sendCardList.forEach(({ rxcList }) => {
|
|
|
+ rxcList && rxcList.sort((a, b) => {
|
|
|
+ if (a.port === b.port) {
|
|
|
+ return a.sub - b.sub
|
|
|
+ }
|
|
|
+ return a.port - b.port
|
|
|
+ }).map(({ port, sub, row_index, col_index }, index) => {
|
|
|
+ maxRow = Math.max(maxRow, row_index)
|
|
|
+ maxCol = Math.max(maxCol, col_index)
|
|
|
+ let tip = sub === 1 ? 'S' : ''
|
|
|
+ let dirc = ''
|
|
|
+ const next = rxcList[index + 1]
|
|
|
+ if (next) {
|
|
|
+ if (port === next.port) {
|
|
|
+ if (row_index > next.row_index) {
|
|
|
+ dirc = 'top'
|
|
|
+ } else if (row_index < next.row_index) {
|
|
|
+ dirc = 'bottom'
|
|
|
+ } else {
|
|
|
+ dirc = col_index < next.col_index ? 'right' : 'left'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tip = 'E'
|
|
|
+ }
|
|
|
+ } else if (!tip) {
|
|
|
+ tip = 'E'
|
|
|
+ }
|
|
|
+ const card = {
|
|
|
+ key: `${port}-${sub}`,
|
|
|
+ style: {
|
|
|
+ gridRow: row_index,
|
|
|
+ gridColumn: col_index
|
|
|
+ },
|
|
|
+ tip, dirc
|
|
|
+ }
|
|
|
+ this.setStatus(card, status)
|
|
|
+ cards.push(card)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
+ this.cards = cards
|
|
|
} else {
|
|
|
this.cards = null
|
|
|
}
|
|
|
@@ -120,7 +121,7 @@ export default {
|
|
|
gridTemplateRows: `repeat(${maxRow}, 96px)`,
|
|
|
gridTemplateColumns: `repeat(${maxCol}, 96px)`
|
|
|
}
|
|
|
- this.check()
|
|
|
+ // this.check()
|
|
|
},
|
|
|
check () {
|
|
|
if (!this._inactive && this.cards?.length) {
|
|
|
@@ -129,24 +130,20 @@ export default {
|
|
|
},
|
|
|
onUpdate (data) {
|
|
|
if (data) {
|
|
|
- const { version, rxcList } = data
|
|
|
- if (version === this.version) {
|
|
|
- this.message = null
|
|
|
- if (rxcList) {
|
|
|
- const map = {}
|
|
|
- rxcList.forEach(({ port, sub, version }) => {
|
|
|
- map[`${port}-${sub}`] = version
|
|
|
- })
|
|
|
- this.cards.forEach(card => {
|
|
|
- this.setStatus(card, card.version === map[card.key] ? 1 : map[card.key] ? 3 : 2)
|
|
|
+ const map = {}
|
|
|
+ data.screenList.forEach(({ outCardList }) => {
|
|
|
+ outCardList.forEach(({ sendCardList }) => {
|
|
|
+ sendCardList.forEach(({ rxcList }) => {
|
|
|
+ rxcList.forEach(({ port, sub }) => {
|
|
|
+ map[`${port}-${sub}`] = 1
|
|
|
+ })
|
|
|
})
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.message = `${this.version} -> ${version}`
|
|
|
- this.cards.forEach(card => {
|
|
|
- this.setStatus(card, 0)
|
|
|
})
|
|
|
- }
|
|
|
+ })
|
|
|
+ this.cards.forEach(card => {
|
|
|
+ this.setStatus(card, map[card.key] ? 1 : 0)
|
|
|
+ })
|
|
|
+ this.message = null
|
|
|
} else if (!this.$runtime) {
|
|
|
this.getRuntime()
|
|
|
}
|
|
|
@@ -154,14 +151,12 @@ export default {
|
|
|
getRuntime () {
|
|
|
getReceivingCardTopology(this.$route.params.id, { custom: true }).then(({ data }) => {
|
|
|
this.$runtime = true
|
|
|
- if (data?.version === this.version) {
|
|
|
- this.onUpdate(data)
|
|
|
- }
|
|
|
+ this.onUpdate(data)
|
|
|
})
|
|
|
},
|
|
|
setStatus (card, status) {
|
|
|
- card.status = ['unknown', 'normal', 'error', 'error'][status]
|
|
|
- card.text = ['未知', '正常', '异常', '版本不匹配'][status]
|
|
|
+ card.status = this.online ? ['error', 'online', 'error'][status] : 'unknown'
|
|
|
+ card.text = this.online ? ['离线', '在线', '异常'][status] : '未知'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -215,7 +210,7 @@ export default {
|
|
|
color: $info;
|
|
|
background: url("~@/assets/screen.png") 0 0 / 100% 100% no-repeat;
|
|
|
|
|
|
- &.normal,
|
|
|
+ &.online,
|
|
|
&.error {
|
|
|
color: $success--dark;
|
|
|
}
|
|
|
@@ -236,7 +231,7 @@ export default {
|
|
|
transform: scale(0.8);
|
|
|
}
|
|
|
|
|
|
- &.normal::after {
|
|
|
+ &.online::after {
|
|
|
background-color: $black;
|
|
|
}
|
|
|
|
|
|
@@ -257,7 +252,7 @@ export default {
|
|
|
background: url("~@/assets/icon_card_unknown.png") 0 0 / 100% 100% no-repeat;
|
|
|
}
|
|
|
|
|
|
- &.normal {
|
|
|
+ &.online {
|
|
|
.o-receiving-card__status {
|
|
|
color: $error;
|
|
|
background-image: url("~@/assets/icon_card_normal.png");
|