z_yu
3 years ago
8 changed files with 183 additions and 79 deletions
-
9src/api/securityDoor/securityDoor.js
-
9src/api/storeManage/deviceManage/storeroom.js
-
110src/views/components/SecurityDoor.vue
-
10src/views/components/WarehouseWarning.vue
-
29src/views/environmentalScreen/index.vue
-
7src/views/home.vue
-
11src/views/storeManage/warehouse3D/archivesStorage/index.vue
-
69src/views/storeManage/warehouse3DConfig/index.vue
@ -0,0 +1,9 @@ |
|||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
export function securitydoor() { |
||||
|
return request({ |
||||
|
url: 'api/securitydoor/storeroom', |
||||
|
method: 'get' |
||||
|
}) |
||||
|
} |
||||
|
export default { securitydoor } |
@ -0,0 +1,110 @@ |
|||||
|
<template> |
||||
|
<div class="container-wrap"> |
||||
|
<span class="right-top-line" /> |
||||
|
<span class="left-bottom-line" /> |
||||
|
<h3 class="table-title"> |
||||
|
<p class="title-arrow"> |
||||
|
<svg-icon icon-class="menjin" class-name="warehouse-svg" />门禁记录 |
||||
|
</p> |
||||
|
</h3> |
||||
|
<el-table ref="table" style="min-width: 100%;" height="100%" :data="tableData" class="warehose-el-table" stripe> |
||||
|
<el-table-column prop="time" label="时间" align="center" min-width="60" /> |
||||
|
<el-table-column label="库房" align="center" min-width="60"> |
||||
|
<template> |
||||
|
档案库 |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="warning" label="警情" align="center" :show-overflow-tooltip="true" min-width="85" /> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script> |
||||
|
import { securitydoor } from '@/api/securityDoor/securityDoor' |
||||
|
export default { |
||||
|
name: 'SecurityDoor', |
||||
|
props: { |
||||
|
width: { |
||||
|
type: String, |
||||
|
default: '100%' |
||||
|
}, |
||||
|
height: { |
||||
|
type: String, |
||||
|
default: '100%' |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
tableData: [], // 正在展示的数据 |
||||
|
socket: null |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
securitydoor().then((data) => { |
||||
|
this.tableData.push(...data) |
||||
|
}) |
||||
|
this.openSocket() |
||||
|
}, |
||||
|
destroyed() { |
||||
|
if (this.socket) { |
||||
|
this.socket.close() |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
// 表格隔行变色 |
||||
|
rowBgColor({ row, rowIndex }) { |
||||
|
if (rowIndex % 2 === 1) { |
||||
|
return 'light-blue' |
||||
|
} else { |
||||
|
return '' |
||||
|
} |
||||
|
}, |
||||
|
openSocket() { |
||||
|
if (!('WebSocket' in window)) { |
||||
|
console.log('您的浏览器不支持WebSocket') |
||||
|
} else { |
||||
|
console.log('您的浏览器支持WebSocket') |
||||
|
const socketUrl = process.env.VUE_APP_WS_API + '/webSocket' |
||||
|
if (this.socket != null) { |
||||
|
this.socket.close() |
||||
|
this.socket = null |
||||
|
} |
||||
|
this.socket = new WebSocket(socketUrl) |
||||
|
// 打开事件 |
||||
|
this.socket.onopen = () => { |
||||
|
console.log('websocket已经打开') |
||||
|
// 心跳检测重置 |
||||
|
// this.heartCheck.start() |
||||
|
} |
||||
|
// 获得消息 |
||||
|
this.socket.onmessage = (msg) => { |
||||
|
console.log(msg) |
||||
|
this.tableData.push(JSON.parse(msg.data.slice(7, msg.data.length - 2)).Data) |
||||
|
} |
||||
|
// 关闭事件 |
||||
|
this.socket.onclose = function() { |
||||
|
console.log('websocket已关闭') |
||||
|
} |
||||
|
// 发生了错误事件 |
||||
|
this.socket.onerror = function(e) { |
||||
|
console.log('websocket发生了错误') |
||||
|
console.log(e) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
@import "~@/assets/styles/lend-manage.scss"; |
||||
|
.warehouse-left { |
||||
|
position: relative; |
||||
|
h2 { |
||||
|
position: absolute; |
||||
|
left: 50%; |
||||
|
top: 0; |
||||
|
transform: translateX(-50%); |
||||
|
color: #fff; |
||||
|
font-size: 16px; |
||||
|
} |
||||
|
} |
||||
|
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue