Files
aio-hl-new/src/pages/homeset/Home.vue

165 lines
4.3 KiB
Vue
Raw Normal View History

2023-04-03 11:14:32 +08:00
<template>
<div>
<section class="content">
<div class="device-status">
2023-04-10 17:00:48 +08:00
<p><span class="icon white"></span><span class="txt">关机</span></p>
<p><span class="icon blue"></span><span class="txt">开机</span></p>
2023-04-03 11:14:32 +08:00
<p><span class="icon green"></span><span class="txt">生产中</span></p>
2023-04-10 17:00:48 +08:00
<p><span class="icon yellow"></span><span class="txt">待机</span></p>
<p><span class="icon red"></span><span class="txt">故障</span></p>
2023-04-03 11:14:32 +08:00
</div>
<div class="list-box">
2023-04-10 11:16:58 +08:00
<div class="device" v-for="e in dataList" :key="e.device_code" :class="{bg1:e.is_run=='1',bg2:e.is_run=='0'}" @click="toOperation(e)"
2023-04-03 11:14:32 +08:00
>
2023-04-10 11:16:58 +08:00
<div class="device-top">
2023-04-10 17:00:48 +08:00
<div class="img">
<img v-if="e.device_icon !== ''" :src="e.device_icon" alt="">
<img v-else src="../../images/1.png" alt="">
2023-04-10 11:16:58 +08:00
</div>
2023-04-10 17:00:48 +08:00
</div>
2023-04-10 17:15:36 +08:00
<div class="fl icon" :class="['white', 'blue', 'green', 'yellow', 'red'][Number(e.device_status) - 1]">
2023-04-10 17:00:48 +08:00
</div>
<div class="fl desc">
<p class="device_name">{{e.deviceName}}</p>
2023-04-10 19:06:58 +08:00
<p class="ellipsis">工单数: {{e.job_count}}</p>
<p class="ellipsis">当前工单: {{e.workorderCode}}</p>
2023-04-10 17:00:48 +08:00
</div>
2023-04-03 11:14:32 +08:00
</div>
</div>
<Back></Back>
</section>
</div>
</template>
<script>
import Back from '@components/Back.vue'
2023-04-07 17:41:38 +08:00
import {getDevice} from './../../config/getData2.js'
2023-04-03 11:14:32 +08:00
export default {
name: 'Home',
components: {
Back
},
data () {
return {
timer: null,
2023-04-10 11:16:58 +08:00
dataList: []
2023-04-03 11:14:32 +08:00
}
},
mounted () {
this.getList()
this.refresh()
},
methods: {
refresh () {
this.timer = setInterval(() => {
this.getList()
2023-04-10 11:17:42 +08:00
}, 30000)
2023-04-03 11:14:32 +08:00
},
2023-04-07 17:41:38 +08:00
async getList () {
let res = await getDevice()
2023-04-10 17:00:48 +08:00
// let newArr = []
// res.map(el => {
// newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + '/' + el.device_icon}))
// })
this.dataList = [...res]
2023-04-03 11:14:32 +08:00
},
2023-04-10 11:16:58 +08:00
toOperation (e) {
if (e.is_run === '1') {
2023-04-07 17:41:38 +08:00
this.$router.push({
path: '/workordermanage',
2023-04-10 11:16:58 +08:00
query: {code: e.deviceCode}
2023-04-07 17:41:38 +08:00
})
2023-04-03 11:14:32 +08:00
}
}
},
beforeDestroy () {
clearInterval(this.timer)
}
}
</script>
<style lang="stylus" scoped>
2023-04-10 17:00:48 +08:00
.yellow
background #E9B451
2023-04-03 11:14:32 +08:00
.red
background red
.green
background #09ed20
.blue
background #53ccf9
.white
background white
.bg1
background #1E307E
border 1px solid #4F93D9
.bg2
background rgba(0,0,0,0.50)
border 1px solid #7B7B7B
.content
clear both
box-sizing border-box
// height 5rem
width 7.9rem
.device-status
text-align right
font-size .18rem
padding .1rem 0 0 .1rem
p
display inline-block
text-align left
.icon
display inline-block
width .2rem
height .2rem
border-radius .1rem
margin-top .08rem
.txt
display inline-block
line-height .4rem
margin-left .11rem
float right
2023-04-07 18:28:08 +08:00
color #fff
2023-04-03 11:14:32 +08:00
.list-box
padding-bottom .2rem
// height 4.6rem
// overflow-y scroll
.device
display inline-block
width 1.75rem
2023-04-10 17:15:36 +08:00
margin 0 0 .15rem .19rem
2023-04-03 11:14:32 +08:00
overflow hidden
.device-top
box-sizing border-box
height 1rem
background #1E307E
box-shadow inset 0 0 5px 0 #4F93D9
padding .12rem .18rem .12rem .18rem
.img
width 1.37rem
height .76rem
background #fff
text-align center
img
width 1.37rem
height .76rem
.icon
display inline-block
2023-04-10 17:15:36 +08:00
width .15rem
height .15rem
2023-04-03 11:14:32 +08:00
border-radius .1rem
margin .1rem .06rem 0 .04rem
.desc
display inline-block
width 1.35rem
margin-top: .05rem
line-height .25rem
p
font-size .13rem
2023-04-10 11:16:58 +08:00
color #fff
2023-04-03 11:14:32 +08:00
.device_name
max-height .5rem
overflow hidden
2023-04-10 11:16:58 +08:00
color #fff
2023-04-03 11:14:32 +08:00
</style>