From b496fab726e76436f1200725926f863da6edc694 Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期一, 11 十二月 2023 10:19:39 +0800
Subject: [PATCH] 修改weobsocket 连接多用户同时推送

---
 CanadaMes-ui/src/views/home/index.vue |   55 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue
index 2d65daf..14fbabe 100644
--- a/CanadaMes-ui/src/views/home/index.vue
+++ b/CanadaMes-ui/src/views/home/index.vue
@@ -634,7 +634,7 @@
             <el-button type="primary" @click="isAllowReorderingState()" :disabled="this.isAllowQueue">{{
                 this.isAllowReordering == true ? $t('Not Allow') : $t('Allow')
             }}</el-button>
-            <el-table :data="this.OutSlice" :height="700" :span-method="objectSpanMethod" border
+            <el-table :data="this.OutSlice" :height="700" :span-method="objectSpanMethod" border :cell-style="cellStyle"
                 style="width: 100%;overflow: auto;">
                 <el-table-column prop="glassId" :label="$t('Barcode')"></el-table-column>
                 <el-table-column prop="storageCage.orderId" :label="$t('Order No')"></el-table-column>
@@ -648,7 +648,16 @@
                     </template>
                 </el-table-column>
                 <el-table-column prop="sequence" :label="$t('Sequence')"></el-table-column>
-                <el-table-column prop="position" :label="$t('Position')"></el-table-column>
+                <el-table-column prop="position" :label="$t('Position')">
+                    <template slot-scope='scope'>
+                        {{ scope.row.position==1?$t('Yes'):$t('No') }}
+                    </template>
+                </el-table-column>
+                <el-table-column prop="position" :label="$t('Flip')">
+                    <template slot-scope='scope'>
+                        {{ scope.row.flip==1?$t('Yes'):$t('No') }}
+                    </template>
+                </el-table-column>
                 <el-table-column prop="barcode" :label="$t('Frame No')"></el-table-column>
 
                 <el-table-column prop="barcode" :label="$t('Complete')">
@@ -809,14 +818,23 @@
             ManuallyInfeedGlass: true,
             OutingQueue: true,
             OrderInfo: true,
-            CageDetails: true
+            CageDetails: true,
+            
         };
     },
     created() {
         this.load();
         this.init();
-    },
+        setInterval(() => {
+            if(socket.readyState != 1){
+            this.init();
+            }
+        }, 20000);
+    }
+    ,
     methods: {
+        
+        
         init() {
             let viewname = "Home";
             if (typeof (WebSocket) == "undefined") {
@@ -833,6 +851,13 @@
                 //鎵撳紑浜嬩欢
                 socket.onopen = function () {
                     console.log("websocket宸叉墦寮�");
+                    // setInterval(()=>{
+                    //     if(socket){
+                    //         if(socket.readyState==socket.OPEN){
+                    //             socket.send('');
+                    //         }
+                    //     }
+                    // },5000);
                 };
                 //  娴忚鍣ㄧ鏀舵秷鎭紝鑾峰緱浠庢湇鍔$鍙戦�佽繃鏉ョ殑鏂囨湰娑堟伅
                 socket.onmessage = function (msg) {
@@ -927,13 +952,13 @@
                         if (item.permissionId == "32" && item.state == 1) {
                             this.ManuallyInfeedGlass = false;
                         }
-                        if (item.permissionId == "32" && item.state == 1) {
+                        if (item.permissionId == "33" && item.state == 1) {
                             this.OutingQueue = false;
                         }
-                        if (item.permissionId == "33" && item.state == 1) {
+                        if (item.permissionId == "34" && item.state == 1) {
                             this.OrderInfo = false;
                         }
-                        if (item.permissionId == "34" && item.state == 1) {
+                        if (item.permissionId == "35" && item.state == 1) {
                             this.CageDetails = false;
                         }
                     });
@@ -1575,6 +1600,20 @@
             });
         }
         ,
+         cellStyle({ row, column, rowIndex, columnIndex }) {
+ // console.log(row, column, "ss");
+ column=rowIndex;
+ rowIndex=column;
+ let style="";
+ if (columnIndex === 8&&row.position==1) {
+ style="background-Color:yellow;";
+ }
+ if (columnIndex === 9&&row.flip==1) {
+ style="background-Color:yellow;";
+ }
+ return style;
+ }
+        ,
         //鍚堝苟琛�
         objectSpanMethod({ row, column, rowIndex, columnIndex }) {
             // console.log(row, column, "ss");
@@ -1589,7 +1628,7 @@
             if (rowIndex != 0) {
                 barcode2 = arrOutSlice[rowIndex - 1].barcode;
             }
-            if (columnIndex === 11) {
+            if (columnIndex === 12) {
                 if (barcode != barcode2) {
                     // this.FrameNoFlag = barcode;
                     for (let i = rowIndex; i < this.OutSlice.length; i++) {

--
Gitblit v1.8.0