gaosp
2024-01-21 f307da0cf193416eb8c7a13630942e50b912e848
src/container/workshop/device.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-13 20:46:33
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-21 21:46:33
 * @LastEditTime: 2024-01-21 22:33:42
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/device.vue
-->
<template>
@@ -14,7 +14,7 @@
                <span class="img-status run" v-if="item.status === 'RUN'">运行</span>
                <span class="img-status standby" v-if="item.status === 'IDLE'">待机</span>
                <span class="img-status alerm" v-if="item.status === 'ALARM'">报警</span>
                <img src="./img/machine.png" alt="">
                <img :src="pic || devicePng" alt="">
            </div>
            <ul>
                <li>
@@ -44,6 +44,7 @@
</template>
<script>
import { getRequest, getUrl } from '@/api/Api'
import devicePng from './img/machine.png'
export default {
    props: {
        id: {
@@ -70,6 +71,7 @@
    },
    data() {
        return {
            devicePng,
            care: false,
            item: {}
        }
@@ -90,20 +92,40 @@
            if (this.deviceList.length > 0) {
                try {
                    machineName = this.deviceList.find(item => item.machineId === this.id).machineName
                } catch (error) {
                } catch (error) {
                    // console.info(error) 
                }
            }
            if (this.plantDeviceList.length > 0) {
                try {
                    machineName = this.plantDeviceList.find(item => item.machineId === this.id).machineName
                } catch (error) {
                } catch (error) {
                    // console.info(error) 
                }
            }
            if (machineName) {
                return machineName
            }
            return ''
        },
        pic() {
            let pic = ''
            if (this.info.pic) return this.info.pic
            if (this.deviceList.length > 0) {
                try {
                    pic = this.deviceList.find(item => item.machineId === this.id).pic
                } catch (error) {
                }
            }
            if (this.plantDeviceList.length > 0) {
                try {
                    pic = this.plantDeviceList.find(item => item.machineId === this.id).pic
                } catch (error) {
                }
            }
            if (pic) {
                return pic
            }
            return ''
        }
@@ -254,4 +276,5 @@
            }
        }
    }
}</style>
}
</style>