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