0920
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
|
||||
<!-- 选择关联图书 -->
|
||||
<el-dialog v-if="tableData.length > 0"
|
||||
title="请选择"
|
||||
v-loading="loading"
|
||||
title="请选择图书"
|
||||
:visible.sync="chooseBookVisible"
|
||||
width="30%"
|
||||
:before-close="handleClose">
|
||||
@@ -16,9 +15,10 @@
|
||||
<el-button @click="getBookList()">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
<el-table
|
||||
:data="tableData"
|
||||
stripe
|
||||
v-loading="loading"
|
||||
ref="multipleTablebb"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
@@ -49,7 +49,7 @@
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="chooseBookVisible = false">取 消</el-button>
|
||||
<el-button @click="handleClose()">取 消</el-button>
|
||||
<el-button type="primary" @click="submitBookIds">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@@ -92,7 +92,8 @@ export default {
|
||||
if (data.bookIds.length > 0) {
|
||||
this.$nextTick(()=> {
|
||||
//this.toggleSelection() // 获取到已选中的数据
|
||||
this.oldSelected = data.bookIds
|
||||
this.oldSelected = data.bookIds
|
||||
console.log('以前选中的部分')
|
||||
console.log(this.oldSelected,'oldSelected')
|
||||
})
|
||||
|
||||
@@ -142,18 +143,21 @@ export default {
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// if (this.oldSelected.length > 0) {
|
||||
// this.selectedBooks.forEach(item => {
|
||||
// this.$refs.multipleTablebb.toggleRowSelection(item, true);
|
||||
// })
|
||||
|
||||
// }
|
||||
|
||||
},
|
||||
submitBookIds() {
|
||||
// 提交bookids
|
||||
this.$bus.$emit("haveBookIds", { 'bookIds': this.selectedBooks });
|
||||
// 提交bookids
|
||||
// console.log('新选择的:', this.selectedBooks)
|
||||
var arr = []
|
||||
if (this.oldSelected.length > 0) {
|
||||
// console.log('有之前选中的数据', this.oldSelected)
|
||||
arr = this.oldSelected
|
||||
arr = arr.concat(this.selectedBooks)
|
||||
} else {
|
||||
arr = this.selectedBooks
|
||||
}
|
||||
// console.log('需要提交的数组', arr, this.selectedBooks)
|
||||
this.$bus.$emit("haveBookIds", { 'bookIds': arr });
|
||||
this.handleClose()
|
||||
},
|
||||
handleSelectionChange(e) {
|
||||
@@ -161,6 +165,8 @@ export default {
|
||||
this.selectedBooks = e
|
||||
},
|
||||
handleClose() { // 关闭组件
|
||||
this.oldSelected = [],
|
||||
this.selectedBooks = []
|
||||
this.$emit('closeBookf', false)
|
||||
},
|
||||
// 每页数
|
||||
|
||||
Reference in New Issue
Block a user