1.培训班管理上下架操作

2.用户列表的导出功能
3.太湖英才表单增加职称、科室、地区选项
This commit is contained in:
liuyuan
2025-06-13 10:07:38 +08:00
parent b198355f96
commit a434a0f192
4 changed files with 413 additions and 72 deletions

View File

@@ -116,6 +116,20 @@
</el-switch>
</template>
</el-table-column>
<el-table-column label="是否上架" align="center" width="200">
<template slot-scope="scope">
<el-switch
@change="changeDisplayFlag(scope.row)"
v-model="scope.row.displayFlag"
active-color="#13ce66"
inactive-color="#999"
:active-value="0"
:inactive-value="1"
active-text="上架"
inactive-text="下架">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sort" width="90"></el-table-column>
@@ -132,7 +146,7 @@
@click="editHandle(scope.row)"
>修改</el-button
>
<router-link :to="{ path: '/training-course-user', query: { id: scope.row.id } }">
<router-link :to="{ path: '/training-course-user', query: { id: scope.row.id, title: scope.row.title } }">
<el-button
type="text"
size="small"
@@ -231,6 +245,18 @@
>
</el-switch>
</el-form-item>
<el-form-item label="是否上架" prop="displayFlag">
<el-switch
v-model="addForm.displayFlag"
active-color="#13ce66"
inactive-color="#999"
:active-value="0"
:inactive-value="1"
inactive-text="下架"
active-text="上架"
>
</el-switch>
</el-form-item>
<el-form-item label="上传海报" prop="icon">
<el-upload
:limit="1"
@@ -283,6 +309,7 @@ export default {
year: '', //日期
trainingDate: '',
singupFlag: '', //1可报名 0不可报名
displayFlag: '', //0上架 1下架
},
addForm: {
id: "", //新增不传
@@ -300,6 +327,7 @@ export default {
threeHuFee: '',
fiveHuFee: '',
singupFlag: 1, //1可报名 0不可报名
displayFlag: 0, //0上架 1下架
sort: ''
},
editId: "",
@@ -397,7 +425,8 @@ export default {
title: this.dataForm.title,
type: this.dataForm.type,
year: this.dataForm.year,
singupFlag: this.dataForm.singupFlag
singupFlag: this.dataForm.singupFlag,
displayFlag: this.dataForm.displayFlag
}),
}).then(({ data }) => {
if (data && data.code === 0) {
@@ -409,7 +438,11 @@ export default {
},
//设置开关 修改数据
changeSingupFlag(data){
this.editCate(data);
this.editCate(data, '1');
},
//上下架开关
changeDisplayFlag(data){
this.editCate(data, '1');
},
//新增
@@ -417,7 +450,6 @@ export default {
this.addOrUpdateVisible = true;
this.statusType = 0; //新增
this.titlesub = '新增';
this.$refs["addFormRef"].resetFields();
this.addForm = {
title: "", //标题
type: 1, //1线上 2线下
@@ -433,18 +465,22 @@ export default {
threeHuFee: '',
fiveHuFee: '',
singupFlag: 1, //1可报名 0不可报名
displayFlag: 0,
sort: ''
}
this.fileList = [];
this.vipType = [];
this.svipType = [];
this.$nextTick(() => {
this.$refs.addFormRef.clearValidate();
});
},
//点击确定
addOrEditCate(){
if(this.statusType==0){ //如果是新增
this.addCate();
}else if(this.statusType==1){ //如果是修改
this.editCate(this.addForm);
this.editCate(this.addForm, '0');
}
},
//取消
@@ -452,47 +488,56 @@ export default {
this.addOrUpdateVisible = false;
},
//修改
editCate(data){
this.$refs["addFormRef"].validate(valid => {
if (valid) {
var icon = '';
if(this.fileList&&this.fileList.length>0){
icon = this.fileList[0].url
editCate(data, type){
if(type=='0'){
this.$refs["addFormRef"].validate(valid => {
if (valid) {
this.submitData(data);
}
this.$http({
url: this.$http.adornUrl("/master/trainingClass/editTrainingClass"),
method: "post",
data: this.$http.adornData({
id: data.id,
title: data.title,
type: data.type,
year: data.year,
trainingDate: data.trainingDate,
endDate: data.endDate,
singupFlag: data.singupFlag,
icon: icon,
fee: data.fee,
vipType: String(this.vipType),
vipFee: data.vipFee,
svipType: String(this.svipType),
svipFee: data.svipFee,
threeHuFee: data.threeHuFee,
fiveHuFee: data.fiveHuFee,
sort: data.sort
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success"
});
this.addOrUpdateVisible = false;
this.getDataList();
}
})
}else{
this.submitData(data);
}
},
//修改
submitData(data){
var icon = '';
if(this.fileList&&this.fileList.length>0){
icon = this.fileList[0].url
}
this.$http({
url: this.$http.adornUrl("/master/trainingClass/editTrainingClass"),
method: "post",
data: this.$http.adornData({
id: data.id,
title: data.title,
type: data.type,
year: data.year,
trainingDate: data.trainingDate,
endDate: data.endDate,
singupFlag: data.singupFlag,
displayFlag: data.displayFlag,
icon: icon,
fee: data.fee,
vipType: String(this.vipType),
vipFee: data.vipFee,
svipType: String(this.svipType),
svipFee: data.svipFee,
threeHuFee: data.threeHuFee,
fiveHuFee: data.fiveHuFee,
sort: data.sort
}),
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success"
});
this.addOrUpdateVisible = false;
this.getDataList();
}
})
});
},
// 每页数
sizeChangeHandle(val) {
@@ -523,6 +568,7 @@ export default {
trainingDate: this.addForm.trainingDate,
endDate: this.addForm.endDate,
singupFlag: String(this.addForm.singupFlag),
displayFlag: String(this.addForm.displayFlag),
icon: icon,
fee: this.addForm.fee,
vipType: String(this.vipType),
@@ -563,6 +609,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.icon = data.icon;
//图片赋值
if(data.icon){
@@ -578,6 +625,9 @@ export default {
this.addForm.threeHuFee = data.threeHuFee;
this.addForm.fiveHuFee = data.fiveHuFee;
this.addForm.sort = data.sort;
this.$nextTick(() => {
this.$refs.addFormRef.clearValidate();
});
},
//上传图片
handlePreview(file) {

View File

@@ -4,6 +4,7 @@
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
style="position: relative;"
>
<el-form-item label="手机号">
<el-input
@@ -27,6 +28,12 @@
>报名</el-button
>
</el-form-item>
<el-form-item style="position: absolute; right: 0; top: 0; margin-right: 0;">
<el-button
type="primary"
@click="handleExport()">
导出</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
@@ -61,7 +68,7 @@
<el-table-column label="支付方式" align="center">
<template slot-scope="scope">{{ scope.row.payMethod }}{{ scope.row.realMoney }}</template>
</el-table-column>
<el-table-column label="抵扣方式" align="center">
<el-table-column label="积分抵扣" align="center">
<template slot-scope="scope">积分{{ scope.row.jfDeduction }}</template>
</el-table-column>
<el-table-column
@@ -130,6 +137,7 @@ export default {
data() {
return {
trainingId: null,
trainingTitle: '',
dataForm: {
tel: ''
},
@@ -171,6 +179,7 @@ export default {
},
activated(){
this.trainingId = this.$route.query.id;
this.trainingTitle = this.$route.query.title;
this.getDataList();
},
methods: {
@@ -343,6 +352,44 @@ export default {
})
.catch(() => {});
},
//导出
handleExport() {
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
}),
responseType: "blob"
}).then(res => {
const blob = new Blob([res.data], {
type:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
});
const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = '['+ this.trainingTitle +']-用户数据文件';
link.click();
window.URL.revokeObjectURL(link.href); // 释放内存
this.$message({
message: "培训班用户数据文件下载完成,请注意查看!",
type: "success",
duration: 3000,
showClose: true
});
});
} catch (err) {
this.$message.error("文件下载失败!");
}
},
},
};
</script>