|
|
@@ -48,10 +48,11 @@
|
|
|
<b-col md="6">
|
|
|
<b-card title="報到輸入" style="height: 65vh;">
|
|
|
<b-input-group prepend="編號" class="mt-3">
|
|
|
- <b-form-input v-model="input" @keydown.native="keyListener" inputmode="numeric"
|
|
|
+ <b-form-input v-model="input" @keydown.native="keyListener" :inputmode="inputmode"
|
|
|
placeholder="請輸入員工編號或來賓編號..."></b-form-input>
|
|
|
<b-input-group-append>
|
|
|
- <b-button @click="searchData" variant="info">送出</b-button>
|
|
|
+ <b-button size="sm" @click="searchData" variant="info">送出</b-button>
|
|
|
+ <b-button size="sm" @click="switchType">{{ mode }}</b-button>
|
|
|
</b-input-group-append>
|
|
|
</b-input-group>
|
|
|
<br>
|
|
|
@@ -104,6 +105,7 @@ export default {
|
|
|
return {
|
|
|
user: { name: " ", user_id: " ", department: " " },
|
|
|
input: "",
|
|
|
+ isNum: true,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -138,6 +140,7 @@ export default {
|
|
|
this.user = { name: " ", user_id: " ", department: " " };
|
|
|
},
|
|
|
showToast(variant) {
|
|
|
+
|
|
|
useJwt.postData('/api/check_in/update', { 'user_id': this.user.user_id }).then(response => {
|
|
|
console.log(response.data)
|
|
|
this.$toast({
|
|
|
@@ -152,6 +155,16 @@ export default {
|
|
|
this.user.is_checked_in = 1;
|
|
|
}).catch(error => {
|
|
|
console.log(error)
|
|
|
+ variant = 'danger'
|
|
|
+ this.$toast({
|
|
|
+ component: ToastificationContent,
|
|
|
+ props: {
|
|
|
+ title: '報到失敗',
|
|
|
+ icon: 'CheckCircleIcon',
|
|
|
+ text: '報到失敗! 原因: ' + error,
|
|
|
+ variant,
|
|
|
+ },
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
|
|
|
@@ -166,13 +179,25 @@ export default {
|
|
|
} else {
|
|
|
return '/images/profile-picture/' + user_id + '.jpg';
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ switchType() {
|
|
|
+ this.isNum = !this.isNum;
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ mode() {
|
|
|
+ return this.isNum ? "ABC" : "123";
|
|
|
+ },
|
|
|
+ inputmode() {
|
|
|
+
|
|
|
+ return this.isNum ? "numeric" : "search";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|