Pārlūkot izejas kodu

新增华大读卡器

LiuTeng 10 mēneši atpakaļ
vecāks
revīzija
1ccb2301ea
2 mainītis faili ar 93 papildinājumiem un 54 dzēšanām
  1. 58 50
      src/api/report.js
  2. 35 4
      src/views/report/components/brushCard.vue

+ 58 - 50
src/api/report.js

@@ -1,126 +1,134 @@
-import request from '@/utils/request'
+import request from "@/utils/request";
 // debug、键盘、poss机
 export function GetMac(data) {
   return request({
-    url: 'http://127.0.0.1:18801/Service?' + Math.round(Math.random()*1000),
-    method: 'post',
-    data:data,
-    headers:{"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"}
-  })
+    url: "http://127.0.0.1:18801/Service?" + Math.round(Math.random() * 1000),
+    method: "post",
+    data: data,
+    headers: {
+      "Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
+    },
+  });
 }
 // 读卡
 export function getReadIDCard(data) {
-
   return request({
     url: `http://127.0.0.1:5005/Device#ReadIDCard/CVR100`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 // 获取身份信息
 export function GetIDCardInfo(data) {
   return request({
     url: `http://127.0.0.1:5005/Device#GetIDCardInfo/CVR100`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 // 关闭设备
 export function CloseDevice(data) {
   return request({
     url: `http://127.0.0.1:5005/Device#CloseDevice/CVR100`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 // 查询企业
 export function qylb(data) {
   return request({
     url: `/tax/informationSelect/personalRealNameEnterprisequery`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //查询纳税人信息
 export function nsrxx(data) {
   return request({
     url: `/tax/informationSelect/enterpriseInformationQuery`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //纳税信用级别查询
 export function nsxyjb(data) {
   return request({
     url: `/tax/informationSelect/currentCreditRating`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //纳税人缴纳税款信息
 export function skxx(data) {
   return request({
     url: `/tax/informationSelect/queryBusinessWss`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //欠税信息查询
 export function qsxx(data) {
   return request({
     url: `/tax/informationSelect/qsxxcx`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //违法违章信息查询
 export function wfwzxx(data) {
   return request({
     url: `/tax/informationSelect/illegalInformationSelect`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //
 export function getGZ(data) {
   return request({
     url: `/tax/informationSelect/getGZ`,
-    method: 'get',
-    data
-  })
+    method: "get",
+    data,
+  });
 }
 //代办事项
 export function ysbxxcx(data) {
   return request({
     url: `/tax/informationSelect/ysbxxcx`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //风险提醒
 export function yqwsbcx(data) {
   return request({
     url: `/tax/informationSelect/yqwsbcx`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 //票种核定信息
 export function pzhd(data) {
   return request({
     url: `/tax/informationSelect/pzhd`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 
 //pdf
 export function tjbgPdf(data) {
   return request({
     url: `/tax/pdf/tjbgPdf`,
-    method: 'post',
-    data
-  })
+    method: "post",
+    data,
+  });
 }
 
-
+// 华大刷卡机
+export function hdCard(data) {
+  return request({
+    url: "http://localhost:8889/sstruntime/device/IDCard/read",
+    method: "post",
+    data: data,
+  });
+}

+ 35 - 4
src/views/report/components/brushCard.vue

@@ -33,7 +33,12 @@
 </template>
 
 <script>
-import { getReadIDCard, GetIDCardInfo, CloseDevice } from "@/api/report";
+import {
+  getReadIDCard,
+  GetIDCardInfo,
+  CloseDevice,
+  hdCard,
+} from "@/api/report";
 export default {
   name: "ZhtBrushCard",
 
@@ -51,7 +56,12 @@ export default {
   mounted() {
     this.$emit("update:timerTime", 60);
     this.init = true;
-    this.getReadIDCard();
+    let cardReader = this.$route.query.cardReader;
+    if (cardReader && cardReader == "hd") {
+      this.readHdReader();
+    } else {
+      this.getReadIDCard();
+    }
     // 测试
     // this.test();
   },
@@ -162,6 +172,28 @@ export default {
       };
       CloseDevice(from).then((res) => {});
     },
+
+    // 华大读卡器
+    readHdReader() {
+      let form = { timeout: 30 };
+      hdCard(form).then((res) => {
+        if (res.resultCode == 0) {
+          this.$tip("读取信息成功", "success");
+          let userinfo = {
+            xm: res.data.name,
+            zjhm: res.data.citizenId,
+          };
+          sessionStorage.setItem("userinfo", JSON.stringify(userinfo));
+          this.nextStep();
+        } else {
+          this.$tip("未读取到信息,正在重试...", "error");
+          setTimeout(() => {
+            this.readHdReader();
+          }, 30000);
+        }
+      });
+    },
+
     nextStep() {
       clearInterval(this.timer);
       this.timer = null;
@@ -346,11 +378,10 @@ export default {
     }
 
     .card-icon {
-
       img {
         width: 670px;
       }
     }
   }
 }
-</style>
+</style>