You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

311 lines
13 KiB

4 years ago
<template>
<div>
<el-row :gutter="20">
<el-col :span="24">
<el-card shadow="hover" class="mgb20">
<div>
<div class="flex-center mgb20">
<p class="hr_tag"></p>
<span>筛选</span>
</div>
<div>
<el-form label-width="80px">
<el-col :span="5">
<el-form-item label="学科类别">
4 years ago
<el-select v-model="form.categoryId" clearable
@change="getProfessionalClass()" @clear="clearClass()">
<el-option v-for="(item,index) in subjectList" :key="index"
:label="item.disciplineName"
:value="item.disciplineId"></el-option>
4 years ago
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="专业类">
4 years ago
<el-select v-model="form.professionalCategoryId" clearable
:disabled="form.categoryId ? false : true"
@change="getProfessional()" @clear="clearProfess()">
<el-option v-for="(item,index) in ProfessionalClassList" :key="index"
:label="item.professionalClassName"
:value="item.professionalClassId"></el-option>
4 years ago
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="专业">
4 years ago
<el-select v-model="form.professionalId" clearable
:disabled="form.professionalCategoryId ? false : true"
@change="getData()">
<el-option v-for="(item,index) in ProfessionalList" :key="index"
:label="item.professionalName"
:value="item.professionalId"></el-option>
4 years ago
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
4 years ago
<el-form-item label="课程类别">
<el-select v-model="form.curriculumType" clearable
@change="getData()">
<el-option label="理论课程" :value="0"></el-option>
<el-option label="实训课程" :value="1"></el-option>
4 years ago
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item>
4 years ago
<el-input placeholder="请输入课程名称" prefix-icon="el-icon-search"
v-model="form.curriculumName" clearable
@keyup.enter.native="onSearch"></el-input>
4 years ago
</el-form-item>
</el-col>
</el-form>
</div>
4 years ago
</div>
4 years ago
</el-card>
</el-col>
<el-col :span="24">
<el-card shadow="hover" class="mgb20">
<div class="flex-between mgb20">
<div class="flex-center">
<p class="hr_tag"></p>
<span>课程列表</span>
</div>
<div>
4 years ago
<el-button type="primary" round class="mag" @click="addcourse">新建课程</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
4 years ago
</div>
</div>
4 years ago
<el-table v-loading="loading" :data="courseData" class="table" stripe header-align="center"
@selection-change="handleSelectionChange" :row-key="getRowKeys">
<el-table-column type="selection" width="55" align="center"
:reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="curriculumName" label="课程名称" align="center"></el-table-column>
<el-table-column prop="curriculumType" label="课程类型" align="center">
<template slot-scope="scope">
<span class="ellipsis">{{ courseTypeStatus[scope.row.curriculumType] }}</span>
</template>
4 years ago
</el-table-column>
<el-table-column label="配置的实训应用" align="center">
<template slot-scope="scope">
4 years ago
<span class="ellipsis">{{ scope.row.sysName }}</span>
4 years ago
</template>
</el-table-column>
4 years ago
<el-table-column prop="orderVolume" label="订单量" align="center"></el-table-column>
<el-table-column prop="expectedCourse" label="预计课时" align="center"></el-table-column>
4 years ago
<el-table-column label="上架/下架" align="center">
<template slot-scope="scope">
<el-switch
4 years ago
v-model="scope.row.isEnable"
4 years ago
:active-value="0"
:inactive-value="1"
4 years ago
@change="changeSwitch($event, scope.row)">
4 years ago
</el-switch>
4 years ago
</template>
4 years ago
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
4 years ago
<el-button type="text" @click="config(scope.row)">内容设置</el-button>
4 years ago
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
4 years ago
<el-pagination background @current-change="handleCurrentChange" :current-page="pageNo"
layout="total, prev, pager, next" :total="totals"></el-pagination>
4 years ago
</div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
export default {
4 years ago
name: "customer",
4 years ago
data() {
return {
4 years ago
courseTypeStatus: {
0: "理论课程",
1: "实训课程"
},
name: localStorage.getItem("ms_username"),
courseData: [],
4 years ago
form: {
4 years ago
categoryId: "",
professionalCategoryId: "",
professionalId: "",
curriculumType: "",
curriculumName: ""
4 years ago
},
pageNo: 1,
pageSize: 10,
totals: 1,
4 years ago
subjectList: [], // 学科类别
ProfessionalClassList: [], // 专业类
ProfessionalList: [], // 专业
4 years ago
multipleSelection: [],
loading: false,
searchTimer: null
4 years ago
};
},
watch: {
"form.curriculumName": function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
},
4 years ago
mounted() {
4 years ago
this.getSubject();
this.getData();
4 years ago
},
methods: {
4 years ago
getRowKeys(row) {
return row.cid;
},
// 获取列表数据
4 years ago
getData() {
let data = {
4 years ago
...this.form,
pageNum: this.pageNo,
pageSize: this.pageSize
};
this.$post(this.api.curriculumList, data).then(res => {
this.courseData = res.page.records;
this.totals = res.page.total;
this.loading = false;
}).catch(err => {
});
4 years ago
},
initData() {
this.pageNo = 1;
this.getData();
},
4 years ago
// 获取学科类别
4 years ago
getSubject() {
this.$get(this.api.courseDiscipline).then(res => {
this.subjectList = res.list;
}).catch(err => {
});
4 years ago
},
// 清除学科类别
4 years ago
clearClass() {
this.form.professionalCategoryId = "",
this.form.professionalId = "";
4 years ago
},
// 获取专业类
4 years ago
getProfessionalClass() {
this.clearClass();
this.getProfessionalClassData();
this.pageNo = 1;
this.getData();
4 years ago
},
4 years ago
getProfessionalClassData() {
4 years ago
let data = {
4 years ago
disciplineId: this.form.categoryId
};
this.$get(this.api.courseProfessionalClass, data).then(res => {
this.ProfessionalClassList = res.list;
}).catch(err => {
});
4 years ago
},
// 清除专业类
4 years ago
clearProfess() {
this.form.professionalId = "";
4 years ago
},
// 获取专业
4 years ago
getProfessional() {
this.clearProfess();
this.getProfessionalData();
this.pageNo = 1;
this.getData();
4 years ago
},
4 years ago
getProfessionalData() {
4 years ago
let data = {
4 years ago
professionalClassId: this.form.professionalCategoryId
};
this.$get(this.api.courseProfessional, data).then(res => {
this.ProfessionalList = res.list;
}).catch(err => {
});
4 years ago
},
4 years ago
// 新建课程
addcourse() {
this.$router.push("/addcurriculum");
4 years ago
},
4 years ago
// 编辑
edit(row) {
this.$router.push(`/addcurriculum?cid=${row.cid}`);
4 years ago
},
4 years ago
// 内容设置
config(row) {
this.$router.push(`/contentSettings?cid=${row.cid}`);
},
// 删除
4 years ago
handleDelete(row) {
4 years ago
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => {
this.getData();
this.$message.success("删除成功");
}).catch(err => {
});
}).catch(() => {
});
4 years ago
},
4 years ago
// 处理多选
4 years ago
handleSelectionChange(val) {
this.multipleSelection = val;
},
// 批量删除
delAllSelection() {
4 years ago
if (this.multipleSelection.length) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(i => i.cid);
this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => {
this.getData();
this.$message.success("删除成功");
}).catch(err => {
});
}).catch(() => {
});
4 years ago
} else {
this.$message.warning("请先选择课程 !");
4 years ago
}
},
4 years ago
// 处理页码切换
4 years ago
handleCurrentChange(val) {
this.pageNo = val;
this.getData();
},
4 years ago
// 课程名称条件搜索
onSearch() {
this.pageNo = 1;
this.getData();
4 years ago
},
// 上下架
4 years ago
changeSwitch(value, row) {
this.$post(`${this.api.isShelves}?cid=${row.cid}&isEnable=${value}`).then((res) => {
this.getData();
this.$message.success("修改上下架状态成功!");
}).catch((res) => {
});
4 years ago
}
4 years ago
}
};
</script>
<style scoped>
4 years ago
.mag {
4 years ago
margin-right: 20px;
}
</style>