讲书视频,用户权限,图书分类

This commit is contained in:
徐哼唧L
2024-01-15 18:00:28 +08:00
parent 359e704506
commit ef51aadc74
5 changed files with 1489 additions and 1404 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible" @close="handlereset"> <el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @close="handlereset">
label-width="80px"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
<el-form-item label="书名" prop="name"> <el-form-item label="书名" prop="name">
<el-input v-model="dataForm.name" placeholder="书名"></el-input> <el-input v-model="dataForm.name" placeholder="书名"></el-input>
</el-form-item> </el-form-item>
@@ -20,7 +20,7 @@
</el-row> --> </el-row> -->
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<!-- <el-form-item label="作者" prop="authorId"> <!-- <el-form-item label="作者" prop="authorId">
<el-select <el-select
v-model="dataForm.authorId" v-model="dataForm.authorId"
multiple multiple
@@ -37,39 +37,31 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
<el-form-item label="作者" prop="publisherName"> <el-form-item label="作者" prop="publisherName">
<el-input v-model="dataForm.publisherName" placeholder="请输入作者" ></el-input> <el-input v-model="dataForm.publisherName" placeholder="请输入作者"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="出版社" prop="publisherId"> <el-form-item label="出版社" prop="publisherId">
<el-select <el-select v-model="dataForm.publisherId" multiple filterable allow-create default-first-option
v-model="dataForm.publisherId" placeholder="请输入出版社名称">
multiple <el-option v-for="item in publisherList" :key="item.value + ''" :label="item.value" :value="item.id + ''">
filterable </el-option>
allow-create </el-select>
default-first-option </el-form-item>
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-col>
</el-row> </el-row>
<!-- <el-input v-model="dataForm.authorId" placeholder="作者姓名" v-show="false"></el-input> --> <!-- <el-input v-model="dataForm.authorId" placeholder="作者姓名" v-show="false"></el-input> -->
<el-form-item label="序言" prop="title"> <el-form-item label="序言" prop="title">
<el-input v-model="dataForm.title" placeholder="序言" :rows="3" type="textarea"></el-input> <el-input v-model="dataForm.title" placeholder="序言" :rows="3" type="textarea"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="拆分类型" prop="splits"> <el-form-item label="拆分类型" prop="splits">
<el-radio-group v-model="dataForm.splits" > <el-radio-group v-model="dataForm.splits">
<el-radio v-for="item in splitsTypeList" :key="item.dictType" :label="item.dictType" :value="item.dictType">{{item.dictValue}}</el-radio> <el-radio v-for="item in splitsTypeList" :key="item.dictType" :label="item.dictType"
:value="item.dictType">{{item.dictValue}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="目录" prop="content"> <el-form-item label="目录" prop="content">
@@ -78,15 +70,13 @@
<el-form-item label="简介" prop="description"> <el-form-item label="简介" prop="description">
<el-input v-model="dataForm.description" placeholder="简介" :rows="5" type="textarea"></el-input> <el-input v-model="dataForm.description" placeholder="简介" :rows="5" type="textarea"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="图书分类" prop="type"> <el-form-item label="图书分类" prop="bookType">
<!-- <el-select v-model="dataForm.type" placeholder="图书分类"> <el-radio-group v-model="dataForm.bookType">
<el-option v-for="item in bookList" :key="item.dictType + ''" :label="item.dictValue" <el-radio :label="0">普通</el-radio>
:value="item.dictType + ''"> <el-radio :label="1">中医经典</el-radio>
</el-option> <el-radio :label="2">国学经典</el-radio>
</el-select> -->
<el-checkbox-group v-model="dataForm.type"> </el-radio-group>
<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>
<el-row> <el-row>
<!-- <el-col :span="12"> <!-- <el-col :span="12">
@@ -101,20 +91,16 @@
<!-- </el-col> --> <!-- </el-col> -->
<el-form-item label="图书类型" prop="medicaldesBookType"> <el-form-item label="图书类型" prop="medicaldesBookType">
<el-checkbox-group v-model="dataForm.medicaldesBookType"> <el-checkbox-group v-model="dataForm.medicaldesBookType">
<el-checkbox v-for="item in medicaldesBookTypeList" :key="item.dictType" :label="item.dictType" :value="item.dictType">{{item.dictValue}}</el-checkbox> <el-checkbox v-for="item in medicaldesBookTypeList" :key="item.dictType" :label="item.dictType"
:value="item.dictType">{{item.dictValue}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否可听" > <el-form-item label="是否可听">
<!-- <el-input v-model="dataForm.salePrice" placeholder="优惠价格"></el-input> --> <!-- <el-input v-model="dataForm.salePrice" placeholder="优惠价格"></el-input> -->
<el-switch <el-switch style="display: block" v-model="dataForm.canListen" active-color="#13ce66"
style="display: block" inactive-color="#ff4949" active-text="可听" inactive-text="不可听">
v-model="dataForm.canListen" </el-switch>
active-color="#13ce66"
inactive-color="#ff4949"
active-text="可听"
inactive-text="不可听">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -122,7 +108,7 @@
<el-radio-group v-model="dataForm.clockIn"> <el-radio-group v-model="dataForm.clockIn">
<!-- <el-radio :label="3">听书</el-radio> --> <!-- <el-radio :label="3">听书</el-radio> -->
<el-radio :label="1">参与打卡</el-radio> <el-radio :label="1">参与打卡</el-radio>
<el-radio :label="2">不参与打卡</el-radio> <el-radio :label="2">不参与打卡</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
@@ -130,7 +116,7 @@
<el-radio-group v-model="dataForm.teachIn"> <el-radio-group v-model="dataForm.teachIn">
<!-- <el-radio :label="3">听书</el-radio> --> <!-- <el-radio :label="3">听书</el-radio> -->
<el-radio :label="1">参与</el-radio> <el-radio :label="1">参与</el-radio>
<el-radio :label="0">不参与</el-radio> <el-radio :label="0">不参与</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
@@ -144,7 +130,7 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="免费章节数" prop="freeChapterCount" label-width="250"> <el-form-item label="免费章节数" prop="freeChapterCount" label-width="250">
<el-input-number v-model="dataForm.freeChapterCount" :min="0" :max="10" label="免费章节数"></el-input-number> <el-input-number v-model="dataForm.freeChapterCount" :min="0" :max="10" label="免费章节数"></el-input-number>
</el-form-item> </el-form-item>
<!-- <el-form-item label="置顶" prop="istop"> <!-- <el-form-item label="置顶" prop="istop">
<el-radio-group v-model="dataForm.istop"> <el-radio-group v-model="dataForm.istop">
@@ -162,28 +148,15 @@
<el-input v-model="dataForm.publisherId" placeholder="出版商名称"></el-input> <el-input v-model="dataForm.publisherId" placeholder="出版商名称"></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item label="文件上传" prop="novel"> <el-form-item label="文件上传" prop="novel">
<el-upload <el-upload class="upload-demo" :action="baseUrl + '/oss/fileoss'" :on-preview="handlePreview"
class="upload-demo" :on-remove="handleRemoveNovel" :before-remove="beforeRemove" :on-success="handleNovelSuccess" multiple
:action= "baseUrl + '/oss/fileoss'" :limit="3" :on-exceed="handleExceed" :file-list="fileListNovel">
:on-preview="handlePreview"
:on-remove="handleRemoveNovel"
:before-remove="beforeRemove"
:on-success="handleNovelSuccess"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileListNovel">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="插图" prop="images"> <el-form-item label="插图" prop="images">
<el-upload <el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
:action= "baseUrl + '/oss/fileoss'" :file-list="fileList" :on-success="handlePicSuccess" :on-remove="handleRemove">
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:file-list="fileList"
:on-success="handlePicSuccess"
:on-remove="handleRemove">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
<el-dialog :visible.sync="dialogVisible" :append-to-body="true"> <el-dialog :visible.sync="dialogVisible" :append-to-body="true">
@@ -198,7 +171,7 @@
</el-form-item> --> </el-form-item> -->
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input v-model="dataForm.sort" placeholder="排序"></el-input> <el-input v-model="dataForm.sort" placeholder="排序"></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="删除标记" prop="delFlag"> <!-- <el-form-item label="删除标记" prop="delFlag">
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input> <el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input>
</el-form-item> --> </el-form-item> -->
@@ -213,348 +186,398 @@
<script> <script>
import global from '../../common/common.vue' //引入共用组间 import global from '../../common/common.vue' //引入共用组间
export default { export default {
data() { data() {
return { return {
baseUrl:global.baseUrl, baseUrl: global.baseUrl,
visible: false, visible: false,
bookList: [], bookList: [{
medicaldesBookTypeList:[ dictType: 0,
{dictType:1,dictValue:"中医基础"}, dictValue: "普通"
{dictType:2,dictValue:"中医经典"}, },
{dictType:3,dictValue:"各家学说"}, {
{dictType:4,dictValue:"中医临床"}, dictType: 1,
{dictType:5,dictValue:"文学"}, dictValue: "中医经典"
{dictType:6,dictValue:"哲学"}, },
], {
props: { dictType: 2,
dictType: '', dictValue: "国学经典"
dictValue: '' }
}, ],
authorList:[], medicaldesBookTypeList: [{
restaurants: [], dictType: 1,
author:'', dictValue: "中医基础"
publisherList:[], },
fileList:[], {
fileListNovel:[], dictType: 2,
dialogImageUrl: '', dictValue: "中医经典"
dialogVisible: false, },
dataForm: { {
id: 0, dictType: 3,
name: '', dictValue: "各家学说"
publisherName:'', },
splits:0, {
authorId: [], dictType: 4,
description: '', dictValue: "中医临床"
title: '', },
content: '', {
type:[], dictType: 5,
medicaldesBookType:[], dictValue: "文学"
// price: '', },
salePrice:'', {
// istop: '', dictType: 6,
isVip:0, dictValue: "哲学"
freeChapterCount:0, },
// isSale: '', ],
publisherId: [], props: {
images: '', dictType: '',
pid: '', dictValue: ''
level: '', },
createTime: '', authorList: [],
updateTime: '', restaurants: [],
sort: '', author: '',
delFlag: '', publisherList: [],
novel: '', fileList: [],
canListen: false, fileListNovel: [],
clockIn: 2, dialogImageUrl: '',
teachIn: 0, dialogVisible: false,
}, dataForm: {
splitsTypeList:[], id: 0,
dataRule: { name: '',
publisherName: '',
// name: [ splits: 0,
// { required: true, message: '书名不能为空', trigger: 'blur' } authorId: [],
// ], description: '',
// authorId: [ title: '',
// { required: true, message: '作者id不能为空', trigger: 'blur' } bookType: 0,
// ], content: '',
// description: [ type: [],
// { required: true, message: '简介不能为空', trigger: 'blur' } medicaldesBookType: [],
// ], // price: '',
// title: [ salePrice: '',
// { required: true, message: '序言不能为空', trigger: 'blur' } // istop: '',
// ], isVip: 0,
// content: [ freeChapterCount: 0,
// { required: true, message: '内容不能为空', trigger: 'blur' } // isSale: '',
// ], publisherId: [],
// type: [ images: '',
// { required: true, message: '类型不能为空', trigger: 'blur' } pid: '',
// ], level: '',
// price: [ createTime: '',
// { required: true, message: '价格不能为空', trigger: 'blur' } updateTime: '',
// ], sort: '',
// istop: [ delFlag: '',
// { required: true, message: '置顶不能为空', trigger: 'blur' } novel: '',
// ], canListen: false,
// publisherId: [ clockIn: 2,
// { required: true, message: '出版商id不能为空', trigger: 'blur' } teachIn: 0,
// ], },
// images: [ splitsTypeList: [],
// { required: true, message: '插图不能为空', trigger: 'blur' } dataRule: {
// ],
// 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' }
// ],
// splits: [
// { required: true, message: '拆分类类型不能为空', trigger: 'blur' }
// ]
}
}
},
created() {
this.getBookList()
this.loadAll()
},
mounted(){
// this.restaurants = this.loadAll();
},
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/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.publisherName = data.book.dataForm
// 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.salePrice = data.book.salePrice
// this.dataForm.istop = data.book.istop
this.dataForm.isVip = data.book.isVip
// this.dataForm.isSale = data.book.isSale
this.dataForm.freeChapterCount = data.book.freeChapterCount
this.dataForm.splits = data.book.splits
// 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
this.dataForm.clockIn = data.book.clockIn
this.dataForm.teachIn = data.book.teachIn
var checklist = data.book.type
var medicaldeschecklist = data.book.medicaldesBookType
var authorList = data.book.authorId
var publisherlish = data.book.publisherId
if(data.book.authorId != ""){
this.dataForm.authorId = authorList.split(',')
}
if(data.book.publisherId != ""){
this.dataForm.publisherId = publisherlish.split(',')
}
this.dataForm.type = checklist.split(',')
this.dataForm.medicaldesBookType = medicaldeschecklist.split(',')
for (let i = 0; i < this.dataForm.medicaldesBookType .length; i++) {
this.dataForm.medicaldesBookType [i] = parseInt(this.dataForm.medicaldesBookType [i]);
}
console.log(this.dataForm.type)
console.log('2222222222',this.dataForm.medicaldesBookType)
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() {
console.log('11111',this.dataForm.medicaldesBookType)
if(this.dataForm.medicaldesBookType.length == 0){
this.$message.error("请选择图书类型");
return
}
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,
'publisherName': this.dataForm.publisherName,
'content': this.dataForm.content,
'type': this.dataForm.type.join(','),
"medicaldesBookType": this.dataForm.medicaldesBookType.join(','),
// 'price': this.dataForm.price,
// 'salePrice': this.dataForm.salePrice,
// 'istop': this.dataForm.istop,
'isVip': this.dataForm.isVip,
// 'isSale': this.dataForm.isSale,
'freeChapterCount': this.dataForm.freeChapterCount,
'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,
'splits': this.dataForm.splits,
'canListen': this.dataForm.canListen,
'clockIn': this.dataForm.clockIn,
'teachIn': this.dataForm.teachIn
})
}).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
})
// 获取图书拆分类型 // name: [
this.$http({ // { required: true, message: '书名不能为空', trigger: 'blur' }
url: this.$http.adornUrl('/book/sysdictdata/selectByType/splitsType'), // ],
method: 'get', // authorId: [
}).then(({ data }) => { // { required: true, message: '作者id不能为空', trigger: 'blur' }
this.splitsTypeList = data.dataList // ],
}) // 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' }
// ],
// splits: [
// { required: true, message: '拆分类类型不能为空', trigger: 'blur' }
// ]
}
}
}, },
handleRemove(file) { created() {
this.dataForm.images = ''; this.getBookList()
this.loadAll()
}, },
handlePictureCardPreview(file) { mounted() {
this.dataForm.images = file.url; // this.restaurants = this.loadAll();
this.dialogVisible = true;
}, },
handleDownload(file) { methods: {
console.log(file) init(id) {
}, this.dataForm.id = id || 0
handlereset(){ this.visible = true
this.fileList = [], this.$nextTick(() => {
this.fileListNovel = [], this.$refs['dataForm'].resetFields()
this.visible = false if (this.dataForm.id) {
}, this.$http({
handlePreview(file) { url: this.$http.adornUrl(`/book/book/info/${this.dataForm.id}`),
console.log(file); method: 'get',
}, params: this.$http.adornParams()
handleExceed(files, fileList) { }).then(({
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); data
}, }) => {
beforeRemove(file, fileList) { if (data && data.code === 0) {
return this.$confirm(`确定移除 ${ file.name }`); this.dataForm.name = data.book.name
}, this.dataForm.publisherName = data.book.dataForm
handleRemoveNovel(file) { // this.dataForm.authorId = data.book.authorId
this.dataForm.novel = ''; this.dataForm.description = data.book.description
}, this.dataForm.title = data.book.title
handleNovelSuccess(file){ this.dataForm.bookType = data.book.bookType
this.dataForm.novel = file.url this.dataForm.content = data.book.content
}, // this.dataForm.type = data.book.type
// querySearch(queryString, cb) { // this.dataForm.price = data.book.price
// var restaurants = this.restaurants; // this.dataForm.salePrice = data.book.salePrice
// var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants; // this.dataForm.istop = data.book.istop
// // 调用 callback 返回建议列表的数据 this.dataForm.isVip = data.book.isVip
// console.log(results) // this.dataForm.isSale = data.book.isSale
// cb(results); this.dataForm.freeChapterCount = data.book.freeChapterCount
// }, this.dataForm.splits = data.book.splits
// createFilter(queryString) { // this.dataForm.publisherId = data.book.publisherId
// return (restaurant) => { this.dataForm.images = data.book.images
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0); this.dataForm.pid = data.book.pid
// }; this.dataForm.level = data.book.level
// }, this.dataForm.createTime = data.book.createTime
loadAll() { this.dataForm.updateTime = data.book.updateTime
this.dataForm.sort = data.book.sort
this.dataForm.delFlag = data.book.delFlag
this.dataForm.novel = data.book.novel
this.dataForm.clockIn = data.book.clockIn
this.dataForm.teachIn = data.book.teachIn
var checklist = data.book.type
var medicaldeschecklist = data.book.medicaldesBookType
var authorList = data.book.authorId
var publisherlish = data.book.publisherId
if (data.book.authorId != "") {
this.dataForm.authorId = authorList.split(',')
}
if (data.book.publisherId != "") {
this.dataForm.publisherId = publisherlish.split(',')
}
this.dataForm.type = checklist.split(',')
this.dataForm.medicaldesBookType = medicaldeschecklist.split(',')
for (let i = 0; i < this.dataForm.medicaldesBookType.length; i++) {
this.dataForm.medicaldesBookType[i] = parseInt(this.dataForm.medicaldesBookType[i]);
}
console.log(this.dataForm.type)
console.log('2222222222', this.dataForm.medicaldesBookType)
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() {
console.log('11111', this.dataForm.medicaldesBookType)
if (this.dataForm.medicaldesBookType.length == 0) {
this.$message.error("请选择图书类型");
return
}
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,
'bookType': this.dataForm.bookType,
'publisherName': this.dataForm.publisherName,
'content': this.dataForm.content,
'type': this.dataForm.type.join(','),
"medicaldesBookType": this.dataForm.medicaldesBookType.join(','),
// 'price': this.dataForm.price,
// 'salePrice': this.dataForm.salePrice,
// 'istop': this.dataForm.istop,
'isVip': this.dataForm.isVip,
// 'isSale': this.dataForm.isSale,
'freeChapterCount': this.dataForm.freeChapterCount,
'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,
'splits': this.dataForm.splits,
'canListen': this.dataForm.canListen,
'clockIn': this.dataForm.clockIn,
'teachIn': this.dataForm.teachIn
})
}).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({ this.$http({
url: this.$http.adornUrl('/book/author/bookAuthorList'), url: this.$http.adornUrl('/book/sysdictdata/selectByType/book_type'),
method: 'get', method: 'get',
}).then(({ data }) => { // params: this.$http.adornParams({
this.authorList = data.list // 'type': 'book_type',
}) // })
}).then(({
data
}) => {
console.log(data)
// this.bookList = data.dataList
})
// 获取图书拆分类型
this.$http({ this.$http({
url: this.$http.adornUrl('/book/publisher/publisherList'), url: this.$http.adornUrl('/book/sysdictdata/selectByType/splitsType'),
method: 'get', method: 'get',
}).then(({ data }) => { }).then(({
this.publisherList = data.list data
}) }) => {
this.splitsTypeList = data.dataList
}, })
// handleSelect(item) { },
// this.dataForm.authorId = item.id handleRemove(file) {
// console.log(item); 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> </script>

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item> <el-form-item>
<!-- <el-button @click="getDataList()">查询</el-button> --> <!-- <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:save')" type="primary" @click="addOrUpdateHandle()">增加讲书目录</el-button>
@@ -14,18 +14,18 @@
:data="dataList" :data="dataList"
border border
v-loading="dataListLoading" v-loading="dataListLoading"
@selection-change="selectionChangeHandle" @selection-change="selectionChangeHandle"
style="width: 100%;"> style="width: 100%;">
<el-table-column width="100" <el-table-column width="100"
prop="chapter" prop="chapter"
align="center" align="center"
label="章节序号"> label="章节序号">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="title" prop="title"
label="标题"> label="标题">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="content" prop="content"
header-align="center" header-align="center"
@@ -40,9 +40,19 @@
label="音频"> label="音频">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.voices == ''">暂未上传音频</span> <span v-if="scope.row.voices == ''">暂未上传音频</span>
<audio v-else id="resource" :src="scope.row.voices" controls v-show='true' style="width: 350px;"></audio> <audio v-else id="resource" :src="scope.row.voices" controls v-show='true' style="width: 350px;"></audio>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="200"
prop="video"
header-align="center"
align="center"
label="视频">
<template slot-scope="scope">
<span v-if="scope.row.video == ''">暂未上传视频</span>
<span else>{{scope.row.video}}</span>
</template>
</el-table-column>
<!-- <el-table-column <!-- <el-table-column
prop="createTime" prop="createTime"
header-align="center" header-align="center"
@@ -67,9 +77,9 @@
align="center" align="center"
width="150" width="150"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.teachId)">修改</el-button> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.teachId)">修改</el-button>
<router-link :to="{path: 'commentsList' , query:{ teachId : scope.row.teachId} }"> <router-link :to="{path: 'commentsList' , query:{ teachId : scope.row.teachId} }">
<el-button type="text" size="small">评论管理</el-button> <el-button type="text" size="small">评论管理</el-button>
</router-link> </router-link>
<el-button type="text" size="small" @click="deleteHandle(scope.row.teachId)">删除</el-button> <el-button type="text" size="small" @click="deleteHandle(scope.row.teachId)">删除</el-button>
@@ -89,7 +99,7 @@
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div> </div>
</template> </template>
<script> <script>
import AddOrUpdate from './talkBook-add-or-update' import AddOrUpdate from './talkBook-add-or-update'
export default { export default {
@@ -172,7 +182,7 @@
// 新增 / 修改 // 新增 / 修改
addOrUpdateHandle (id) { addOrUpdateHandle (id) {
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, this.bookid) this.$refs.addOrUpdate.init(id, this.bookid)
}) })
}, },
@@ -188,7 +198,7 @@
}).then(() => { }).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl('/book/teach/delTeach'), url: this.$http.adornUrl('/book/teach/delTeach'),
method: 'post', method: 'post',
// data: this.$http.adornData(ids, false) // data: this.$http.adornData(ids, false)
// data: {'teachId': id} // data: {'teachId': id}
data: this.$http.adornData({ data: this.$http.adornData({
@@ -213,4 +223,3 @@
} }
} }
</script> </script>

View File

@@ -1,288 +1,288 @@
<template> <template>
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="分类"> <el-form-item label="分类">
<el-select v-model="dataForm.dictType" placeholder="请选择分类"> <el-select v-model="dataForm.dictType" placeholder="请选择分类">
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType"> <el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="书名"> <el-form-item label="书名">
<el-input v-model="dataForm.bookName" placeholder="请输入书名"></el-input> <el-input v-model="dataForm.bookName" placeholder="请输入书名"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button> <el-button @click="pageIndex = 1;getDataList()">查询</el-button>
<el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%;">
:data="dataList" <el-table-column header-align="center" align="center" label="分类">
border <template slot-scope="scope">
v-loading="dataListLoading" {{ filterAA(scope.row.typeId) }}
style="width: 100%;"> </template>
<el-table-column </el-table-column>
header-align="center" <el-table-column label="书名" align="center">
align="center" <template slot-scope="scope">
label="分类"> {{ scope.row.book.name }}
<template slot-scope="scope"> </template>
{{ filterAA(scope.row.typeId) }} </el-table-column>
</template> <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
</el-table-column> <template slot-scope="scope">
<el-table-column label="书名" align="center"> <el-button type="text" size="small" @click="editOrUpdateHandle(scope.row)">修改</el-button>
<template slot-scope="scope"> <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
{{ scope.row.book.name }} </template>
</template> </el-table-column>
</el-table-column> </el-table>
<el-table-column <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
fixed="right" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
header-align="center" layout="total, sizes, prev, pager, next, jumper">
align="center" </el-pagination>
width="150" <!-- 弹窗, 新增 / 修改 -->
label="操作"> <el-dialog :visible.sync="addOrUpdateVisible" :append-to-body="true" :title="titlesub" width="50%"
<template slot-scope="scope"> @close="cancleClose">
<el-button type="text" size="small" @click="editOrUpdateHandle(scope.row)">修改</el-button> <el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule">
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button> <el-row type="flex" justify="center">
</template> <el-form-item label="分类" prop="typeId">
</el-table-column> <el-select v-model="addForm.typeId" placeholder="请选择分类" style="width: 500px;">
</el-table> <el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
<el-pagination </el-option>
@size-change="sizeChangeHandle" </el-select>
@current-change="currentChangeHandle" </el-form-item>
:current-page="pageIndex" </el-row>
:page-sizes="[10, 20, 50, 100]" <el-row type="flex" justify="center">
:page-size="pageSize" <el-form-item label="书名" prop="bookId">
:total="totalPage" <el-select v-model="addForm.bookId" placeholder="请选择书名" style="width: 500px;">
layout="total, sizes, prev, pager, next, jumper"> <el-option v-for="item in booknameList" :key="item.id" :label="item.name" :value="item.id">
</el-pagination> </el-option>
<!-- 弹窗, 新增 / 修改 --> </el-select>
<el-dialog :visible.sync="addOrUpdateVisible" :append-to-body="true" :title="titlesub" width="50%" @close="cancleClose"> </el-form-item>
<el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule"> </el-row>
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-form-item label="分类" prop="typeId"> <el-form-item label="排序" label-width="48px">
<el-select v-model="addForm.typeId" placeholder="请选择分类" style="width: 500px;"> <el-input style="width:500px" v-model="addForm.sort"></el-input>
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType"> </el-form-item>
</el-option> </el-row>
</el-select> </el-form>
</el-form-item> <span slot="footer" class="dialog-footer">
</el-row> <el-button @click="cancleClose"> </el-button>
<el-row type="flex" justify="center"> <el-button type="primary" @click="addOreEditCate"> </el-button>
<el-form-item label="书名" prop="bookId"> </span>
<el-select v-model="addForm.bookId" placeholder="请选择书名" style="width: 500px;"> </el-dialog>
<el-option v-for="item in booknameList" :key="item.id" :label="item.name" :value="item.id"> <!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
</el-option>
</el-select>
</el-form-item>
</el-row>
<el-row type="flex" justify="center">
<el-form-item label="排序" label-width="48px">
<el-input style="width:500px" v-model="addForm.sort"></el-input>
</el-form-item>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="cancleClose"> </el-button>
<el-button type="primary" @click="addOreEditCate"> </el-button>
</span>
</el-dialog>
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @showchooseBookf = "showchooseBookf"></add-or-update>
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> --> <choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book> -->
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
typeList: [], //类型列表 typeList: [], //类型列表
booknameList: [], booknameList: [],
dataForm: { dataForm: {
dictType: '',//分类 dictType: '', //分类
bookName: '',//书名 bookName: '', //书名
}, },
addForm: { addForm: {
"id": '',//新增不传 "id": '', //新增不传
"bookId": '', "bookId": '',
"typeId": '', "typeId": '',
"sort": '' "sort": ''
}, },
editId: '', editId: '',
addFormRule: { addFormRule: {
typeId: [{required: true, message: "请选择分类" }], typeId: [{
bookId: [{required: true, message: "请选择书名"}] required: true,
}, message: "请选择分类"
dataList: [], }],
// publishStatus: false, bookId: [{
pageIndex: 1, required: true,
pageSize: 10, message: "请选择书名"
totalPage: 0, }]
dataListLoading: false, },
dataListSelections: [], dataList: [],
addOrUpdateVisible: false, // publishStatus: false,
bookIds:[], pageIndex: 1,
titlesub: '新增' pageSize: 10,
} totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
bookIds: [],
titlesub: '新增'
}
}, },
components: { components: {
// AddOrUpdate, // AddOrUpdate,
// chooseBook // chooseBook
}, },
activated () { activated() {
this.gettypeList() this.gettypeList()
this.getDataList() this.getDataList()
}, },
methods: { methods: {
gettypeList () { gettypeList() {
this.$http({
url: this.$http.adornUrl('/book/medicaldes/typeList?label=medicaldesBookType'),
method: 'post',
}).then(({data}) => {
if (data && data.code === 0) {
this.typeList = data.result
} else {
this.typeList = []
}
})
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/medicaldes/bookRelationListByType'),
method: 'post',
data: this.$http.adornData({
"dictType": this.dataForm.dictType,
"bookName": this.dataForm.bookName,
"current": this.pageIndex,
"limit": this.pageSize
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
getbookname() {
// 获取数据列表
this.$http({ this.$http({
url: this.$http.adornUrl('/book/book/list'), url: this.$http.adornUrl('/book/medicaldes/typeList?label=medicaldesBookType'),
method: 'get', method: 'post',
params: this.$http.adornParams({ }).then(({
data
}) => {
if (data && data.code === 0) {
this.typeList = data.result
} else {
this.typeList = []
}
})
},
// 获取数据列表
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/book/medicaldes/bookRelationListByType'),
method: 'post',
data: this.$http.adornData({
"dictType": this.dataForm.dictType,
"bookName": this.dataForm.bookName,
"current": this.pageIndex,
"limit": this.pageSize
})
}).then(({
data
}) => {
if (data && data.code === 0) {
this.dataList = data.result.records
this.totalPage = data.result.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
getbookname() {
// 获取数据列表
this.$http({
url: this.$http.adornUrl('/book/medicaldes/bookList'),
method: 'get',
params: this.$http.adornParams({
'page': 1, 'page': 1,
'limit': 1000000, 'limit': 1000000,
'bookName': '', 'bookName': '',
'publisherName' : '', 'publisherName': '',
'authorName' : '' 'authorName': ''
}) })
}).then(({ data }) => { }).then(({
if (data && data.code === 0) { data
this.booknameList = data.page.list }) => {
} else { if (data && data.code === 0) {
this.booknameList = [] this.booknameList = data.page.list
} } else {
}) this.booknameList = []
}
}, })
filterAA(val){
var aa = this.typeList.filter(obj => obj.dictType == val) },
return aa[0].dictValue filterAA(val) {
}, var aa = this.typeList.filter(obj => obj.dictType == val)
// 每页数 return aa[0].dictValue
sizeChangeHandle (val) { },
this.pageSize = val // 每页数
this.pageIndex = 1 sizeChangeHandle(val) {
this.getDataList() this.pageSize = val
}, this.pageIndex = 1
// 当前页 this.getDataList()
currentChangeHandle (val) { },
this.pageIndex = val // 当前页
this.getDataList() currentChangeHandle(val) {
}, this.pageIndex = val
// 多选 this.getDataList()
selectionChangeHandle (val) { },
this.dataListSelections = val // 多选
}, selectionChangeHandle(val) {
// 新增 / 修改 this.dataListSelections = val
editOrUpdateHandle (row) { },
this.titlesub = '修改' // 新增 / 修改
this.getbookname() editOrUpdateHandle(row) {
this.editId = row.id this.titlesub = '修改'
this.addForm.bookId = row.bookId this.getbookname()
this.addForm.typeId = row.typeId.toString() this.editId = row.id
this.addForm.sort = row.sort this.addForm.bookId = row.bookId
this.addOrUpdateVisible = true this.addForm.typeId = row.typeId.toString()
this.addForm.sort = row.sort
}, this.addOrUpdateVisible = true
addOrUpdateHandle() {
this.getbookname() },
this.editId = '' addOrUpdateHandle() {
this.titlesub = '新增' this.getbookname()
this.addOrUpdateVisible = true this.editId = ''
}, this.titlesub = '新增'
cancleClose() { this.addOrUpdateVisible = true
this.addOrUpdateVisible = false },
this.$refs["addFormRef"].resetFields(); cancleClose() {
this.addForm = { this.addOrUpdateVisible = false
"id": '',//新增不传 this.$refs["addFormRef"].resetFields();
"bookId": '', this.addForm = {
"typeId": '', "id": '', //新增不传
"sort": '' "bookId": '',
} "typeId": '',
}, "sort": ''
// 删除
deleteHandle (id) {
this.$confirm('请确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/book/medicaldes/delBookRelation?id=${id}`),
method: 'post',
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
addOreEditCate() {
this.$refs["addFormRef"].validate(valid => {
if(valid) {
this.$http({
url: this.$http.adornUrl('/book/medicaldes/saveOrUpdateBookRelation'),
method: 'post',
data: this.$http.adornData({
"id": this.editId, //新增不传
"bookId": this.addForm.bookId,
"typeId": this.addForm.typeId,
"sort": this.addForm.sort
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message.success("成功");
this.addOrUpdateVisible = false
this.getDataList()
} else {
this.$message.error("失败");
}
})
}
})
} }
},
// 删除
deleteHandle(id) {
this.$confirm('请确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/book/medicaldes/delBookRelation?id=${id}`),
method: 'post',
}).then(({
data
}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
addOreEditCate() {
this.$refs["addFormRef"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/book/medicaldes/saveOrUpdateBookRelation'),
method: 'post',
data: this.$http.adornData({
"id": this.editId, //新增不传
"bookId": this.addForm.bookId,
"typeId": this.addForm.typeId,
"sort": this.addForm.sort
})
}).then(({
data
}) => {
if (data && data.code === 0) {
this.$message.success("成功");
this.addOrUpdateVisible = false
this.getDataList()
} else {
this.$message.error("失败");
}
})
}
})
}
} }
} }
</script> </script>

View File

@@ -1,7 +1,8 @@
<template> <template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible" @close="handlereset"> <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()" <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px"> label-width="120px">
<el-form-item label="姓名" prop="name"> <el-form-item label="姓名" prop="name">
<el-input v-model="dataForm.name" placeholder="姓名"></el-input> <el-input v-model="dataForm.name" placeholder="姓名"></el-input>
</el-form-item> </el-form-item>
@@ -12,36 +13,35 @@
<el-input v-model="dataForm.password" placeholder="密码"></el-input> <el-input v-model="dataForm.password" placeholder="密码"></el-input>
</el-form-item> </el-form-item>
<div v-if="dataForm.id"> <div v-if="dataForm.id">
<el-form-item label="年龄" prop="age"> <el-form-item label="年龄" prop="age">
<el-input v-model="dataForm.age" placeholder="年龄"></el-input> <el-input v-model="dataForm.age" placeholder="年龄"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="性别" prop="sex"> <el-form-item label="性别" prop="sex">
<!-- <el-input v-model="dataForm.sex" placeholder="性别"></el-input> --> <!-- <el-input v-model="dataForm.sex" placeholder="性别"></el-input> -->
<el-radio v-model="dataForm.sex" :label=2>保密</el-radio> <el-radio v-model="dataForm.sex" :label=2>保密</el-radio>
<el-radio v-model="dataForm.sex" :label=1></el-radio> <el-radio v-model="dataForm.sex" :label=1></el-radio>
<el-radio v-model="dataForm.sex" :label=0></el-radio> <el-radio v-model="dataForm.sex" :label=0></el-radio>
</el-form-item> </el-form-item>
<el-form-item label="头像" prop="avatar"> <el-form-item label="头像" prop="avatar">
<!-- <el-input v-model="dataForm.avatar" placeholder="头像"></el-input> --> <!-- <el-input v-model="dataForm.avatar" placeholder="头像"></el-input> -->
<el-upload :action= "baseUrl + '/oss/fileoss'" list-type="picture-card" <el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
:on-preview="handlePictureCardPreview" :file-list="fileList" :on-success="handlePicSuccess" :file-list="fileList" :on-success="handlePicSuccess" :on-remove="handleRemove">
:on-remove="handleRemove"> <i class="el-icon-plus"></i>
<i class="el-icon-plus"></i> </el-upload>
</el-upload> <el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<el-dialog :visible.sync="dialogVisible" :append-to-body="true"> <img width="100%" :src="dataForm.avatar" alt="">
<img width="100%" :src="dataForm.avatar" alt=""> </el-dialog>
</el-dialog> </el-form-item>
</el-form-item> <el-form-item label="昵称" prop="nickname">
<el-form-item label="昵称" prop="nickname"> <el-input v-model="dataForm.nickname" placeholder="昵称"></el-input>
<el-input v-model="dataForm.nickname" placeholder="昵称"></el-input> </el-form-item>
</el-form-item> <!-- <el-form-item label="密码" prop="password">
<!-- <el-form-item label="密码" prop="password">
<el-input v-model="dataForm.password" placeholder="密码"></el-input> <el-input v-model="dataForm.password" placeholder="密码"></el-input>
</el-form-item> --> </el-form-item> -->
<!-- <el-form-item label="会员类型" prop="vip"> <!-- <el-form-item label="会员类型" prop="vip">
<el-input v-model="dataForm.vip" placeholder="0-普通 1-vip"></el-input> <el-input v-model="dataForm.vip" placeholder="0-普通 1-vip"></el-input>
</el-form-item> --> </el-form-item> -->
<!-- <el-form-item label="vip 有效期" prop="vipValidtime"> <!-- <el-form-item label="vip 有效期" prop="vipValidtime">
<el-date-picker <el-date-picker
v-model="dataForm.vipValidtime" v-model="dataForm.vipValidtime"
type="datetime" type="datetime"
@@ -51,17 +51,17 @@
</el-date-picker> </el-date-picker>
<el-input v-model="dataForm.vipValidtime" placeholder="vip 有效期"></el-input> <el-input v-model="dataForm.vipValidtime" placeholder="vip 有效期"></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item label="花生币" prop="peanutCoin"> <el-form-item label="花生币" prop="peanutCoin">
<!-- <el-input v-model="dataForm.peanutCoin" placeholder="花生币"></el-input> --> <!-- <el-input v-model="dataForm.peanutCoin" placeholder="花生币"></el-input> -->
<el-input-number disabled v-model="dataForm.peanutCoin" label="花生币"></el-input-number> <el-input-number disabled v-model="dataForm.peanutCoin" label="花生币"></el-input-number>
</el-form-item> </el-form-item>
<!-- <el-form-item label="阅读时间" prop="readTime"> <!-- <el-form-item label="阅读时间" prop="readTime">
<el-input v-model="dataForm.readTime" placeholder="阅读时间"></el-input> <el-input v-model="dataForm.readTime" placeholder="阅读时间"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="最后登录时间" prop="lastLoginTime"> <el-form-item label="最后登录时间" prop="lastLoginTime">
<el-input v-model="dataForm.lastLoginTime" placeholder="最后登录时间"></el-input> <el-input v-model="dataForm.lastLoginTime" placeholder="最后登录时间"></el-input>
</el-form-item> --> </el-form-item> -->
<!-- <el-form-item label="创建时间" prop="createTime"> <!-- <el-form-item label="创建时间" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input> <el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="更新时间" prop="updateTime"> <el-form-item label="更新时间" prop="updateTime">
@@ -70,7 +70,27 @@
<el-form-item label="删除标记" prop="delFlag"> <el-form-item label="删除标记" prop="delFlag">
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input> <el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input>
</el-form-item> --> </el-form-item> -->
</div> <el-form-item label="脉六权限" prop="pointPower">
<el-radio v-model="dataForm.pointPower" :label='0'></el-radio>
<el-radio v-model="dataForm.pointPower" :label='1'></el-radio>
</el-form-item>
<el-form-item label="时辰取穴权限" prop="tgdzPower">
<el-radio v-model="dataForm.tgdzPower" :label='0'></el-radio>
<el-radio v-model="dataForm.tgdzPower" :label='1'></el-radio>
</el-form-item>
<el-form-item label="五运六气权限" prop="wylqPower">
<el-radio v-model="dataForm.wylqPower" :label='0'></el-radio>
<el-radio v-model="dataForm.wylqPower" :label='1'></el-radio>
</el-form-item>
<el-form-item label="吴门验方权限" prop="prescriptAPower">
<el-radio v-model="dataForm.prescriptAPower" :label='0'></el-radio>
<el-radio v-model="dataForm.prescriptAPower" :label='1'></el-radio>
</el-form-item>
<el-form-item label="肿瘤古方权限" prop="prescriptBPower">
<el-radio v-model="dataForm.prescriptBPower" :label='0'></el-radio>
<el-radio v-model="dataForm.prescriptBPower" :label='1'></el-radio>
</el-form-item>
</div>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button> <el-button @click="handlereset">取消</el-button>
@@ -80,16 +100,16 @@
</template> </template>
<script> <script>
import global from '../../common/common.vue' //引入共用组间 import global from '../../common/common.vue' //引入共用组间
export default { export default {
data() { data() {
return { return {
baseUrl:global.baseUrl, baseUrl: global.baseUrl,
visible: false, visible: false,
dialogVisible: false, dialogVisible: false,
fileList: [], fileList: [],
pickerOptions:{ pickerOptions: {
shortcuts: [{ shortcuts: [{
text: '今天', text: '今天',
onClick(picker) { onClick(picker) {
picker.$emit('pick', new Date()); picker.$emit('pick', new Date());
@@ -109,144 +129,171 @@ export default {
picker.$emit('pick', date); picker.$emit('pick', date);
} }
}] }]
}, },
dataForm: { dataForm: {
id: 0, id: 0,
name: '', name: '',
age: '', age: '',
sex: 2, sex: 2,
avatar: '', avatar: '',
nickname: '', nickname: '',
tel: '', tel: '',
password: '', password: '',
vip: '', vip: '',
vipValidtime: '', vipValidtime: '',
peanutCoin: '', peanutCoin: '',
readTime: '', readTime: '',
lastLoginTime: '', lastLoginTime: '',
createTime: '', createTime: '',
updateTime: '', updateTime: '',
delFlag: '', delFlag: '',
}, pointPower: 0,
dataRule: { tgdzPower: 0,
name: [ wylqPower: 0,
{ required: true, message: '姓名不能为空', trigger: 'blur' } prescriptAPower: 0,
], prescriptBPower: 0,
password: [ },
{ required: true, message: '密码不能为空', trigger: 'blur' } dataRule: {
], name: [{
// age: [ required: true,
// { required: true, message: '年龄不能为空', trigger: 'blur' } message: '姓名不能为空',
// ], trigger: 'blur'
// sex: [ }],
// { required: true, message: '性别不能为空', trigger: 'blur' } password: [{
// ], required: true,
// avatar: [ message: '密码不能为空',
// { required: true, message: '头像不能为空', trigger: 'blur' } trigger: 'blur'
// ], }],
// nickname: [ // age: [
// { required: true, message: '昵称不能为空', trigger: 'blur' } // { required: true, message: '年龄不能为空', trigger: 'blur' }
// ], // ],
tel: [ // sex: [
{ required: true, message: '电话不能为空', trigger: 'blur' }, // { required: true, message: '性别不能为空', trigger: 'blur' }
{ // ],
validator: function(rule, value, callback) { // avatar: [
if (/^1[34578]\d{9}$/.test(value) == false) { // { required: true, message: '头像不能为空', trigger: 'blur' }
callback(new Error("手机号格式错误")); // ],
} else { // nickname: [
callback(); // { required: true, message: '昵称不能为空', trigger: 'blur' }
} // ],
tel: [{
required: true,
message: '电话不能为空',
trigger: 'blur'
}, },
trigger: "blur" {
} validator: function(rule, value, callback) {
], if (/^1[34578]\d{9}$/.test(value) == false) {
// password: [ callback(new Error("手机号格式错误"));
// { required: true, message: '密码不能为空', trigger: 'blur' } } else {
// ], callback();
// vip: [ }
// { required: true, message: '0-普通 1-vip不能为空', trigger: 'blur' } },
// ], trigger: "blur"
// vipValidtime: [
// { required: true, message: 'vip 有效期不能为空', trigger: 'blur' }
// ],
// peanutCoin: [
// { required: true, message: '花生币不能为空', trigger: 'blur' }
// ],
// readTime: [
// { required: true, message: '阅读时间不能为空', trigger: 'blur' }
// ],
// lastLoginTime: [
// { 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/user/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.name = data.user.name
this.dataForm.age = data.user.age
this.dataForm.sex = data.user.sex
this.dataForm.avatar = data.user.avatar
this.dataForm.nickname = data.user.nickname
this.dataForm.tel = data.user.tel
this.dataForm.password = data.user.password
this.dataForm.vip = data.user.vip
this.dataForm.vipValidtime = data.user.vipValidtime
this.dataForm.peanutCoin = data.user.peanutCoin
this.dataForm.readTime = data.user.readTime
this.dataForm.lastLoginTime = data.user.lastLoginTime
this.dataForm.createTime = data.user.createTime
this.dataForm.updateTime = data.user.updateTime
this.dataForm.delFlag = data.user.delFlag
if (data.user.avatar && data.user.avatar != "") {
var img = { name: '', url: data.user.avatar }
var attr = []
attr.push(img)
this.fileList = attr
}
} }
}) ],
// password: [
// { required: true, message: '密码不能为空', trigger: 'blur' }
// ],
// vip: [
// { required: true, message: '0-普通 1-vip不能为空', trigger: 'blur' }
// ],
// vipValidtime: [
// { required: true, message: 'vip 有效期不能为空', trigger: 'blur' }
// ],
// peanutCoin: [
// { required: true, message: '花生币不能为空', trigger: 'blur' }
// ],
// readTime: [
// { required: true, message: '阅读时间不能为空', trigger: 'blur' }
// ],
// lastLoginTime: [
// { required: true, message: '最后登录时间不能为空', trigger: 'blur' }
// ],
// createTime: [
// { required: true, message: '创建时间不能为空', trigger: 'blur' }
// ],
// updateTime: [
// { required: true, message: '更新时间不能为空', trigger: 'blur' }
// ],
// delFlag: [
// { required: true, message: '删除标记不能为空', trigger: 'blur' }
// ]
} }
}) }
}, },
// 表单提交 methods: {
dataFormSubmit() { init(id) {
this.$refs['dataForm'].validate((valid) => { this.dataForm.id = id || 0
let myData = {} this.visible = true
if(!this.dataForm.id){ this.$nextTick(() => {
myData = { this.$refs['dataForm'].resetFields()
'name': this.dataForm.name, if (this.dataForm.id) {
'tel': this.dataForm.tel, this.$http({
url: this.$http.adornUrl(`/book/user/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({
data
}) => {
if (data && data.code === 0) {
this.dataForm.name = data.user.name
this.dataForm.age = data.user.age
this.dataForm.sex = data.user.sex
this.dataForm.avatar = data.user.avatar
this.dataForm.nickname = data.user.nickname
this.dataForm.tel = data.user.tel
this.dataForm.password = data.user.password
this.dataForm.vip = data.user.vip
this.dataForm.vipValidtime = data.user.vipValidtime
this.dataForm.peanutCoin = data.user.peanutCoin
this.dataForm.readTime = data.user.readTime
this.dataForm.lastLoginTime = data.user.lastLoginTime
this.dataForm.createTime = data.user.createTime
this.dataForm.updateTime = data.user.updateTime
this.dataForm.delFlag = data.user.delFlag
this.dataForm.pointPower = data.user.pointPower
this.dataForm.tgdzPower = data.user.tgdzPower
this.dataForm.wylqPower = data.user.wylqPower
this.dataForm.prescriptAPower = data.user.prescriptAPower
this.dataForm.prescriptBPower = data.user.prescriptBPower
if (data.user.avatar && data.user.avatar != "") {
var img = {
name: '',
url: data.user.avatar
}
var attr = []
attr.push(img)
this.fileList = attr
}
}
})
} }
}else{ })
myData = { },
'id': this.dataForm.id, // 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
let myData = {}
if (!this.dataForm.id) {
myData = {
'name': this.dataForm.name,
'tel': this.dataForm.tel,
}
} else {
myData = {
'id': this.dataForm.id,
'name': this.dataForm.name, 'name': this.dataForm.name,
'age': this.dataForm.age, 'age': this.dataForm.age,
'sex': this.dataForm.sex, 'sex': this.dataForm.sex,
'avatar': this.dataForm.avatar, 'avatar': this.dataForm.avatar,
'nickname': this.dataForm.nickname, 'nickname': this.dataForm.nickname,
'tel': this.dataForm.tel, 'tel': this.dataForm.tel,
'pointPower': this.dataForm.pointPower,
'tgdzPower': this.dataForm.tgdzPower,
'wylqPower': this.dataForm.wylqPower,
'prescriptAPower': this.dataForm.prescriptAPower,
'prescriptBPower': this.dataForm.prescriptBPower,
// 'password': this.dataForm.password, // 'password': this.dataForm.password,
// 'vip': this.dataForm.vip, // 'vip': this.dataForm.vip,
// 'vipValidtime': this.dataForm.vipValidtime, // 'vipValidtime': this.dataForm.vipValidtime,
@@ -256,54 +303,56 @@ export default {
// 'createTime': this.dataForm.createTime, // 'createTime': this.dataForm.createTime,
// 'updateTime': this.dataForm.updateTime, // 'updateTime': this.dataForm.updateTime,
// 'delFlag': this.dataForm.delFlag // 'delFlag': this.dataForm.delFlag
}
}
console.log('myData', myData)
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/user/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData(myData)
}).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)
} }
}) }
console.log('myData', myData)
if (valid) {
this.$http({
url: this.$http.adornUrl(`/book/user/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData(myData)
}).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)
}
})
}
})
},
handlePictureCardPreview(file) {
this.dataForm.avatar = file.url;
this.dialogVisible = true;
},
handlePicSuccess(res, file) {
if (res.msg == "success") {
this.dataForm.avatar = res.url;
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
} }
}) },
}, handleRemove(file) {
handlePictureCardPreview(file) { this.dataForm.avatar = '';
this.dataForm.avatar = file.url; },
this.dialogVisible = true; handlereset() {
}, // console.log('关闭了')
handlePicSuccess(res, file) { this.$refs['dataForm'].resetFields()
if (res.msg == "success") { this.dataForm.password = ''
this.dataForm.avatar = res.url; this.fileList = [],
this.$message.success("上传成功"); this.visible = false
} else { },
this.$message.error("上传失败"); }
}
},
handleRemove(file) {
this.dataForm.avatar = '';
},
handlereset(){
// console.log('关闭了')
this.$refs['dataForm'].resetFields()
this.dataForm.password = ''
this.fileList = [],
this.visible = false
},
} }
} </script>
</script>