修复托盘登录批次选择确认
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
:row-key="rowKey"
|
||||
:header-cell-style="headerCellStyle"
|
||||
v-bind="tableAttrs"
|
||||
v-on="tableListeners"
|
||||
v-on="elTableListeners"
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<!--
|
||||
@@ -366,6 +366,20 @@ export default {
|
||||
*/
|
||||
headerCellStyle () {
|
||||
return () => 'background-color: #F8F8F8; color: #000000; font-weight: 500;'
|
||||
},
|
||||
|
||||
/**
|
||||
* 将父组件直接绑定在 page-table 上的 el-table 原生事件透传下去。
|
||||
* selection-change 由当前组件统一维护选中行状态,避免父级监听被触发两次。
|
||||
*/
|
||||
elTableListeners () {
|
||||
const listeners = {
|
||||
...this.$listeners,
|
||||
...this.tableListeners
|
||||
}
|
||||
delete listeners['selection-change']
|
||||
delete listeners['page-change']
|
||||
return listeners
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
||||
@@ -136,9 +136,15 @@
|
||||
:row-buttons="[]"
|
||||
:pagination="null"
|
||||
:table-attrs="{ size: 'mini', rowKey: 'batch', highlightCurrentRow: true }"
|
||||
:table-listeners="batchTableListeners"
|
||||
height="420px"
|
||||
@row-dblclick="selectBatch"
|
||||
/>
|
||||
<span slot="footer">
|
||||
<el-button size="mini" @click="batchDialogVisible = false">{{ $t(key('cancel')) }}</el-button>
|
||||
<el-button size="mini" type="primary" :disabled="!currentBatch" @click="confirmBatch">
|
||||
{{ $t(key('confirm')) }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :title="$t(key('format_dialog_title'))" :visible.sync="formatDialogVisible" width="820px">
|
||||
@@ -154,8 +160,8 @@
|
||||
:row-buttons="[]"
|
||||
:pagination="null"
|
||||
:table-attrs="{ size: 'mini', rowKey: 'id', highlightCurrentRow: true }"
|
||||
:table-listeners="formatTableListeners"
|
||||
height="360px"
|
||||
@row-dblclick="selectFormatRow"
|
||||
>
|
||||
<template #col-actions="{ row }">
|
||||
<el-button type="text" class="danger-action" @click="deleteFormat(row)">
|
||||
@@ -239,6 +245,7 @@ export default {
|
||||
batchList: [],
|
||||
formatList: [],
|
||||
selectedRows: [],
|
||||
currentBatch: null,
|
||||
batchDialogVisible: false,
|
||||
formatDialogVisible: false,
|
||||
formatFormVisible: false,
|
||||
@@ -312,6 +319,18 @@ export default {
|
||||
selectionWidth: 0,
|
||||
indexWidth: 0
|
||||
})
|
||||
},
|
||||
batchTableListeners () {
|
||||
return {
|
||||
'current-change': this.onBatchCurrentChange,
|
||||
'row-click': this.onBatchCurrentChange,
|
||||
'row-dblclick': this.selectBatch
|
||||
}
|
||||
},
|
||||
formatTableListeners () {
|
||||
return {
|
||||
'row-dblclick': this.selectFormatRow
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@@ -335,11 +354,21 @@ export default {
|
||||
return new RegExp(`^${escaped}$`)
|
||||
},
|
||||
openBatchDialog () {
|
||||
this.currentBatch = this.batchList.find(item => item.batch === this.form.batch) || null
|
||||
this.batchDialogVisible = true
|
||||
if (!this.batchList.length) this.fetchBatchList()
|
||||
},
|
||||
onBatchCurrentChange (row) {
|
||||
this.currentBatch = row || null
|
||||
},
|
||||
confirmBatch () {
|
||||
if (!this.currentBatch) return
|
||||
this.selectBatch(this.currentBatch)
|
||||
},
|
||||
selectBatch (row) {
|
||||
if (!row || !row.batch) return
|
||||
this.form.batch = row.batch
|
||||
this.currentBatch = row
|
||||
this.batchDialogVisible = false
|
||||
},
|
||||
async fetchBatchList () {
|
||||
|
||||
Reference in New Issue
Block a user