分类筛选+协议分页

This commit is contained in:
2024-05-16 15:47:55 +08:00
parent 840e8fe762
commit 1b845e5f2f
2 changed files with 277 additions and 155 deletions

View File

@@ -1,64 +1,135 @@
<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-input v-model="query.keywords" placeholder="课程目录章节名称" clearable></el-input> <el-input v-model="query.keywords" placeholder="课程目录章节名称" clearable></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 type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table :data="dataList" border v-loading="dataListLoading" <el-table
style="width: 100%;"> :data="dataList"
<el-table-column prop="title" header-align="center" align="center" label="章节名称"> border
v-loading="dataListLoading"
style="width: 100%;"
>
<el-table-column
prop="title"
header-align="center"
align="center"
label="章节名称"
>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" header-align="center" align="center" label="创建日期"> <el-table-column
prop="createTime"
header-align="center"
align="center"
label="创建日期"
>
</el-table-column> </el-table-column>
<el-table-column header-align="center" align="center" label="图片"> <el-table-column header-align="center" align="center" label="图片">
<template slot-scope="scope"> <template slot-scope="scope">
<img v-if="scope.row.imgUrl != ''" :src="scope.row.imgUrl" width="70" height="100" class="tableImg" /> <img
v-if="scope.row.imgUrl != ''"
:src="scope.row.imgUrl"
width="70"
height="100"
class="tableImg"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="content" header-align="center" align="center" label="内容"> <el-table-column
prop="content"
header-align="center"
align="center"
label="内容"
>
<template slot-scope="scope">
<div class="hidden1">
{{ scope.row.content }}
</div>
</template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="250" label="操作"> <el-table-column
fixed="right"
header-align="center"
align="center"
width="250"
label="操作"
>
<template slot-scope="scope"> <template slot-scope="scope">
<div>
<div> <router-link
<router-link :to="{path: 'course-courseVideo' , query:{ id : scope.row.id , pageIndex} }"> :to="{
<el-button type="text" size="small">视频管理</el-button> path: 'course-courseVideo',
</router-link> query: { id: scope.row.id, pageIndex }
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row)">修改</el-button> }"
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button> >
</div> <el-button type="text" size="small">视频管理</el-button>
</router-link>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row)"
>修改</el-button
>
<el-button
type="text"
size="small"
@click="deleteHandle(scope.row.id)"
>删除</el-button
>
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" <el-pagination
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" @size-change="sizeChangeHandle"
style="padding: 30px 0; text-align: center;" layout="total, sizes, prev, pager, next, jumper"> @current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
style="padding: 30px 0; text-align: center;"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination> </el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<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 './chapter-add-or-update' import AddOrUpdate from "./chapter-add-or-update";
export default { export default {
data() { data() {
return { return {
dataForm: { dataForm: {
key: '' key: ""
}, },
query:{ query: {
type:'', type: "",
categoryId:'', categoryId: "",
sociologyId:'', sociologyId: "",
keywords:'' keywords: ""
}, },
dataList: [], dataList: [],
delFlag: false, delFlag: false,
@@ -68,7 +139,7 @@ export default {
dataListLoading: false, dataListLoading: false,
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false addOrUpdateVisible: false
} };
}, },
components: { components: {
AddOrUpdate AddOrUpdate
@@ -76,95 +147,101 @@ export default {
activated() { activated() {
this.courseid = this.$route.query.courseid; this.courseid = this.$route.query.courseid;
this.catalogue_id = this.$route.query.id; this.catalogue_id = this.$route.query.id;
console.log('111', this.courseid) console.log("111", this.courseid);
console.log('222', this.catalogue_id) console.log("222", this.catalogue_id);
if(this.$route.query.upPageInde != null){ if (this.$route.query.upPageInde != null) {
this.pageIndex = this.$route.query.upPageIndex; this.pageIndex = this.$route.query.upPageIndex;
console.log(this.pageIndex) console.log(this.pageIndex);
} }
this.getDataList() this.getDataList();
}, },
methods: { methods: {
// 获取数据列表 // 获取数据列表
getDataList() { getDataList() {
this.dataListLoading = true this.dataListLoading = true;
this.$http({ this.$http({
url: this.$http.adornUrl('/master/course/getCourseCatalogueChapterList'), url: this.$http.adornUrl(
method: 'post', "/master/course/getCourseCatalogueChapterList"
),
method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
'id': this.catalogue_id, id: this.catalogue_id,
'page': this.pageIndex, page: this.pageIndex,
'limit': this.pageSize, limit: this.pageSize
// "type": this.query.type||0, //类型0全部1医学2国学 // "type": this.query.type||0, //类型0全部1医学2国学
// "categoryId": this.query.categoryId, //医学类型id当type为1时为必填项;为0时代表全部 // "categoryId": this.query.categoryId, //医学类型id当type为1时为必填项;为0时代表全部
// "sociologyId": this.query.sociologyId, //国学类型id,当type为2时为必填项为0代表全部 // "sociologyId": this.query.sociologyId, //国学类型id,当type为2时为必填项为0代表全部
// "keywords": this.query.keywords //关键字 // "keywords": this.query.keywords //关键字
}) })
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.page.records this.dataList = data.page.records;
this.totalPage = data.page.total this.totalPage = data.page.total;
} else { } else {
this.dataList = [] this.dataList = [];
this.totalPage = 0 this.totalPage = 0;
} }
this.dataListLoading = false this.dataListLoading = false;
}) });
}, },
// 每页数 // 每页数
sizeChangeHandle(val) { sizeChangeHandle(val) {
this.pageSize = val this.pageSize = val;
this.pageIndex = 1 this.pageIndex = 1;
this.getDataList() this.getDataList();
}, },
// 当前页 // 当前页
currentChangeHandle(val) { currentChangeHandle(val) {
this.pageIndex = val this.pageIndex = val;
this.getDataList() this.getDataList();
}, },
// 多选 // 多选
selectionChangeHandle(val) { selectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val;
}, },
// 新增 / 修改 // 新增 / 修改
addOrUpdateHandle(row) { addOrUpdateHandle(row) {
console.log('row1', row) console.log("row1", row);
this.addOrUpdateVisible = true this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(row, this.catalogue_id, this.courseid) this.$refs.addOrUpdate.init(row, this.catalogue_id, this.courseid);
}) });
}, },
// 删除 // 删除
deleteHandle(id) { deleteHandle(id) {
// var ids = id ? [id] : this.dataListSelections.map(item => { // var ids = id ? [id] : this.dataListSelections.map(item => {
// return item.id // return item.id
// }) // })
this.$confirm(`确定对[id=${id}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', { this.$confirm(
confirmButtonText: '确定', `确定对[id=${id}]进行[${id ? "删除" : "批量删除"}]操作?`,
cancelButtonText: '取消', "提示",
type: 'warning' {
}).then(() => { confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({ this.$http({
url: this.$http.adornUrl('/master/course/delCourseCatalogueChapter'), url: this.$http.adornUrl("/master/course/delCourseCatalogueChapter"),
method: 'post', method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
'id': id id: id
}) })
}).then(({ data }) => { }).then(({ 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.getDataList() this.getDataList();
} }
}) });
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg);
} }
}) });
}) });
}, },
// 开关变化 // 开关变化
SwitchChange(event) { SwitchChange(event) {
@@ -172,81 +249,95 @@ export default {
var parms = { var parms = {
delFlag: event.delFlag, delFlag: event.delFlag,
id: event.id id: event.id
} };
this.$http({ this.$http({
url: this.$http.adornUrl('/book/book/update'), url: this.$http.adornUrl("/book/book/update"),
method: 'post', method: "post",
data: parms data: parms
}).then(res => {
this.$message({
message: '成功',
type: 'success'
})
this.loading = false
this.getDataList()
}).catch(error => {
this.loading = false
console.log(error)
}) })
console.log(event) .then(res => {
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
})
.catch(error => {
this.loading = false;
console.log(error);
});
console.log(event);
}, },
chapterHandle(id, row) { chapterHandle(id, row) {
if (row.novel == '') { if (row.novel == "") {
this.$alert('请上传电子书文件后在进行此操作', '提示', { this.$alert("请上传电子书文件后在进行此操作", "提示", {
confirmButtonText: '好的', confirmButtonText: "好的"
}); });
return false return false;
} }
this.$http({ this.$http({
url: this.$http.adornUrl('/book/book/getChapter'), url: this.$http.adornUrl("/book/book/getChapter"),
method: 'get', method: "get",
params: this.$http.adornParams({ params: this.$http.adornParams({
'id':id id: id
})
}).then(res => {
this.$message({
message: '成功',
type: 'success'
}) })
this.loading = false }).then(res => {
this.getDataList() this.$message({
}) message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
}, },
contentHandle(id){ contentHandle(id) {
this.$http({ this.$http({
url: this.$http.adornUrl('/book/bookchaptercontent/getBookVoices'), url: this.$http.adornUrl("/book/bookchaptercontent/getBookVoices"),
method: 'get', method: "get",
params: this.$http.adornParams({ params: this.$http.adornParams({
'id':id id: id
})
}).then(res => {
this.$message({
message: '成功',
type: 'success'
}) })
this.loading = false }).then(res => {
this.getDataList() this.$message({
}) message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
}, },
voicesHandle(id){ voicesHandle(id) {
//allVoices //allVoices
this.$http({ this.$http({
// url: this.$http.adornUrl('/book/bookchaptercontent/allVoices'), // url: this.$http.adornUrl('/book/bookchaptercontent/allVoices'),
url: this.$http.adornUrl('/book/bookchaptercontent/AllVOices'), url: this.$http.adornUrl("/book/bookchaptercontent/AllVOices"),
method: 'get', method: "get",
params: this.$http.adornParams({ params: this.$http.adornParams({
'id':id id: id
})
}).then(res => {
console.log('book/bookchaptercontent/AllVOices')
this.$message({
message: '成功',
type: 'success'
}) })
this.loading = false }).then(res => {
this.getDataList() console.log("book/bookchaptercontent/AllVOices");
}) this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
} }
} }
} };
</script> </script>
<style scoped lang="scss">
.hidden1 {
text-overflow: ellipsis;
// white-space: nowrap;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="mod-config"> <div class="mod-config" >
<el-form <el-form
:inline="true" :inline="true"
:model="dataForm" :model="dataForm"
@@ -12,6 +12,17 @@
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item>
<el-select v-model="dataForm.goodsType" placeholder="请选择商品类型" clearable >
<el-option
v-for="item in goodsTypeList"
:key="item.dictType"
:label="item.dictValue"
:value="item.dictType"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button
@click=" @click="
@@ -36,6 +47,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
height="70vh"
:data="dataList" :data="dataList"
border border
v-loading="dataListLoading" v-loading="dataListLoading"
@@ -183,7 +195,7 @@
<commonTags ref="commonTags"></commonTags> <commonTags ref="commonTags"></commonTags>
<correlation ref="correlation"></correlation> <correlation ref="correlation"></correlation>
<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>
@@ -200,8 +212,9 @@ export default {
data() { data() {
return { return {
dataForm: { dataForm: {
key: "" key: "",
}, goodsType: "",
}, goodsTypeList: [],
dataList: [], dataList: [],
publishStatus: false, publishStatus: false,
pageIndex: 1, pageIndex: 1,
@@ -224,8 +237,18 @@ export default {
}, },
activated() { activated() {
this.getDataList(); this.getDataList();
this.getGoodsTypeList();
}, },
methods: { methods: {
getGoodsTypeList() {
this.$http({
url: this.$http.adornUrl("/book/sysdictdata/selectByType/goodsType"),
method: "get"
}).then(({ data }) => {
// console.log(data.dataList)
this.goodsTypeList = data.dataList;
});
},
handleEditTags(id) { handleEditTags(id) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.commonTags.open(id); this.$refs.commonTags.open(id);
@@ -251,18 +274,26 @@ export default {
// 获取数据列表 // 获取数据列表
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/book/shopproduct/list"), this.$http
method: "get", .request({
params: this.$http.adornParams({ url: this.$http.adornUrl(`/master/shopProduct/listByPage`),
page: this.pageIndex, method: "POST",
data: {
current: this.pageIndex,
limit: this.pageSize, limit: this.pageSize,
key: this.dataForm.key productName: this.dataForm.key,
}) goodsType: this.dataForm.goodsType
}).then(({ data }) => { },
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.page.list; this.dataList = data.result.records;
this.totalPage = data.page.totalCount; this.totalPage = data.result.pages;
} else { } else {
this.dataList = []; this.dataList = [];
this.totalPage = 0; this.totalPage = 0;