讲书视频,用户权限,图书分类
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible" @close="handlereset">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm"
|
||||
label-width="80px">
|
||||
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"
|
||||
@close="handlereset">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
|
||||
<el-form-item label="书名" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="书名"></el-input>
|
||||
</el-form-item>
|
||||
@@ -20,7 +20,7 @@
|
||||
</el-row> -->
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<!-- <el-form-item label="作者" prop="authorId">
|
||||
<!-- <el-form-item label="作者" prop="authorId">
|
||||
<el-select
|
||||
v-model="dataForm.authorId"
|
||||
multiple
|
||||
@@ -37,39 +37,31 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="作者" prop="publisherName">
|
||||
<el-input v-model="dataForm.publisherName" placeholder="请输入作者" ></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="publisherName">
|
||||
<el-input v-model="dataForm.publisherName" placeholder="请输入作者"></el-input>
|
||||
</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-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-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="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-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-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="目录" prop="content">
|
||||
@@ -78,15 +70,13 @@
|
||||
<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 label="图书分类" prop="bookType">
|
||||
<el-radio-group v-model="dataForm.bookType">
|
||||
<el-radio :label="0">普通</el-radio>
|
||||
<el-radio :label="1">中医经典</el-radio>
|
||||
<el-radio :label="2">国学经典</el-radio>
|
||||
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<!-- <el-col :span="12">
|
||||
@@ -101,20 +91,16 @@
|
||||
<!-- </el-col> -->
|
||||
<el-form-item label="图书类型" prop="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-form-item>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否可听" >
|
||||
<el-form-item label="是否可听">
|
||||
<!-- <el-input v-model="dataForm.salePrice" placeholder="优惠价格"></el-input> -->
|
||||
<el-switch
|
||||
style="display: block"
|
||||
v-model="dataForm.canListen"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-text="可听"
|
||||
inactive-text="不可听">
|
||||
</el-switch>
|
||||
<el-switch style="display: block" v-model="dataForm.canListen" active-color="#13ce66"
|
||||
inactive-color="#ff4949" active-text="可听" inactive-text="不可听">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -122,7 +108,7 @@
|
||||
<el-radio-group v-model="dataForm.clockIn">
|
||||
<!-- <el-radio :label="3">听书</el-radio> -->
|
||||
<el-radio :label="1">参与打卡</el-radio>
|
||||
<el-radio :label="2">不参与打卡</el-radio>
|
||||
<el-radio :label="2">不参与打卡</el-radio>
|
||||
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
@@ -130,7 +116,7 @@
|
||||
<el-radio-group v-model="dataForm.teachIn">
|
||||
<!-- <el-radio :label="3">听书</el-radio> -->
|
||||
<el-radio :label="1">参与</el-radio>
|
||||
<el-radio :label="0">不参与</el-radio>
|
||||
<el-radio :label="0">不参与</el-radio>
|
||||
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
@@ -144,7 +130,7 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<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 label="置顶" prop="istop">
|
||||
<el-radio-group v-model="dataForm.istop">
|
||||
@@ -162,28 +148,15 @@
|
||||
<el-input v-model="dataForm.publisherId" placeholder="出版商名称"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="文件上传" prop="novel">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:action= "baseUrl + '/oss/fileoss'"
|
||||
:on-preview="handlePreview"
|
||||
:on-remove="handleRemoveNovel"
|
||||
:before-remove="beforeRemove"
|
||||
:on-success="handleNovelSuccess"
|
||||
multiple
|
||||
:limit="3"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileListNovel">
|
||||
<el-upload class="upload-demo" :action="baseUrl + '/oss/fileoss'" :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-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="插图" prop="images">
|
||||
<el-upload
|
||||
:action= "baseUrl + '/oss/fileoss'"
|
||||
list-type="picture-card"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:file-list="fileList"
|
||||
:on-success="handlePicSuccess"
|
||||
:on-remove="handleRemove">
|
||||
<el-upload :action="baseUrl + '/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">
|
||||
@@ -198,7 +171,7 @@
|
||||
</el-form-item> -->
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||
</el-form-item>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="删除标记" prop="delFlag">
|
||||
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input>
|
||||
</el-form-item> -->
|
||||
@@ -213,348 +186,398 @@
|
||||
|
||||
|
||||
<script>
|
||||
import global from '../../common/common.vue' //引入共用组间
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl:global.baseUrl,
|
||||
visible: false,
|
||||
bookList: [],
|
||||
medicaldesBookTypeList:[
|
||||
{dictType:1,dictValue:"中医基础"},
|
||||
{dictType:2,dictValue:"中医经典"},
|
||||
{dictType:3,dictValue:"各家学说"},
|
||||
{dictType:4,dictValue:"中医临床"},
|
||||
{dictType:5,dictValue:"文学"},
|
||||
{dictType:6,dictValue:"哲学"},
|
||||
],
|
||||
props: {
|
||||
dictType: '',
|
||||
dictValue: ''
|
||||
},
|
||||
authorList:[],
|
||||
restaurants: [],
|
||||
author:'',
|
||||
publisherList:[],
|
||||
fileList:[],
|
||||
fileListNovel:[],
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
publisherName:'',
|
||||
splits:0,
|
||||
authorId: [],
|
||||
description: '',
|
||||
title: '',
|
||||
content: '',
|
||||
type:[],
|
||||
medicaldesBookType:[],
|
||||
// price: '',
|
||||
salePrice:'',
|
||||
// istop: '',
|
||||
isVip:0,
|
||||
freeChapterCount:0,
|
||||
// isSale: '',
|
||||
publisherId: [],
|
||||
images: '',
|
||||
pid: '',
|
||||
level: '',
|
||||
createTime: '',
|
||||
updateTime: '',
|
||||
sort: '',
|
||||
delFlag: '',
|
||||
novel: '',
|
||||
canListen: false,
|
||||
clockIn: 2,
|
||||
teachIn: 0,
|
||||
},
|
||||
splitsTypeList:[],
|
||||
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' }
|
||||
// ],
|
||||
// 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
|
||||
})
|
||||
import global from '../../common/common.vue' //引入共用组间
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl: global.baseUrl,
|
||||
visible: false,
|
||||
bookList: [{
|
||||
dictType: 0,
|
||||
dictValue: "普通"
|
||||
},
|
||||
{
|
||||
dictType: 1,
|
||||
dictValue: "中医经典"
|
||||
},
|
||||
{
|
||||
dictType: 2,
|
||||
dictValue: "国学经典"
|
||||
}
|
||||
],
|
||||
medicaldesBookTypeList: [{
|
||||
dictType: 1,
|
||||
dictValue: "中医基础"
|
||||
},
|
||||
{
|
||||
dictType: 2,
|
||||
dictValue: "中医经典"
|
||||
},
|
||||
{
|
||||
dictType: 3,
|
||||
dictValue: "各家学说"
|
||||
},
|
||||
{
|
||||
dictType: 4,
|
||||
dictValue: "中医临床"
|
||||
},
|
||||
{
|
||||
dictType: 5,
|
||||
dictValue: "文学"
|
||||
},
|
||||
{
|
||||
dictType: 6,
|
||||
dictValue: "哲学"
|
||||
},
|
||||
],
|
||||
props: {
|
||||
dictType: '',
|
||||
dictValue: ''
|
||||
},
|
||||
authorList: [],
|
||||
restaurants: [],
|
||||
author: '',
|
||||
publisherList: [],
|
||||
fileList: [],
|
||||
fileListNovel: [],
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
publisherName: '',
|
||||
splits: 0,
|
||||
authorId: [],
|
||||
description: '',
|
||||
title: '',
|
||||
bookType: 0,
|
||||
content: '',
|
||||
type: [],
|
||||
medicaldesBookType: [],
|
||||
// price: '',
|
||||
salePrice: '',
|
||||
// istop: '',
|
||||
isVip: 0,
|
||||
freeChapterCount: 0,
|
||||
// isSale: '',
|
||||
publisherId: [],
|
||||
images: '',
|
||||
pid: '',
|
||||
level: '',
|
||||
createTime: '',
|
||||
updateTime: '',
|
||||
sort: '',
|
||||
delFlag: '',
|
||||
novel: '',
|
||||
canListen: false,
|
||||
clockIn: 2,
|
||||
teachIn: 0,
|
||||
},
|
||||
splitsTypeList: [],
|
||||
dataRule: {
|
||||
|
||||
// 获取图书拆分类型
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/splitsType'),
|
||||
method: 'get',
|
||||
}).then(({ data }) => {
|
||||
this.splitsTypeList = data.dataList
|
||||
})
|
||||
// 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' }
|
||||
// ],
|
||||
// splits: [
|
||||
// { required: true, message: '拆分类类型不能为空', trigger: 'blur' }
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
handleRemove(file) {
|
||||
this.dataForm.images = '';
|
||||
created() {
|
||||
this.getBookList()
|
||||
this.loadAll()
|
||||
},
|
||||
handlePictureCardPreview(file) {
|
||||
this.dataForm.images = file.url;
|
||||
this.dialogVisible = true;
|
||||
mounted() {
|
||||
// this.restaurants = this.loadAll();
|
||||
},
|
||||
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() {
|
||||
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.bookType = data.book.bookType
|
||||
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,
|
||||
'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({
|
||||
url: this.$http.adornUrl('/book/author/bookAuthorList'),
|
||||
method: 'get',
|
||||
}).then(({ data }) => {
|
||||
this.authorList = data.list
|
||||
})
|
||||
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
|
||||
})
|
||||
|
||||
// 获取图书拆分类型
|
||||
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);
|
||||
// }
|
||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/splitsType'),
|
||||
method: 'get',
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.splitsTypeList = 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>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<!-- <el-button @click="getDataList()">查询</el-button> -->
|
||||
<el-button v-if="isAuth('book:bookchapter:save')" type="primary" @click="addOrUpdateHandle()">增加讲书目录</el-button>
|
||||
@@ -14,18 +14,18 @@
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
|
||||
|
||||
<el-table-column width="100"
|
||||
prop="chapter"
|
||||
prop="chapter"
|
||||
align="center"
|
||||
label="章节序号">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
label="标题">
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="content"
|
||||
header-align="center"
|
||||
@@ -40,9 +40,19 @@
|
||||
label="音频">
|
||||
<template slot-scope="scope">
|
||||
<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>
|
||||
</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
|
||||
prop="createTime"
|
||||
header-align="center"
|
||||
@@ -67,9 +77,9 @@
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<template slot-scope="scope">
|
||||
<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>
|
||||
</router-link>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './talkBook-add-or-update'
|
||||
export default {
|
||||
@@ -172,7 +182,7 @@
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id, this.bookid)
|
||||
})
|
||||
},
|
||||
@@ -188,7 +198,7 @@
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/teach/delTeach'),
|
||||
method: 'post',
|
||||
method: 'post',
|
||||
// data: this.$http.adornData(ids, false)
|
||||
// data: {'teachId': id}
|
||||
data: this.$http.adornData({
|
||||
@@ -213,4 +223,3 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,288 +1,288 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item label="分类">
|
||||
<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>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="书名">
|
||||
<el-input v-model="dataForm.bookName" placeholder="请输入书名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="分类">
|
||||
<template slot-scope="scope">
|
||||
{{ filterAA(scope.row.typeId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="书名" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.book.name }}
|
||||
</template>
|
||||
</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="editOrUpdateHandle(scope.row)">修改</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>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<el-dialog :visible.sync="addOrUpdateVisible" :append-to-body="true" :title="titlesub" width="50%" @close="cancleClose">
|
||||
<el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule">
|
||||
<el-row type="flex" justify="center">
|
||||
<el-form-item label="分类" prop="typeId">
|
||||
<el-select v-model="addForm.typeId" placeholder="请选择分类" style="width: 500px;">
|
||||
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row type="flex" justify="center">
|
||||
<el-form-item label="书名" prop="bookId">
|
||||
<el-select v-model="addForm.bookId" placeholder="请选择书名" style="width: 500px;">
|
||||
<el-option v-for="item in booknameList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</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>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item label="分类">
|
||||
<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>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="书名">
|
||||
<el-input v-model="dataForm.bookName" placeholder="请输入书名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:shopproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table :data="dataList" border v-loading="dataListLoading" style="width: 100%;">
|
||||
<el-table-column header-align="center" align="center" label="分类">
|
||||
<template slot-scope="scope">
|
||||
{{ filterAA(scope.row.typeId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="书名" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.book.name }}
|
||||
</template>
|
||||
</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="editOrUpdateHandle(scope.row)">修改</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>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<el-dialog :visible.sync="addOrUpdateVisible" :append-to-body="true" :title="titlesub" width="50%"
|
||||
@close="cancleClose">
|
||||
<el-form :inline="true" :model="addForm" ref="addFormRef" :rules="addFormRule">
|
||||
<el-row type="flex" justify="center">
|
||||
<el-form-item label="分类" prop="typeId">
|
||||
<el-select v-model="addForm.typeId" placeholder="请选择分类" style="width: 500px;">
|
||||
<el-option v-for="(item,index) in typeList" :key="index" :label="item.dictValue" :value="item.dictType">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row type="flex" justify="center">
|
||||
<el-form-item label="书名" prop="bookId">
|
||||
<el-select v-model="addForm.bookId" placeholder="请选择书名" style="width: 500px;">
|
||||
<el-option v-for="item in booknameList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</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> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
typeList: [], //类型列表
|
||||
booknameList: [],
|
||||
dataForm: {
|
||||
dictType: '',//分类
|
||||
bookName: '',//书名
|
||||
},
|
||||
addForm: {
|
||||
"id": '',//新增不传
|
||||
"bookId": '',
|
||||
"typeId": '',
|
||||
"sort": ''
|
||||
},
|
||||
editId: '',
|
||||
addFormRule: {
|
||||
typeId: [{required: true, message: "请选择分类" }],
|
||||
bookId: [{required: true, message: "请选择书名"}]
|
||||
},
|
||||
dataList: [],
|
||||
// publishStatus: false,
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false,
|
||||
bookIds:[],
|
||||
titlesub: '新增'
|
||||
}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
typeList: [], //类型列表
|
||||
booknameList: [],
|
||||
dataForm: {
|
||||
dictType: '', //分类
|
||||
bookName: '', //书名
|
||||
},
|
||||
addForm: {
|
||||
"id": '', //新增不传
|
||||
"bookId": '',
|
||||
"typeId": '',
|
||||
"sort": ''
|
||||
},
|
||||
editId: '',
|
||||
addFormRule: {
|
||||
typeId: [{
|
||||
required: true,
|
||||
message: "请选择分类"
|
||||
}],
|
||||
bookId: [{
|
||||
required: true,
|
||||
message: "请选择书名"
|
||||
}]
|
||||
},
|
||||
dataList: [],
|
||||
// publishStatus: false,
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false,
|
||||
bookIds: [],
|
||||
titlesub: '新增'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
// AddOrUpdate,
|
||||
// chooseBook
|
||||
// AddOrUpdate,
|
||||
// chooseBook
|
||||
},
|
||||
activated () {
|
||||
this.gettypeList()
|
||||
this.getDataList()
|
||||
activated() {
|
||||
this.gettypeList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
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() {
|
||||
// 获取数据列表
|
||||
gettypeList() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/book/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
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({
|
||||
url: this.$http.adornUrl('/book/medicaldes/bookList'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': 1,
|
||||
'limit': 1000000,
|
||||
'bookName': '',
|
||||
'publisherName' : '',
|
||||
'authorName' : ''
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.booknameList = data.page.list
|
||||
} else {
|
||||
this.booknameList = []
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
filterAA(val){
|
||||
var aa = this.typeList.filter(obj => obj.dictType == val)
|
||||
return aa[0].dictValue
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
editOrUpdateHandle (row) {
|
||||
this.titlesub = '修改'
|
||||
this.getbookname()
|
||||
this.editId = row.id
|
||||
this.addForm.bookId = row.bookId
|
||||
this.addForm.typeId = row.typeId.toString()
|
||||
this.addForm.sort = row.sort
|
||||
this.addOrUpdateVisible = true
|
||||
|
||||
},
|
||||
addOrUpdateHandle() {
|
||||
this.getbookname()
|
||||
this.editId = ''
|
||||
this.titlesub = '新增'
|
||||
this.addOrUpdateVisible = true
|
||||
},
|
||||
cancleClose() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.$refs["addFormRef"].resetFields();
|
||||
this.addForm = {
|
||||
"id": '',//新增不传
|
||||
"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("失败");
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
'publisherName': '',
|
||||
'authorName': ''
|
||||
})
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.booknameList = data.page.list
|
||||
} else {
|
||||
this.booknameList = []
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
filterAA(val) {
|
||||
var aa = this.typeList.filter(obj => obj.dictType == val)
|
||||
return aa[0].dictValue
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
editOrUpdateHandle(row) {
|
||||
this.titlesub = '修改'
|
||||
this.getbookname()
|
||||
this.editId = row.id
|
||||
this.addForm.bookId = row.bookId
|
||||
this.addForm.typeId = row.typeId.toString()
|
||||
this.addForm.sort = row.sort
|
||||
this.addOrUpdateVisible = true
|
||||
|
||||
},
|
||||
addOrUpdateHandle() {
|
||||
this.getbookname()
|
||||
this.editId = ''
|
||||
this.titlesub = '新增'
|
||||
this.addOrUpdateVisible = true
|
||||
},
|
||||
cancleClose() {
|
||||
this.addOrUpdateVisible = false
|
||||
this.$refs["addFormRef"].resetFields();
|
||||
this.addForm = {
|
||||
"id": '', //新增不传
|
||||
"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("失败");
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
}
|
||||
</script>
|
||||
@@ -1,7 +1,8 @@
|
||||
<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()"
|
||||
label-width="80px">
|
||||
label-width="120px">
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="姓名"></el-input>
|
||||
</el-form-item>
|
||||
@@ -12,36 +13,35 @@
|
||||
<el-input v-model="dataForm.password" placeholder="密码"></el-input>
|
||||
</el-form-item>
|
||||
<div v-if="dataForm.id">
|
||||
<el-form-item label="年龄" prop="age">
|
||||
<el-input v-model="dataForm.age" 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=2>保密</el-radio>
|
||||
<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="avatar">
|
||||
<!-- <el-input v-model="dataForm.avatar" placeholder="头像"></el-input> -->
|
||||
<el-upload :action= "baseUrl + '/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.avatar" alt="">
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="nickname">
|
||||
<el-input v-model="dataForm.nickname" placeholder="昵称"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="密码" prop="password">
|
||||
<el-form-item label="年龄" prop="age">
|
||||
<el-input v-model="dataForm.age" 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=2>保密</el-radio>
|
||||
<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="avatar">
|
||||
<!-- <el-input v-model="dataForm.avatar" placeholder="头像"></el-input> -->
|
||||
<el-upload :action="baseUrl + '/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.avatar" alt="">
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="nickname">
|
||||
<el-input v-model="dataForm.nickname" placeholder="昵称"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="密码" prop="password">
|
||||
<el-input v-model="dataForm.password" placeholder="密码"></el-input>
|
||||
</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-form-item> -->
|
||||
<!-- <el-form-item label="vip 有效期" prop="vipValidtime">
|
||||
<!-- <el-form-item label="vip 有效期" prop="vipValidtime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.vipValidtime"
|
||||
type="datetime"
|
||||
@@ -51,17 +51,17 @@
|
||||
</el-date-picker>
|
||||
<el-input v-model="dataForm.vipValidtime" placeholder="vip 有效期"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="花生币" prop="peanutCoin">
|
||||
<!-- <el-input v-model="dataForm.peanutCoin" placeholder="花生币"></el-input> -->
|
||||
<el-input-number disabled v-model="dataForm.peanutCoin" label="花生币"></el-input-number>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="阅读时间" prop="readTime">
|
||||
<el-form-item label="花生币" prop="peanutCoin">
|
||||
<!-- <el-input v-model="dataForm.peanutCoin" placeholder="花生币"></el-input> -->
|
||||
<el-input-number disabled v-model="dataForm.peanutCoin" label="花生币"></el-input-number>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="阅读时间" prop="readTime">
|
||||
<el-input v-model="dataForm.readTime" placeholder="阅读时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="最后登录时间" prop="lastLoginTime">
|
||||
<el-input v-model="dataForm.lastLoginTime" placeholder="最后登录时间"></el-input>
|
||||
</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-form-item>
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
@@ -70,7 +70,27 @@
|
||||
<el-form-item label="删除标记" prop="delFlag">
|
||||
<el-input v-model="dataForm.delFlag" placeholder="删除标记"></el-input>
|
||||
</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>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handlereset">取消</el-button>
|
||||
@@ -80,16 +100,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import global from '../../common/common.vue' //引入共用组间
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl:global.baseUrl,
|
||||
visible: false,
|
||||
dialogVisible: false,
|
||||
fileList: [],
|
||||
pickerOptions:{
|
||||
shortcuts: [{
|
||||
import global from '../../common/common.vue' //引入共用组间
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl: global.baseUrl,
|
||||
visible: false,
|
||||
dialogVisible: false,
|
||||
fileList: [],
|
||||
pickerOptions: {
|
||||
shortcuts: [{
|
||||
text: '今天',
|
||||
onClick(picker) {
|
||||
picker.$emit('pick', new Date());
|
||||
@@ -109,144 +129,171 @@ export default {
|
||||
picker.$emit('pick', date);
|
||||
}
|
||||
}]
|
||||
},
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
age: '',
|
||||
sex: 2,
|
||||
avatar: '',
|
||||
nickname: '',
|
||||
tel: '',
|
||||
password: '',
|
||||
vip: '',
|
||||
vipValidtime: '',
|
||||
peanutCoin: '',
|
||||
readTime: '',
|
||||
lastLoginTime: '',
|
||||
createTime: '',
|
||||
updateTime: '',
|
||||
delFlag: '',
|
||||
},
|
||||
dataRule: {
|
||||
name: [
|
||||
{ required: true, message: '姓名不能为空', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '密码不能为空', trigger: 'blur' }
|
||||
],
|
||||
// age: [
|
||||
// { required: true, message: '年龄不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// sex: [
|
||||
// { required: true, message: '性别不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// avatar: [
|
||||
// { required: true, message: '头像不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// nickname: [
|
||||
// { required: true, message: '昵称不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
tel: [
|
||||
{ required: true, message: '电话不能为空', trigger: 'blur' },
|
||||
{
|
||||
validator: function(rule, value, callback) {
|
||||
if (/^1[34578]\d{9}$/.test(value) == false) {
|
||||
callback(new Error("手机号格式错误"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
dataForm: {
|
||||
id: 0,
|
||||
name: '',
|
||||
age: '',
|
||||
sex: 2,
|
||||
avatar: '',
|
||||
nickname: '',
|
||||
tel: '',
|
||||
password: '',
|
||||
vip: '',
|
||||
vipValidtime: '',
|
||||
peanutCoin: '',
|
||||
readTime: '',
|
||||
lastLoginTime: '',
|
||||
createTime: '',
|
||||
updateTime: '',
|
||||
delFlag: '',
|
||||
pointPower: 0,
|
||||
tgdzPower: 0,
|
||||
wylqPower: 0,
|
||||
prescriptAPower: 0,
|
||||
prescriptBPower: 0,
|
||||
},
|
||||
dataRule: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: '姓名不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
password: [{
|
||||
required: true,
|
||||
message: '密码不能为空',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
// age: [
|
||||
// { required: true, message: '年龄不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// sex: [
|
||||
// { required: true, message: '性别不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// avatar: [
|
||||
// { required: true, message: '头像不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// nickname: [
|
||||
// { required: true, message: '昵称不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
tel: [{
|
||||
required: true,
|
||||
message: '电话不能为空',
|
||||
trigger: 'blur'
|
||||
},
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
// 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: {
|
||||
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
|
||||
}
|
||||
{
|
||||
validator: function(rule, value, callback) {
|
||||
if (/^1[34578]\d{9}$/.test(value) == false) {
|
||||
callback(new Error("手机号格式错误"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: "blur"
|
||||
}
|
||||
})
|
||||
],
|
||||
// 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' }
|
||||
// ]
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
let myData = {}
|
||||
if(!this.dataForm.id){
|
||||
myData = {
|
||||
'name': this.dataForm.name,
|
||||
'tel': this.dataForm.tel,
|
||||
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
|
||||
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,
|
||||
'age': this.dataForm.age,
|
||||
'sex': this.dataForm.sex,
|
||||
'avatar': this.dataForm.avatar,
|
||||
'nickname': this.dataForm.nickname,
|
||||
'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,
|
||||
// 'vip': this.dataForm.vip,
|
||||
// 'vipValidtime': this.dataForm.vipValidtime,
|
||||
@@ -256,54 +303,56 @@ export default {
|
||||
// 'createTime': this.dataForm.createTime,
|
||||
// 'updateTime': this.dataForm.updateTime,
|
||||
// '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("上传失败");
|
||||
}
|
||||
})
|
||||
},
|
||||
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) {
|
||||
this.dataForm.avatar = '';
|
||||
},
|
||||
handlereset(){
|
||||
// console.log('关闭了')
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.dataForm.password = ''
|
||||
this.fileList = [],
|
||||
this.visible = false
|
||||
},
|
||||
},
|
||||
handleRemove(file) {
|
||||
this.dataForm.avatar = '';
|
||||
},
|
||||
handlereset() {
|
||||
// console.log('关闭了')
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.dataForm.password = ''
|
||||
this.fileList = [],
|
||||
this.visible = false
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
Reference in New Issue
Block a user