wangqifan 3 years ago
parent
commit
7246719bc6

+ 17 - 7
src/main/vue/src/components/operation/CheckinInfoEdit.vue

@@ -206,7 +206,7 @@ export default {
                 console.log(e);
                 this.$message.error(e.error);
             });
-        eventBus.$on('readIdResult', this.onReadId);
+        // eventBus.$on('readIdResult', this.onReadId);
     },
     data() {
         return {
@@ -420,14 +420,24 @@ export default {
             }
         },
         readId() {
-            eventBus.$emit('readId');
+            // eventBus.$emit('readId');
+            this.$http
+                .get('http://127.0.0.1:30004/api/info')
+                .then(res => {
+                    this.onReadId(res);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$emit('cancel');
+                    this.$message.error(e.error);
+                });
         },
         onReadId(res) {
-            this.$set(this.formData, 'idNo', res.Certificate.IDNumber);
-            this.$set(this.formData, 'name', res.Certificate.Name);
-            this.$set(this.formData, 'sex', res.Certificate.Sex);
-            this.$set(this.formData, 'address', res.Certificate.Address);
-            this.$set(this.formData, 'photo', res.Certificate.Base64Photo);
+            this.$set(this.formData, 'idNo', res.CardInfo.No);
+            this.$set(this.formData, 'name', res.CardInfo.Name);
+            this.$set(this.formData, 'sex', res.CardInfo.Sex);
+            this.$set(this.formData, 'address', res.CardInfo.Address);
+            this.$set(this.formData, 'photo', res.CardInfo.Photo);
         }
     },
     watch: {

+ 20 - 13
src/main/vue/src/components/roomStatus/CheckinDialog.vue

@@ -95,7 +95,7 @@
                             placeholder="请输入身份证"
                             style="width:200px"
                         ></el-input>
-                        <el-button class="filter-btn" style="margin-left:10px" @click="getIDCard">读取身份证</el-button>
+                        <el-button class="filter-btn" style="margin-left:10px" @click="readId">读取身份证</el-button>
                     </el-form-item>
                     <el-form-item class="filter-item" label="地址" prop="address">
                         <el-input v-model="checkInForm.address" autocomplete="off" placeholder="请输入地址"></el-input>
@@ -204,10 +204,10 @@ import eventBus from '../../eventBus';
 export default {
     name: 'CheckinForm',
     created() {
-        eventBus.$on('readIdResult', this.onReadId);
+        // eventBus.$on('readIdResult', this.onReadId);
     },
     beforeDestroy() {
-        eventBus.$off('readIdResult', this.onReadId);
+        // eventBus.$off('readIdResult', this.onReadId);
     },
     data() {
         return {
@@ -533,18 +533,25 @@ export default {
             list = list.filter((item, index, self) => index === self.findIndex(t => t.id === item.id));
             this.checkInForm.personalFeeTypes = list;
         },
-        getIDCard() {
-            eventBus.$emit('readId');
+        readId() {
+            // eventBus.$emit('readId');
+            this.$http
+                .get('http://127.0.0.1:30004/api/info')
+                .then(res => {
+                    this.onReadId(res);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$emit('cancel');
+                    this.$message.error(e.error);
+                });
         },
         onReadId(res) {
-            console.log('onReadId::', res);
-            if (this.visible) {
-                this.$set(this.checkInForm, 'idNo', res.Certificate.IDNumber);
-                this.$set(this.checkInForm, 'name', res.Certificate.Name);
-                this.$set(this.checkInForm, 'sex', res.Certificate.Sex);
-                this.$set(this.checkInForm, 'address', res.Certificate.Address);
-                this.$set(this.checkInForm, 'photo', res.Certificate.Base64Photo);
-            }
+            this.$set(this.formData, 'idNo', res.CardInfo.No);
+            this.$set(this.formData, 'name', res.CardInfo.Name);
+            this.$set(this.formData, 'sex', res.CardInfo.Sex);
+            this.$set(this.formData, 'address', res.CardInfo.Address);
+            this.$set(this.formData, 'photo', res.CardInfo.Photo);
         },
         confirmBlackList() {
             if (this.checkInForm.idNo) {