wxw
2024-09-02 54da8a22c438e1495b9c5fbae75ca9d4b5ca7335
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<template>
    <el-container>
        <el-aside style="width: auto; height: auto;">
            <el-card class="box-card">
                <div slot="header" class="linefix">
                    <span>输送线</span>
                    <div class="lineStatus"></div>
                </div>
                <div class="choosefix">
                    <el-select v-model="lineValue" placeholder="请选择">
                        <el-option v-for="item in lineOptions" :key="item.value" :label="item.label"
                            :value="item.value"></el-option>
                    </el-select>
                    <el-select v-model="stationValue" placeholder="请选择" style="margin-top: 10px;">
                        <el-option v-for="item in stations" :key="item.id" :label="item.stationNum"
                            :value="item.id"></el-option>
                    </el-select>
                </div>
                <div class="lineValuefix">
                    <el-form label-position="left" label-width="80px">
                        <el-form-item label="任务号">
                            <el-input></el-input>
                        </el-form-item>
                        <el-form-item label="任务类型">
                            <el-input></el-input>
                        </el-form-item>
                        <el-form-item label="起始工位">
                            <el-input></el-input>
                        </el-form-item>
                        <el-form-item label="目的工位">
                            <el-input></el-input>
                        </el-form-item>
                        <el-form-item label="托盘码">
                            <el-input></el-input>
                        </el-form-item>
                        <el-form-item label="PLC">
                            <el-input></el-input>
                        </el-form-item>
                        <el-form-item label="WCS">
                            <el-input></el-input>
                        </el-form-item>
                        <el-form-item label="状态">
                            <el-input></el-input>
                        </el-form-item>
                    </el-form>
                </div>
                <div class="lineButtonfix">
                    <el-form label-position="left" label-width="80px">
                        <el-form-item>
                            <el-button>写入</el-button>
                            <el-button>设置</el-button>
                        </el-form-item>
                    </el-form>
                </div>
            </el-card>
        </el-aside>
        <el-main style="padding: 0 0 0 5px;">
            <div class="card-container">
                <el-card class="other-box-card" v-for="deviceInfo in listStackingMachineData" :key="deviceInfo.id">
                    <div slot="header" class="linefix">
                        <span>{{ deviceInfo.text }}</span>
                        <div
                            :class="['lineStatus', { 'device-status-0': deviceInfo.status === true }, { 'device-status-1': deviceInfo.status === false }]">
                        </div>
                    </div>
                    <div class="otherValuefix">
                        <el-form label-position="left" label-width="80px">
                            <el-form-item label="任务号">
                                <el-input v-model="deviceInfo.taskNo"></el-input>
                            </el-form-item>
                            <el-form-item label="任务类型">
                                <el-select clearable="" v-model="deviceInfo.taskType" placeholder="请选择状态">
                                    <el-option v-for="(item, index) in dl('TaskTypeEnum')" :key="index"
                                        :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}] `" />
                                </el-select>
                            </el-form-item>
                            <el-form-item label="PLC">
                                <el-input v-model="deviceInfo.plc"></el-input>
                            </el-form-item>
                            <el-form-item label="WCS">
                                <el-input v-model="deviceInfo.wcs"></el-input>
                            </el-form-item>
                            <el-form-item label="状态">
                                <el-input :value="deviceInfo.status ? '在线' : '离线'" readonly></el-input>
                            </el-form-item>
                        </el-form>
                    </div>
                    <div class="otherButtonfix">
                        <el-form label-position="left">
                            <el-form-item>
                                <el-button>写入</el-button>
                                <el-button>设置</el-button>
                            </el-form-item>
                        </el-form>
                    </div>
                </el-card>
            </div>
        </el-main>
    </el-container>
</template>
 
<script lang="ts" setup>
import { ref, reactive } from 'vue';
import { listWcsDevice } from '/@/api/wcs/wcsDevice';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
 
const stations = ref<any>([]);
const listStackingMachineData = ref<any>([]);
 
const lineValue = ref('1');
const stationValue = ref();
 
// 查询操作
const handleQuery = async () => {
    var res = await listWcsDevice();
    listStackingMachineData.value = res.data.result.filter(s => s.type == 0);
    const listConveyorLineData = res.data.result.filter(s => s.type == 1 || s.type == 4);
    stations.value = {
        '1': listConveyorLineData.filter(s => s.text = '1层托盘输送线'),
        '2': listConveyorLineData.filter(s => s.text = '2层托盘输送线'),
        '3': listConveyorLineData.filter(s => s.text = '3层托盘输送线')
    }
    if (stations.value.length > 0)
        stationValue.value = stations.value[0][0].id;
    debugger;
};
handleQuery();
 
 
const lineOptions = [
    { value: '1', label: '一楼输送线' },
    { value: '2', label: '二楼输送线' },
    { value: '3', label: '三楼输送线' }
];
 
const deviceList = reactive([
    { id: 1, name: '1号码垛机器人', taskNumber: 'T000001', taskType: '', plc: '', wcs: '', status: 0 },
    { id: 2, name: '2号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 1 },
    { id: 3, name: '3号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 },
    { id: 4, name: '4号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 1 },
    { id: 5, name: '5号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 },
    { id: 6, name: '6号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 },
    { id: 7, name: '7号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: '' },
    { id: 8, name: '8号码垛机器人', taskNumber: '', taskType: '', plc: '', wcs: '', status: 0 }
]);
 
const deviceTypeText = (taskType: number) => {
    switch (taskType) {
        case 0:
            return '入库任务'
        case 1:
            return '出库任务'
        case 2:
            return '移库任务'
        case 3:
            return 'PLC申请入库'
    }
    return ''
};
</script>
 
<style scoped>
.text {
    font-size: 14px;
}
 
.item {
    margin-bottom: 18px;
}
 
.linefix {
    border-bottom: 1px solid rgb(197, 195, 195);
    display: flex;
    align-items: center;
    height: 30px;
    position: relative;
}
 
.lineStatus {
    position: absolute;
    right: 0;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background-color: #67C23A;
}
 
.choosefix {
    width: 100%;
    padding: 10px;
    border-bottom: 1px solid rgb(197, 195, 195);
}
 
.box-card {
    width: 100%;
    max-width: 280px;
    background: linear-gradient(135deg, #66ccff, #3399ff);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    color: #fff;
}
 
.lineValuefix {
    width: 100%;
    padding: 10px;
    border-bottom: 1px solid rgb(197, 195, 195);
}
 
.lineButtonfix {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px;
}
 
.otherValuefix {
    width: 100%;
    padding: 10px;
    border-bottom: 1px solid rgb(197, 195, 195);
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Optional, for spacing between form items */
}
 
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}
 
.other-box-card {
    box-sizing: border-box;
    background: linear-gradient(135deg, #66ccff, #3399ff);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    color: #fff;
    display: flex;
    flex-direction: column;
    height: auto;
    /* Ensure card height adjusts based on content */
}
 
.otherButtonfix {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px;
}
 
.device-status-0 {
    background-color: #67C23A;
}
 
.device-status-1 {
    background-color: red;
}
 
.linefix span {
    color: #fff;
}
</style>