小班、自考证书合并列表导出功能,培训班管理可在3个app中选择显示模块

This commit is contained in:
liuyuan
2025-06-27 15:05:41 +08:00
parent 2c89e36035
commit 4f52d8377d
6 changed files with 395 additions and 119 deletions

View File

@@ -27,6 +27,13 @@
<el-option label="线下" value="2">线下</el-option>
</el-select>
</el-form-item>
<el-form-item label="App名称">
<el-select v-model="dataForm.displayApp" placeholder="请选择">
<el-option label="众妙之门" value="1">众妙之门</el-option>
<el-option label="吴门医述" value="2">吴门医述</el-option>
<el-option label="心灵空间" value="3">心灵空间</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
@click="
@@ -74,11 +81,6 @@
<el-table-column label="标题" align="center" width="160">
<template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column>
<el-table-column label="海报" align="center" width="90">
<template slot-scope="scope">
<img width="50px" :src="scope.row.icon" v-if="scope.row.icon" alt="" />
</template>
</el-table-column>
<el-table-column label="年份" align="center" prop="year" width="90"></el-table-column>
<el-table-column label="原价" align="center" width="80">
<template slot-scope="scope">{{ scope.row.fee }}</template>
@@ -95,6 +97,11 @@
五星湖粉 {{ scope.row.fiveHuFee }}
</template>
</el-table-column>
<el-table-column label="App名称" align="center" width="90">
<template slot-scope="scope">
{{ getAppNames(scope.row.displayApp) }}
</template>
</el-table-column>
<el-table-column label="活动类型" align="center" prop="type" width="90">
<template slot-scope="scope">
<span v-if="scope.row.type==1">线上</span>
@@ -116,7 +123,7 @@
</el-switch>
</template>
</el-table-column>
<el-table-column label="是否上架" align="center" width="200">
<!-- <el-table-column label="是否上架" align="center" width="200">
<template slot-scope="scope">
<el-switch
@change="changeDisplayFlag(scope.row)"
@@ -129,7 +136,7 @@
inactive-text="下架">
</el-switch>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="排序" align="center" prop="sort" width="90"></el-table-column>
@@ -227,6 +234,11 @@
</div>
</el-form-item>
<el-form-item label="选择App">
<el-checkbox-group v-model="appType" @change="handleCheckedApp" class="checkbox-group">
<el-checkbox v-for="item in appList" :label="item.type" :key="item.type">{{item.title}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="活动类型" prop="type">
<el-radio-group v-model="addForm.type">
<el-radio :label="1">线上</el-radio>
@@ -245,7 +257,7 @@
>
</el-switch>
</el-form-item>
<el-form-item label="是否上架" prop="displayFlag">
<!-- <el-form-item label="是否上架" prop="displayFlag">
<el-switch
v-model="addForm.displayFlag"
active-color="#13ce66"
@@ -256,7 +268,7 @@
active-text="上架"
>
</el-switch>
</el-form-item>
</el-form-item> -->
<el-form-item label="上传海报" prop="icon">
<el-upload
:limit="1"
@@ -310,6 +322,7 @@ export default {
trainingDate: '',
singupFlag: '', //1可报名 0不可报名
displayFlag: '', //0上架 1下架
displayApp: ''
},
addForm: {
id: "", //新增不传
@@ -328,6 +341,7 @@ export default {
fiveHuFee: '',
singupFlag: 1, //1可报名 0不可报名
displayFlag: 0, //0上架 1下架
displayApp: '',
sort: ''
},
editId: "",
@@ -367,14 +381,30 @@ export default {
//保存数据
vipList: [],
svipList: [],
appList: [
{
type: '1',
title: '众妙之门'
},
{
type: '2',
title: '吴门医述'
},
{
type: '3',
title: '心灵空间'
}
],
//勾选值
vipType: [],
svipType: [],
appType: [],
//日期排序
sortParams: {
date1: '',
date2: ''
}
},
//疯子读书-0 众妙之门-1 吴门医述-2 心灵空间-3 太湖云医-4
};
},
activated(){
@@ -382,6 +412,18 @@ export default {
this.getVipData();
},
methods: {
//app名称展示的逻辑
getAppNames(displayApp) {
if (!displayApp) return ''
return displayApp.split(',')
.map(code => code.trim())
.filter(code => code !== '')
.map(code => {
const app = this.appList.find(item => item.type === code);
return app ? app.title : '';
})
.join(' ');
},
//排序变化事件
handleSortChange({ column, prop, order }) {
// 更新当前列的排序状态
@@ -426,7 +468,8 @@ export default {
type: this.dataForm.type,
year: this.dataForm.year,
singupFlag: this.dataForm.singupFlag,
displayFlag: this.dataForm.displayFlag
//displayFlag: this.dataForm.displayFlag,
displayApp: this.dataForm.displayApp
}),
}).then(({ data }) => {
if (data && data.code === 0) {
@@ -461,6 +504,7 @@ export default {
vipType: '',
vipFee: '',
svipType: '',
appType: '',
svipFee: '',
threeHuFee: '',
fiveHuFee: '',
@@ -471,6 +515,7 @@ export default {
this.fileList = [];
this.vipType = [];
this.svipType = [];
this.appType = [];
this.$nextTick(() => {
this.$refs.addFormRef.clearValidate();
});
@@ -502,9 +547,24 @@ export default {
//修改
submitData(data){
var icon = '';
var vipType = '';
var svipType = '';
var appType = '';
if(this.fileList&&this.fileList.length>0){
icon = this.fileList[0].url
}
console.log('vipType-submit', this.vipType)
console.log('svipType-submit', this.svipType)
console.log('appType-submit', this.appType)
if(this.vipType&&this.vipType.length>0){
vipType = String(this.vipType);
}
if(this.svipType&&this.svipType.length>0){
svipType = String(this.svipType);
}
if(this.appType&&this.appType.length>0){
appType = String(this.appType);
}
this.$http({
url: this.$http.adornUrl("/master/trainingClass/editTrainingClass"),
method: "post",
@@ -516,12 +576,13 @@ export default {
trainingDate: data.trainingDate,
endDate: data.endDate,
singupFlag: data.singupFlag,
displayFlag: data.displayFlag,
//displayFlag: data.displayFlag,
icon: icon,
fee: data.fee,
vipType: String(this.vipType),
vipType: vipType,
vipFee: data.vipFee,
svipType: String(this.svipType),
svipType: svipType,
displayApp: appType,
svipFee: data.svipFee,
threeHuFee: data.threeHuFee,
fiveHuFee: data.fiveHuFee,
@@ -555,9 +616,21 @@ export default {
this.$refs["addFormRef"].validate(valid => {
if (valid) {
var icon = '';
var vipType = '';
var svipType = '';
var appType = '';
if(this.fileList&&this.fileList.length>0){
icon = this.fileList[0].url
}
if(this.vipType&&this.vipType.length>0){
vipType = String(this.vipType);
}
if(this.svipType&&this.svipType.length>0){
svipType = String(this.svipType);
}
if(this.appType&&this.appType.length>0){
appType = String(this.appType);
}
this.$http({
url: this.$http.adornUrl("/master/trainingClass/addTrainingClass"),
method: "post",
@@ -568,12 +641,13 @@ export default {
trainingDate: this.addForm.trainingDate,
endDate: this.addForm.endDate,
singupFlag: String(this.addForm.singupFlag),
displayFlag: String(this.addForm.displayFlag),
//displayFlag: String(this.addForm.displayFlag),
icon: icon,
fee: this.addForm.fee,
vipType: String(this.vipType),
vipType: vipType,
vipFee: this.addForm.vipFee,
svipType: String(this.svipType),
svipType: svipType,
displayApp: appType,
svipFee: this.addForm.svipFee,
threeHuFee: this.addForm.threeHuFee,
fiveHuFee: this.addForm.fiveHuFee,
@@ -609,7 +683,7 @@ export default {
this.addForm.trainingDate = data.trainingDate;
this.addForm.endDate = data.endDate;
this.addForm.singupFlag = Number(data.singupFlag);
this.addForm.displayFlag = Number(data.displayFlag);
//this.addForm.displayFlag = Number(data.displayFlag);
this.addForm.icon = data.icon;
//图片赋值
if(data.icon){
@@ -618,9 +692,23 @@ export default {
});
}
this.addForm.fee = data.fee;
this.vipType = data.vipType.split(',').map(item => parseInt(item, 10));
this.addForm.vipFee = data.vipFee;
this.svipType = data.svipType.split(',').map(item => parseInt(item, 10));
if(data.vipType){
this.vipType = data.vipType.split(',').map(item => parseInt(item, 10));
}else{
this.vipType = [];
}
if(data.svipType){
this.svipType = data.svipType.split(',').map(item => parseInt(item, 10));
}else{
this.svipType = [];
}
if(data.displayApp){
this.appType = data.displayApp.split(',').map(item => item.trim());
}else{
this.appType = [];
}
this.addForm.svipFee = data.svipFee;
this.addForm.threeHuFee = data.threeHuFee;
this.addForm.fiveHuFee = data.fiveHuFee;
@@ -675,6 +763,10 @@ export default {
handleCheckedSvip(value){
console.log('svip的值', value)
},
//勾选app
handleCheckedApp(value){
console.log('app的值', value)
}
},
};
</script>

View File

@@ -61,7 +61,12 @@
</el-table-column>
<el-table-column label="用户身份" align="center">
<template slot-scope="scope">
{{ scope.row.identity }}
{{ splitIdentity(scope.row.identity).type }}
</template>
</el-table-column>
<el-table-column label="费用" align="center">
<template slot-scope="scope">
{{ splitIdentity(scope.row.identity).price ? `¥${splitIdentity(scope.row.identity).price}` : '' }}
</template>
</el-table-column>
@@ -183,6 +188,13 @@ export default {
this.getDataList();
},
methods: {
splitIdentity(identity) {
const match = identity.match(/([^\d]+)()([\d.]+)/);
return {
type: match ? match[1].trim() : identity,
price: match ? match[3] : ''
};
},
//排序变化事件
handleSortChange({ column, prop, order }) {
this.sortParams.date = order
@@ -354,13 +366,12 @@ export default {
},
//导出
handleExport() {
this.dataListLoading = true;
try {
this.$http({
url: this.$http.adornUrl("/master/trainingClass/exportTrainingClassUser"),
method: "post",
data: this.$http.adornData({
current: this.pageIndex,
limit: this.pageSize,
trainingId: this.trainingId,
tel: this.dataForm.tel,
createTimeSort: this.sortParams.date
@@ -378,6 +389,7 @@ export default {
link.click();
window.URL.revokeObjectURL(link.href); // 释放内存
this.dataListLoading = false;
this.$message({
message: "培训班用户数据文件下载完成,请注意查看!",
type: "success",
@@ -388,6 +400,7 @@ export default {
});
} catch (err) {
this.$message.error("文件下载失败!");
this.dataListLoading = true;
}
},
},