<template>
|
<div class="device-status-info">
|
<div v-if="type == 1" class="color-one">
|
设备状态
|
<!-- 1断开2生产3待机 -->
|
<span v-if="device.plcStatus" class="device-m">
|
<el-popover
|
v-if="device.plcStatus == 1 && device.plcNotConnected"
|
:width="180"
|
placement="top-end"
|
trigger="click"
|
>
|
<template #reference>
|
<el-icon class="duan">
|
<Link />
|
</el-icon>
|
断开
|
</template>
|
{{ device.plcNotConnected }}
|
</el-popover>
|
<span v-else>
|
<el-icon v-if="device.plcStatus == 1 && !device.plcNotConnected" class="duan">
|
<Link />
|
</el-icon>
|
<el-icon v-else class="lian">
|
<Link />
|
</el-icon>
|
<!-- :class="{
|
'status-running': device.plcStatus == 2,
|
'status-off': device.plcStatus != 2,
|
}" -->
|
<span class="status-running">
|
{{ device.plcStatus == 1 ? '断开' : device.plcStatus == 2 ? '生产中' : '待机' }}
|
</span>
|
</span>
|
</span>
|
<div class="device-b">运行时间:1天1小时23分12秒</div>
|
</div>
|
<div v-if="type == 2" class="color-two">
|
集群状态
|
<!-- 1断开2生产3待机 -->
|
<span v-if="device.plcStatus" class="device-m">
|
<el-popover
|
v-if="device.plcStatus == 1 && device.plcNotConnected"
|
:width="180"
|
placement="top-end"
|
trigger="click"
|
>
|
<template #reference>
|
<el-icon class="duan">
|
<CircleCloseFilled />
|
</el-icon>
|
断开
|
</template>
|
{{ device.plcNotConnected }}
|
</el-popover>
|
<span v-else>
|
<el-icon v-if="device.plcStatus == 1 && !device.plcNotConnected" class="duan">
|
<CircleCloseFilled />
|
</el-icon>
|
<el-icon v-else class="lian">
|
<SuccessFilled />
|
</el-icon>
|
<!-- :class="{
|
'status-running': device.plcStatus == 2,
|
'status-off': device.plcStatus != 2,
|
}" -->
|
<span class="status-running">
|
{{ device.plcStatus == 1 ? '断开' : device.plcStatus == 2 ? '在线' : '待机' }}
|
</span>
|
</span>
|
</span>
|
<div class="device-b">运行时间:1天1小时23分12秒</div>
|
</div>
|
</div>
|
</template>
|
<script setup lang="ts">
|
import { toRefs } from 'vue'
|
import { Link, CircleCloseFilled, SuccessFilled } from '@element-plus/icons-vue'
|
import type { PLCResponse } from '@/api/plc'
|
|
export interface DeviceStatusInfoProps {
|
device: PLCResponse
|
type?: Number
|
}
|
|
const props = defineProps<DeviceStatusInfoProps>()
|
const { device, type } = toRefs(props)
|
</script>
|
|
<style scoped lang="scss">
|
$status-default: #13235a;
|
$status-running: #00ff00f0;
|
$status-ready: #13235a;
|
$status-done: #2c5dbb82;
|
$status-border: #ffffff21;
|
$status-dark-font: #efefef;
|
$status-off: red;
|
.device-status-info {
|
width: calc(50% - 5px);
|
height: 150px;
|
line-height: 40px;
|
background: $status-done;
|
margin-top: 10px;
|
border-radius: 4px;
|
color: #fff;
|
border: 1px solid $status-border;
|
box-sizing: border-box;
|
overflow: hidden;
|
float: left;
|
text-align: center;
|
font-size: 15px;
|
|
.duan {
|
color: $status-off;
|
font-size: 26px;
|
margin-right: 5px;
|
margin-top: 2px;
|
float: left;
|
}
|
.lian {
|
color: $status-running;
|
font-size: 26px;
|
margin-right: 5px;
|
float: left;
|
margin-top: 2px;
|
}
|
.color-one,
|
.color-two {
|
height: 100%;
|
width: 100%;
|
margin-right: 10px;
|
.device-m {
|
width: 100%;
|
display: inline-block;
|
font-size: 15px;
|
line-height: 25px;
|
span {
|
display: inline-block;
|
line-height: 30px;
|
}
|
}
|
.device-b {
|
font-size: 12px;
|
margin-top: 10px;
|
width: 100%;
|
line-height: 25px;
|
color: $status-dark-font;
|
}
|
}
|
.color-two {
|
margin-left: 10px;
|
}
|
}
|
</style>
|