Merge branch 'xie-fenzhi'
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<!-- <el-form-item label="图书id" prop="bookId">
|
||||
<el-input v-model="dataForm.bookId" placeholder="图书id"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="章节序号" prop="number" v-show="opName== 'update'">
|
||||
<el-form-item label="章节序号" prop="number" >
|
||||
<el-input style="width: 150px;" type="number" v-model="dataForm.number" placeholder="章节序号:1,2..."></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="章节" prop="chapter">
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
<img width="100%" :src="dataForm.productImages" alt="">
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="简介/描述" prop="bookdesc">
|
||||
<el-input type="textarea" rows="4" v-model="dataForm.bookdesc"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="书评详情" prop="productDetails">
|
||||
<quill-editor v-model="dataForm.productDetails" ref="myQuillEditor" :options="editorOption"
|
||||
@blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
|
||||
@@ -79,6 +81,7 @@
|
||||
title: '',
|
||||
productPid: '',
|
||||
productImages: '',
|
||||
bookdesc:'',
|
||||
shupingid:null,
|
||||
|
||||
},
|
||||
@@ -172,7 +175,7 @@
|
||||
// console.log(data,666)
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.title = data.BookForumArticlesEntity.title
|
||||
|
||||
this.dataForm.bookdesc = data.BookForumArticlesEntity.bookdesc
|
||||
this.dataForm.productImages = data.BookForumArticlesEntity.image
|
||||
this.dataForm.productDetails = data.BookForumArticlesEntity.content
|
||||
|
||||
@@ -224,7 +227,8 @@
|
||||
'image': this.dataForm.productImages,
|
||||
'content': this.dataForm.productDetails,
|
||||
'userid': this.$store.state.user.id,
|
||||
'id': this.dataForm.shupingid
|
||||
'id': this.dataForm.shupingid,
|
||||
'bookdesc': this.dataForm.bookdesc
|
||||
})
|
||||
}).then(({
|
||||
data
|
||||
|
||||
@@ -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)
|
||||
},
|
||||
// 每页数
|
||||
|
||||
@@ -461,8 +461,8 @@
|
||||
// 'quality': this.dataForm.quality, // 内文用纸
|
||||
'productStock': this.dataForm.productStock, // 库存
|
||||
'activityPrice': this.dataForm.hDprice,
|
||||
'bookids': this.bookidsd, // 关联的图书
|
||||
'bookidsimages': this.dataForm.Books // 关联的图书对象
|
||||
'bookids': this.bookidsd, // 关联的图书[12,13,45]
|
||||
// 'bookidsimages': this.dataForm.Books // 关联的图书对象
|
||||
})
|
||||
}).then(({
|
||||
data
|
||||
@@ -582,8 +582,25 @@
|
||||
mounted() {
|
||||
this.$bus.$on("haveBookIds", (data) => {
|
||||
sessionStorage.setItem('Books', JSON.stringify(data.bookIds))
|
||||
// console.log('haveBookIds',data)
|
||||
data.bookIds.length > 0 ? this.dataForm.Books = data.bookIds : this.dataForm.Books = []
|
||||
// console.log('haveBookIds',data)
|
||||
//console.log(data.bookIds, '收到的数据')
|
||||
var newarr = []
|
||||
var ids = [] //哨兵数组
|
||||
if (data.bookIds && data.bookIds.length > 0) {
|
||||
ids[0] = data.bookIds[0].id
|
||||
newarr[0] = data.bookIds[0]
|
||||
// console.log(ids,'ids')
|
||||
// newarr.push(data.bookIds[0])
|
||||
for (let index = 0; index < data.bookIds.length; index++) {
|
||||
if (!ids.includes(data.bookIds[index].id)) {
|
||||
// console.log(data.bookIds[index].id, 'data.bookIds[index].id')
|
||||
newarr.push(data.bookIds[index])
|
||||
ids.push(data.bookIds[index].id)
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(newarr,'newarr',ids)
|
||||
data.bookIds.length > 0 ? this.dataForm.Books = newarr : this.dataForm.Books = []
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user