gaosp
2024-01-20 c3d5a56a83a8ab420bff5ed01437a806259fa5ef
src/container/workshop/device.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-01-13 20:46:33
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-17 23:06:46
 * @LastEditTime: 2024-01-20 20:13:21
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/device.vue
-->
<template>
@@ -20,21 +20,21 @@
                <li>
                    <img src="./img/sd.png" alt="">
                    <div>
                        <p>{{ efficiency}}</p>
                        <p>{{ efficiency }}</p>
                        <p>能力利用率</p>
                    </div>
                </li>
                <li>
                    <img src="./img/sd.png" alt="">
                    <div>
                        <p>{{ utilizationDaily}}</p>
                        <p>{{ utilizationDaily }}</p>
                        <p>日利用率</p>
                    </div>
                </li>
                <li>
                    <img src="./img/sd.png" alt="">
                    <div>
                        <p>{{ info.cycleCount}}</p>
                        <p>{{ info.cycleCount }}</p>
                        <p>完工件数</p>
                    </div>
                </li>
@@ -43,11 +43,11 @@
    </div>
</template>
<script>
import { getRequest,getUrl } from '@/api/Api'
import { getRequest, getUrl } from '@/api/Api'
export default {
    props: {
        id: {
            type: [String,Number]
            type: [String, Number]
        },
        info: {
            type: Object,
@@ -57,41 +57,50 @@
        },
        deviceList: {
            type: Array,
            default: function() {
            default: function () {
                return []
            }
        },
        plantDeviceList: {
            type: Array,
            default: function() {
            default: function () {
                return []
            }
        }
    },
    data () {
    data() {
        return {
            care: false,
            item: {}
        }
    },
    computed: {
        efficiency () {
        efficiency() {
            return this.info.efficiency || 0
        },
        utilizationDaily () {
        utilizationDaily() {
            return this.info.utilizationDaily || 0
        },
        cycleCount () {
        cycleCount() {
            return this.info.cycleCount || 0
        },
        machineName () {
        machineName() {
            let machineName = ''
            try {
                machineName =  this.deviceList.find(item => item.machineId=== this.id).machineName
            } catch (error) {console.error(error)}
            try {
                machineName =  this.plantDeviceList.find(item => item.machineId=== this.id).machineName
            } catch (error) {console.error(error)}
            if (this.deviceList.length > 0) {
                try {
                    machineName = this.deviceList.find(item => item.machineId === this.id).machineName
                } catch (error) {
                    // console.info(error)
                }
            }
            if (this.plantDeviceList.length > 0) {
                try {
                    machineName = this.plantDeviceList.find(item => item.machineId === this.id).machineName
                } catch (error) {
                    // console.info(error)
                }
            }
            if (machineName) {
                return machineName
            }
@@ -99,13 +108,13 @@
        }
    },
    methods: {
        change (val) {
        change(val) {
            console.log(val)
            getRequest('machineConcern',{concern: val ? 1 : 0,id: this.id}).then(res => {
            getRequest('machineConcern', { concern: val ? 1 : 0, id: this.id }).then(res => {
                console.log(res)
            })
        },
        getInfo () {
        getInfo() {
            this.item = {}
        }
    },
@@ -121,12 +130,14 @@
    display: flex;
    flex-direction: column;
    position: relative;
    .care {
        position: absolute;
        right: 5px;
        top: 5px;
        z-index: 999;
    }
    &>p {
        color: #E9FFFF;
        text-shadow: 0px 1px 11px #549BD4;
@@ -136,6 +147,7 @@
        text-align: center;
        position: relative;
    }
    &>p:before {
        content: '';
        position: absolute;
@@ -145,8 +157,9 @@
        transform: translateY(-50%);
        width: 30px;
        height: 1px;
        background: linear-gradient(270deg, #65A5D6 0%, rgba(11,70,115,0) 100%);
        background: linear-gradient(270deg, #65A5D6 0%, rgba(11, 70, 115, 0) 100%);
    }
    &>p:after {
        content: '';
        position: absolute;
@@ -155,8 +168,9 @@
        transform: translateY(-50%);
        width: 30px;
        height: 1px;
        background: linear-gradient(90deg, #65A5D6 0%, rgba(11,70,115,0) 100%);
        background: linear-gradient(90deg, #65A5D6 0%, rgba(11, 70, 115, 0) 100%);
    }
    &>div.device-item-box {
        flex: 1 1 auto;
        margin-top: 20px;
@@ -172,26 +186,31 @@
            border: 1px solid #444C55;
            border-radius: 10px;
            position: relative;
            .img-status {
                position: absolute;
                font-size: 12px;
                right: 10px;
                top: 10px;
                background: rgba(216,216,216,0.09);
                background: rgba(216, 216, 216, 0.09);
                border-radius: 11px;
                // border: 1px solid #FFFFFF;
                padding: 5px 10px;
            }
            .img-status.standby {
                background: linear-gradient(130deg, #FF3333 0%, #F2BF24 100%);
            }
            .img-status.run {
                background: linear-gradient(130deg, #EAF224 0%, #3DF297 100%);
            }
            .img-status.alerm {
                background: #FF3333;
                color: #fff;
            }
            img {
                position: absolute;
                top: 50%;