表格支持左右箭头翻页,button 修复bug

This commit is contained in:
吕金泽 2022-01-30 11:58:10 +08:00
parent b59503729c
commit bdf4bc828a
4 changed files with 24 additions and 12 deletions

View File

@ -61,6 +61,7 @@ export default {
data() { data() {
return { return {
el_: this.el || {}, el_: this.el || {},
requestMethod_: this.requestMethod,
beforeConfirm_: this.beforeConfirm, beforeConfirm_: this.beforeConfirm,
successTips_: this.successTips, successTips_: this.successTips,
failTips_: this.failTips failTips_: this.failTips
@ -69,7 +70,7 @@ export default {
created() { created() {
if (this.btnType) { if (this.btnType) {
if (this.btnType === 'delete') { if (this.btnType === 'delete') {
this.requestMethod = 'post' this.requestMethod_ = 'post'
this.el_.type = 'danger' this.el_.type = 'danger'
this.el_.text = '删除' this.el_.text = '删除'
this.el_.icon = 'el-icon-delete' this.el_.icon = 'el-icon-delete'
@ -96,7 +97,7 @@ export default {
buttonClickRequest() { buttonClickRequest() {
// var requestOptions = {} // var requestOptions = {}
// requestOptions.url = this.requestUrl // requestOptions.url = this.requestUrl
// requestOptions.method = this.requestMethod // requestOptions.method = this.requestMethod_
// if (requestOptions.method === 'get') { // if (requestOptions.method === 'get') {
// requestOptions.params = this.requestData // requestOptions.params = this.requestData
// } else { // } else {
@ -108,7 +109,7 @@ export default {
}) })
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.requestMethod === 'get') { if (this.requestMethod_ === 'get') {
this.$get(this.requestUrl, this.requestData).then(res => { this.$get(this.requestUrl, this.requestData).then(res => {
const { data } = res const { data } = res
if (data) { if (data) {

View File

@ -122,6 +122,7 @@ export default {
this.newWhere = this.$common.renderWhere(this.where) this.newWhere = this.$common.renderWhere(this.where)
}, },
mounted() { mounted() {
this.keyup()
if (this.data) { if (this.data) {
this.handlerData() this.handlerData()
} }
@ -191,6 +192,22 @@ export default {
if (this.data) { if (this.data) {
this.handlerData() this.handlerData()
} }
},
keyup(){
document.onkeyup = (e) => {
if(e.target.nodeName != 'INPUT'){
if (e && e.keyCode == 37) {
if(this.listCurrent != 1){
this.listCurrent -= 1
}
} else if (e && e.keyCode == 39) {
if(this.listCurrent != parseInt((this.total + this.limit - 1) / this.limit)){
this.listCurrent += 1
}
}
}
this.handlerPagination()
}
} }
} }
} }

View File

@ -58,7 +58,8 @@ export default {
type: 'input', type: 'input',
label: '值', label: '值',
value: '' value: ''
} },
dictId: this.dictId
}, },
cols: [ cols: [
{ {
@ -118,19 +119,12 @@ export default {
temp: this.getTemp() temp: this.getTemp()
} }
}, },
watch: {
dictId(newVal) {
this.dictId = newVal
this.reloadTable()
}
},
mounted() { mounted() {
this.selectValue = this.value this.selectValue = this.value
this.reloadTable() this.reloadTable()
}, },
methods: { methods: {
reloadTable() { reloadTable() {
this.tableOptions.where.dictId = this.dictId
this.$refs.table.reloadList() this.$refs.table.reloadList()
}, },
getTemp() { getTemp() {

View File

@ -35,7 +35,7 @@
<mb-dialog ref="dictItemsDialog" title="字典项" width="1400px"> <mb-dialog ref="dictItemsDialog" title="字典项" width="1400px">
<template #content> <template #content>
<dict-items :dict-id.sync="dictId" /> <dict-items :key="Math.random()" :dict-id.sync="dictId" />
</template> </template>
</mb-dialog> </mb-dialog>