接口
This commit is contained in:
@@ -2,25 +2,22 @@
|
||||
<div>
|
||||
<section class="content">
|
||||
<div class="device-status">
|
||||
<button class="fl mgt10 mgl10 button--primary" @click="toIfWork">设备开/完工</button>
|
||||
<p><span class="icon red"></span><span class="txt">有任务</span></p>
|
||||
<p><span class="icon green"></span><span class="txt">生产中</span></p>
|
||||
<p><span class="icon blue"></span><span class="txt">停机</span></p>
|
||||
<p><span class="icon white"></span><span class="txt">待机</span></p>
|
||||
</div>
|
||||
<div class="list-box">
|
||||
<div class="device"
|
||||
:class="{bg1:item.is_run=='1',bg2:item.is_run=='0'}"
|
||||
v-for="(item, index) in list" :key="index"
|
||||
@click="toOperation(item)"
|
||||
<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)"
|
||||
>
|
||||
<div class="device-top"><div class="img"><img v-show="item.device_icon" :src="item.imgurl" alt=""></div></div>
|
||||
<div class="fl icon" :class="{blue:item.device_status=='3',red:item.device_status=='2',green:item.device_status=='1',white:item.device_status=='0'}"></div>
|
||||
<div class="fl desc">
|
||||
<p class="device_name">{{item.device_name}}</p>
|
||||
<p class="ellipsis">任务数: {{item.job_count}}</p>
|
||||
<p class="ellipsis">工单: {{item.produceorder_code}}</p>
|
||||
</div>
|
||||
<div class="device-top">
|
||||
<div class="img"><img v-show="e.device_icon" :src="e.imgurl" alt=""></div></div>
|
||||
<div class="fl icon" :class="['white', 'green', 'red', 'blue'][Number(e.device_status)]"></div>
|
||||
<div class="fl desc">
|
||||
<p class="device_name">{{e.deviceName}}</p>
|
||||
<p class="ellipsis">任务数: {{e.job_count}}</p>
|
||||
<p class="ellipsis">工单: {{e.workorderCode}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Back></Back>
|
||||
@@ -40,7 +37,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
timer: null,
|
||||
list: []
|
||||
dataList: []
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@@ -51,29 +48,21 @@ export default {
|
||||
refresh () {
|
||||
this.timer = setInterval(() => {
|
||||
this.getList()
|
||||
}, 30000)
|
||||
}, 3000)
|
||||
},
|
||||
async getList () {
|
||||
let res = await getDevice()
|
||||
let newArr = []
|
||||
res.map(el => {
|
||||
newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + el.device_icon}))
|
||||
newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + '/' + el.device_icon}))
|
||||
})
|
||||
this.list = [...newArr]
|
||||
// this.$store.dispatch('getIsProplan', res.result.is_productonplan)
|
||||
this.dataList = [...newArr]
|
||||
},
|
||||
toIfWork () {
|
||||
// this.$router.push('/ifwork')
|
||||
},
|
||||
toOperation (item) {
|
||||
if (item.is_run === '1') {
|
||||
// let obj = {
|
||||
// code: item.device_code
|
||||
// }
|
||||
// this.$store.dispatch('setDevice', obj)
|
||||
toOperation (e) {
|
||||
if (e.is_run === '1') {
|
||||
this.$router.push({
|
||||
path: '/workordermanage',
|
||||
query: {code: item.device_code}
|
||||
query: {code: e.deviceCode}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -161,7 +150,9 @@ export default {
|
||||
line-height .25rem
|
||||
p
|
||||
font-size .13rem
|
||||
color #fff
|
||||
.device_name
|
||||
max-height .5rem
|
||||
overflow hidden
|
||||
color #fff
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user