Explorar el Código

适配最新的读卡插件。

lighter hace 3 años
padre
commit
0fdbe3d5b6

+ 55 - 15
src/components/medical-insurance/readcard/Index.vue

@@ -4,8 +4,11 @@
     <template #dropdown>
       <el-dropdown-menu>
         <el-dropdown-item icon="el-icon-bank-card" command="sicard">社保卡</el-dropdown-item>
-        <el-dropdown-item icon="el-icon-s-grid" command="qrcode">二维码</el-dropdown-item>
+        <el-dropdown-item icon="el-icon-s-grid" command="qrcode">电子凭证</el-dropdown-item>
         <el-dropdown-item icon="el-icon-user" command="idcard">身份证</el-dropdown-item>
+        <el-dropdown-item icon="el-icon-bank-card" command="new-sicard" divided>社保卡(新)</el-dropdown-item>
+        <el-dropdown-item icon="el-icon-s-grid" command="new-qrcode">电子凭证(新)</el-dropdown-item>
+        <el-dropdown-item icon="el-icon-user" command="new-idcard">身份证(新)</el-dropdown-item>
       </el-dropdown-menu>
     </template>
   </el-dropdown>
@@ -28,8 +31,9 @@
 </template>
 
 <script>
-import { readCardCallback } from '@/api/medical-insurance/si-inpatient'
 import { ElMessage, ElMessageBox } from 'element-plus'
+import axios from 'axios'
+import { startLoading, endLoading } from '@/utils/loading'
 export default {
   props: {
     patNo: {
@@ -80,20 +84,56 @@ export default {
 
     const executeReadCard = (cardtype) => {
       const nowbiztype = props.biztype || currentBiztype.value
-      const param = `${cardtype}_${props.patNo}_${nowbiztype}`
-      window.open(`ReadCard://${param}`, '_self')
-      readCardCallback(param).then((res) => {
-        const result = {
-          mdtrtCertType: cardtype,
-          readCardResult: res.data,
-          readCardBizType: nowbiztype,
+      if (cardtype.startsWith('new') !== -1) {
+        cardtype = cardtype.split('-')[1]
+        if (cardtype !== 'qrcode') {
+          startLoading()
         }
-        ctx.emit('success', result)
-        ElMessageBox.alert(res.message, '提示', {
-          type: 'success',
-          showCancelButton: false,
-        }).then(() => {})
-      })
+        const param = `${cardtype}_${nowbiztype}`
+        axios('http://localhost:8321/readcard/entry?param=' + param)
+          .then((res) => {
+            endLoading()
+            if (res.data.code === 200) {
+              const result = {
+                mdtrtCertType: cardtype,
+                readCardResult: cardtype === 'qrcode' ? JSON.stringify(JSON.parse(res.data.data).data) : res.data.data,
+                readCardBizType: nowbiztype,
+              }
+              ctx.emit('success', result)
+              ElMessageBox.alert(res.data.message, '提示', {
+                type: 'success',
+                showCancelButton: false,
+              }).then(() => {})
+            } else {
+              ElMessageBox.alert(res.data.message.trim(), '错误', {
+                type: 'error',
+                showCancelButton: false,
+              }).then(() => {})
+            }
+          })
+          .catch((e) => {
+            endLoading()
+            ElMessageBox.alert(e, '错误', {
+              type: 'error',
+              showCancelButton: false,
+            }).then(() => {})
+          })
+      } else {
+        const param = `${cardtype}_${props.patNo}_${nowbiztype}`
+        window.open(`ReadCard://${param}`, '_self')
+        readCardCallback(param).then((res) => {
+          const result = {
+            mdtrtCertType: cardtype,
+            readCardResult: cardtype === 'qrcode' ? JSON.stringify(res.data) : res.data,
+            readCardBizType: nowbiztype,
+          }
+          ctx.emit('success', result)
+          ElMessageBox.alert(res.message, '提示', {
+            type: 'success',
+            showCancelButton: false,
+          }).then(() => {})
+        })
+      }
     }
 
     return {

+ 13 - 3
src/views/medical-insurance/inpatient/Home.vue

@@ -15,7 +15,16 @@
           </span>
           &nbsp;&nbsp;
           <el-button type="primary" icon="el-icon-postcard" @click="checkIdCard">身份信息</el-button>
-          <el-button type="primary" icon="el-icon-download" @click="downloadReadCard" style="margin-left: 10px"> 下载读卡程序 </el-button>
+          <el-dropdown style="margin: 0 10px" trigger="click" @command="downloadReadCard">
+            <el-button type="primary">下载读卡程序<i class="el-icon-arrow-down el-icon--right"></i> </el-button>
+            <template #dropdown>
+              <el-dropdown-menu>
+                <el-dropdown-item command="thcardreader">读卡插件安装包</el-dropdown-item>
+                <el-dropdown-item command="framework" divided>.Net Framework</el-dropdown-item>
+              </el-dropdown-menu>
+            </template>
+          </el-dropdown>
+
           <el-button style="margin-left: 10px" type="success" icon="el-icon-document" @click="getRegInfo">登记信息 </el-button>
           <el-button style="margin-left: 10px" type="danger" icon="el-icon-magic-stick" @click="toEmpiView">360视图 </el-button>
         </el-header>
@@ -152,7 +161,8 @@ function makeOverview(val) {
   }
 }
 
-function downloadReadCard() {
-  window.open('http://172.16.32.160:8888/readcard/ReadCard(解压到D盘根目录).zip', '_blank')
+function downloadReadCard(command) {
+  const filename = command === 'thcardreader' ? '读卡插件.msi' : '.NET Framework 4.6.1.exe'
+  window.open(`http://172.16.32.160:8888/readcard/${filename}`, '_blank')
 }
 </script>