Ver Fonte

优化读卡

lighter há 3 anos atrás
pai
commit
c2bd00453a
1 ficheiros alterados com 27 adições e 45 exclusões
  1. 27 45
      src/components/medical-insurance/readcard/Index.vue

+ 27 - 45
src/components/medical-insurance/readcard/Index.vue

@@ -3,9 +3,9 @@
     <el-button type="primary">读卡<i class="el-icon-arrow-down el-icon--right"></i> </el-button>
     <template #dropdown>
       <el-dropdown-menu>
-        <el-dropdown-item icon="el-icon-bank-card" command="new-sicard">社保卡</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-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-user" command="idcard">身份证</el-dropdown-item>
       </el-dropdown-menu>
     </template>
   </el-dropdown>
@@ -81,56 +81,38 @@ export default {
 
     const executeReadCard = (cardtype) => {
       const nowbiztype = props.biztype || currentBiztype.value
-      if (cardtype.startsWith('new')) {
-        cardtype = cardtype.split('-')[1]
-        if (cardtype !== 'qrcode') {
-          startLoading()
-        }
-        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(() => {})
+      if (cardtype !== 'qrcode') {
+        startLoading()
+      }
+      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,
             }
-          })
-          .catch((e) => {
-            endLoading()
-            ElMessageBox.alert(e, '错误', {
+            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(() => {})
-          })
-      } 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',
+        })
+        .catch((e) => {
+          endLoading()
+          ElMessageBox.alert(e, '错误', {
+            type: 'error',
             showCancelButton: false,
           }).then(() => {})
         })
-      }
     }
 
     return {