chengsc
2025-04-14 d2588d8d1305171e7716055b23a6b5706e9cc04b
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
<template>
    <div class="wcsAlarmInfo-container">
        <el-dialog v-model="isShowDialog" :width="800" draggable="" :close-on-click-modal="false">
            <template #header>
                <div class="dialog-header">
                    <span>{{ props.title }}</span>
                </div>
            </template>
 
            <el-card class="box-card" shadow="hover">
                <template #header>
                    <div class="card-header">
 
                        <div>
                            <span>工位号:</span>
                            <el-select v-model="stationValue" placeholder="请选择" filterable value-key="stationNum"
                                style="width: 200px;">
                                <el-option v-for="item in listStationsData" :key="item.id" :label="item.stationNum"
                                    :value="item">
                                </el-option>
                            </el-select>
                            <!-- <el-button style="margin-left: 10px;">自动</el-button> -->
                        </div>
                        <div>
                            <div :class="['lineStatus', stationValue.status ? 'device-status-0' : 'device-status-1']">
                            </div>
                        </div>
                    </div>
                </template>
                <div>
                    <el-form label-position="left" label-width="80px">
                        <el-row :gutter="25">
                            <el-col :span="12">
                                <el-form-item label="任务号">
                                    <el-input v-model="stationValue.taskNo"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="任务类型">
                                    <el-select clearable="" v-model="stationValue.taskType" placeholder="请选择状态">
                                        <el-option v-for="(item, index) in dl('TaskTypeEnum')" :key="index"
                                            :value="Number(item.value)" :label="`${item.name} [${item.value}] `" />
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="起始工位">
                                    <el-input v-model="stationValue.startLocatNo"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="目的工位">
                                    <el-input v-model="stationValue.endLocatNo"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="PLC">
                                    <el-input v-model="stationValue.plc"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="WCS">
                                    <el-input v-model="stationValue.wcs"></el-input>
                                </el-form-item>
                            </el-col>
 
                            <el-col :span="12">
                                <el-form-item label="取货排">
                                    <el-input v-model="stationValue.pickRow"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="放货排">
                                    <el-input v-model="stationValue.releaseRow"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="取货列">
                                    <el-input v-model="stationValue.pickCol"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="放货列">
                                    <el-input v-model="stationValue.releaseCol"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="取货层">
                                    <el-input v-model="stationValue.pickStorey"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="放货层">
                                    <el-input v-model="stationValue.releaseStorey"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="托盘码">
                                    <el-input v-model="stationValue.palletNo"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="状态">
                                    <el-input :value="stationValue.status ? '在线' : '离线'" readonly></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                    </el-form>
                    <div style="text-align: center;margin: 10px;">
                        <el-button class="button" size="large" @click="write(stationValue)">写入数据</el-button>
                    </div>
                </div>
                <!-- <template #footer>
                    <div class="card-footer">
                        <el-button class="button" size="large">正&nbsp;&nbsp;&nbsp;&nbsp;转</el-button>
                        <el-button class="button" size="large">反&nbsp;&nbsp;&nbsp;&nbsp;转</el-button>
                        <el-button class="button" size="large">移栽上升</el-button>
                        <el-button class="button" size="large">移栽下降</el-button>
                    </div>
                </template> -->
            </el-card>
 
            <!-- <template #footer>
                <span class="dialog-footer">
                    <el-button @click="closeDialog" type="primary">关 闭</el-button>
                </span>
            </template> -->
        </el-dialog>
    </div>
</template>
 
<script lang="ts" setup>
import { ref, defineModel } from 'vue';
import { writeValue } from '/@/api/wcs/wcsDevice';
import { ElMessageBox, ElMessage } from 'element-plus';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
const listStationsData = defineModel<any>("listStationsData")
const stationValue = defineModel<any>("stationValue")
 
const props = defineProps({
    title: {
        type: String,
        default: '',
    }
});
// const emit = defineEmits<{ (e: "update:listStationsData", value: Array<any>): void, (e: "update:stationValue", value): void }>()
 
// const handlestationChange = () => {
//     emit('update:listStationsData', listStationsData.value);
//     emit('update:stationValue', stationValue);
// };
const write = async (row: any) => {
    await writeValue(row);
    ElMessage.success('写入成功!');
}
const isShowDialog = ref(false);
 
const openDialog = async (row: any) => {
    console.log(listStationsData.value);
    debugger;
    isShowDialog.value = true;
};
 
const closeDialog = () => {
    isShowDialog.value = false;
};
 
defineExpose({ openDialog });
</script>
 
<style>
.el-col {
    margin-bottom: 15px;
}
 
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    padding: 10px;
    border-radius: 10px 10px 0 0;
}
 
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
 
.text {
    font-size: 14px;
    color: #fff;
}
 
.item {
    margin-bottom: 18px;
}
 
.box-card {
    width: 100%;
    background: linear-gradient(135deg, #66ccff, #3399ff);
    border-radius: 10px;
    color: #fff;
}
 
.dialog-footer {
    display: flex;
    justify-content: flex-end;
    padding: 10px;
}
 
.lineStatus {
    right: 0;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background-color: #67C23A;
}
 
.device-status-0 {
    background-color: #67C23A;
}
 
.device-status-1 {
    background-color: red;
}
</style>