|
@@ -12,11 +12,11 @@
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<el-row>
|
|
<el-row>
|
|
- <el-col :span="6" v-for="(item, index) in frames" :key="index">
|
|
|
|
|
|
+ <el-col :span="6" v-for="(item, index) in beaconDevices" :key="index">
|
|
<el-card :id="'myFrame'+item.id" shadow="never" class="myClass">
|
|
<el-card :id="'myFrame'+item.id" shadow="never" class="myClass">
|
|
<div>
|
|
<div>
|
|
<svg-icon :id="'myIcon' + item.id" icon-class="footmark" class-name="footmark" style="font-size: 30px;display: none" />
|
|
<svg-icon :id="'myIcon' + item.id" icon-class="footmark" class-name="footmark" style="font-size: 30px;display: none" />
|
|
- <svg-icon icon-class="sickroom" style="font-size: 40px;padding-right: 20px" />{{ item.full_name }}
|
|
|
|
|
|
+ <svg-icon icon-class="sickroom" style="font-size: 40px;padding-right: 20px" />{{ item.name }}
|
|
</div>
|
|
</div>
|
|
<div style="float:right">
|
|
<div style="float:right">
|
|
<span :id="'myText' + item.id" ></span>
|
|
<span :id="'myText' + item.id" ></span>
|
|
@@ -53,7 +53,10 @@
|
|
import * as API_DeviceLocation from '@/api/ncs_device_location'
|
|
import * as API_DeviceLocation from '@/api/ncs_device_location'
|
|
import { unixToDate } from '@/utils/Foundation'
|
|
import { unixToDate } from '@/utils/Foundation'
|
|
import { getListByDeviceId } from '@/api/ncs_hospitalFrame'
|
|
import { getListByDeviceId } from '@/api/ncs_hospitalFrame'
|
|
-import {DeviceUrl} from "@/utils/domain";
|
|
|
|
|
|
+// import {DeviceUrl} from "@/utils/domain"
|
|
|
|
+const DeviceUrl = domain.DeviceUrl
|
|
|
|
+import { getDeviceByType } from '@/api/ncs_device'
|
|
|
|
+import { DEVICE_TYPE } from '@/utils/enum/DeviceTypeEnum'
|
|
export default {
|
|
export default {
|
|
name: 'Index',
|
|
name: 'Index',
|
|
props: {
|
|
props: {
|
|
@@ -69,7 +72,7 @@ export default {
|
|
|
|
|
|
data: function() {
|
|
data: function() {
|
|
return {
|
|
return {
|
|
- frames: [],
|
|
|
|
|
|
+ beaconDevices: [],
|
|
locationList: [],
|
|
locationList: [],
|
|
params: {
|
|
params: {
|
|
page_size: 20,
|
|
page_size: 20,
|
|
@@ -107,14 +110,14 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- this.API_Frames()
|
|
|
|
|
|
+ this.API_Devices()
|
|
this.initWebSocket()
|
|
this.initWebSocket()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- API_Frames() {
|
|
|
|
|
|
+ API_Devices() {
|
|
const _this = this
|
|
const _this = this
|
|
- getListByDeviceId(this.$store.getters.partId).then(res => {
|
|
|
|
- _this.frames = res
|
|
|
|
|
|
+ getDeviceByType(this.$store.getters.partId, DEVICE_TYPE.BEACON).then(res => {
|
|
|
|
+ _this.beaconDevices = res
|
|
_this.API_GetList()
|
|
_this.API_GetList()
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -127,6 +130,7 @@ export default {
|
|
page_size: res.page_size,
|
|
page_size: res.page_size,
|
|
data_total: res.data_total
|
|
data_total: res.data_total
|
|
}
|
|
}
|
|
|
|
+ _this.locationList = []
|
|
if (_this.tableData.length > 0) {
|
|
if (_this.tableData.length > 0) {
|
|
_this.changeStyle()
|
|
_this.changeStyle()
|
|
}
|
|
}
|
|
@@ -134,7 +138,6 @@ export default {
|
|
},
|
|
},
|
|
changeStyle() {
|
|
changeStyle() {
|
|
const _this = this
|
|
const _this = this
|
|
- this.locationList = []
|
|
|
|
let myId = ''
|
|
let myId = ''
|
|
const time = Date.parse(new Date()) / 1000
|
|
const time = Date.parse(new Date()) / 1000
|
|
if (time - this.tableData[0].create_time > 60) {
|
|
if (time - this.tableData[0].create_time > 60) {
|
|
@@ -147,8 +150,8 @@ export default {
|
|
if (myId) {
|
|
if (myId) {
|
|
document.getElementById(myId).style = 'background: #d3dce6'
|
|
document.getElementById(myId).style = 'background: #d3dce6'
|
|
}
|
|
}
|
|
- document.getElementById('myFrame'+data.frame_id).style = 'color: white;background: #3DCB0A'
|
|
|
|
- document.getElementById('myIcon'+data.frame_id).style.display='inline'
|
|
|
|
|
|
+ document.getElementById('myFrame'+data.beacon_device_id).style = 'color: white;background: #3DCB0A'
|
|
|
|
+ document.getElementById('myIcon'+data.beacon_device_id).style.display='inline'
|
|
_this.$notify({
|
|
_this.$notify({
|
|
title: data.full_name,
|
|
title: data.full_name,
|
|
message: unixToDate(data.create_time) + '在' + data.full_name + '附近',
|
|
message: unixToDate(data.create_time) + '在' + data.full_name + '附近',
|
|
@@ -156,17 +159,17 @@ export default {
|
|
showClose: false,
|
|
showClose: false,
|
|
duration: 2500
|
|
duration: 2500
|
|
})
|
|
})
|
|
- myId = 'myFrame'+data.frame_id
|
|
|
|
|
|
+ myId = 'myFrame'+data.beacon_device_id
|
|
_this.locationList.unshift(data)
|
|
_this.locationList.unshift(data)
|
|
- let text = document.getElementById('myText'+data.frame_id)
|
|
|
|
|
|
+ let text = document.getElementById('myText'+data.beacon_device_id)
|
|
if (text.innerText) {
|
|
if (text.innerText) {
|
|
text.innerText = text.innerText + '、'+ (i+1)
|
|
text.innerText = text.innerText + '、'+ (i+1)
|
|
} else {
|
|
} else {
|
|
text.innerText = (i+1)
|
|
text.innerText = (i+1)
|
|
}
|
|
}
|
|
- // document.getElementById('myText'+data.frame_id).innerText = i+1+1
|
|
|
|
- if (_this.clearList.find(p => p === data.frame_id) == null) {
|
|
|
|
- _this.clearList.push(data.frame_id)
|
|
|
|
|
|
+ // document.getElementById('myText'+data.beacon_device_id).innerText = i+1+1
|
|
|
|
+ if (_this.clearList.find(p => p === data.beacon_device_id) == null) {
|
|
|
|
+ _this.clearList.push(data.beacon_device_id)
|
|
}
|
|
}
|
|
|
|
|
|
}, 250 * t); // 还是每秒执行一次,不是累加的
|
|
}, 250 * t); // 还是每秒执行一次,不是累加的
|
|
@@ -183,10 +186,10 @@ export default {
|
|
dir: 'desc'
|
|
dir: 'desc'
|
|
}
|
|
}
|
|
this.myTitle = ''
|
|
this.myTitle = ''
|
|
- this.frames = []
|
|
|
|
|
|
+ this.beaconDevices = []
|
|
this.locationList = []
|
|
this.locationList = []
|
|
this.initWebSocket()
|
|
this.initWebSocket()
|
|
- this.API_Frames()
|
|
|
|
|
|
+ this.API_Devices()
|
|
},
|
|
},
|
|
/** 分页大小发生改变 */
|
|
/** 分页大小发生改变 */
|
|
handlePageSizeChange(size) {
|
|
handlePageSizeChange(size) {
|
|
@@ -236,22 +239,22 @@ export default {
|
|
websocketonmessage: function(e) {
|
|
websocketonmessage: function(e) {
|
|
console.log('收到消息:', e.data)
|
|
console.log('收到消息:', e.data)
|
|
const data = JSON.parse(e.data)
|
|
const data = JSON.parse(e.data)
|
|
- if (data.frame_id) {
|
|
|
|
|
|
+ if (data.beacon_device_id) {
|
|
this.myTitle = ''
|
|
this.myTitle = ''
|
|
this.fullscreenLoading = false
|
|
this.fullscreenLoading = false
|
|
let size = this.tableData.length
|
|
let size = this.tableData.length
|
|
if (size > 0) {
|
|
if (size > 0) {
|
|
- document.getElementById('myFrame'+this.tableData[(size - 1)].frame_id).style = 'background: #d3dce6'
|
|
|
|
|
|
+ document.getElementById('myFrame'+this.tableData[(size - 1)].beacon_device_id).style = 'background: #d3dce6'
|
|
}
|
|
}
|
|
- document.getElementById('myFrame'+data.frame_id).style = 'color: white;background: #3DCB0A'
|
|
|
|
- document.getElementById('myIcon'+data.frame_id).style.display='inline'
|
|
|
|
|
|
+ document.getElementById('myFrame'+data.beacon_device_id).style = 'color: white;background: #3DCB0A'
|
|
|
|
+ document.getElementById('myIcon'+data.beacon_device_id).style.display='inline'
|
|
this.$notify({
|
|
this.$notify({
|
|
title: data.full_name,
|
|
title: data.full_name,
|
|
message: unixToDate(data.create_time) + '在' + data.full_name + '附近',
|
|
message: unixToDate(data.create_time) + '在' + data.full_name + '附近',
|
|
showClose: false,
|
|
showClose: false,
|
|
offset: 100
|
|
offset: 100
|
|
})
|
|
})
|
|
- let text = document.getElementById('myText'+data.frame_id)
|
|
|
|
|
|
+ let text = document.getElementById('myText'+data.beacon_device_id)
|
|
if (text.innerText) {
|
|
if (text.innerText) {
|
|
text.innerText = text.innerText + '、'+ (size+1)
|
|
text.innerText = text.innerText + '、'+ (size+1)
|
|
} else {
|
|
} else {
|
|
@@ -259,8 +262,8 @@ export default {
|
|
}
|
|
}
|
|
this.tableData.push(data)
|
|
this.tableData.push(data)
|
|
this.locationList.unshift(data)
|
|
this.locationList.unshift(data)
|
|
- if (this.clearList.find(p => p === data.frame_id) == null) {
|
|
|
|
- this.clearList.push(data.frame_id)
|
|
|
|
|
|
+ if (this.clearList.find(p => p === data.beacon_device_id) == null) {
|
|
|
|
+ this.clearList.push(data.beacon_device_id)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|