提交 | 用户 | 时间
|
0ca254
|
1 |
<template> |
A |
2 |
<div class="app-container"> |
|
3 |
<el-row :gutter="5"> |
|
4 |
<el-col :span="7"> |
|
5 |
<el-card shadow="never"> |
|
6 |
<span class="head-font">工位编号 : {{headContent.processesCode}}</span> |
|
7 |
</el-card> |
|
8 |
</el-col> |
|
9 |
<el-col :span="7"> |
|
10 |
<el-card shadow="never"> |
|
11 |
<span class="head-font">工位名称 : {{headContent.processesName}}</span> |
|
12 |
</el-card> |
|
13 |
</el-col> |
|
14 |
<el-col :span="10"> |
|
15 |
<el-card shadow="never"> |
|
16 |
<span class="head-font">产品序列号 : {{headContent.sfcCode}}</span> |
|
17 |
<!-- <el-input v-model="content" style="float: right;width: 150px;" placeholder="请输入内容"></el-input>--> |
|
18 |
<!-- <el-button @click="scanCompleted" style="float: right" type="primary">扫码完成</el-button>--> |
|
19 |
<el-button type="primary" style="float: right" icon="el-icon-search" size="mini" @click="serialLink">串口连接</el-button> |
|
20 |
<el-button @click="clearClick" style="float: right" type="danger" size="mini">清除</el-button> |
|
21 |
</el-card> |
|
22 |
</el-col> |
|
23 |
|
|
24 |
</el-row> |
|
25 |
<el-row :gutter="5" style="margin-top: 5px"> |
|
26 |
<el-col :span="7" > |
|
27 |
<el-card class="bottom-card"> |
|
28 |
<div slot="header" class="clearfix"> |
|
29 |
<i class="el-icon-tickets"></i> |
|
30 |
<span style="font-weight: bold">当前工件信息</span> |
|
31 |
</div> |
|
32 |
<el-descriptions :column="1" border :content-style="{'min-width': '140px'}"> |
|
33 |
<el-descriptions-item label="工单编号"> |
|
34 |
<span>{{workpieceInformation.workOrderNo}}</span> |
|
35 |
</el-descriptions-item> |
653b17
|
36 |
<el-descriptions-item label="物料编码"> |
A |
37 |
<span>{{workpieceInformation.materialCode}}</span> |
0ca254
|
38 |
</el-descriptions-item> |
653b17
|
39 |
<el-descriptions-item label="计划数量"> |
A |
40 |
<span>{{workpieceInformation.planQty}}</span> |
0ca254
|
41 |
</el-descriptions-item> |
A |
42 |
<el-descriptions-item label="开始时间"> |
|
43 |
<span>{{workpieceInformation.inboundTime}}</span> |
|
44 |
</el-descriptions-item> |
|
45 |
</el-descriptions> |
|
46 |
<el-divider></el-divider> |
|
47 |
<el-row> |
|
48 |
<el-col :span="12"> |
|
49 |
<el-button class="circle-button" :class="cakeLamp.plcState ? 'circle-green-animate':'circle-red'" circle></el-button> |
|
50 |
<span style="display: none">{{cakeLamp.plcState}}</span> |
|
51 |
<span> PLC状态</span> |
|
52 |
</el-col> |
|
53 |
<el-col :span="12"> |
|
54 |
<el-button class="circle-button" :class="cakeLamp.scannerState ? 'circle-green-animate':'circle-red'" circle></el-button> |
|
55 |
<span style="display: none">{{cakeLamp.scannerState}}</span> |
|
56 |
<span> 扫码枪状态</span> |
|
57 |
</el-col> |
|
58 |
</el-row> |
|
59 |
<el-row style="margin-top: 20px"> |
|
60 |
<el-col :span="12"> |
|
61 |
<el-button class="circle-button" :class="cakeLamp.InPlace ? 'circle-green':'circle-red'" circle></el-button> |
|
62 |
<span style="display: none">{{cakeLamp.InPlace}}</span> |
|
63 |
<span> 工件到位</span> |
|
64 |
</el-col> |
|
65 |
<el-col :span="12"> |
|
66 |
<el-button class="circle-button" :class="cakeLamp.scanFinish ? 'circle-green':'circle-red'" circle></el-button> |
|
67 |
<span style="display: none">{{cakeLamp.scanFinish}}</span> |
|
68 |
<span> 扫码完成</span> |
|
69 |
</el-col> |
|
70 |
</el-row> |
|
71 |
<el-row style="margin-top: 20px"> |
|
72 |
<el-col :span="12"> |
|
73 |
<el-button class="circle-button" :class="cakeLamp.startWork ? 'circle-green':'circle-red'" circle></el-button> |
|
74 |
<span style="display: none">{{cakeLamp.startWork}}</span> |
|
75 |
<span> 开始作业</span> |
|
76 |
</el-col> |
|
77 |
<el-col :span="12"> |
|
78 |
<el-button class="circle-button" :class="cakeLamp.release ? 'circle-green':'circle-red'" circle></el-button> |
|
79 |
<span style="display: none">{{cakeLamp.release}}</span> |
|
80 |
<span> 允许放行</span> |
|
81 |
</el-col> |
|
82 |
</el-row> |
22c9e0
|
83 |
<el-row v-show="orderFlag" style="margin-top: 20px"> |
A |
84 |
<el-button @click="getWorkOrders" type="warning" size="mini">接收工单</el-button> |
0ca254
|
85 |
</el-row> |
A |
86 |
<!-- <el-row v-show="showInput" style="margin-top: 20px">--> |
|
87 |
<!-- <el-button @click="bindYzSfc" type="primary">绑定</el-button>--> |
|
88 |
<!-- </el-row>--> |
|
89 |
|
|
90 |
<!-- <el-row v-show="onLineBinDing" style="margin-top: 20px">--> |
|
91 |
<!-- <el-col></el-col>--> |
|
92 |
<!-- <span style="width: 130px;" class="head-font">小车码 : {{headContent.cardCode}}</span>--> |
|
93 |
<!-- </el-row>--> |
|
94 |
<!-- <el-row v-show="onLineBinDing" style="margin-top: 20px">--> |
|
95 |
<!-- <el-button @click="bindcardCode" type="primary">绑定</el-button>--> |
|
96 |
<!-- </el-row>--> |
|
97 |
</el-card> |
|
98 |
|
|
99 |
</el-col> |
|
100 |
<el-col :span="17"> |
|
101 |
<el-tabs type="border-card" style="height: 600px" v-model="activeName" @tab-click="changeMenu"> |
|
102 |
<el-tab-pane name="first"> |
|
103 |
<span slot="label"> <a class="el-icon-date"></a>首页</span> |
|
104 |
<el-col :span="24"> |
|
105 |
<el-table height="500" :cell-style="rowStyle" :data="formulaChildList"> |
|
106 |
<!-- <el-table-column label="排序" width="60" align="center" type="index">--> |
|
107 |
<!-- </el-table-column>--> |
|
108 |
<el-table-column label="拧紧步号" width="80" align="center" prop="stepSort"> |
|
109 |
</el-table-column> |
|
110 |
<el-table-column label="操作内容" align="center" prop="operationSteps"> |
|
111 |
</el-table-column> |
|
112 |
<!-- <el-table-column label="上限" width="60" align="center" prop="spareField3">--> |
|
113 |
<!-- </el-table-column>--> |
|
114 |
<!-- <el-table-column label="下限" width="60" align="center" prop="spareField4">--> |
|
115 |
<!-- </el-table-column>--> |
|
116 |
<el-table-column label="产品编号" width="80" align="center" prop="productCode"> |
|
117 |
</el-table-column> |
|
118 |
<el-table-column label="物料编码" width="110" align="center" prop="materialCode"> |
|
119 |
</el-table-column> |
|
120 |
<el-table-column label="采集值" align="center" prop="collectData"> |
|
121 |
</el-table-column> |
|
122 |
<el-table-column label="结果" width="60" align="center" prop="results"> |
|
123 |
</el-table-column> |
|
124 |
|
|
125 |
</el-table> |
|
126 |
</el-col> |
|
127 |
<!-- <el-col :span="14">--> |
|
128 |
<!-- <el-image style="height: 520px;width: 100%" :src="imgSrc"></el-image>--> |
|
129 |
<!-- </el-col>--> |
|
130 |
</el-tab-pane> |
|
131 |
<!-- <el-tab-pane name="second">--> |
|
132 |
<!-- <span slot="label"> <b class="el-icon-date"></b>物料BOM</span>--> |
|
133 |
<!-- <el-empty>--> |
|
134 |
<!-- <span slot="description">暂无数据</span>--> |
|
135 |
<!-- </el-empty>--> |
|
136 |
<!-- </el-tab-pane>--> |
|
137 |
<!-- <el-tab-pane name="third">--> |
|
138 |
<!-- <span slot="label"> <b class="el-icon-date"></b>采集清单</span>--> |
|
139 |
<!-- <el-empty>--> |
|
140 |
<!-- <span slot="description">暂无数据</span>--> |
|
141 |
<!-- </el-empty>--> |
|
142 |
<!-- </el-tab-pane>--> |
|
143 |
<!-- <el-tab-pane name="fourth">--> |
|
144 |
<!-- <span slot="label"> <b class="el-icon-date"></b>安灯状态</span>--> |
|
145 |
<!-- <el-empty>--> |
|
146 |
<!-- <span slot="description">暂无数据</span>--> |
|
147 |
<!-- </el-empty>--> |
|
148 |
<!-- </el-tab-pane>--> |
|
149 |
<!-- <el-tab-pane name="fifth">--> |
|
150 |
<!-- <span slot="label"> <b class="el-icon-date"></b>工艺配方</span>--> |
|
151 |
<!-- <el-empty>--> |
|
152 |
<!-- <span slot="description">暂无数据</span>--> |
|
153 |
<!-- </el-empty>--> |
|
154 |
<!-- </el-tab-pane>--> |
|
155 |
</el-tabs> |
|
156 |
</el-col> |
|
157 |
</el-row> |
|
158 |
<el-dialog v-dialogpop-up :title="title" :visible.sync="open1" width="1000" append-to-body> |
|
159 |
<el-row |
|
160 |
type="flex" |
|
161 |
class="row-bg" |
|
162 |
justify="center" |
|
163 |
v-show="portsList.length === 0" |
|
164 |
> |
|
165 |
<el-col :span="7"> |
|
166 |
<div style="margin-top: 400px"> |
|
167 |
<span style="display: block"> |
|
168 |
仅支持Chrome 89+或者Edge 89+浏览器(安全上下文(HTTPS)中可用) |
|
169 |
</span> |
|
170 |
<el-button type="primary" @click="obtainAuthorization">授权</el-button> |
|
171 |
</div> |
|
172 |
</el-col> |
|
173 |
</el-row> |
|
174 |
<el-form |
|
175 |
v-show="portsList.length > 0" |
|
176 |
ref="form1" |
|
177 |
:model="form1" |
|
178 |
label-width="100px"> |
|
179 |
<el-row> |
|
180 |
<el-col :span="24" |
|
181 |
><div> |
|
182 |
<el-form-item label="串口"> |
|
183 |
<el-select |
|
184 |
v-model="form1.port" |
|
185 |
filterable |
|
186 |
placeholder="请选择串口" |
|
187 |
:disabled="isDisable" |
|
188 |
> |
|
189 |
<el-option |
|
190 |
v-for="item in portsList" |
|
191 |
:key="item.value" |
|
192 |
:label="item.label" |
|
193 |
:value="item.value" |
|
194 |
> |
|
195 |
</el-option> |
|
196 |
</el-select> |
|
197 |
</el-form-item> |
|
198 |
<el-form-item label="波特率"> |
|
199 |
<el-autocomplete |
|
200 |
popper-class="my-autocomplete" |
|
201 |
v-model="form1.baudRate" |
|
202 |
:fetch-suggestions="querySearch" |
|
203 |
placeholder="请输入波特率" |
|
204 |
:disabled="isDisable" |
|
205 |
> |
|
206 |
<i class="el-icon-edit el-input__icon" slot="suffix"> </i> |
|
207 |
<template slot-scope="{ item }"> |
|
208 |
<div class="name">{{ item.value }}</div> |
|
209 |
<span class="addr">{{ item.address }}</span> |
|
210 |
</template> |
|
211 |
</el-autocomplete> |
|
212 |
</el-form-item> |
|
213 |
<el-form-item label="数据位"> |
|
214 |
<el-select |
|
215 |
v-model="form1.dataBits" |
|
216 |
placeholder="请选择数据位" |
|
217 |
:disabled="isDisable" |
|
218 |
> |
|
219 |
<el-option label="7" value="7"></el-option> |
|
220 |
<el-option label="8" value="8"></el-option> |
|
221 |
</el-select> |
|
222 |
</el-form-item> |
|
223 |
<el-form-item label="停止位"> |
|
224 |
<el-select |
|
225 |
v-model="form1.stopBits" |
|
226 |
placeholder="请选择停止位" |
|
227 |
:disabled="isDisable" |
|
228 |
> |
|
229 |
<el-option label="1" value="1"></el-option> |
|
230 |
<el-option label="2" value="2"></el-option> |
|
231 |
</el-select> |
|
232 |
</el-form-item> |
|
233 |
|
|
234 |
<el-form-item label="校验位"> |
|
235 |
<el-select |
|
236 |
v-model="form1.parity" |
|
237 |
placeholder="请选择校验位" |
|
238 |
:disabled="isDisable" |
|
239 |
> |
|
240 |
<el-option label="None" value="none"></el-option> |
|
241 |
<el-option label="Even" value="even"></el-option> |
|
242 |
<el-option label="Odd" value="odd"></el-option> |
|
243 |
</el-select> |
|
244 |
</el-form-item> |
|
245 |
|
|
246 |
<el-form-item label="流控制"> |
|
247 |
<el-select |
|
248 |
v-model="form1.flowControl" |
|
249 |
placeholder="请选择流控制" |
|
250 |
:disabled="isDisable" |
|
251 |
> |
|
252 |
<el-option label="None" value="none"></el-option> |
|
253 |
<el-option label="HardWare" value="hardware"></el-option> |
|
254 |
</el-select> |
|
255 |
</el-form-item> |
|
256 |
<el-form-item label="显示历史"> |
|
257 |
<el-switch |
|
258 |
v-model="form1.isShowHistory" |
|
259 |
@change="loadHistory" |
|
260 |
></el-switch> |
|
261 |
<el-button |
|
262 |
type="danger" |
|
263 |
icon="el-icon-delete" |
|
264 |
circle |
|
265 |
title="清空历史" |
|
266 |
@click="clearHistory" |
|
267 |
></el-button> |
|
268 |
</el-form-item> |
|
269 |
<el-form-item label="发送区设置" v-show="isShowSendArea"> |
|
270 |
<el-form-item label="发送格式"> |
|
271 |
<el-radio-group v-model="form1.type"> |
|
272 |
<el-radio label="1">ASCII</el-radio> |
|
273 |
<el-radio label="2">HEX</el-radio> |
|
274 |
</el-radio-group> |
|
275 |
</el-form-item> |
|
276 |
<el-form-item label="发送信息"> |
|
277 |
<el-input type="textarea" v-model="form1.sendMsg"></el-input> |
|
278 |
</el-form-item> |
|
279 |
<el-button type="primary" @click="sendCommon">发送</el-button> |
|
280 |
</el-form-item> |
|
281 |
|
|
282 |
<el-form-item> |
|
283 |
<el-button :type="btnType" @click="connectBtn">{{ |
|
284 |
btnText |
|
285 |
}}</el-button> |
|
286 |
<el-button type="info" @click="obtainAuthorization" |
|
287 |
>新增授权</el-button |
|
288 |
> |
|
289 |
</el-form-item> |
|
290 |
</div> |
|
291 |
</el-col> |
|
292 |
</el-row> |
|
293 |
</el-form> |
|
294 |
</el-dialog> |
|
295 |
</div> |
|
296 |
</template> |
|
297 |
<script> |
|
298 |
import {listWorkReport} from "@/api/main/om/workReport/workReport"; |
|
299 |
import {listStationConf,getIpv4} from "@/api/main/sc/stationConf"; |
|
300 |
import { |
|
301 |
clearWorkpieceRelease, |
7ae9a9
|
302 |
fistSetpNumber, initializedData, |
0ca254
|
303 |
listFormulaChild, |
A |
304 |
noPageListFormulaChild, |
2aae2d
|
305 |
releaseCheck, unfinishedProcess, |
0ca254
|
306 |
updateResults, |
A |
307 |
updateTighteningFormula, |
|
308 |
workpieceRelease |
|
309 |
} from "@/api/main/bs/formulaChild/formulaChild"; |
|
310 |
import MySerialPort from "@/utils/MySerialPort"; |
|
311 |
import USBDevice from "@/utils/usb.json"; |
|
312 |
import { |
|
313 |
bindYzSfcFlag, |
|
314 |
checkCarCode, checkYzSfcCode, |
517d1a
|
315 |
findBytrolleyYardGetOne, getProductionOrdeOneBySfcCode, |
22c9e0
|
316 |
listProductionOrde, mozuReceivingWorkOrders, |
0ca254
|
317 |
receivingWorkOrders, |
A |
318 |
trolleyYardBinDing |
|
319 |
} from "@/api/main/om/productionOrde/productionOrde"; |
|
320 |
import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection"; |
|
321 |
import { |
|
322 |
addBasicParameters, |
|
323 |
addParamCollection, |
|
324 |
addTighteningParameters, |
|
325 |
saveCampaignTimeParameters, |
|
326 |
replaceAssemblyCode, checkRecordDataDone, |
|
327 |
} from "@/api/main/da/paramCollection/paramCollection"; |
22c9e0
|
328 |
import {addFormula} from "@/api/main/bs/formula/formula"; |
0ca254
|
329 |
|
A |
330 |
export default { |
|
331 |
name: "stationTerminal", |
|
332 |
data() { |
|
333 |
return { |
|
334 |
carCode: '', |
|
335 |
showInput: false, |
|
336 |
onLineBinDing: false, |
|
337 |
|
|
338 |
serialPortContent: '', |
|
339 |
// 查询参数 |
|
340 |
formulaChildParams: { |
|
341 |
pageNum: 1, |
|
342 |
pageSize: 10, |
|
343 |
productCode: null, |
|
344 |
processesCode: null, |
|
345 |
}, |
|
346 |
// 配方配置子信息表格数据 |
|
347 |
formulaChildList: [], |
|
348 |
ipAddress: '', |
|
349 |
imgSrc: '', |
|
350 |
headContent: { |
|
351 |
processesCode: 'OP1010', |
|
352 |
processesName: '贴标机-贴码', |
|
353 |
sfcCode: '', |
|
354 |
yzSfcCode: '', |
|
355 |
cardCode: '', |
|
356 |
}, |
|
357 |
workpieceInformation: { |
|
358 |
workOrderNo: null, |
|
359 |
productCode: null, |
|
360 |
productModel: null, |
|
361 |
productName: null, |
|
362 |
inboundTime: null, |
653b17
|
363 |
materialCode: null, |
A |
364 |
planQty: null, |
0ca254
|
365 |
}, |
A |
366 |
// 查询参数 |
|
367 |
queryParams: { |
|
368 |
pageNum: 1, |
|
369 |
pageSize: 10, |
|
370 |
sfcCode: null, |
|
371 |
}, |
|
372 |
// 查询参数 |
|
373 |
StationConfQueryParams: { |
|
374 |
pageNum: 1, |
|
375 |
pageSize: 10, |
|
376 |
ipAddress: null, |
|
377 |
}, |
|
378 |
cakeLamp: { |
|
379 |
plcState: 1, //plc |
|
380 |
scannerState: 1, //扫码枪 |
|
381 |
InPlace: 0, //工件到位 |
|
382 |
scanFinish: 0, |
|
383 |
startWork: 0, |
|
384 |
release: 0 //允许放行 |
|
385 |
}, |
|
386 |
content: '', |
|
387 |
activeName: 'first', |
7597c6
|
388 |
// url: "ws://10.103.210.248:8080/websocket/message/", |
A |
389 |
url: "ws://192.168.10.100:8080/websocket/message/", |
0ca254
|
390 |
message: "", |
A |
391 |
text_content: "", |
|
392 |
ws: null, |
|
393 |
inputValue: '9', |
|
394 |
|
|
395 |
open1: false, |
|
396 |
input: "", |
|
397 |
keepReading: true, |
|
398 |
form1: { |
|
399 |
baudRate: "115200", |
|
400 |
dataBits: "8", |
|
401 |
stopBits: "1", |
|
402 |
parity: "none", |
|
403 |
flowControl: "none", |
|
404 |
desc: "", |
|
405 |
type: "1", |
|
406 |
isShowHistory: false, |
|
407 |
}, |
|
408 |
btnType: "primary", |
|
409 |
btnText: "连接串口", |
|
410 |
restaurants: [], |
|
411 |
portsList: [], |
|
412 |
isShowSendArea: false, |
|
413 |
readType: 1, |
|
414 |
title: "", |
|
415 |
|
|
416 |
passingStationForm: {}, |
|
417 |
originalArray: [], |
|
418 |
yzSfcFlag: 1, |
|
419 |
endYz: false, |
22c9e0
|
420 |
orderFlag: true |
0ca254
|
421 |
} |
A |
422 |
}, |
|
423 |
beforeDestroy() { |
|
424 |
this.exit(); |
|
425 |
}, |
|
426 |
created() { |
|
427 |
this.initStation(); |
|
428 |
// this.getStationConfList(); |
|
429 |
// setTimeout(() => { |
|
430 |
// this.connectWebsocket(); |
|
431 |
// }, 3000); |
|
432 |
}, |
|
433 |
mounted() { |
|
434 |
if ("serial" in navigator) { |
|
435 |
this.myserialport = new MySerialPort(); |
|
436 |
this.getPorts(); |
|
437 |
navigator.serial.addEventListener("connect", (e) => { |
|
438 |
this.$message.success("设备已连接"); |
|
439 |
this.getPorts(); |
|
440 |
}); |
|
441 |
navigator.serial.addEventListener("disconnect", (e) => { |
|
442 |
this.$message.error("设备已断开"); |
|
443 |
}); |
|
444 |
this.restaurants = this.loadAll(); |
|
445 |
} else { |
|
446 |
this.$message.error( |
|
447 |
"当前为HTTP模式或者浏览器版本过低,不支持网页连接串口" |
|
448 |
); |
|
449 |
} |
|
450 |
}, |
|
451 |
computed: { |
|
452 |
isDisable() { |
|
453 |
return this.btnType === "danger"; |
|
454 |
}, |
|
455 |
}, |
|
456 |
methods: { |
22c9e0
|
457 |
getWorkOrders(){ |
A |
458 |
if(this.headContent.sfcCode === '' || this.headContent.sfcCode === null){ |
|
459 |
//接收工单 |
|
460 |
const param = { |
|
461 |
lineCode: this.headContent.processesCode |
|
462 |
} |
|
463 |
mozuReceivingWorkOrders(param).then(response => { |
|
464 |
this.headContent.sfcCode = response.msg; |
|
465 |
this.queryParams.productNum = response.msg; |
|
466 |
this.getList() |
|
467 |
this.cakeLamp.scanFinish = 1 |
|
468 |
this.cakeLamp.startWork = 1 |
09ceef
|
469 |
this.cakeLamp.InPlace = 1 |
22c9e0
|
470 |
}); |
A |
471 |
}else { |
|
472 |
this.$message.error("已经有工单了,不能接收!"); |
|
473 |
} |
|
474 |
}, |
0ca254
|
475 |
bindcardCode(scanValue){ |
A |
476 |
// this.$message('绑定成功!'); |
|
477 |
let param = { |
|
478 |
productNum: this.headContent.sfcCode, |
|
479 |
trolleyYard: scanValue, |
|
480 |
} |
|
481 |
trolleyYardBinDing(param).then(response => { |
|
482 |
}); |
|
483 |
|
|
484 |
}, |
|
485 |
serialLink() { |
|
486 |
this.open1 = true |
|
487 |
}, |
|
488 |
bindYzSfc(){ |
|
489 |
if(this.headContent.sfcCode!==""&&this.headContent.yzSfcCode!==""){ |
|
490 |
let param = { |
|
491 |
sfcCode: this.headContent.sfcCode, |
|
492 |
locationCode: this.headContent.processesCode, |
|
493 |
yzSfcCode: this.headContent.yzSfcCode |
|
494 |
} |
|
495 |
const orderParam = { |
|
496 |
productNum: this.headContent.sfcCode, |
|
497 |
} |
|
498 |
replaceAssemblyCode(param).then(response => { |
|
499 |
this.$message('绑定成功!'); |
|
500 |
bindYzSfcFlag(orderParam).then(response => { |
|
501 |
this.yzSfcFlag = 1 |
|
502 |
}); |
|
503 |
}); |
|
504 |
} |
|
505 |
}, |
|
506 |
Release(){ |
|
507 |
// this.$message('portsList!'+this.portsList.length); |
|
508 |
if(this.btnType === "danger"){ |
|
509 |
this.$message('连接了!'); |
|
510 |
|
|
511 |
}else { |
|
512 |
this.$message('mei连接了!'); |
|
513 |
|
|
514 |
} |
|
515 |
}, |
|
516 |
serialPortMethod(value){ |
|
517 |
let formulaChildParams = { |
|
518 |
scanBarcode: value, |
|
519 |
sfcBarcode: this.headContent.sfcCode, |
|
520 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
521 |
productCode: this.workpieceInformation.productCode, |
|
522 |
locationCode: this.headContent.processesCode, |
|
523 |
collectionTime: new Date() |
|
524 |
} |
|
525 |
updateResults(formulaChildParams).then(response => { |
|
526 |
console.log(response) |
|
527 |
if(response.msg === "3"){ |
|
528 |
this.cakeLamp.release= 1 //允许放行 |
|
529 |
}else if(response.msg === "2"){ |
|
530 |
this.$message.error('扫码重复请重新扫码!'); |
|
531 |
} |
|
532 |
this.getListFormulaChild() |
|
533 |
}); |
|
534 |
}, |
|
535 |
rowStyle({ row }) { |
|
536 |
if (row.results === 'OK') { |
|
537 |
return 'background-color: PaleGreen'; |
|
538 |
} else if (row.results === 'NG') { |
|
539 |
return 'background-color: LightSalmon'; |
|
540 |
} |
|
541 |
return ''; |
|
542 |
}, |
|
543 |
/** 查询配方配置子信息列表 */ |
|
544 |
getListFormulaChild() { |
|
545 |
// this.formulaChildList = [] |
|
546 |
this.formulaChildParams.productCode = this.workpieceInformation.productCode |
|
547 |
this.formulaChildParams.processesCode = this.headContent.processesCode |
|
548 |
console.log(this.formulaChildParams) |
|
549 |
noPageListFormulaChild(this.formulaChildParams).then(response => { |
|
550 |
this.formulaChildList = response.rows; |
|
551 |
if (this.formulaChildList.length >0){ |
|
552 |
let pos = 0 |
|
553 |
const tempArr = this.formulaChildList.filter(x=> 'OK' === x.results) |
|
554 |
if (tempArr.length>0){ |
|
555 |
pos = tempArr.length |
|
556 |
this.$nextTick(() => { |
|
557 |
let temp33 = document.getElementsByClassName('el-table__row') |
|
558 |
console.log('temp33',temp33) |
|
559 |
console.log('len',temp33.item(pos)) |
|
560 |
if (temp33.length > 0){ |
|
561 |
console.log('1111111111111111') |
|
562 |
let arr = temp33[pos-1] |
|
563 |
console.log('srr',arr) |
|
564 |
arr.scrollIntoView({ block: 'center' }) |
|
565 |
} |
|
566 |
}) |
|
567 |
} |
|
568 |
|
|
569 |
} |
|
570 |
|
|
571 |
}); |
|
572 |
}, |
|
573 |
endClear(){ |
|
574 |
this.cakeLamp.InPlace= 0 //工件到位 |
|
575 |
this.cakeLamp.scanFinish= 0 |
|
576 |
this.cakeLamp.startWork= 0 |
|
577 |
this.cakeLamp.release= 0 //允许放行 |
|
578 |
|
|
579 |
this.formulaChildList = [] |
|
580 |
this.workpieceInformation.productCode = null; |
|
581 |
this.workpieceInformation.workOrderNo = null; |
|
582 |
this.workpieceInformation.productModel = null; |
|
583 |
this.workpieceInformation.productName = null; |
|
584 |
this.workpieceInformation.inboundTime = null; |
|
585 |
this.headContent.sfcCode = ''; |
|
586 |
this.headContent.yzSfcCode = ''; |
|
587 |
this.headContent.cardCode = ''; |
|
588 |
}, |
|
589 |
changeMenu(tab, event) { |
|
590 |
console.log(tab, event); |
|
591 |
}, |
|
592 |
clearClick(){ |
|
593 |
const param = { |
|
594 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
595 |
productCode: this.workpieceInformation.productCode, |
|
596 |
locationCode: this.headContent.processesCode, |
|
597 |
productBarcode: this.headContent.sfcCode, |
|
598 |
} |
|
599 |
this.endClear() |
|
600 |
clearWorkpieceRelease(param).then(response => {}); |
|
601 |
this.headContent.sfcCode = '' |
|
602 |
this.$message('清除成功!'); |
|
603 |
}, |
|
604 |
scanCompleted(){ |
|
605 |
this.$message('扫码完成'+this.content); |
|
606 |
this.headContent.sfcCode = this.content |
|
607 |
this.queryParams.sfcCode = this.content |
|
608 |
this.getList() |
|
609 |
this.getListFormulaChild() |
|
610 |
this.cakeLamp.scanFinish = 1 |
|
611 |
this.cakeLamp.startWork = 1 |
|
612 |
|
|
613 |
}, |
|
614 |
/** 查询工单列表 */ |
|
615 |
async getList() { |
517d1a
|
616 |
await getProductionOrdeOneBySfcCode(this.queryParams).then(response => { |
A |
617 |
if(response.code === 200){ |
|
618 |
const rowsData = response.data |
|
619 |
this.workpieceInformation.workOrderNo = rowsData.workOrderNo; |
|
620 |
this.workpieceInformation.productCode = rowsData.productCode; |
|
621 |
this.workpieceInformation.materialCode = rowsData.materialCode; |
|
622 |
this.workpieceInformation.planQty = rowsData.planQty; |
|
623 |
this.headContent.cardCode = rowsData.trolleyYard; |
|
624 |
|
|
625 |
this.getListFormulaChild() |
|
626 |
this.workpieceInformation.inboundTime = this.getCurrentTime() |
|
627 |
} |
0ca254
|
628 |
}); |
A |
629 |
}, |
|
630 |
|
7ae9a9
|
631 |
initializedData(){ |
A |
632 |
const param = { |
|
633 |
locationCode: this.headContent.processesCode, |
|
634 |
} |
|
635 |
initializedData(param).then(response => { |
|
636 |
if(response.msg !== ''){ |
|
637 |
this.headContent.sfcCode = response.msg; |
|
638 |
this.queryParams.productNum = response.msg; |
|
639 |
this.getList() |
|
640 |
this.cakeLamp.scanFinish = 1 |
|
641 |
this.cakeLamp.startWork = 1 |
da4f49
|
642 |
this.cakeLamp.InPlace = 1 |
7ae9a9
|
643 |
} |
A |
644 |
}); |
|
645 |
}, |
|
646 |
|
0ca254
|
647 |
getCurrentTime() { |
A |
648 |
const now = new Date(); |
|
649 |
const year = now.getFullYear(); |
|
650 |
const month = this.padTimeUnit(now.getMonth() + 1); // 月份是从0开始的 |
|
651 |
const day = this.padTimeUnit(now.getDate()); |
|
652 |
const hours = this.padTimeUnit(now.getHours()); |
|
653 |
const minutes = this.padTimeUnit(now.getMinutes()); |
|
654 |
const seconds = this.padTimeUnit(now.getSeconds()); |
|
655 |
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; |
|
656 |
}, |
|
657 |
padTimeUnit(value) { |
|
658 |
return value.toString().padStart(2, '0'); |
|
659 |
}, |
|
660 |
addBaseData(){ |
|
661 |
addBasicParameters(this.passingStationForm).then(response => {}); |
|
662 |
}, |
|
663 |
|
|
664 |
/** 入站增加过站采集记录 **/ |
|
665 |
addOverStationCollection(){ |
|
666 |
this.passingStationForm = { |
|
667 |
id: null, |
|
668 |
workOrderNo: this.workpieceInformation.workOrderNo, |
|
669 |
productCode: this.workpieceInformation.productCode, |
|
670 |
locationCode: this.headContent.processesCode, |
|
671 |
model: this.workpieceInformation.productModel, |
|
672 |
productBarcode: this.headContent.sfcCode, |
|
673 |
sfcCode: this.headContent.sfcCode, |
|
674 |
inboundTime: new Date() |
|
675 |
} |
|
676 |
addPassingStationCollection(this.passingStationForm).then(response => {}); |
|
677 |
// addBasicParameters(this.passingStationForm).then(response => {}); |
|
678 |
}, |
|
679 |
exit() { |
|
680 |
if (this.ws) { |
|
681 |
this.ws.close(); |
|
682 |
this.ws = null; |
|
683 |
} |
|
684 |
}, |
|
685 |
send() { |
|
686 |
if (this.ws) { |
|
687 |
this.ws.send(this.message); |
|
688 |
} else { |
|
689 |
alert("未连接到服务器"); |
|
690 |
} |
|
691 |
}, |
|
692 |
|
|
693 |
initStation: async function () { |
|
694 |
await getIpv4().then(response => { |
|
695 |
this.StationConfQueryParams.ipAddress = response.msg |
|
696 |
console.log('查询到本工位IP为' + this.StationConfQueryParams.ipAddress) |
|
697 |
}); |
|
698 |
await listStationConf(this.StationConfQueryParams).then(response => { |
|
699 |
let rows = response.rows[0] |
|
700 |
if (response.rows.length === 0) { |
|
701 |
this.$message('该工位没有配置IP,请联系管理员配置IP'); |
|
702 |
return |
|
703 |
} |
|
704 |
this.headContent.processesName = rows.processesName |
|
705 |
this.headContent.processesCode = rows.processesCode |
7ae9a9
|
706 |
this.initializedData() |
0ca254
|
707 |
|
A |
708 |
}); |
|
709 |
this.conCom() |
|
710 |
console.log('websocket连接工位为' + this.headContent.processesCode) |
|
711 |
const wsuri = this.url + this.headContent.processesCode; |
|
712 |
this.ws = new WebSocket(wsuri); |
|
713 |
const self = this; |
|
714 |
this.ws.onopen = function (event) { |
|
715 |
this.$message('websocket连接成功!'); |
|
716 |
|
|
717 |
}; |
8c5c9c
|
718 |
|
C |
719 |
|
|
720 |
//socket从后台向前台推送数据 |
0ca254
|
721 |
this.ws.onmessage = function (event) { |
A |
722 |
if (event.data === "IN") { |
|
723 |
self.cakeLamp.InPlace = 1; |
|
724 |
console.log(self.headContent.processesCode); |
|
725 |
// const param = { |
|
726 |
// processesCode: self.headContent.processesCode, |
|
727 |
// } |
|
728 |
// fistSetpNumber(param).then(response => {}); |
|
729 |
} else if (event.data === "IN0") { |
|
730 |
self.cakeLamp.InPlace = 0; |
|
731 |
} else if (event.data === "OUT") { |
|
732 |
self.cakeLamp.release = 1; |
|
733 |
} else if (event.data === "END") { |
|
734 |
|
|
735 |
const formulaChildIndex = self.formulaChildList.length-1 |
|
736 |
|
|
737 |
const orderParam = { |
|
738 |
productNum: self.headContent.sfcCode, |
|
739 |
} |
|
740 |
|
|
741 |
if(self.headContent.sfcCode=== ''||self.headContent.sfcCode=== null){ |
|
742 |
self.$message('总成码为空,请扫码!') |
2aae2d
|
743 |
unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 26}).then(response => {}); |
0ca254
|
744 |
return; |
A |
745 |
} |
|
746 |
|
|
747 |
if(self.formulaChildList[formulaChildIndex].results !== 'OK'){ |
|
748 |
self.$message('未做完工序禁止放行'); |
2aae2d
|
749 |
unfinishedProcess({processesCode: self.headContent.processesCode,recordDataDone: 25}).then(response => {}); |
0ca254
|
750 |
return; |
A |
751 |
} |
|
752 |
|
|
753 |
|
|
754 |
const param = { |
|
755 |
workOrderNo: self.workpieceInformation.workOrderNo, |
|
756 |
productCode: self.workpieceInformation.productCode, |
|
757 |
locationCode: self.headContent.processesCode, |
|
758 |
productBarcode: self.headContent.sfcCode, |
|
759 |
inboundTime: self.workpieceInformation.inboundTime, |
|
760 |
formulaChildEntity: self.formulaChildList[formulaChildIndex] |
|
761 |
} |
|
762 |
|
|
763 |
console.log("进入最终方法") |
|
764 |
self.endSaveData(param) |
|
765 |
|
|
766 |
} else if (event.data.includes("[")) { |
|
767 |
let formulaChilds = ""; |
|
768 |
self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort); |
|
769 |
self.formulaChildList |
|
770 |
.filter((formulaChild) => formulaChild.operationType === '1'); |
|
771 |
for (let i = 0; i < self.formulaChildList.length; i++) { |
|
772 |
let formulaChild = self.formulaChildList[i]; |
|
773 |
let results = formulaChild.results; |
|
774 |
|
|
775 |
if (results === '' || results === null || results === 'NG') { |
|
776 |
formulaChilds = formulaChild; |
|
777 |
break; |
|
778 |
} |
|
779 |
} |
|
780 |
if(formulaChilds === ""){ |
|
781 |
self.$message.error('本工位已工作完成!'); |
|
782 |
return; |
|
783 |
} |
|
784 |
const param = { |
|
785 |
id: formulaChilds.id, |
|
786 |
tightenTheArray: event.data, |
|
787 |
paramCode: formulaChilds.paramCode, |
|
788 |
workOrderNo: self.workpieceInformation.workOrderNo, |
|
789 |
productCode: self.workpieceInformation.productCode, |
|
790 |
locationCode: self.headContent.processesCode, |
|
791 |
productBarcode: self.headContent.sfcCode, |
|
792 |
spareField1: formulaChilds.spareField1, |
|
793 |
spareField2: formulaChilds.spareField2, |
|
794 |
spareField3: formulaChilds.spareField3, |
|
795 |
spareField4: formulaChilds.spareField4, |
|
796 |
stepSort: formulaChilds.stepSort |
|
797 |
} |
|
798 |
if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){ |
|
799 |
self.$message('未找到参数码,请检查参数码是否正确'); |
|
800 |
return; |
|
801 |
} |
|
802 |
if(self.headContent.sfcCode!==null||self.headContent.sfcCode!==''){ |
|
803 |
updateTighteningFormula(param).then(response => { |
|
804 |
//addTighteningParameters(param).then(response => {}); |
|
805 |
self.getListFormulaChild() |
|
806 |
}).catch(error =>{ |
|
807 |
self.getListFormulaChild() |
|
808 |
}); |
|
809 |
} |
8c5c9c
|
810 |
}else if(event.data.includes("productNum")){ |
22c9e0
|
811 |
let productNum = event.data.split(',')[1]; |
A |
812 |
self.headContent.sfcCode = productNum; |
|
813 |
self.queryParams.productNum = productNum; |
|
814 |
self.getList() |
|
815 |
self.cakeLamp.scanFinish = 1 |
|
816 |
self.cakeLamp.startWork = 1 |
58c9d4
|
817 |
self.cakeLamp.InPlace = 1 |
50c585
|
818 |
|
0ca254
|
819 |
} |
A |
820 |
}; |
|
821 |
}, |
|
822 |
|
|
823 |
endSaveData(param){ |
|
824 |
saveCampaignTimeParameters(param).then(response => { |
|
825 |
this.cakeLamp.release = 1; |
|
826 |
this.endClear() |
|
827 |
workpieceRelease(param).then(response => {}); |
|
828 |
}); |
|
829 |
}, |
|
830 |
|
|
831 |
//接受数据的回调 |
|
832 |
callBack(value) { |
|
833 |
if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); |
|
834 |
else { |
|
835 |
const scanValue = this.myserialport.hex2atostr(value).replace(/[\r\n]/g, ''); |
|
836 |
console.log("串口收到数据-------------------"+scanValue) |
|
837 |
console.log("sfc=--"+this.headContent.sfcCode+"--") |
|
838 |
if(this.headContent.sfcCode !== '' && this.headContent.sfcCode !== null |
|
839 |
&& this.headContent.sfcCode !== undefined){ |
|
840 |
if(scanValue.includes("0RSP1TE") && this.headContent.processesCode === 'OP240'){ |
|
841 |
this.headContent.cardCode = scanValue |
|
842 |
this.bindcardCode(scanValue); |
|
843 |
this.serialPortMethod(scanValue) |
|
844 |
}else { |
|
845 |
this.$message('工位终端扫描物料编码'+scanValue); |
|
846 |
console.log(scanValue) |
|
847 |
this.serialPortMethod(scanValue) |
|
848 |
} |
|
849 |
} else { |
50c585
|
850 |
// if(this.headContent.processesCode === 'OP240'){ |
0ca254
|
851 |
this.headContent.sfcCode = scanValue; |
A |
852 |
this.queryParams.productNum = scanValue; |
|
853 |
this.getList() |
|
854 |
this.cakeLamp.scanFinish = 1 |
|
855 |
this.cakeLamp.startWork = 1 |
50c585
|
856 |
this.cakeLamp.InPlace = 1 |
A |
857 |
// }else { |
|
858 |
// let param = { |
|
859 |
// trolleyYard: scanValue |
|
860 |
// } |
|
861 |
// findBytrolleyYardGetOne(param).then(response => { |
|
862 |
// if(response.msg !== '2'){ |
|
863 |
// this.headContent.sfcCode = response.msg; |
|
864 |
// this.queryParams.productNum = response.msg; |
|
865 |
// this.$message('扫码识别产品序列号'+scanValue); |
|
866 |
// this.getList() |
|
867 |
// this.cakeLamp.scanFinish = 1 |
|
868 |
// this.cakeLamp.startWork = 1 |
|
869 |
// this.cakeLamp.InPlace = 1 |
|
870 |
// }else { |
|
871 |
// this.$message('没有序列号'+scanValue); |
|
872 |
// return |
|
873 |
// } |
|
874 |
// }); |
|
875 |
// } |
0ca254
|
876 |
|
A |
877 |
} |
|
878 |
|
|
879 |
} |
|
880 |
}, |
|
881 |
clearHistory() { |
|
882 |
this.form1.desc = ""; |
|
883 |
this.myserialport.state.readValue = []; |
|
884 |
}, |
|
885 |
loadHistory() { |
|
886 |
if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); |
|
887 |
else { |
|
888 |
let temp = this.readLi(); |
|
889 |
if (temp.length > 0) this.form1.desc = temp[temp.length - 1].join(""); |
|
890 |
} |
|
891 |
}, |
|
892 |
readLi() { |
|
893 |
let readType = this.readType; |
|
894 |
return this.myserialport.state.readValue.map((items, index) => { |
|
895 |
const item = items.value; |
|
896 |
const type = items.type; // 1接收,2发送 |
|
897 |
let body = []; |
|
898 |
if (item !== undefined) { |
|
899 |
let strArr = []; |
|
900 |
for (let hex of Array.from(item)) { |
|
901 |
strArr.push(hex.toString(16).toLocaleUpperCase()); |
|
902 |
} |
|
903 |
if (strArr.includes("D") && strArr.includes("A")) { |
|
904 |
if (strArr.indexOf("A") - strArr.indexOf("D") === 1) { |
|
905 |
strArr.splice(strArr.indexOf("D"), 1); |
|
906 |
strArr.splice(strArr.indexOf("A"), 1, <br key={0} />); |
|
907 |
} |
|
908 |
} |
|
909 |
strArr = strArr.map((item) => { |
|
910 |
if (typeof item === "string") { |
|
911 |
if (readType === 1) { |
|
912 |
return this.myserialport.hex2a(parseInt(item, 16)); |
|
913 |
} else if (readType === 2) { |
|
914 |
return item + " "; |
|
915 |
} |
|
916 |
} |
|
917 |
return item; |
|
918 |
}); |
|
919 |
if (typeof strArr[strArr.length - 1] === "string") { |
|
920 |
strArr.push("\r\n"); |
|
921 |
} |
|
922 |
body.push(strArr.join("")); |
|
923 |
} |
|
924 |
return body; |
|
925 |
}); |
|
926 |
}, |
|
927 |
conCom(){ |
|
928 |
try { |
|
929 |
this.myserialport.state.baudRate = this.form1.baudRate; |
|
930 |
this.myserialport.state.dataBits = this.form1.dataBits; |
|
931 |
this.myserialport.state.stopBits = this.form1.stopBits; |
|
932 |
this.myserialport.state.parity = this.form1.parity; |
|
933 |
this.myserialport.state.flowControl = this.form1.flowControl; |
|
934 |
this.myserialport.openPort(0, true, this.callBack); |
|
935 |
console.log(this.form1.port) |
|
936 |
} catch (error) { |
|
937 |
this.$message.error("串口连接失败!请检查串口是否已被占用"); |
|
938 |
} |
|
939 |
if (this.myserialport.state.isOpen) { |
|
940 |
this.$message.success("串口连接成功"); |
|
941 |
} |
|
942 |
}, |
|
943 |
//连接 |
|
944 |
async connectBtn() { |
|
945 |
if (this.btnType === "primary") { |
|
946 |
try { |
|
947 |
this.myserialport.state.baudRate = this.form1.baudRate; |
|
948 |
this.myserialport.state.dataBits = this.form1.dataBits; |
|
949 |
this.myserialport.state.stopBits = this.form1.stopBits; |
|
950 |
this.myserialport.state.parity = this.form1.parity; |
|
951 |
this.myserialport.state.flowControl = this.form1.flowControl; |
|
952 |
await this.myserialport.openPort(this.form1.port, true, this.callBack); |
|
953 |
console.log(this.form1.port) |
|
954 |
} catch (error) { |
|
955 |
this.$message.error("串口连接失败!请检查串口是否已被占用"); |
|
956 |
} |
|
957 |
if (this.myserialport.state.isOpen) { |
|
958 |
this.$message.success("串口连接成功"); |
|
959 |
this.open1 = false |
|
960 |
this.btnType = "danger"; |
|
961 |
this.btnText = "关闭串口"; |
|
962 |
} |
|
963 |
} else { |
|
964 |
this.myserialport.openPort(this.form1.port, false, this.callBack); |
|
965 |
this.$message.success("串口关闭成功"); |
|
966 |
this.btnType = "primary"; |
|
967 |
this.btnText = "连接串口"; |
|
968 |
} |
|
969 |
}, |
|
970 |
//授权 |
|
971 |
async obtainAuthorization() { |
|
972 |
if ("serial" in navigator) { |
|
973 |
console.log("The Web Serial API is supported."); |
|
974 |
if (!this.myserialport) this.myserialport = new MySerialPort(); |
|
975 |
try { |
|
976 |
await this.myserialport.handleRequestPort(); |
|
977 |
this.$message.success("串口授权成功"); |
|
978 |
this.getPortInfo(this.myserialport.state.ports); |
|
979 |
} catch (error) { |
|
980 |
this.$message.warning("未选择新串口授权!"); |
|
981 |
} |
|
982 |
} else { |
|
983 |
this.$message.error( |
|
984 |
"当前为HTTP模式或者浏览器版本过低,不支持网页连接串口" |
|
985 |
); |
|
986 |
} |
|
987 |
}, |
|
988 |
//串口列表初始化 |
|
989 |
getPortInfo(portList) { |
|
990 |
this.portsList = []; |
|
991 |
portList.map((port, index) => { |
|
992 |
const { usbProductId, usbVendorId } = port.getInfo(); |
|
993 |
if (usbProductId === undefined || usbVendorId === undefined) { |
|
994 |
this.portsList.push({ label: "未知设备" + index, value: index }); |
|
995 |
} else { |
|
996 |
const usbVendor = USBDevice.filter( |
|
997 |
(item) => parseInt(item.vendor, 16) === usbVendorId |
|
998 |
); |
|
999 |
let usbProduct = []; |
|
1000 |
if (usbVendor.length === 1) { |
|
1001 |
usbProduct = usbVendor[0].devices.filter( |
|
1002 |
(item) => parseInt(item.devid, 16) === usbProductId |
|
1003 |
); |
|
1004 |
} |
|
1005 |
this.portsList.push({ label: usbProduct[0].devname, value: index }); |
|
1006 |
} |
|
1007 |
}); |
|
1008 |
}, |
|
1009 |
// 发送 |
|
1010 |
async sendCommon() { |
|
1011 |
if (this.myserialport.state.isOpen) { |
|
1012 |
if (this.form1.sendMsg.length !== 0) { |
|
1013 |
const writeType = this.form1.type; |
|
1014 |
let value = this.form1.sendMsg; |
|
1015 |
let arr = []; |
|
1016 |
if (writeType === 1) { |
|
1017 |
// ASCII |
|
1018 |
for (let i = 0; i < value.length; i++) { |
|
1019 |
arr.push(this.myserialport.a2hex(value[i])); |
|
1020 |
} |
|
1021 |
} else if (writeType === 2) { |
|
1022 |
// HEX |
|
1023 |
if (/^[0-9A-Fa-f]+$/.test(value) && value.length % 2 === 0) { |
|
1024 |
for (let i = 0; i < value.length; i = i + 2) { |
|
1025 |
arr.push(parseInt(value.substring(i, i + 2), 16)); |
|
1026 |
} |
|
1027 |
} else { |
|
1028 |
this.$message.error("格式错误"); |
|
1029 |
return; |
|
1030 |
} |
|
1031 |
} |
|
1032 |
this.myserialport.writeText(arr); |
|
1033 |
} else { |
|
1034 |
this.$message.warning("请输入发送的信息"); |
|
1035 |
} |
|
1036 |
} else { |
|
1037 |
this.$message.warning("串口处于关闭状态,请连接串口"); |
|
1038 |
} |
|
1039 |
}, |
|
1040 |
async getPorts() { |
|
1041 |
await this.myserialport.getPorts(); |
|
1042 |
this.getPortInfo(this.myserialport.state.ports); |
|
1043 |
}, |
|
1044 |
querySearch(queryString, cb) { |
|
1045 |
var restaurants = this.restaurants; |
|
1046 |
var results = queryString |
|
1047 |
? restaurants.filter(this.createFilter(queryString)) |
|
1048 |
: restaurants; |
|
1049 |
// 调用 callback 返回建议列表的数据 |
|
1050 |
cb(results); |
|
1051 |
}, |
|
1052 |
createFilter(queryString) { |
|
1053 |
return (restaurant) => { |
|
1054 |
return ( |
|
1055 |
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === |
|
1056 |
0 |
|
1057 |
); |
|
1058 |
}; |
|
1059 |
}, |
|
1060 |
loadAll() { |
|
1061 |
return [ |
|
1062 |
{ value: "110" }, |
|
1063 |
{ value: "300" }, |
|
1064 |
{ value: "600" }, |
|
1065 |
{ value: "1200" }, |
|
1066 |
{ value: "2400" }, |
|
1067 |
{ value: "4800" }, |
|
1068 |
{ value: "7200" }, |
|
1069 |
{ value: "9600" }, |
|
1070 |
{ value: "14400" }, |
|
1071 |
{ value: "19200" }, |
|
1072 |
{ value: "28800" }, |
|
1073 |
{ value: "38400" }, |
|
1074 |
{ value: "56000" }, |
|
1075 |
{ value: "57600" }, |
|
1076 |
{ value: "76800" }, |
|
1077 |
{ value: "115200" }, |
|
1078 |
{ value: "230400" }, |
|
1079 |
{ value: "460800" }, |
|
1080 |
]; |
|
1081 |
}, |
|
1082 |
} |
|
1083 |
} |
|
1084 |
|
|
1085 |
</script> |
|
1086 |
<style scoped> |
|
1087 |
.bottom-card{ |
|
1088 |
height: 600px; |
|
1089 |
} |
|
1090 |
.circle-button{ |
|
1091 |
height: 30px; |
|
1092 |
width: 30px; |
|
1093 |
} |
|
1094 |
.circle-red { |
|
1095 |
background-color: #e01a4f; |
|
1096 |
} |
|
1097 |
.circle-green { |
|
1098 |
background-color: green; |
|
1099 |
} |
|
1100 |
.circle-green-animate { |
|
1101 |
background-color: green; |
|
1102 |
animation: circle-green-animate 2s infinite; |
|
1103 |
} |
|
1104 |
@keyframes circle-green-animate { |
|
1105 |
50% { |
|
1106 |
opacity: 0.6; |
|
1107 |
} |
|
1108 |
0% { |
|
1109 |
opacity: 0.2; |
|
1110 |
} |
|
1111 |
} |
|
1112 |
.head-font{ |
|
1113 |
/*font-weight: bold;*/ |
|
1114 |
/*font-size: 25px;*/ |
|
1115 |
} |
|
1116 |
span{ |
|
1117 |
font-size: 15px; |
|
1118 |
} |
|
1119 |
.el-table .warning-row { |
|
1120 |
background: oldlace; |
|
1121 |
} |
|
1122 |
|
|
1123 |
.el-table .success-row { |
|
1124 |
background: #f0f9eb; |
|
1125 |
} |
|
1126 |
</style> |
|
1127 |
|