forked from drone/command-center-dashboard

chenyao
2025-04-12 80790ccc8b8ee6ac8db201f0f6c2d136fefd5a69
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!-- 机巢列表详情 -->
<template>
    <el-dialog
        modal-class="machineTableDetails"
        v-model="isShowDetails"
        title="机巢详情"
        :width="pxToRem(1500)"
        :close-on-click-modal="false"
        :destroy-on-close="true"
    >
        <el-divider content-position="left">详情</el-divider>
        <div class="infoBox">
            <div class="itemBox" v-for="item in infoList">
                <div class="itemTitle">{{ item.name }}:</div>
                <div class="itemValue">{{ item.value }}</div>
            </div>
        </div>
        <DeviceJob v-if="isShowDetails" />
        <DeviceEvent v-if="isShowDetails" />
    </el-dialog>
</template>
 
<script setup>
import DeviceEvent from '@/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceEvent.vue'
import DeviceJob from '@/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/DeviceJob/DeviceJob.vue'
import { pxToRem } from '@/utils/rem';
import { useStore } from 'vuex'
 
const isShowDetails = defineModel('show')
 
const infoList = ref([
    { name: '机巢名称', value: '',field:'nickname' },
    { name: '机巢所属地区', value: '',field:'device_area' },
    { name: '机巢状态', value: '',field:'status' },
    { name: '任务成功', value: '',field:'result_num' },
    { name: '机巢位置', value: '',field:'address' },
])
const store = useStore();
const singleTotal = computed(() => store.state.home.singleTotal);
watch(singleTotal, (val) => {
    if (val?.device_info){
        infoList.value.forEach(item => {
            item.value = val.device_info?.[item.field] || ''
        })
    }
})
onMounted(() => {
})
</script>
 
<style lang="scss">
.machineTableDetails {
    .el-pagination {
        text-align: left;
        padding: 20px;
    }
}
</style>
 
<style lang="scss" scoped>
.infoBox {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px; // 列之间的间距
    padding: 10px;
 
    .itemBox {
        background-color: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 15px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
 
    .itemTitle {
        font-weight: bold;
        color: #333;
    }
 
    .itemValue {
        margin-top: 5px;
        color: #666;
    }
}
</style>