yangys
2024-01-13 f466ae4fdc645c66c9f25e2e4598b9809e2b41af
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!--
 * @Date: 2024-01-06 17:40:19
 * @LastEditors: Sneed
 * @LastEditTime: 2024-01-13 22:21:35
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/workshop/index.vue
-->
<template>
    <div class="workshop">
        <div class="nav">车间列表 / {{ this.$route.query.name }}</div>
        <div class="workshop-box">
            <LeftStatus :info="info" />
            <div class="right">
                <Status class="right-status" :info="info" style="justify-content: flex-start;">
                    <template slot="before">
                        <div style="margin-right: 200px;">
                            <el-button type="primary" size="mini" :class="concernFlag === 0 ? 'active' : ''"
                                @click="query(0)">全部</el-button>
                            <el-button type="primary" size="mini" :class="concernFlag === 1 ? 'active' : ''"
                                @click="query(1)">关注</el-button>
                            <!-- <el-button type="primary" size="mini" style="margin-right: auto;">我的关注</el-button> -->
                        </div>
                    </template>
                    <template slot="after">
                        <div style="margin-left: auto;margin-right: 20px;">
                            <el-input v-model="searchWord" placeholder="请输入关键词"></el-input>
                        </div>
                    </template>
                </Status>
                <div class="list-box">
                    <div class="list">
                        <Item v-for="item in list" :item="item" :key="item.id"></Item>
                    </div>
                </div>
 
            </div>
        </div>
    </div>
</template>
<script>
import LeftStatus from '../Map/LeftStatus.vue';
import Status from '@/components/newComp/Status';
import { getRequest, getUrl } from '@/api/Api'
import Item from './device.vue'
export default {
    components: {
        LeftStatus,
        Status,
        Item
    },
    data() {
        return {
            concernFlag: 0,
            searchWord: '',
            list: [],
            info: {
                runRate: '',
                cutRate: '',
                alarmRate: '',
                threeShiftRate: '',
                twoShiftRate: '',
                run: '',
                alarm: '',
                stop: '',
                idle: '',
            }
        }
    },
    watch: {
        '$route.params.id'() {
            this.query()
        }
    },
    mounted() {
        this.query()
    },
    methods: {
        query(flag) {
            if (flag !== undefined) {
                this.concernFlag = flag
            }
            getRequest('machineList', {
                plantId: this.$route.params.id,
                concernFlag: this.concernFlag,
            }).then(res => {
                console.log(res)
                this.list = res.data.list
                this.info = {
                    runRate: res.data.runRate,
                    cutRate: res.data.cutRate,
                    alarmRate: res.data.alarmRate,
                    threeShiftRate: res.data.threeShiftRate,
                    twoShiftRate: res.data.twoShiftRate,
                    run: res.data.run,
                    alarm: res.data.alarm,
                    stop: res.data.stop,
                    idle: res.data.idle
                }
            })
        }
    },
}
</script>
<style lang="scss" scoped>
.workshop {
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: #FFF;
    display: flex;
    flex-direction: column;
 
    .nav {
        padding: 10px 30px;
        font-size: 14px;
    }
 
    .workshop-box {
        width: 100%;
        height: 100%;
        flex: 1 1 auto;
        display: flex;
 
        .right {
            width: 100%;
            height: 100%;
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            .right-status {
                margin-bottom: 20px;
            }
            .list-box {
                width: 100%;
                height: 100%;
                overflow: auto;
                flex: 1 1 auto;
                // border: 1px solid red;
                padding: 20px;
                .list {
                    display: flex;
                    flex-wrap: wrap;
                    width: 100%;
                    &>div {
                        margin: 10px;
                    }
                }
                
            }
        }
 
    }
}</style>