第一次提交

This commit is contained in:
Sakura9701
2022-08-17 17:22:31 +08:00
parent 956f301664
commit 71d5a097e0
771 changed files with 250239 additions and 1 deletions

View File

@@ -0,0 +1,167 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="作者姓名" prop="authorName">
<el-input v-model="dataForm.authorName" placeholder="作者姓名"></el-input>
</el-form-item>
<el-form-item label="性别" prop="sex">
<!-- <el-input v-model="dataForm.sex" placeholder="性别"></el-input> -->
<el-radio v-model="dataForm.sex" :label=1></el-radio>
<el-radio v-model="dataForm.sex" :label=0></el-radio>
</el-form-item>
<el-form-item label="年龄" prop="age">
<el-input v-model="dataForm.age" placeholder="年龄"></el-input>
</el-form-item>
<el-form-item label="简介" prop="introduction">
<el-input v-model="dataForm.introduction" placeholder="简介"></el-input>
</el-form-item>
<el-form-item label="电话" prop="tel">
<el-input v-model="dataForm.tel" placeholder="电话"></el-input>
</el-form-item>
<!-- <el-form-item label="住址" prop="address">
<el-input v-model="dataForm.address" placeholder="住址"></el-input>
</el-form-item> -->
<!-- <el-form-item label="创建时间" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
</el-form-item>
<el-form-item label="更新时间" prop="updateTime">
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
</el-form-item> -->
<el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item>
<!-- <el-form-item label="删除标记" prop="delFlag">
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
authorName: '',
sex: '',
age: '',
introduction: '',
tel: '',
address: '',
createTime: '',
updateTime: '',
sort: '',
delFlag: ''
},
dataRule: {
authorName: [
{ required: true, message: '作者姓名不能为空', trigger: 'blur' }
],
sex: [
{ required: true, message: '性别不能为空', trigger: 'blur' }
],
age: [
{ required: true, message: '年龄不能为空', trigger: 'blur' }
],
introduction: [
{ required: true, message: '简介不能为空', trigger: 'blur' }
],
tel: [
{ required: true, message: '电话不能为空', trigger: 'blur' }
],
// address: [
// { required: true, message: '住址不能为空', trigger: 'blur' }
// ],
createTime: [
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
],
updateTime: [
{ required: true, message: '更新时间不能为空', trigger: 'blur' }
],
sort: [
{ required: true, message: '排序不能为空', trigger: 'blur' }
],
delFlag: [
{ required: true, message: '删除标记不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/book/author/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.authorName = data.author.authorName
this.dataForm.sex = data.author.sex
this.dataForm.age = data.author.age
this.dataForm.introduction = data.author.introduction
this.dataForm.tel = data.author.tel
this.dataForm.address = data.author.address
this.dataForm.createTime = data.author.createTime
this.dataForm.updateTime = data.author.updateTime
this.dataForm.sort = data.author.sort
this.dataForm.delFlag = data.author.delFlag
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/author/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'authorName': this.dataForm.authorName,
'sex': this.dataForm.sex,
'age': this.dataForm.age,
'introduction': this.dataForm.introduction,
'tel': this.dataForm.tel,
'address': this.dataForm.address,
'createTime': this.dataForm.createTime,
'updateTime': this.dataForm.updateTime,
'sort': this.dataForm.sort,
'delFlag': this.dataForm.delFlag
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,225 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:author:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('book:author:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<!-- <el-table-column
prop="id"
header-align="center"
align="center"
label="">
</el-table-column> -->
<el-table-column label="序号" width="70" align="center">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column
prop="authorName"
header-align="center"
align="center"
label="作者姓名">
</el-table-column>
<el-table-column
prop="sex"
header-align="center"
align="center"
label="性别">
<template slot-scope="scope">
{{scope.row.sex == 0 ? '女':'男'}}
</template>
</el-table-column>
<el-table-column
prop="age"
header-align="center"
align="center"
label="年龄">
</el-table-column>
<el-table-column
prop="introduction"
header-align="center"
align="center"
label="简介">
</el-table-column>
<el-table-column
prop="tel"
header-align="center"
align="center"
label="电话">
</el-table-column>
<!-- <el-table-column
prop="address"
header-align="center"
align="center"
label="住址">
</el-table-column> -->
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="更新时间">
</el-table-column>
<el-table-column
prop="sort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<!-- <el-table-column
prop="delFlag"
header-align="center"
align="center"
label="删除标记">
</el-table-column> -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './author-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/author/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/book/author/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,428 @@
<template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible" @close="handlereset">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-form-item label="书名" prop="name">
<el-input v-model="dataForm.name" placeholder="书名"></el-input>
</el-form-item>
<!-- <el-row>
<el-col :span="12">
<el-form-item label="作者姓名" prop="authorId">
<el-autocomplete
class="inline-input"
v-model="author"
:fetch-suggestions="querySearch"
placeholder="请输入作者姓名"
@select="handleSelect"
></el-autocomplete>
</el-form-item>
</el-col>
</el-row> -->
<el-row>
<el-col :span="12">
<el-form-item label="作者" prop="authorId">
<el-select
v-model="dataForm.authorId"
multiple
filterable
allow-create
size="small"
default-first-option
placeholder="请输入作者姓名">
<el-option
v-for="item in authorList"
:key="item.value + ''"
:label="item.value"
:value="item.id + ''">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出版社" prop="publisherId">
<el-select
v-model="dataForm.publisherId"
multiple
filterable
allow-create
default-first-option
placeholder="请输入作者姓名">
<el-option
v-for="item in publisherList"
:key="item.value + ''"
:label="item.value"
:value="item.id + ''">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- <el-input v-model="dataForm.authorId" placeholder="作者姓名" v-show="false"></el-input> -->
<el-form-item label="序言" prop="title">
<el-input v-model="dataForm.title" placeholder="序言" :rows="3" type="textarea"></el-input>
</el-form-item>
<el-form-item label="目录" prop="content">
<el-input v-model="dataForm.content" placeholder="目录" :rows="5" type="textarea"></el-input>
</el-form-item>
<el-form-item label="简介" prop="description">
<el-input v-model="dataForm.description" placeholder="简介" :rows="5" type="textarea"></el-input>
</el-form-item>
<el-form-item label="图书分类" prop="type">
<!-- <el-select v-model="dataForm.type" placeholder="图书分类">
<el-option v-for="item in bookList" :key="item.dictType + ''" :label="item.dictValue"
:value="item.dictType + ''">
</el-option>
</el-select> -->
<el-checkbox-group v-model="dataForm.type">
<el-checkbox v-for="item in bookList" :key="item.dictType" :label="item.dictType" :value="item.dictType">{{item.dictValue}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="价格" prop="price">
<el-input v-model="dataForm.price" placeholder="价格"></el-input>
</el-form-item>
<el-form-item label="置顶" prop="istop">
<el-radio-group v-model="dataForm.istop">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="出版商名称" prop="publisherId">
<el-input v-model="dataForm.publisherId" placeholder="出版商名称"></el-input>
</el-form-item> -->
<el-form-item label="文件上传" prop="novel">
<el-upload
class="upload-demo"
action="http://localhost:9100/pb/oss/fileoss"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-success="handleNovelSuccess"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileListNovel">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-form-item label="插图" prop="images">
<el-upload
action="http://localhost:9100/pb/oss/fileoss"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:file-list="fileList"
:on-success="handlePicSuccess"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<img width="100%" :src="dataForm.images" alt="">
</el-dialog>
</el-form-item>
<!-- <el-form-item label="创建日期" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder="创建日期"></el-input>
</el-form-item>
<el-form-item label="更新日期" prop="updateTime">
<el-input v-model="dataForm.updateTime" placeholder="更新日期"></el-input>
</el-form-item> -->
<el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item>
<!-- <el-form-item label="删除标记" prop="delFlag">
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
visible: false,
bookList: [],
props: {
dictType: '',
dictValue: ''
},
authorList:[],
restaurants: [],
author:'',
publisherList:[],
fileList:[],
fileListNovel:[],
dialogImageUrl: '',
dialogVisible: false,
dataForm: {
id: 0,
name: '',
authorId: [],
description: '',
title: '',
content: '',
type:[],
price: '',
istop: '',
publisherId: [],
images: '',
pid: '',
level: '',
createTime: '',
updateTime: '',
sort: '',
delFlag: '',
novel : ''
},
dataRule: {
// name: [
// { required: true, message: '书名不能为空', trigger: 'blur' }
// ],
// authorId: [
// { required: true, message: '作者id不能为空', trigger: 'blur' }
// ],
// description: [
// { required: true, message: '简介不能为空', trigger: 'blur' }
// ],
// title: [
// { required: true, message: '序言不能为空', trigger: 'blur' }
// ],
// content: [
// { required: true, message: '内容不能为空', trigger: 'blur' }
// ],
// type: [
// { required: true, message: '类型不能为空', trigger: 'blur' }
// ],
// price: [
// { required: true, message: '价格不能为空', trigger: 'blur' }
// ],
// istop: [
// { required: true, message: '置顶不能为空', trigger: 'blur' }
// ],
// publisherId: [
// { required: true, message: '出版商id不能为空', trigger: 'blur' }
// ],
// images: [
// { required: true, message: '插图不能为空', trigger: 'blur' }
// ],
// pid: [
// { required: true, message: '父id不能为空', trigger: 'blur' }
// ],
// level: [
// { required: true, message: '层级不能为空', trigger: 'blur' }
// ],
// createTime: [
// { required: true, message: '创建日期不能为空', trigger: 'blur' }
// ],
// updateTime: [
// { required: true, message: '更新日期不能为空', trigger: 'blur' }
// ],
// sort: [
// { required: true, message: '排序不能为空', trigger: 'blur' }
// ],
// delFlag: [
// { required: true, message: '删除标记不能为空', trigger: 'blur' }
// ]
}
}
},
created() {
this.getBookList()
this.loadAll()
},
mounted(){
// this.restaurants = this.loadAll();
},
methods: {
init(id) {
this.fileList = []
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/book/book/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.name = data.book.name
// this.dataForm.authorId = data.book.authorId
this.dataForm.description = data.book.description
this.dataForm.title = data.book.title
this.dataForm.content = data.book.content
// this.dataForm.type = data.book.type
this.dataForm.price = data.book.price
this.dataForm.istop = data.book.istop
// this.dataForm.publisherId = data.book.publisherId
this.dataForm.images = data.book.images
this.dataForm.pid = data.book.pid
this.dataForm.level = data.book.level
this.dataForm.createTime = data.book.createTime
this.dataForm.updateTime = data.book.updateTime
this.dataForm.sort = data.book.sort
this.dataForm.delFlag = data.book.delFlag
this.dataForm.novel = data.book.novel
var checklist = data.book.type
var authorList = data.book.authorId
var publisherlish = data.book.publisherId
this.dataForm.publisherId = publisherlish.split(',')
this.dataForm.type = checklist.split(',')
this.dataForm.authorId = authorList.split(',')
console.log(this.dataForm.type)
if (data.book.images != "") {
var img = { name: '', url: data.book.images }
var attr = []
attr.push(img)
this.fileList = attr
}
if (data.book.novel != "" && data.book.novel != null && data.book.novel != 'undefined') {
var novel = { name: '电子书文件', url: data.book.novel }
var attr = []
attr.push(novel)
this.fileListNovel = attr
}
}
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/book/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'name': this.dataForm.name,
'authorId': this.dataForm.authorId.join(','),
'description': this.dataForm.description,
'title': this.dataForm.title,
'content': this.dataForm.content,
'type': this.dataForm.type.join(','),
'price': this.dataForm.price,
'istop': this.dataForm.istop,
'publisherId': this.dataForm.publisherId.join(','),
'images': this.dataForm.images,
'pid': this.dataForm.pid,
'level': this.dataForm.level,
'createTime': this.dataForm.createTime,
'updateTime': this.dataForm.updateTime,
'sort': this.dataForm.sort,
'delFlag': this.dataForm.delFlag,
'novel' : this.dataForm.novel
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
},
handlePicSuccess(res, file) {
if (res.msg == "success") {
this.dataForm.images = res.url;
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
}
},
//图书分类
getBookList() {
this.$http({
url: this.$http.adornUrl('/book/sysdictdata/selectByType/book_type'),
method: 'get',
// params: this.$http.adornParams({
// 'type': 'book_type',
// })
}).then(({ data }) => {
console.log(data)
this.bookList = data.dataList
})
},
handleRemove(file) {
this.dataForm.images = '';
},
handlePictureCardPreview(file) {
this.dataForm.images = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
console.log(file)
},
handlereset(){
this.fileList = [],
this.fileListNovel = [],
this.visible = false
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }`);
},
handleRemoveNovel(file) {
this.dataForm.novel = '';
},
handleNovelSuccess(file){
this.dataForm.novel = file.url
},
// querySearch(queryString, cb) {
// var restaurants = this.restaurants;
// var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
// // 调用 callback 返回建议列表的数据
// console.log(results)
// cb(results);
// },
// createFilter(queryString) {
// return (restaurant) => {
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
// };
// },
loadAll() {
this.$http({
url: this.$http.adornUrl('/book/author/bookAuthorList'),
method: 'get',
}).then(({ data }) => {
this.authorList = data.list
})
this.$http({
url: this.$http.adornUrl('/book/publisher/publisherList'),
method: 'get',
}).then(({ data }) => {
this.publisherList = data.list
})
},
// handleSelect(item) {
// this.dataForm.authorId = item.id
// console.log(item);
// }
}
}
</script>

View File

@@ -0,0 +1,331 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="图书名称">
<el-input v-model="query.bookName" placeholder="图书名称" clearable></el-input>
</el-form-item>
<el-form-item label="出版社名称">
<el-input v-model="query.publisherName" placeholder="出版社名称" clearable></el-input>
</el-form-item>
<el-form-item label="作者姓名">
<el-input v-model="query.authorName" placeholder="作者姓名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:book:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('book:book:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column label="序号" width="70" align="center">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="state" header-align="center" align="center" label="状态">
<template slot-scope="scope">
<el-switch :active-value=1 :inactive-value=0 style="display: block" v-model="scope.row.state"
@change="SwitchChange(scope.row)" active-color="#13ce66" inactive-color="#ff4949" active-text="上架"
inactive-text="下架">
</el-switch>
</template>
</el-table-column>
<el-table-column prop="name" header-align="center" align="center" label="书名">
</el-table-column>
<el-table-column prop="authorName" header-align="center" align="center" label="作者姓名">
</el-table-column>
<el-table-column header-align="center" align="center" label="插图">
<template slot-scope="scope">
<img v-if="scope.row.images != ''" :src="scope.row.images" width="70" height="100" class="tableImg" />
</template>
</el-table-column>
<el-table-column prop="description" header-align="center" align="center" :show-overflow-tooltip="true" label="简介">
</el-table-column>
<!-- <el-table-column
prop="title"
header-align="center"
align="center"
label="序言">
</el-table-column>
<el-table-column
prop="content"
header-align="center"
align="center"
label="内容">
</el-table-column> -->
<el-table-column prop="type" header-align="center" align="center" label="类型">
</el-table-column>
<el-table-column prop="price" header-align="center" align="center" label="价格">
</el-table-column>
<!-- <el-table-column
prop="istop"
header-align="center"
align="center"
label="置顶">
</el-table-column> -->
<el-table-column prop="publisherName" header-align="center" align="center" label="出版商名称">
</el-table-column>
<el-table-column prop="chapterStatus" header-align="center" align="center" label="章节拆分">
<template slot-scope="scope">
<span v-if="scope.row.chapterStatus == '成功'" style="color:blue">{{scope.row.chapterStatus}}</span>
<span v-if="scope.row.chapterStatus == '失败'" style="color: red">{{scope.row.chapterStatus}}</span>
<span v-if="scope.row.chapterStatus == '处理中'">{{scope.row.chapterStatus}}</span>
<span v-if="scope.row.chapterStatus == '未处理'">{{scope.row.chapterStatus}}</span>
</template>
</el-table-column>
<el-table-column prop="contentStatus" header-align="center" align="center" label="单句拆分">
<template slot-scope="scope">
<span v-if="scope.row.contentStatus == '成功'" style="color:blue">{{scope.row.contentStatus}}</span>
<span v-if="scope.row.contentStatus == '失败'" style="color: red">{{scope.row.contentStatus}}</span>
<span v-if="scope.row.contentStatus == '处理中'">{{scope.row.contentStatus}}</span>
<span v-if="scope.row.contentStatus == '未处理'">{{scope.row.contentStatus}}</span>
</template>
</el-table-column>
<el-table-column prop="voicesStatus" header-align="center" align="center" label="音频处理">
<template slot-scope="scope">
<span v-if="scope.row.voicesStatus == '成功'" style="color:blue">{{scope.row.voicesStatus}}</span>
<span v-if="scope.row.voicesStatus == '失败'" style="color: red">{{scope.row.voicesStatus}}</span>
<span v-if="scope.row.voicesStatus == '处理中'">{{scope.row.voicesStatus}}</span>
<span v-if="scope.row.voicesStatus == '未处理'">{{scope.row.voicesStatus}}</span>
</template>
</el-table-column>
<!-- <el-table-column
prop="pid"
header-align="center"
align="center"
label="父id">
</el-table-column>
<el-table-column
prop="level"
header-align="center"
align="center"
label="层级">
</el-table-column> -->
<el-table-column prop="createTime" header-align="center" align="center" label="创建日期">
</el-table-column>
<el-table-column prop="updateTime" header-align="center" align="center" label="更新日期">
</el-table-column>
<!-- <el-table-column
prop="sort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<el-table-column
prop="delFlag"
header-align="center"
align="center"
label="删除标记">
</el-table-column> -->
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<router-link :to="{path: 'book-bookchapter' , query:{ id : scope.row.id , pageIndex} }">
<el-button v-if="scope.row.chapterStatus == '成功'" type="text" size="small">章节列表</el-button>
</router-link>
<el-button v-if="scope.row.chapterStatus == '未处理' || scope.row.chapterStatus == '失败'" type="text" size="small" @click="chapterHandle(scope.row.id)">章节拆分</el-button>
<el-button v-if="scope.row.chapterStatus == '成功' && (scope.row.contentStatus == '未处理' || scope.row.contentStatus == '失败') " type="text" size="small" @click="contentHandle(scope.row.id)">单句拆分</el-button>
<el-button v-if="scope.row.contentStatus == '成功' && (scope.row.voicesStatus == '未处理' || scope.row.voicesStatus == '失败') " type="text" size="small" @click="voicesHandle(scope.row.id)">音频处理</el-button>
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
style="padding: 30px 0; text-align: center;" layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './book-add-or-update'
export default {
data() {
return {
dataForm: {
key: ''
},
query:{
bookName:'',
publisherName:'',
authorName:''
},
dataList: [],
state: false,
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated() {
if(this.$route.query.upPageInde != null){
this.pageIndex = this.$route.query.upPageIndex;
console.log(this.pageIndex)
}
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/book/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'bookName': this.query.bookName,
'publisherName' : this.query.publisherName,
'authorName' : this.query.authorName
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/book/book/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
// 开关变化
SwitchChange(event) {
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
var parms = {
state: event.state,
id: event.id
}
this.$http({
url: this.$http.adornUrl('/book/book/update'),
method: 'post',
data: parms
}).then(res => {
this.$message({
message: '成功',
type: 'success'
})
this.loading = false
this.getDataList()
}).catch(error => {
this.loading = false
console.log(error)
})
console.log(event)
},
chapterHandle(id){
this.$http({
url: this.$http.adornUrl('/book/book/getChapter'),
method: 'get',
params: this.$http.adornParams({
'id':id
})
}).then(res => {
this.$message({
message: '成功',
type: 'success'
})
this.loading = false
this.getDataList()
})
},
contentHandle(id){
this.$http({
url: this.$http.adornUrl('/book/bookchaptercontent/getBookVoices'),
method: 'get',
params: this.$http.adornParams({
'id':id
})
}).then(res => {
this.$message({
message: '成功',
type: 'success'
})
this.loading = false
this.getDataList()
})
},
voicesHandle(id){
//allVoices
this.$http({
url: this.$http.adornUrl('/book/bookchaptercontent/allVoices'),
method: 'get',
params: this.$http.adornParams({
'id':id
})
}).then(res => {
this.$message({
message: '成功',
type: 'success'
})
this.loading = false
this.getDataList()
})
}
}
}
</script>

View File

@@ -0,0 +1,147 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<!-- <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="chapter">
<el-input v-model="dataForm.chapter" placeholder="章节"></el-input>
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input v-model="dataForm.content" placeholder="内容" type="textarea" rows="10"></el-input>
</el-form-item>
<!-- <el-form-item label="音频文件地址" prop="voices">
<el-input v-model="dataForm.voices" placeholder="音频文件地址"></el-input>
</el-form-item>
<el-form-item label="" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder=""></el-input>
</el-form-item>
<el-form-item label="" prop="updateTime">
<el-input v-model="dataForm.updateTime" placeholder=""></el-input>
</el-form-item>
<el-form-item label="" prop="sort">
<el-input v-model="dataForm.sort" placeholder=""></el-input>
</el-form-item>
<el-form-item label="" prop="delFlag">
<el-input v-model="dataForm.delFlag" placeholder=""></el-input>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
bookId: '',
chapter: '',
content: '',
voices: '',
createTime: '',
updateTime: '',
sort: '',
delFlag: ''
},
dataRule: {
bookId: [
{ required: true, message: '图书id不能为空', trigger: 'blur' }
],
chapter: [
{ required: true, message: '章节不能为空', trigger: 'blur' }
],
content: [
{ required: true, message: '内容不能为空', trigger: 'blur' }
],
voices: [
{ required: true, message: '音频文件地址不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
updateTime: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
sort: [
{ required: true, message: '不能为空', trigger: 'blur' }
],
delFlag: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/book/bookchapter/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.bookId = data.bookChapter.bookId
this.dataForm.chapter = data.bookChapter.chapter
this.dataForm.content = data.bookChapter.content
this.dataForm.voices = data.bookChapter.voices
this.dataForm.createTime = data.bookChapter.createTime
this.dataForm.updateTime = data.bookChapter.updateTime
this.dataForm.sort = data.bookChapter.sort
this.dataForm.delFlag = data.bookChapter.delFlag
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/bookchapter/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'bookId': this.dataForm.bookId,
'chapter': this.dataForm.chapter,
'content': this.dataForm.content,
'voices': this.dataForm.voices,
'createTime': this.dataForm.createTime,
'updateTime': this.dataForm.updateTime,
'sort': this.dataForm.sort,
'delFlag': this.dataForm.delFlag
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,227 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:bookchapter:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('book:bookchapter:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
<router-link :to="{path: 'book-book' , query:{ upPageIndex } }">
<el-button type="primary">返回上一级</el-button>
</router-link>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column label="序号" width="70" align="center">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<!-- <el-table-column
prop="id"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
prop="bookId"
header-align="center"
align="center"
label="图书id">
</el-table-column> -->
<el-table-column
prop="chapter"
header-align="center"
align="center"
label="章节">
</el-table-column>
<el-table-column
prop="content"
header-align="center"
align="center"
:show-overflow-tooltip="true"
label="内容">
</el-table-column>
<!-- <el-table-column
prop="voices"
header-align="center"
align="center"
label="音频文件地址">
</el-table-column> -->
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="更新时间">
</el-table-column>
<!-- <el-table-column
prop="sort"
header-align="center"
align="center"
label="排序">
</el-table-column>
<el-table-column
prop="delFlag"
header-align="center"
align="center"
label="">
</el-table-column> -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<router-link :to="{path: 'book-bookchaptercontent' , query:{ chapterid : scope.row.id , bookid : scope.row.bookId , pageIndex} }">
<el-button type="text" size="small">章节详情</el-button>
</router-link>
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './bookchapter-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
bookid:0,
upPageIndex:0,
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.bookid = this.$route.query.id;
if(this.$route.query.upPageInde != null){
this.pageIndex = this.$route.query.upPageIndex;
console.log(this.pageIndex)
}
this.upPageIndex = this.$route.query.pageIndex;
console.log(this.bookid)
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/bookchapter/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key,
'bookid' : this.bookid
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/book/bookchapter/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,209 @@
<template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible" @close="handlereset">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<!-- <el-form-item label="" prop="bookId">
<el-input v-model="dataForm.bookId" placeholder=""></el-input>
</el-form-item>
<el-form-item label="" prop="bookChatperId">
<el-input v-model="dataForm.bookChatperId" placeholder=""></el-input>
</el-form-item> -->
<el-form-item label="序号" prop="number">
<el-input v-model="dataForm.number" placeholder="序号"></el-input>
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input v-model="dataForm.content" placeholder="内容" type="textarea"></el-input>
<el-button style="margin-top: 10px;" @click="fontchange(dataForm.content)" type="primary">文字转语音</el-button>
</el-form-item>
<el-form-item label="音频文件上传" prop="voices">
<el-upload class="upload-demo" action="http://localhost:9100/pb/oss/fileoss" :on-preview="handlePreview"
:on-remove="handleRemove" :on-success="handleVoicesSuccess" multiple :limit="3"
:file-list="fileListVoices">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
<audio controls="controls" hidden src="./static/audio/tsy.wav" ref="audio"></audio>
<audio id="resource" :src="dataForm.voices" controls autoplay="autoplay" v-show='true'></audio>
</el-form-item>
<!-- <el-form-item label="" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder=""></el-input>
</el-form-item>
<el-form-item label="" prop="updateTime">
<el-input v-model="dataForm.updateTime" placeholder=""></el-input>
</el-form-item> -->
<el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item>
<!-- <el-form-item label="" prop="delFlag">
<el-input v-model="dataForm.delFlag" placeholder=""></el-input>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
visible: false,
fileListVoices: [],
dataForm: {
id: 0,
bookId: '',
bookChatperId: '',
number: '',
content: '',
voices: '',
createTime: '',
updateTime: '',
sort: '',
delFlag: ''
},
dataRule: {
// bookId: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// bookChatperId: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// number: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// content: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// voices: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// createTime: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// updateTime: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// sort: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ],
// delFlag: [
// { required: true, message: '不能为空', trigger: 'blur' }
// ]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/book/bookchaptercontent/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.bookId = data.bookChapterContent.bookId
this.dataForm.bookChatperId = data.bookChapterContent.bookChatperId
this.dataForm.number = data.bookChapterContent.number
this.dataForm.content = data.bookChapterContent.content
this.dataForm.voices = data.bookChapterContent.voices
this.dataForm.createTime = data.bookChapterContent.createTime
this.dataForm.updateTime = data.bookChapterContent.updateTime
this.dataForm.sort = data.bookChapterContent.sort
this.dataForm.delFlag = data.bookChapterContent.delFlag
if (data.bookChapterContent.voices != "" && data.bookChapterContent.voices != null && data.bookChapterContent.voices != 'undefined') {
var voices = { name: '音频文件', url: data.bookChapterContent.voices }
var attr = []
attr.push(voices)
this.fileListVoices = attr
}
}
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/bookchaptercontent/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'bookId': this.dataForm.bookId,
'bookChatperId': this.dataForm.bookChatperId,
'number': this.dataForm.number,
'content': this.dataForm.content,
'voices': this.dataForm.voices,
'createTime': this.dataForm.createTime,
'updateTime': this.dataForm.updateTime,
'sort': this.dataForm.sort,
'delFlag': this.dataForm.delFlag
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
},
handlePreview(file) {
console.log(file);
},
handleRemove(file) {
this.dataForm.voices = '';
},
handleNovelSuccess(file) {
this.dataForm.voices = file.url
},
handleVoicesSuccess(res, file) {
if (res.msg == "success") {
this.dataForm.voices = res.url;
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
}
},
handlereset() {
this.fileListVoices = [],
this.visible = false
},
fontchange(content){
this.$http({
url: this.$http.adornUrl('/book/bookchaptercontent/signVoices'),
method: 'get',
params: this.$http.adornParams({
'content':content
})
}).then(res => {
this.$message({
message: '成功',
type: 'success'
})
this.loading = false
this.dataForm.voices = res.data.voices
console.log(res)
})
}
}
}
</script>

View File

@@ -0,0 +1,225 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:bookchaptercontent:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('book:bookchaptercontent:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
<router-link :to="{path: 'book-bookchapter' , query:{ upPageIndex, id: bookid } }">
<el-button type="primary">返回上一级</el-button>
</router-link>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<!-- <el-table-column
prop="id"
header-align="center"
align="center"
label="">
</el-table-column>
<el-table-column
prop="bookId"
header-align="center"
align="center"
label="">
</el-table-column> -->
<!-- <el-table-column
prop="bookChatperId"
header-align="center"
align="center"
label="">
</el-table-column> -->
<el-table-column
prop="number"
header-align="center"
align="center"
label="序号">
</el-table-column>
<el-table-column
prop="content"
header-align="center"
:show-overflow-tooltip="true"
align="center"
label="内容">
</el-table-column>
<el-table-column
prop="voices"
header-align="center"
align="center"
label="音频">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="更新时间">
</el-table-column>
<!-- <el-table-column
prop="sort"
header-align="center"
align="center"
label="">
</el-table-column> -->
<!-- <el-table-column
prop="delFlag"
header-align="center"
align="center"
label="">
</el-table-column> -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './bookchaptercontent-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
bookid:0,
upPageIndex:0,
chapterid:0,
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.bookid = this.$route.query.bookid;
this.chapterid = this.$route.query.chapterid
this.upPageIndex = this.$route.query.pageIndex
console.log(this.bookid)
console.log(this.upPageIndex)
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/bookchaptercontent/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key,
'bookid' : this.bookid,
'chapterid' : this.chapterid
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/book/bookchaptercontent/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,129 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="出版商名称" prop="publisherName">
<el-input v-model="dataForm.publisherName" placeholder="出版商名称"></el-input>
</el-form-item>
<el-form-item label="联系方式" prop="tel">
<el-input v-model="dataForm.tel" placeholder="联系方式"></el-input>
</el-form-item>
<el-form-item label="出版商简介" prop="introduction">
<el-input v-model="dataForm.introduction" placeholder="出版商简介" type="textarea" rows="5"></el-input>
</el-form-item>
<!-- <el-form-item label="创建时间" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
</el-form-item>
<el-form-item label="更新时间" prop="updateTime">
<el-input v-model="dataForm.updateTime" placeholder="更新时间"></el-input>
</el-form-item> -->
<!-- <el-form-item label="删除标记" prop="delFlag">
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
publisherName: '',
introduction: '',
tel: '',
createTime: '',
updateTime: '',
delFlag: ''
},
dataRule: {
publisherName: [
{ required: true, message: '出版商名称不能为空', trigger: 'blur' }
],
introduction: [
{ required: true, message: '出版商简介不能为空', trigger: 'blur' }
],
tel: [
{ required: true, message: '联系方式不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
],
updateTime: [
{ required: true, message: '更新时间不能为空', trigger: 'blur' }
],
delFlag: [
{ required: true, message: '删除标记不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/book/publisher/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.publisherName = data.publisher.publisherName
this.dataForm.introduction = data.publisher.introduction
this.dataForm.tel = data.publisher.tel
this.dataForm.createTime = data.publisher.createTime
this.dataForm.updateTime = data.publisher.updateTime
this.dataForm.delFlag = data.publisher.delFlag
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/publisher/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'publisherName': this.dataForm.publisherName,
'introduction': this.dataForm.introduction,
'tel': this.dataForm.tel,
'createTime': this.dataForm.createTime,
'updateTime': this.dataForm.updateTime,
'delFlag': this.dataForm.delFlag
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,198 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('book:publisher:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('book:publisher:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column label="序号" width="70" align="center">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<!-- <el-table-column
prop="id"
header-align="center"
align="center"
label="">
</el-table-column> -->
<el-table-column
prop="publisherName"
header-align="center"
align="center"
label="出版商名称">
</el-table-column>
<el-table-column
prop="introduction"
header-align="center"
align="center"
label="出版商简介">
</el-table-column>
<el-table-column
prop="tel"
header-align="center"
align="center"
label="联系方式">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建时间">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="更新时间">
</el-table-column>
<!-- <el-table-column
prop="delFlag"
header-align="center"
align="center"
label="删除标记">
</el-table-column> -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './publisher-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/publisher/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/book/publisher/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>