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