wangqifan il y a 3 ans
Parent
commit
09c28447ae

+ 7 - 17
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,24 +420,14 @@ export default {
             }
         },
         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);
-                });
+            eventBus.$emit('readId');
         },
         onReadId(res) {
-            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);
+            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);
         }
     },
     watch: {

+ 13 - 20
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="readId">读取身份证</el-button>
+                        <el-button class="filter-btn" style="margin-left:10px" @click="getIDCard">读取身份证</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,25 +533,18 @@ export default {
             list = list.filter((item, index, self) => index === self.findIndex(t => t.id === item.id));
             this.checkInForm.personalFeeTypes = list;
         },
-        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);
-                });
+        getIDCard() {
+            eventBus.$emit('readId');
         },
         onReadId(res) {
-            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);
+            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);
+            }
         },
         confirmBlackList() {
             if (this.checkInForm.idNo) {