From e4aa2d49ae837e46258c42909c10661da903ee0f Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期四, 05 十二月 2024 17:18:52 +0800
Subject: [PATCH] 222

---
 src/views/system/tijianall/index.vue |  155 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 98 insertions(+), 57 deletions(-)

diff --git a/src/views/system/tijianall/index.vue b/src/views/system/tijianall/index.vue
index 8c1c7e8..4ac24cb 100644
--- a/src/views/system/tijianall/index.vue
+++ b/src/views/system/tijianall/index.vue
@@ -227,7 +227,7 @@
                   v-for="dict in dict.type.dict_team"
                   :key="dict.value"
                   :label="dict.label"
-                  :value="parseInt(dict.value)"
+                  :value="dict.value"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -1213,7 +1213,7 @@
       // 琛ㄥ崟鍙傛暟
       form: {
         cusIdcard: "",
-        tjType: 2,
+        tjType: '3',
         category: "01",
         cusSex: 1,
         cusNational: "1",
@@ -1278,6 +1278,8 @@
   },
   created() {
     this.getList1();
+    console.log(this.dict.type.dict_team,999);
+    
   },
   methods: {
     inputChange() {
@@ -1653,72 +1655,28 @@
                 this.websocket = websocket;
                 // 杩炴帴璁惧
                 var jsonObj = {
-                  name: "connect",
+                  type: "1",
                 };
                 var jStr = JSON.stringify(jsonObj);
                 this.websocket.send(jStr);
                 alert("璇锋斁韬唤璇佸啀鐐圭‘璁�");
                 var jsonObj = {
-                  name: "readCert",
+                  // name: "readCert",
                 };
-                var jStr = JSON.stringify(jsonObj);
-                this.websocket.send(jStr);
+                // var jStr = JSON.stringify(jsonObj);
+                // this.websocket.send(jStr);
                 this.dialogVisible = false;
               };
 
               //鎺ユ敹鍒版秷鎭殑鍥炶皟鏂规硶
-              websocket.onmessage = function (event) {
+              websocket.onmessage =  (event)=> {
                 var resultObj = eval("(" + event.data + ")");
                 //resultFlag涓�0浠h〃璇诲崱鎴愬姛
-                if (
-                  resultObj.name == "readCard" ||
-                  resultObj.name == "readCert" ||
-                  resultObj.name == "PushWithImg" ||
-                  resultObj.name == "PushWithOutImg"
-                ) {
-                  if (resultObj.resultFlag == "0") {
-                    //鍥炴樉鐩稿叧鏁版嵁
-                    _this.form.cusName = resultObj.resultContent.partyName;
-                    _this.form.cusSex =
-                      resultObj.resultContent.gender == "0" ? "濂�" : "鐢�";
-                    _this.form.cusNational = resultObj.resultContent.nation;
-                    _this.form.cusBrithday = resultObj.resultContent.bornDay;
-                    if (_this.form.cusBrithday) {
-                      _this.form.cusBrithday = _this.form.cusBrithday.replace(
-                        /^(\d{4})(\d{2})(\d{2})$/,
-                        "$1-$2-$3"
-                      );
-                    }
-                    _this.form.cusAddr = resultObj.resultContent.certAddress;
-                    _this.form.cusIdcard = resultObj.resultContent.certNumber;
-                    _this.imageUrl =
-                      "data:image/jpeg;base64," +
-                      resultObj.resultContent.identityPic;
-                    if (
-                      resultObj.name == "readCert" ||
-                      resultObj.name == "PushWithImg"
-                    ) {
-                      this.imageUrl =
-                        "data:image/jpeg;base64," +
-                        resultObj.resultContent.identityPrintPic;
-                    }
-                  } else if (resultObj.resultFlag == "-1") {
-                    if (resultObj.errorMsg == "绔彛鎵撳紑澶辫触") {
-                      //alert("璇诲崱鍣ㄦ湭杩炴帴");
-                    } else {
-                      //alert(resultObj.errorMsg);
-                    }
-                  } else if (resultObj.resultFlag == "-2") {
-                    //alert(resultObj.errorMsg);
-                  }
-                } else if (resultObj.name == "getStatus") {
-                  if (resultObj.resultFlag == "0") {
-                    if (resultObj.status == "0") {
-                    } else {
-                      alert("璁惧杩炴帴宸叉柇寮�锛岃妫�鏌ヨ鍗″櫒杩炴帴");
-                    }
-                  }
-                }
+                
+                // TODO 浠ヤ笅浠g爜鍙兘鏄尘宸濅娇鐢ㄧ殑
+                console.log(resultObj);
+                // this.jingChuanHandlerWebSocketResult(resultObj)
+                this.readCardWebSocket(resultObj)
               };
 
               //杩炴帴鍏抽棴鐨勫洖璋冩柟娉�
@@ -1764,7 +1722,90 @@
         });
       }
     },
-
+// 鏈�鏂颁娇鐢╳ebSocket閫氫俊
+readCardWebSocket(resultObj){
+      let _this = this;
+      if (resultObj.code === 200) {
+          //鍥炴樉鐩稿叧鏁版嵁
+          _this.form.cusName = resultObj.data.name;
+          _this.form.cusSex =
+            resultObj.data.sex == "0" ? "濂�" : "鐢�";
+          _this.form.cusNational = resultObj.data.mz;
+          _this.form.cusBrithday = resultObj.data.csrq;
+          if (_this.form.cusBrithday) {
+            _this.form.cusBrithday = _this.form.cusBrithday.replace(
+              /^(\d{4})(\d{2})(\d{2})$/,
+              "$1-$2-$3"
+            );
+          }
+          _this.form.cusAddr = resultObj.data.addres;
+          _this.form.cusIdcard = resultObj.data.card;
+          _this.imageUrl =
+            "data:image/jpeg;base64," + resultObj.data.img;
+          if (resultObj.name == "readCert" || resultObj.name == "PushWithImg") {
+            this.imageUrl =
+              "data:image/jpeg;base64," +
+              resultObj.data.img;
+          }
+        } else if (resultObj.resultFlag == "-1") {
+          if (resultObj.errorMsg == "绔彛鎵撳紑澶辫触") {
+            //alert("璇诲崱鍣ㄦ湭杩炴帴");
+          } else {
+            //alert(resultObj.errorMsg);
+          }
+        } else if (resultObj.resultFlag == "-2") {
+          //alert(resultObj.errorMsg);
+        }
+    },
+    // TODO 浠ヤ笅浠g爜鍙兘鏄尘宸濅娇鐢ㄧ殑
+    jingChuanHandlerWebSocketResult(resultObj) {
+      let _this = this;
+      if (
+        resultObj.name == "readCard" ||
+        resultObj.name == "readCert" ||
+        resultObj.name == "PushWithImg" ||
+        resultObj.name == "PushWithOutImg"
+      ) {
+        if (resultObj.resultFlag == "0") {
+          //鍥炴樉鐩稿叧鏁版嵁
+          _this.form.cusName = resultObj.resultContent.partyName;
+          _this.form.cusSex =
+            resultObj.resultContent.gender == "0" ? "濂�" : "鐢�";
+          _this.form.cusNational = resultObj.resultContent.nation;
+          _this.form.cusBrithday = resultObj.resultContent.bornDay;
+          if (_this.form.cusBrithday) {
+            _this.form.cusBrithday = _this.form.cusBrithday.replace(
+              /^(\d{4})(\d{2})(\d{2})$/,
+              "$1-$2-$3"
+            );
+          }
+          _this.form.cusAddr = resultObj.resultContent.certAddress;
+          _this.form.cusIdcard = resultObj.resultContent.certNumber;
+          _this.imageUrl =
+            "data:image/jpeg;base64," + resultObj.resultContent.identityPic;
+          if (resultObj.name == "readCert" || resultObj.name == "PushWithImg") {
+            this.imageUrl =
+              "data:image/jpeg;base64," +
+              resultObj.resultContent.identityPrintPic;
+          }
+        } else if (resultObj.resultFlag == "-1") {
+          if (resultObj.errorMsg == "绔彛鎵撳紑澶辫触") {
+            //alert("璇诲崱鍣ㄦ湭杩炴帴");
+          } else {
+            //alert(resultObj.errorMsg);
+          }
+        } else if (resultObj.resultFlag == "-2") {
+          //alert(resultObj.errorMsg);
+        }
+      } else if (resultObj.name == "getStatus") {
+        if (resultObj.resultFlag == "0") {
+          if (resultObj.status == "0") {
+          } else {
+            alert("璁惧杩炴帴宸叉柇寮�锛岃妫�鏌ヨ鍗″櫒杩炴帴");
+          }
+        }
+      }
+    },
     handleChanges(param1) {
       if (this.form.pacCode == "涓嶈") {
         this.form.cusIdcard = param1[0].xh;

--
Gitblit v1.8.0