-
admin
2024-06-05 16714e1a824acd878b105e6ac433866cfc50ed89
提交 | 用户 | 时间
2c7661 1 <template>
A 2   <div class="app-container">
3    <el-row :gutter="5">
4      <el-col :span="7">
5        <el-card shadow="never">
6          <span class="head-font">工位编号 : {{headContent.processesCode}}</span>
7        </el-card>
8      </el-col>
9      <el-col :span="7">
10        <el-card shadow="never">
11          <span class="head-font">工位名称 : {{headContent.processesName}}</span>
12        </el-card>
13      </el-col>
14      <el-col :span="10">
15        <el-card shadow="never">
16          <span class="head-font">产品序列号 : {{headContent.sfcCode}}</span>
17 <!--         <el-input v-model="content" style="float: right;width: 150px;" placeholder="请输入内容"></el-input>-->
18 <!--         <el-button @click="scanCompleted" style="float: right" type="primary">扫码完成</el-button>-->
19          <el-button type="primary" style="float: right" icon="el-icon-search" size="mini" @click="serialLink">串口连接</el-button>
20          <el-button @click="clearClick" style="float: right" type="danger" size="mini">清除</el-button>
21        </el-card>
22      </el-col>
23
24    </el-row>
25    <el-row :gutter="5" style="margin-top: 5px">
26      <el-col :span="24">
27        <el-tabs type="border-card"  style="height: 600px" v-model="activeName" @tab-click="changeMenu">
28          <el-tab-pane name="first">
29            <span slot="label"> <a class="el-icon-date"></a>首页</span>
30            <el-col :span="24">
31              <el-table height="500" :cell-style="rowStyle" :data="formulaChildList">
32                <el-table-column label="排序" width="60" align="center" type="index">
33                </el-table-column>
34                <el-table-column label="操作内容" :show-overflow-tooltip='true' align="center" prop="operationSteps">
35                </el-table-column>
36                <el-table-column label="产品编号" align="center" prop="productCode">
37                </el-table-column>
38                <el-table-column label="物料编码" align="center" prop="materialCode">
39                </el-table-column>
40                <el-table-column label="采集值" align="center" prop="collectData">
41                </el-table-column>
42                <el-table-column label="结果" align="center" prop="results">
43                </el-table-column>
44              </el-table>
45            </el-col>
46          </el-tab-pane>
47        </el-tabs>
48      </el-col>
49    </el-row>
50     <el-dialog v-dialogpop-up :title="title" :visible.sync="open1" width="1000" append-to-body>
51       <el-row
52         type="flex"
53         class="row-bg"
54         justify="center"
55         v-show="portsList.length === 0"
56       >
57         <el-col :span="7">
58           <div style="margin-top: 400px">
59           <span style="display: block">
60             仅支持Chrome 89+或者Edge 89+浏览器(安全上下文(HTTPS)中可用)
61           </span>
62             <el-button type="primary" @click="obtainAuthorization">授权</el-button>
63           </div>
64         </el-col>
65       </el-row>
66       <el-form
67         v-show="portsList.length > 0"
68         ref="form1"
69         :model="form1"
70         label-width="100px">
71         <el-row>
72           <el-col :span="24"
73           ><div>
74             <el-form-item label="串口">
75               <el-select
76                 v-model="form1.port"
77                 filterable
78                 placeholder="请选择串口"
79                 :disabled="isDisable"
80               >
81                 <el-option
82                   v-for="item in portsList"
83                   :key="item.value"
84                   :label="item.label"
85                   :value="item.value"
86                 >
87                 </el-option>
88               </el-select>
89             </el-form-item>
90             <el-form-item label="波特率">
91               <el-autocomplete
92                 popper-class="my-autocomplete"
93                 v-model="form1.baudRate"
94                 :fetch-suggestions="querySearch"
95                 placeholder="请输入波特率"
96                 :disabled="isDisable"
97               >
98                 <i class="el-icon-edit el-input__icon" slot="suffix"> </i>
99                 <template slot-scope="{ item }">
100                   <div class="name">{{ item.value }}</div>
101                   <span class="addr">{{ item.address }}</span>
102                 </template>
103               </el-autocomplete>
104             </el-form-item>
105             <el-form-item label="数据位">
106               <el-select
107                 v-model="form1.dataBits"
108                 placeholder="请选择数据位"
109                 :disabled="isDisable"
110               >
111                 <el-option label="7" value="7"></el-option>
112                 <el-option label="8" value="8"></el-option>
113               </el-select>
114             </el-form-item>
115             <el-form-item label="停止位">
116               <el-select
117                 v-model="form1.stopBits"
118                 placeholder="请选择停止位"
119                 :disabled="isDisable"
120               >
121                 <el-option label="1" value="1"></el-option>
122                 <el-option label="2" value="2"></el-option>
123               </el-select>
124             </el-form-item>
125
126             <el-form-item label="校验位">
127               <el-select
128                 v-model="form1.parity"
129                 placeholder="请选择校验位"
130                 :disabled="isDisable"
131               >
132                 <el-option label="None" value="none"></el-option>
133                 <el-option label="Even" value="even"></el-option>
134                 <el-option label="Odd" value="odd"></el-option>
135               </el-select>
136             </el-form-item>
137
138             <el-form-item label="流控制">
139               <el-select
140                 v-model="form1.flowControl"
141                 placeholder="请选择流控制"
142                 :disabled="isDisable"
143               >
144                 <el-option label="None" value="none"></el-option>
145                 <el-option label="HardWare" value="hardware"></el-option>
146               </el-select>
147             </el-form-item>
148             <el-form-item label="显示历史">
149               <el-switch
150                 v-model="form1.isShowHistory"
151                 @change="loadHistory"
152               ></el-switch>
153               <el-button
154                 type="danger"
155                 icon="el-icon-delete"
156                 circle
157                 title="清空历史"
158                 @click="clearHistory"
159               ></el-button>
160             </el-form-item>
161             <el-form-item label="发送区设置" v-show="isShowSendArea">
162               <el-form-item label="发送格式">
163                 <el-radio-group v-model="form1.type">
164                   <el-radio label="1">ASCII</el-radio>
165                   <el-radio label="2">HEX</el-radio>
166                 </el-radio-group>
167               </el-form-item>
168               <el-form-item label="发送信息">
169                 <el-input type="textarea" v-model="form1.sendMsg"></el-input>
170               </el-form-item>
171               <el-button type="primary" @click="sendCommon">发送</el-button>
172             </el-form-item>
173
174             <el-form-item>
175               <el-button :type="btnType" @click="connectBtn">{{
176                   btnText
177                 }}</el-button>
178               <el-button type="info" @click="obtainAuthorization"
179               >新增授权</el-button
180               >
181             </el-form-item>
182           </div>
183           </el-col>
184         </el-row>
185       </el-form>
186     </el-dialog>
187   </div>
188 </template>
189 <script>
6a462f 190 import {getIpv4, listStationConf} from "@/api/main/sc/stationConf";
2c7661 191 import {
a759f5 192   fistSetpNumber,
2c7661 193   noPageListFormulaChild,
6a462f 194   workpieceRelease,
W 195   yzUpdateResults,
196   yzUpdateTighteningFormula
2c7661 197 } from "@/api/main/bs/formulaChild/formulaChild";
A 198 import MySerialPort from "@/utils/MySerialPort";
199 import USBDevice from "@/utils/usb.json";
200 import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection";
201 import {
202   addTighteningParameters,
6a462f 203   replaceAssemblyCode,
2c7661 204   saveCampaignTimeParameters,
6a462f 205   yzAddBasicParameters,
2c7661 206 } from "@/api/main/da/paramCollection/paramCollection";
A 207
208 export default {
209   name: "stationTerminal",
210   data() {
211     return {
212       showInput: true,
213       serialPortContent: '',
214       // 查询参数
215       formulaChildParams: {
216         pageNum: 1,
217         pageSize: 10,
218         productCode: null,
219         processesCode: null,
220       },
221       // 配方配置子信息表格数据
222       formulaChildList: [],
223       ipAddress: '',
224       imgSrc: '',
225       headContent: {
226         processesCode: 'OP1010',
227         processesName: '贴标机-贴码',
228         sfcCode: '',
229         yzSfcCode: '',
230       },
231       workpieceInformation: {
232         workOrderNo: null,
233         productCode: null,
234         productModel: null,
235         productName: null,
236         beat: null,
237       },
238       // 查询参数
239       queryParams: {
240         pageNum: 1,
241         pageSize: 10,
242         sfcCode: null,
243       },
244       // 查询参数
245       StationConfQueryParams: {
246         pageNum: 1,
247         pageSize: 10,
248         ipAddress: null,
249       },
250       cakeLamp: {
251         plcState: 1, //plc
252         scannerState: 1, //扫码枪
253         InPlace: 0, //工件到位
254         scanFinish: 0,
255         startWork: 0,
256         release: 0 //允许放行
257       },
258       content: '',
259       activeName: 'first',
4a5f2a 260       url: "ws://192.168.2.76:8080/websocket/message/",
2c7661 261       message: "",
A 262       text_content: "",
263       ws: null,
264       inputValue: '9',
265
266       open1: false,
267       input: "",
268       keepReading: true,
269       form1: {
270         baudRate: "115200",
271         dataBits: "8",
272         stopBits: "1",
273         parity: "none",
274         flowControl: "none",
275         desc: "",
276         type: "1",
277         isShowHistory: false,
278       },
279       btnType: "primary",
280       btnText: "连接串口",
281       restaurants: [],
282       portsList: [],
283       isShowSendArea: false,
284       readType: 1,
285       title: "",
286
287       passingStationForm: {},
288       originalArray: [],
289     }
290   },
291   beforeDestroy() {
292     this.exit();
293   },
294   created() {
295     this.initStation();
296     // this.getStationConfList();
297     // setTimeout(() => {
298     //   this.connectWebsocket();
299     // }, 3000);
300   },
301   mounted() {
302     if ("serial" in navigator) {
303       this.myserialport = new MySerialPort();
304       this.getPorts();
305       navigator.serial.addEventListener("connect", (e) => {
306         this.$message.success("设备已连接");
307         this.getPorts();
308       });
309       navigator.serial.addEventListener("disconnect", (e) => {
310         this.$message.error("设备已断开");
311       });
312       this.restaurants = this.loadAll();
313     } else {
314       this.$message.error(
315         "当前为HTTP模式或者浏览器版本过低,不支持网页连接串口"
316       );
317     }
318   },
319   computed: {
320     isDisable() {
321       return this.btnType === "danger";
322     },
323   },
324   methods: {
325     serialLink() {
326       this.open1 = true
327     },
328     bindYzSfc(){
329       if(this.headContent.sfcCode!==""&&this.headContent.yzSfcCode!==""){
330         let param = {
331           sfcCode: this.headContent.sfcCode,
332           locationCode: this.headContent.processesCode,
333           yzSfcCode: this.headContent.yzSfcCode
334         }
335         this.$message('可以绑定!');
336         replaceAssemblyCode(param).then(response => {
337
338         });
339       }
340     },
4a5f2a 341
2c7661 342     Release(){
A 343       // this.$message('portsList!'+this.portsList.length);
344       if(this.btnType === "danger"){
345         this.$message('连接了!');
346
347       }else {
348         this.$message('mei连接了!');
349
350       }
351
352     },
353     serialPortMethod(value){
354       let formulaChildParams = {
355         scanBarcode: value,
356         sfcBarcode: this.headContent.sfcCode,
357         workOrderNo: this.workpieceInformation.workOrderNo,
358         productCode: "1P102S",
359         locationCode: this.headContent.processesCode,
360         collectionTime: new Date()
361       }
362       yzUpdateResults(formulaChildParams).then(response => {
363         this.getListFormulaChild()
364       });
365     },
366     rowStyle({ row }) {
367       if (row.results === 'OK') {
368         return 'background-color: PaleGreen';
369       } else if (row.results === 'NG') {
370         return 'background-color: LightSalmon';
371       }
372       return '';
373     },
374     /** 查询配方配置子信息列表 */
375     getListFormulaChild() {
376       this.formulaChildParams.productCode = "1P102S"
377       this.formulaChildParams.processesCode = this.headContent.processesCode
378       console.log(this.formulaChildParams)
379       noPageListFormulaChild(this.formulaChildParams).then(response => {
380         this.formulaChildList = response.rows;
6a462f 381         if (this.formulaChildList.length >0){
W 382           let pos = 0
383           const tempArr = this.formulaChildList.filter(x=> 'OK' === x.results)
384           if (tempArr.length>0){
385             pos = tempArr.length
386             this.$nextTick(() => {
387               let temp33 = document.getElementsByClassName('el-table__row')
388               console.log('temp33',temp33)
389               console.log('len',temp33.item(pos))
390               if (temp33.length > 0){
391                 console.log('1111111111111111')
392                 let arr = temp33[pos-1]
393                 console.log('srr',arr)
394                 arr.scrollIntoView({ block: 'center' })
395               }
396             })
397           }
398
399         }
2c7661 400       });
A 401     },
402     endClear(){
403
404     },
405     changeMenu(tab, event) {
406       console.log(tab, event);
407     },
408     clearClick(){
409       this.$message('这是一条清除消息提示');
410       this.headContent.sfcCode = null
411     },
412     scanCompleted(){
413       this.$message('扫码完成'+this.content);
414       this.headContent.sfcCode = this.content
415       this.queryParams.sfcCode = this.content
416       this.getList()
417       this.getListFormulaChild()
418       this.cakeLamp.scanFinish = 1
419       this.cakeLamp.startWork = 1
420
421     },
422     /** 查询工单列表 */
423     async getList() {
a759f5 424       const param = {
A 425         processesCode: this.headContent.processesCode,
426       }
427       fistSetpNumber(param).then(response => {});
2c7661 428       this.getListFormulaChild()
4a5f2a 429       this.addOverStationCollection()
2c7661 430     },
A 431
432     /** 入站增加过站采集记录 **/
433     addOverStationCollection(){
434       this.passingStationForm = {
435         id: null,
4a5f2a 436         // workOrderNo: this.workpieceInformation.workOrderNo,
A 437         productCode: "1P102S",
2c7661 438         locationCode: this.headContent.processesCode,
4a5f2a 439         // model: this.workpieceInformation.productModel,
2c7661 440         productBarcode: this.headContent.sfcCode,
A 441         sfcCode: this.headContent.sfcCode,
442         inboundTime: new Date()
443       }
444       addPassingStationCollection(this.passingStationForm).then(response => {});
4a5f2a 445       yzAddBasicParameters(this.passingStationForm).then(response => {});
2c7661 446     },
A 447     exit() {
448       if (this.ws) {
449         this.ws.close();
450         this.ws = null;
451       }
452     },
453     send() {
454       if (this.ws) {
455         this.ws.send(this.message);
456       } else {
457         alert("未连接到服务器");
458       }
459     },
460
461     initStation: async function () {
462       await getIpv4().then(response => {
463         this.StationConfQueryParams.ipAddress = response.msg
464         console.log('查询到本工位IP为' + this.StationConfQueryParams.ipAddress)
465       });
466       await listStationConf(this.StationConfQueryParams).then(response => {
467         let rows = response.rows[0]
468         if (response.rows.length === 0) {
469           this.$message('该工位没有配置IP,请联系管理员配置IP');
470           return
471         }
472         this.headContent.processesName = rows.processesName
473         this.headContent.processesCode = rows.processesCode
474         console.log('设置工位编码' + this.headContent.processesCode)
475
476       });
477       this.conCom()
478       console.log('websocket连接工位为' + this.headContent.processesCode)
479       const wsuri = this.url + this.headContent.processesCode;
480       this.ws = new WebSocket(wsuri);
481       const self = this;
482       this.ws.onopen = function (event) {
483         this.$message('websocket连接成功!');
484       };
485       this.ws.onmessage = function (event) {
486         if (event.data === "IN") {
487           self.cakeLamp.InPlace = 1;
488         } else if (event.data === "IN0") {
489           self.cakeLamp.InPlace = 0;
490         } else if (event.data === "OUT") {
491           console.log("out")
492
493           const param = {
494             workOrderNo: self.workpieceInformation.workOrderNo,
495             productCode: "1P102S",
496             locationCode: self.headContent.processesCode,
497             productBarcode: self.headContent.sfcCode,
498           }
499           // saveCampaignTimeParameters(param).then(response => {});
500           // self.cakeLamp.release = 1;
501           workpieceRelease(param).then(response => {});
502           self.formulaChildList = [];
503           self.headContent.sfcCode = '';
504           console.log(self.formulaChildList)
505         } else if (event.data === "END") {
506           // const param = {
507           //   workOrderNo: self.workpieceInformation.workOrderNo,
508           //   productCode: self.workpieceInformation.productCode,
509           //   locationCode: self.headContent.processesCode,
510           //   productBarcode: self.headContent.sfcCode,
511           // }
512           // saveCampaignTimeParameters(param).then(response => {});
513           // self.endClear()
514           // workpieceRelease(param).then(response => {});
515         } else if (event.data.includes("[")) {
516           let formulaChilds = "";
517           self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort);
518           self.formulaChildList
519             .filter((formulaChild) => formulaChild.operationType === '1');
520           for (let i = 0; i < self.formulaChildList.length; i++) {
521             let formulaChild = self.formulaChildList[i];
522             let results = formulaChild.results;
523             if (results === '' || results === null || results === 'NG') {
524               formulaChilds = formulaChild;
525               break;
526             }
527           }
528           const param = {
529             tightenTheArray: event.data,
530             paramCode: formulaChilds.paramCode,
4a5f2a 531             // workOrderNo: self.workpieceInformation.workOrderNo,
A 532             productCode: "1P102S",
2c7661 533             locationCode: self.headContent.processesCode,
A 534             productBarcode: self.headContent.sfcCode,
535           }
16714e 536           if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){
A 537             self.$message('未找到参数码,请检查参数码是否正确');
538             return;
539           }
2c7661 540           addTighteningParameters(param).then(response => {});
A 541           yzUpdateTighteningFormula(param).then(response => {
a846f2 542             console.log(response)
A 543             if(response.msg === "1" || response.msg === "3"){
2c7661 544                 self.getListFormulaChild()
A 545             }else {
546               const param = {
547                 workOrderNo: self.workpieceInformation.workOrderNo,
548                 productCode: "1P102S",
549                 locationCode: self.headContent.processesCode,
550                 productBarcode: self.headContent.sfcCode,
551               }
552               saveCampaignTimeParameters(param).then(response => {});
553               workpieceRelease(param).then(response => {});
554               self.formulaChildList = [];
555               self.headContent.sfcCode = '';
556             }
557           });
a846f2 558           // self.getListFormulaChild()
A 559
2c7661 560         }
A 561       };
562     },
563
564
565
566     //接受数据的回调
567     callBack(value) {
568       if (this.form1.isShowHistory) this.form1.desc = this.readLi().join("");
569       else {
570         const scanValue = this.myserialport.hex2atostr(value).replace(/[\r\n]/g, '');
571         console.log("串口收到数据-------------------"+scanValue)
572
573         if(this.headContent.sfcCode !== ''){
a52d08 574           this.$message('预装工位扫描物料编码'+scanValue);
2c7661 575           console.log(scanValue)
A 576           this.serialPortMethod(scanValue)
577         } else {
578           this.headContent.sfcCode = scanValue;
579           this.getList()
580         }
581
582       }
583     },
584     clearHistory() {
585       this.form1.desc = "";
586       this.myserialport.state.readValue = [];
587     },
588     loadHistory() {
589       if (this.form1.isShowHistory) this.form1.desc = this.readLi().join("");
590       else {
591         let temp = this.readLi();
592         if (temp.length > 0) this.form1.desc = temp[temp.length - 1].join("");
593       }
594     },
595     readLi() {
596       let readType = this.readType;
597       return this.myserialport.state.readValue.map((items, index) => {
598         const item = items.value;
599         const type = items.type; // 1接收,2发送
600         let body = [];
601         if (item !== undefined) {
602           let strArr = [];
603           for (let hex of Array.from(item)) {
604             strArr.push(hex.toString(16).toLocaleUpperCase());
605           }
606           if (strArr.includes("D") && strArr.includes("A")) {
607             if (strArr.indexOf("A") - strArr.indexOf("D") === 1) {
608               strArr.splice(strArr.indexOf("D"), 1);
609               strArr.splice(strArr.indexOf("A"), 1, <br key={0} />);
610             }
611           }
612           strArr = strArr.map((item) => {
613             if (typeof item === "string") {
614               if (readType === 1) {
615                 return this.myserialport.hex2a(parseInt(item, 16));
616               } else if (readType === 2) {
617                 return item + " ";
618               }
619             }
620             return item;
621           });
622           if (typeof strArr[strArr.length - 1] === "string") {
623             strArr.push("\r\n");
624           }
625           body.push(strArr.join(""));
626         }
627         return body;
628       });
629     },
630     conCom(){
631       try {
632         this.myserialport.state.baudRate = this.form1.baudRate;
633         this.myserialport.state.dataBits = this.form1.dataBits;
634         this.myserialport.state.stopBits = this.form1.stopBits;
635         this.myserialport.state.parity = this.form1.parity;
636         this.myserialport.state.flowControl = this.form1.flowControl;
637         this.myserialport.openPort(0, true, this.callBack);
638         console.log(this.form1.port)
639       } catch (error) {
640         this.$message.error("串口连接失败!请检查串口是否已被占用");
641       }
642       if (this.myserialport.state.isOpen) {
643         this.$message.success("串口连接成功");
644       }
645     },
646     //连接
647     async connectBtn() {
648       if (this.btnType === "primary") {
649         try {
650           this.myserialport.state.baudRate = this.form1.baudRate;
651           this.myserialport.state.dataBits = this.form1.dataBits;
652           this.myserialport.state.stopBits = this.form1.stopBits;
653           this.myserialport.state.parity = this.form1.parity;
654           this.myserialport.state.flowControl = this.form1.flowControl;
655           await this.myserialport.openPort(this.form1.port, true, this.callBack);
656           console.log(this.form1.port)
657         } catch (error) {
658           this.$message.error("串口连接失败!请检查串口是否已被占用");
659         }
660         if (this.myserialport.state.isOpen) {
661           this.$message.success("串口连接成功");
662           this.open1 = false
663           this.btnType = "danger";
664           this.btnText = "关闭串口";
665         }
666       } else {
667         this.myserialport.openPort(this.form1.port, false, this.callBack);
668         this.$message.success("串口关闭成功");
669         this.btnType = "primary";
670         this.btnText = "连接串口";
671       }
672     },
673     //授权
674     async obtainAuthorization() {
675       if ("serial" in navigator) {
676         console.log("The Web Serial API is supported.");
677         if (!this.myserialport) this.myserialport = new MySerialPort();
678         try {
679           await this.myserialport.handleRequestPort();
680           this.$message.success("串口授权成功");
681           this.getPortInfo(this.myserialport.state.ports);
682         } catch (error) {
683           this.$message.warning("未选择新串口授权!");
684         }
685       } else {
686         this.$message.error(
687           "当前为HTTP模式或者浏览器版本过低,不支持网页连接串口"
688         );
689       }
690     },
691     //串口列表初始化
692     getPortInfo(portList) {
693       this.portsList = [];
694       portList.map((port, index) => {
695         const { usbProductId, usbVendorId } = port.getInfo();
696         if (usbProductId === undefined || usbVendorId === undefined) {
697           this.portsList.push({ label: "未知设备" + index, value: index });
698         } else {
699           const usbVendor = USBDevice.filter(
700             (item) => parseInt(item.vendor, 16) === usbVendorId
701           );
702           let usbProduct = [];
703           if (usbVendor.length === 1) {
704             usbProduct = usbVendor[0].devices.filter(
705               (item) => parseInt(item.devid, 16) === usbProductId
706             );
707           }
708           this.portsList.push({ label: usbProduct[0].devname, value: index });
709         }
710       });
711     },
712     // 发送
713     async sendCommon() {
714       if (this.myserialport.state.isOpen) {
715         if (this.form1.sendMsg.length !== 0) {
716           const writeType = this.form1.type;
717           let value = this.form1.sendMsg;
718           let arr = [];
719           if (writeType === 1) {
720             // ASCII
721             for (let i = 0; i < value.length; i++) {
722               arr.push(this.myserialport.a2hex(value[i]));
723             }
724           } else if (writeType === 2) {
725             // HEX
726             if (/^[0-9A-Fa-f]+$/.test(value) && value.length % 2 === 0) {
727               for (let i = 0; i < value.length; i = i + 2) {
728                 arr.push(parseInt(value.substring(i, i + 2), 16));
729               }
730             } else {
731               this.$message.error("格式错误");
732               return;
733             }
734           }
735           this.myserialport.writeText(arr);
736         } else {
737           this.$message.warning("请输入发送的信息");
738         }
739       } else {
740         this.$message.warning("串口处于关闭状态,请连接串口");
741       }
742     },
743     async getPorts() {
744       await this.myserialport.getPorts();
745       this.getPortInfo(this.myserialport.state.ports);
746     },
747     querySearch(queryString, cb) {
748       var restaurants = this.restaurants;
749       var results = queryString
750         ? restaurants.filter(this.createFilter(queryString))
751         : restaurants;
752       // 调用 callback 返回建议列表的数据
753       cb(results);
754     },
755     createFilter(queryString) {
756       return (restaurant) => {
757         return (
758           restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
759           0
760         );
761       };
762     },
763     loadAll() {
764       return [
765         { value: "110" },
766         { value: "300" },
767         { value: "600" },
768         { value: "1200" },
769         { value: "2400" },
770         { value: "4800" },
771         { value: "7200" },
772         { value: "9600" },
773         { value: "14400" },
774         { value: "19200" },
775         { value: "28800" },
776         { value: "38400" },
777         { value: "56000" },
778         { value: "57600" },
779         { value: "76800" },
780         { value: "115200" },
781         { value: "230400" },
782         { value: "460800" },
783       ];
784     },
785   }
786 }
787
788 </script>
789 <style scoped>
790 .bottom-card{
791   height: 600px;
792 }
793 .circle-button{
794   height: 30px;
795   width: 30px;
796 }
797 .circle-red {
798   background-color: #e01a4f;
799 }
800 .circle-green {
801   background-color: green;
802 }
803 .circle-green-animate {
804   background-color: green;
805   animation: circle-green-animate 2s infinite;
806 }
807   @keyframes circle-green-animate {
808     50% {
809       opacity: 0.6;
810     }
811     0% {
812       opacity: 0.2;
813     }
814   }
815 .head-font{
816   /*font-weight: bold;*/
817   /*font-size: 25px;*/
818 }
819 span{
820   font-size: 15px;
821 }
822 .el-table .warning-row {
823   background: oldlace;
824 }
825
826 .el-table .success-row {
827   background: #f0f9eb;
828 }
829 </style>
830