添加目录加入防抖功能
This commit is contained in:
@@ -1,7 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"
|
<el-dialog
|
||||||
@close="handlereset">
|
:title="!dataForm.id ? '新增' : '修改'"
|
||||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="80px">
|
: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="title">
|
<el-form-item label="课程名" prop="title">
|
||||||
<el-input v-model="dataForm.title" placeholder="课程名"></el-input>
|
<el-input v-model="dataForm.title" placeholder="课程名"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -9,30 +18,58 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="类型" prop="type">
|
<el-form-item label="类型" prop="type">
|
||||||
<el-select v-model="dataForm.type" filterable
|
<el-select
|
||||||
placeholder="请选择类型">
|
v-model="dataForm.type"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择类型"
|
||||||
|
>
|
||||||
<!-- <el-option :key="0" label="无" :value="0"></el-option> -->
|
<!-- <el-option :key="0" label="无" :value="0"></el-option> -->
|
||||||
<el-option v-for="item in typeList" :key="item.dictType" :label="item.dictValue" :value="item.dictType">
|
<el-option
|
||||||
|
v-for="item in typeList"
|
||||||
|
:key="item.dictType"
|
||||||
|
:label="item.dictValue"
|
||||||
|
:value="item.dictType"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if='!this.dataForm.id'>
|
<el-col :span="12" v-if="!this.dataForm.id">
|
||||||
<el-form-item label="是否同步创建商品" prop="needCreate" label-width="140px">
|
<el-form-item
|
||||||
<el-select v-model="dataForm.needCreate" filterable
|
label="是否同步创建商品"
|
||||||
placeholder="请选择是否">
|
prop="needCreate"
|
||||||
|
label-width="140px"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="dataForm.needCreate"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择是否"
|
||||||
|
>
|
||||||
<!-- <el-option :key="0" label="无" :value="0"></el-option> -->
|
<!-- <el-option :key="0" label="无" :value="0"></el-option> -->
|
||||||
<el-option v-for="item in needCreateList" :key="item.dictType" :label="item.dictValue" :value="item.dictType">
|
<el-option
|
||||||
|
v-for="item in needCreateList"
|
||||||
|
:key="item.dictType"
|
||||||
|
:label="item.dictValue"
|
||||||
|
:value="item.dictType"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-form-item label="半年价格" prop="halfFee">
|
<el-form-item label="半年价格" prop="halfFee">
|
||||||
<el-input v-model="dataForm.halfFee" placeholder="半年价格" :disabled='this.dataForm.id'></el-input>
|
<el-input
|
||||||
|
v-model="dataForm.halfFee"
|
||||||
|
placeholder="半年价格"
|
||||||
|
:disabled="this.dataForm.id"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="全年价格" prop="fee">
|
<el-form-item label="全年价格" prop="fee">
|
||||||
<el-input v-model="dataForm.fee" placeholder="全年价格" :disabled='this.dataForm.id'></el-input>
|
<el-input
|
||||||
|
v-model="dataForm.fee"
|
||||||
|
placeholder="全年价格"
|
||||||
|
:disabled="this.dataForm.id"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
@@ -167,16 +204,17 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import global from '../../common/common.vue' //引入共用组间
|
import debounce from "lodash/debounce"; //导入lodash中的debounce
|
||||||
export default {
|
import global from "../../common/common.vue"; //引入共用组间
|
||||||
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baseUrl: global.baseUrl,
|
baseUrl: global.baseUrl,
|
||||||
visible: false,
|
visible: false,
|
||||||
typeList: [{ //类型0免费1普通收费2超v课程
|
typeList: [
|
||||||
|
{
|
||||||
|
//类型0免费1普通收费2超v课程
|
||||||
dictType: 0,
|
dictType: 0,
|
||||||
dictValue: "免费"
|
dictValue: "免费"
|
||||||
},
|
},
|
||||||
@@ -189,7 +227,9 @@
|
|||||||
dictValue: "超v课程"
|
dictValue: "超v课程"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
needCreateList: [{ ////是否同步创建商品0否1是
|
needCreateList: [
|
||||||
|
{
|
||||||
|
////是否同步创建商品0否1是
|
||||||
dictType: 0,
|
dictType: 0,
|
||||||
dictValue: "否"
|
dictValue: "否"
|
||||||
},
|
},
|
||||||
@@ -198,7 +238,8 @@
|
|||||||
dictValue: "是"
|
dictValue: "是"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
medicaldesBookTypeList: [{
|
medicaldesBookTypeList: [
|
||||||
|
{
|
||||||
dictType: 1,
|
dictType: 1,
|
||||||
dictValue: "中医基础"
|
dictValue: "中医基础"
|
||||||
},
|
},
|
||||||
@@ -221,95 +262,97 @@
|
|||||||
{
|
{
|
||||||
dictType: 6,
|
dictType: 6,
|
||||||
dictValue: "哲学"
|
dictValue: "哲学"
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
props: {
|
props: {
|
||||||
dictType: '',
|
dictType: "",
|
||||||
dictValue: ''
|
dictValue: ""
|
||||||
},
|
},
|
||||||
gushuList:[],
|
gushuList: [],
|
||||||
authorList: [],
|
authorList: [],
|
||||||
restaurants: [],
|
restaurants: [],
|
||||||
author: '',
|
author: "",
|
||||||
publisherList: [],
|
publisherList: [],
|
||||||
fileList: [],
|
fileList: [],
|
||||||
fileListNovel: [],
|
fileListNovel: [],
|
||||||
dialogImageUrl: '',
|
dialogImageUrl: "",
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dataForm: {
|
dataForm: {
|
||||||
"id": 0,
|
id: 0,
|
||||||
"courseId": 0,
|
courseId: 0,
|
||||||
"type": 0, //类型0免费1普通收费2超v课程
|
type: 0, //类型0免费1普通收费2超v课程
|
||||||
"title": "",
|
title: "",
|
||||||
"halfFee": 0, //半年价格
|
halfFee: 0, //半年价格
|
||||||
"fee": 0, //全年价格
|
fee: 0, //全年价格
|
||||||
"sort": 1,
|
sort: 1,
|
||||||
"needCreate": 0 //是否同步创建商品0否1是
|
needCreate: 0 //是否同步创建商品0否1是
|
||||||
},
|
},
|
||||||
splitsTypeList: [],
|
splitsTypeList: [],
|
||||||
dataRule: {
|
dataRule: {}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getBookList()
|
this.getBookList();
|
||||||
this.loadAll()
|
this.loadAll();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.restaurants = this.loadAll();
|
// this.restaurants = this.loadAll();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init(row, courseid) {
|
init(row, courseid) {
|
||||||
console.log('row2', row)
|
console.log("row2", row);
|
||||||
this.dataForm = row || {}
|
this.dataForm = row || {};
|
||||||
this.dataForm.courseId = courseid || ''
|
this.dataForm.courseId = courseid || "";
|
||||||
this.visible = true
|
this.visible = true;
|
||||||
|
|
||||||
},
|
},
|
||||||
// 表单提交
|
|
||||||
dataFormSubmit() {
|
dataFormSubmit: debounce(async function() {
|
||||||
console.log('11111', this.dataForm.medicaldesBookType)
|
console.log("11111", this.dataForm.medicaldesBookType);
|
||||||
// if (this.dataForm.medicaldesBookType.length == 0) {
|
// if (this.dataForm.medicaldesBookType.length == 0) {
|
||||||
// this.$message.error("请选择图书类型");
|
// this.$message.error("请选择图书类型");
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
this.$refs["dataForm"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(`${!this.dataForm.id ? '/master/course/addCourseCatalogue' : '/master/course/editCourseCatalogue'}`),
|
url: this.$http.adornUrl(
|
||||||
method: 'post',
|
`${
|
||||||
|
!this.dataForm.id
|
||||||
|
? "/master/course/addCourseCatalogue"
|
||||||
|
: "/master/course/editCourseCatalogue"
|
||||||
|
}`
|
||||||
|
),
|
||||||
|
method: "post",
|
||||||
data: this.$http.adornData({
|
data: this.$http.adornData({
|
||||||
'courseId': this.dataForm.courseId || undefined,
|
courseId: this.dataForm.courseId || undefined,
|
||||||
'id': this.dataForm.id || undefined,
|
id: this.dataForm.id || undefined,
|
||||||
'title': this.dataForm.title,
|
title: this.dataForm.title,
|
||||||
"type": this.dataForm.type, //类型0免费1普通收费2超v课程
|
type: this.dataForm.type, //类型0免费1普通收费2超v课程
|
||||||
"halfFee": this.dataForm.halfFee, //半年价格
|
halfFee: this.dataForm.halfFee, //半年价格
|
||||||
"fee": this.dataForm.fee, //全年价格
|
fee: this.dataForm.fee, //全年价格
|
||||||
"sort": this.dataForm.sort,
|
sort: this.dataForm.sort,
|
||||||
"needCreate": this.dataForm.needCreate //是否同步创建商品0否1是
|
needCreate: this.dataForm.needCreate //是否同步创建商品0否1是
|
||||||
})
|
})
|
||||||
}).then(({
|
}).then(({ data }) => {
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '操作成功',
|
message: "操作成功",
|
||||||
type: 'success',
|
type: "success",
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
this.visible = false
|
this.visible = false;
|
||||||
this.$emit('refreshDataList')
|
this.$emit("refreshDataList");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.msg)
|
this.$message.error(data.msg);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
}, 200),
|
||||||
|
// 表单提交
|
||||||
|
|
||||||
handlePicSuccess(res, file) {
|
handlePicSuccess(res, file) {
|
||||||
if (res.msg == "success") {
|
if (res.msg == "success") {
|
||||||
this.dataForm.images = res.url;
|
this.dataForm.images = res.url;
|
||||||
@@ -321,69 +364,63 @@
|
|||||||
//图书分类
|
//图书分类
|
||||||
getBookList() {
|
getBookList() {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/book_type'),
|
url: this.$http.adornUrl("/book/sysdictdata/selectByType/book_type"),
|
||||||
method: 'get',
|
method: "get"
|
||||||
// params: this.$http.adornParams({
|
// params: this.$http.adornParams({
|
||||||
// 'type': 'book_type',
|
// 'type': 'book_type',
|
||||||
// })
|
// })
|
||||||
}).then(({
|
}).then(({ data }) => {
|
||||||
data
|
console.log(data);
|
||||||
}) => {
|
|
||||||
console.log(data)
|
|
||||||
// this.bookList = data.dataList
|
// this.bookList = data.dataList
|
||||||
})
|
});
|
||||||
|
|
||||||
// 获取图书拆分类型
|
// 获取图书拆分类型
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/book/sysdictdata/selectByType/splitsType'),
|
url: this.$http.adornUrl("/book/sysdictdata/selectByType/splitsType"),
|
||||||
method: 'get',
|
method: "get"
|
||||||
}).then(({
|
}).then(({ data }) => {
|
||||||
data
|
this.splitsTypeList = data.dataList;
|
||||||
}) => {
|
});
|
||||||
this.splitsTypeList = data.dataList
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// 获取古书
|
// 获取古书
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/book/book/getAncientBooks'),
|
url: this.$http.adornUrl("/book/book/getAncientBooks"),
|
||||||
method: 'post',
|
method: "post"
|
||||||
}).then(({
|
}).then(({ data }) => {
|
||||||
data
|
this.gushuList = data.books;
|
||||||
}) => {
|
});
|
||||||
this.gushuList= data.books
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
},
|
||||||
handleRemove(file) {
|
handleRemove(file) {
|
||||||
this.dataForm.images = '';
|
this.dataForm.images = "";
|
||||||
},
|
},
|
||||||
handlePictureCardPreview(file) {
|
handlePictureCardPreview(file) {
|
||||||
this.dataForm.images = file.url;
|
this.dataForm.images = file.url;
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
handleDownload(file) {
|
handleDownload(file) {
|
||||||
console.log(file)
|
console.log(file);
|
||||||
},
|
},
|
||||||
handlereset() {
|
handlereset() {
|
||||||
this.fileList = [],
|
(this.fileList = []), (this.fileListNovel = []), (this.visible = false);
|
||||||
this.fileListNovel = [],
|
|
||||||
this.visible = false
|
|
||||||
},
|
},
|
||||||
handlePreview(file) {
|
handlePreview(file) {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
},
|
},
|
||||||
handleExceed(files, fileList) {
|
handleExceed(files, fileList) {
|
||||||
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
this.$message.warning(
|
||||||
|
`当前限制选择 3 个文件,本次选择了 ${
|
||||||
|
files.length
|
||||||
|
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
||||||
|
);
|
||||||
},
|
},
|
||||||
beforeRemove(file, fileList) {
|
beforeRemove(file, fileList) {
|
||||||
return this.$confirm(`确定移除 ${ file.name }?`);
|
return this.$confirm(`确定移除 ${file.name}?`);
|
||||||
},
|
},
|
||||||
handleRemoveNovel(file) {
|
handleRemoveNovel(file) {
|
||||||
this.dataForm.novel = '';
|
this.dataForm.novel = "";
|
||||||
},
|
},
|
||||||
handleNovelSuccess(file) {
|
handleNovelSuccess(file) {
|
||||||
this.dataForm.novel = file.url
|
this.dataForm.novel = file.url;
|
||||||
},
|
},
|
||||||
// querySearch(queryString, cb) {
|
// querySearch(queryString, cb) {
|
||||||
// var restaurants = this.restaurants;
|
// var restaurants = this.restaurants;
|
||||||
@@ -399,28 +436,22 @@
|
|||||||
// },
|
// },
|
||||||
loadAll() {
|
loadAll() {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/book/author/bookAuthorList'),
|
url: this.$http.adornUrl("/book/author/bookAuthorList"),
|
||||||
method: 'get',
|
method: "get"
|
||||||
}).then(({
|
}).then(({ data }) => {
|
||||||
data
|
this.authorList = data.list;
|
||||||
}) => {
|
});
|
||||||
this.authorList = data.list
|
|
||||||
})
|
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/book/publisher/publisherList'),
|
url: this.$http.adornUrl("/book/publisher/publisherList"),
|
||||||
method: 'get',
|
method: "get"
|
||||||
}).then(({
|
}).then(({ data }) => {
|
||||||
data
|
this.publisherList = data.list;
|
||||||
}) => {
|
});
|
||||||
this.publisherList = data.list
|
}
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
// handleSelect(item) {
|
// handleSelect(item) {
|
||||||
// this.dataForm.authorId = item.id
|
// this.dataForm.authorId = item.id
|
||||||
// console.log(item);
|
// console.log(item);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user