Index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <el-dropdown style="margin: 0 10px" trigger="click" @command="beforeReadCard">
  3. <el-button type="primary">读卡<i class="el-icon-arrow-down el-icon--right"></i> </el-button>
  4. <template #dropdown>
  5. <el-dropdown-menu>
  6. <el-dropdown-item icon="el-icon-bank-card" command="sicard">社保卡</el-dropdown-item>
  7. <el-dropdown-item icon="el-icon-s-grid" command="qrcode">二维码</el-dropdown-item>
  8. <el-dropdown-item icon="el-icon-user" command="idcard">身份证</el-dropdown-item>
  9. </el-dropdown-menu>
  10. </template>
  11. </el-dropdown>
  12. <span class="readcard">
  13. <el-dialog v-model="showSelectBiztype" title="请选择读卡业务" width="300px">
  14. <el-radio-group v-model="currentBiztype">
  15. <el-radio label="01101">门诊挂号</el-radio>
  16. <el-radio label="01301">门诊结算</el-radio>
  17. </el-radio-group>
  18. <template #footer>
  19. <el-button type="primary" @click="handleConfirmBiztype">确定</el-button>
  20. </template>
  21. </el-dialog>
  22. </span>
  23. </template>
  24. <script>
  25. import { readCardCallback } from '@/api/medical-insurance/si-inpatient'
  26. import { ElMessage, ElMessageBox } from 'element-plus'
  27. export default {
  28. props: {
  29. patNo: {
  30. type: String,
  31. default: null,
  32. },
  33. biztype: {
  34. type: String,
  35. default: null,
  36. },
  37. },
  38. emits: ['success'],
  39. setup(props, ctx) {
  40. const showSelectBiztype = ref(false)
  41. const currentCardtype = ref(null)
  42. const currentBiztype = ref(null)
  43. const beforeReadCard = (cardtype) => {
  44. if (!props.patNo) {
  45. ElMessage({
  46. message: '请先选择患者',
  47. type: 'warning',
  48. duration: 2500,
  49. showClose: true,
  50. })
  51. return
  52. }
  53. if (props.biztype) {
  54. executeReadCard(cardtype)
  55. } else {
  56. currentCardtype.value = cardtype
  57. showSelectBiztype.value = true
  58. }
  59. }
  60. const handleConfirmBiztype = () => {
  61. if (!currentBiztype.value) {
  62. ElMessage({
  63. message: '请选择读卡业务!',
  64. type: 'warning',
  65. duration: 2500,
  66. showClose: true,
  67. })
  68. return
  69. }
  70. showSelectBiztype.value = false
  71. executeReadCard(currentCardtype.value)
  72. }
  73. const executeReadCard = (cardtype) => {
  74. const nowbiztype = props.biztype || currentBiztype.value
  75. const param = `${cardtype}_${props.patNo}_${nowbiztype}`
  76. window.open(`ReadCard://${param}`, '_self')
  77. readCardCallback(param).then((res) => {
  78. const result = {
  79. mdtrtCertType: cardtype,
  80. readCardResult: res.data,
  81. readCardBizType: nowbiztype,
  82. }
  83. ctx.emit('success', result)
  84. ElMessageBox.alert(res.message, '提示', {
  85. type: 'success',
  86. showCancelButton: false,
  87. }).then(() => {})
  88. })
  89. }
  90. return {
  91. currentBiztype,
  92. showSelectBiztype,
  93. beforeReadCard,
  94. handleConfirmBiztype,
  95. }
  96. },
  97. }
  98. </script>