|
@@ -413,6 +413,7 @@
|
|
|
@confirm="handleConfirm"
|
|
@confirm="handleConfirm"
|
|
|
>
|
|
>
|
|
|
<cost-audit-table
|
|
<cost-audit-table
|
|
|
|
|
+ ref="selectWhTable"
|
|
|
:table-data="selectDocumentWhData"
|
|
:table-data="selectDocumentWhData"
|
|
|
:columns="selectDocumentWhColumns"
|
|
:columns="selectDocumentWhColumns"
|
|
|
:show-selection="true"
|
|
:show-selection="true"
|
|
@@ -1382,12 +1383,41 @@
|
|
|
this.selectDocumentWhPagination.pageSize = pageSize
|
|
this.selectDocumentWhPagination.pageSize = pageSize
|
|
|
},
|
|
},
|
|
|
selectDocumentWhSelectionChange(selection) {
|
|
selectDocumentWhSelectionChange(selection) {
|
|
|
- if (selection.length > 1) {
|
|
|
|
|
- this.$message.error('只能选择一个文号!')
|
|
|
|
|
|
|
+ // 该弹窗要求“单选”:只保留最后一次勾选
|
|
|
|
|
+ const list = Array.isArray(selection) ? selection : []
|
|
|
|
|
+ if (list.length <= 1) {
|
|
|
|
|
+ this.selectDocumentWhSelection = list
|
|
|
return
|
|
return
|
|
|
- } else {
|
|
|
|
|
- this.selectDocumentWhSelection = selection
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ const last = list[list.length - 1]
|
|
|
|
|
+ this.$message.error('只能选择一个文号!')
|
|
|
|
|
+ this.selectDocumentWhSelection = last ? [last] : []
|
|
|
|
|
+
|
|
|
|
|
+ // 同步清理 UI 上的多选勾选(兼容不同 table 组件暴露的方法)
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ const table = this.$refs.selectWhTable
|
|
|
|
|
+ if (!table) return
|
|
|
|
|
+
|
|
|
|
|
+ // 1) 若内部直接是 el-table
|
|
|
|
|
+ if (typeof table.clearSelection === 'function') {
|
|
|
|
|
+ table.clearSelection()
|
|
|
|
|
+ if (last && typeof table.toggleRowSelection === 'function') {
|
|
|
|
|
+ table.toggleRowSelection(last, true)
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2) 若外层封装,需要从 $refs.table 取 el-table
|
|
|
|
|
+ const inner =
|
|
|
|
|
+ table.$refs && (table.$refs.table || table.$refs.elTable)
|
|
|
|
|
+ if (inner && typeof inner.clearSelection === 'function') {
|
|
|
|
|
+ inner.clearSelection()
|
|
|
|
|
+ if (last && typeof inner.toggleRowSelection === 'function') {
|
|
|
|
|
+ inner.toggleRowSelection(last, true)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
handleTemplateChange() {
|
|
handleTemplateChange() {
|
|
|
let data = this.documentData.documentTypes.find(
|
|
let data = this.documentData.documentTypes.find(
|