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

---
 src/views/system/tijianall/index.vue |  181 +++++++++++++++++++++++++++------------------
 1 files changed, 109 insertions(+), 72 deletions(-)

diff --git a/src/views/system/tijianall/index.vue b/src/views/system/tijianall/index.vue
index 8c1c7e8..5df77de 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>
@@ -650,9 +650,7 @@
                       </el-collapse-item>
                     </div>
                   </el-collapse> -->
-                  <h3  style="font-weight: 600">
-                    鍚堣锛歿{ marryall }}鍏�
-                  </h3>
+                  <h3 style="font-weight: 600">鍚堣锛歿{ marryall }}鍏�</h3>
                 </div>
               </el-col>
             </el-row>
@@ -991,7 +989,8 @@
   getTransitionList,
   getProParentIdDxList,
   getProSonDxList,
-  getaddTj,getconfigKey,
+  getaddTj,
+  getconfigKey,
   getHistryTjOrderProByCusIdCard,
   delTbBycusCardIdAndProId,
 } from "@/api/system/tijian";
@@ -1000,7 +999,8 @@
 export default {
   components: {
     VTreeTransfer,
-    historyTj,Packages
+    historyTj,
+    Packages,
   },
   dicts: [
     "dict_user_national",
@@ -1065,7 +1065,7 @@
       valueUrls: "ws://127.0.0.1:6789/websocket",
       dialogVisiblese: false,
       cardreader: false,
-      cardreaderradio:3,
+      cardreaderradio: 3,
       inputSSS: "",
       lishi: false,
       table: false,
@@ -1213,7 +1213,7 @@
       // 琛ㄥ崟鍙傛暟
       form: {
         cusIdcard: "",
-        tjType: 2,
+        tjType: "3",
         category: "01",
         cusSex: 1,
         cusNational: "1",
@@ -1278,6 +1278,7 @@
   },
   created() {
     this.getList1();
+    console.log(this.dict.type.dict_team, 999);
   },
   methods: {
     inputChange() {
@@ -1653,72 +1654,28 @@
                 this.websocket = websocket;
                 // 杩炴帴璁惧
                 var jsonObj = {
-                  name: "connect",
+                  type: "1",
                 };
                 var jStr = JSON.stringify(jsonObj);
                 this.websocket.send(jStr);
-                alert("璇锋斁韬唤璇佸啀鐐圭‘璁�");
+                // 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 +1721,89 @@
         });
       }
     },
-
+    // 鏈�鏂颁娇鐢╳ebSocket閫氫俊
+    readCardWebSocket(resultObj) {
+      let _this = this;
+      if (resultObj.code === 200 && resultObj.data.name != null) {
+        //鍥炴樉鐩稿叧鏁版嵁
+        _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 {
+        this.$message.warning("鏈煡鍒扮敤鎴蜂俊鎭�");
+      }
+      /* 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;
@@ -1775,7 +1814,6 @@
       // this.form.cusName = param1[0].pacName;
       // this.form.cusPhone = param1[0].pacRemark;
     },
-
 
     changeradio() {
       if (this.cardreaderradio != 3) {
@@ -1870,7 +1908,7 @@
             }
           }
           _this.form.cusAddr = resultObj.data.addres;
-         
+
           _this.cardreader = false;
         };
 
@@ -1943,13 +1981,13 @@
         websocket.onmessage = function (event) {
           var resultObj = JSON.parse(event.data);
           _this.form.cusName = resultObj.data.name;
-       
-          if( resultObj.data.nation == "姹夋棌"){
-            _this.form.cusNational ="1";
+
+          if (resultObj.data.nation == "姹夋棌") {
+            _this.form.cusNational = "1";
           }
-          if(resultObj.data.gender == "鐢�"){
+          if (resultObj.data.gender == "鐢�") {
             _this.form.cusSex = 0;
-          }else{
+          } else {
             _this.form.cusSex = 1;
           }
           _this.form.cusBrithday = resultObj.data.birthday;
@@ -1995,7 +2033,6 @@
         };
       }
     },
-
 
     // checkSelectable(row, index) {
     //   if (!row) {

--
Gitblit v1.8.0