mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +08:00
Close pin dialog (#1121)
Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
2312711de4
commit
64a62b2e69
@ -311,12 +311,12 @@
|
||||
</el-row>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
<el-dialog ref="dialog" :title="$t('form.pos.pinMessage.pin') + attributePin.label" width="40%" :visible.sync="visible">
|
||||
<el-dialog ref="dialog" v-shortkey="{close: ['esc'], enter: ['enter']}" :title="$t('form.pos.pinMessage.pin') + attributePin.label" width="40%" :visible.sync="visible" @shortkey.native="theAction">
|
||||
<el-input
|
||||
id="pin"
|
||||
ref="pin"
|
||||
v-model="pin"
|
||||
:autofocus="true"
|
||||
autofocus
|
||||
type="password"
|
||||
:placeholder="$t('form.pos.tableProduct.pin')"
|
||||
:focus="true"
|
||||
@ -477,21 +477,29 @@ export default {
|
||||
return this.currentPointOfSales.currentOrder
|
||||
}
|
||||
},
|
||||
// watch: {
|
||||
// visible(value) {
|
||||
// if (value && !this.isEmptyValue(this.$refs)) {
|
||||
// setTimeout(() => {
|
||||
// this.focusPin()
|
||||
// }, 500)
|
||||
// } else {
|
||||
// this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: value })
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
watch: {
|
||||
visible(value) {
|
||||
if (value && !this.isEmptyValue(this.$refs)) {
|
||||
setTimeout(() => {
|
||||
this.focusPin()
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.findProcess(this.posProcess)
|
||||
},
|
||||
methods: {
|
||||
theAction(event) {
|
||||
switch (event.srcKey) {
|
||||
case 'enter':
|
||||
this.openPin(this.pin)
|
||||
break
|
||||
case 'close':
|
||||
this.closePin()
|
||||
break
|
||||
}
|
||||
},
|
||||
closePin() {
|
||||
this.visible = false
|
||||
this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: false })
|
||||
@ -501,6 +509,7 @@ export default {
|
||||
this.$refs.pin.focus()
|
||||
},
|
||||
openPin(pin) {
|
||||
this.focusPin()
|
||||
validatePin({
|
||||
posUuid: this.currentPointOfSales.uuid,
|
||||
pin
|
||||
@ -526,6 +535,7 @@ export default {
|
||||
this.pin = ''
|
||||
})
|
||||
.finally(() => {
|
||||
this.pin = ''
|
||||
this.visible = false
|
||||
})
|
||||
},
|
||||
|
@ -21,7 +21,7 @@
|
||||
id="headerContainer"
|
||||
style="display: -webkit-box; height: 100%"
|
||||
>
|
||||
<el-container v-shortkey="{ closeForm: ['esc'] }" style="background: white; height: 100%!important;" @shortkey.native="keyActionClosePin">
|
||||
<el-container style="background: white; height: 100%!important;">
|
||||
<el-header
|
||||
height="auto"
|
||||
:style="isShowedPOSKeyLayout ? 'padding-right: 20px; padding-left: 0px;' : 'padding-right: 0px; padding-left: 0px;'"
|
||||
@ -214,16 +214,15 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-main>
|
||||
<el-dialog ref="dialog" v-shortkey="{ closeForm: ['esc'] }" :title="$t('form.pos.pinMessage.pin') + infowOverdrawnInvoice.label" width="40%" :visible.sync="visible" @shortkey.native="keyActionClosePin">
|
||||
<el-dialog ref="dialog" v-shortkey="{close: ['esc'], enter: ['enter']}" :title="$t('form.pos.pinMessage.pin') + infowOverdrawnInvoice.label" width="40%" :visible.sync="visible" @shortkey.native="theAction">
|
||||
<el-input
|
||||
id="pin"
|
||||
ref="pin"
|
||||
v-model="pin"
|
||||
:autofocus="true"
|
||||
autofocus
|
||||
type="password"
|
||||
:placeholder="$t('form.pos.tableProduct.pin')"
|
||||
:focus="true"
|
||||
@change="openPin(pin)"
|
||||
/>
|
||||
<span style="float: right;">
|
||||
<el-button
|
||||
|
@ -218,6 +218,16 @@ export default {
|
||||
formatDate,
|
||||
formatPrice,
|
||||
formatQuantity,
|
||||
theAction(event) {
|
||||
switch (event.srcKey) {
|
||||
case 'enter':
|
||||
this.openPin(this.pin)
|
||||
break
|
||||
case 'close':
|
||||
this.closePin()
|
||||
break
|
||||
}
|
||||
},
|
||||
openPin(pin) {
|
||||
validatePin({
|
||||
posUuid: this.currentPointOfSales.uuid,
|
||||
@ -245,6 +255,7 @@ export default {
|
||||
})
|
||||
.finally(() => {
|
||||
this.visible = false
|
||||
this.pin = ''
|
||||
})
|
||||
},
|
||||
pinAction(action) {
|
||||
@ -309,6 +320,7 @@ export default {
|
||||
},
|
||||
closePin() {
|
||||
this.visible = false
|
||||
this.pin = ''
|
||||
this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: false })
|
||||
this.setDocumentType(this.currentOrder.documentType)
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user