|
|
|
@ -1,281 +1,353 @@ |
|
|
|
|
<template> |
|
|
|
|
<!-- 平台自建 --> |
|
|
|
|
<div style="padding-top: 24px"> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<ul class="filter" style="align-items: flex-start"> |
|
|
|
|
<li> |
|
|
|
|
<label>可见范围</label> |
|
|
|
|
<el-select v-model="form.visibleRange" clearable placeholder="请选择可见范围" @change="getData"> |
|
|
|
|
<el-option v-for="(item,index) in regions" :key="index" :label="item.name" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>课程分类:</label> |
|
|
|
|
<el-select v-model="form.categoryId" clearable placeholder="请选择课程分类" @change="getData"> |
|
|
|
|
<el-option label="不限" value=""></el-option> |
|
|
|
|
<el-option label="暂无分类" value="0"></el-option> |
|
|
|
|
<el-option v-for="(item,index) in classificationList" :key="index" :label="item.classificationName" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>课程类型:</label> |
|
|
|
|
<el-select v-model="form.courseType" clearable placeholder="请选择课程类型" @change="getData"> |
|
|
|
|
<el-option v-for="(item,index) in types" :key="index" :label="item.name" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>搜索:</label> |
|
|
|
|
<el-input placeholder="请输入理论课程名称/创建人" suffix-icon="el-icon-search" v-model="keyword" clearable size="small"></el-input> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div> |
|
|
|
|
<el-button v-auth="'平台自建:新增'" type="primary" round @click="addCourse">新增</el-button> |
|
|
|
|
<el-button v-auth="'平台自建:批量删除'" type="primary" round @click="delAllData">批量删除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<!-- 平台自建 --> |
|
|
|
|
<div style="padding-top: 24px"> |
|
|
|
|
<div class="tool"> |
|
|
|
|
<ul class="filter" |
|
|
|
|
style="align-items: flex-start"> |
|
|
|
|
<li> |
|
|
|
|
<label>可见范围</label> |
|
|
|
|
<el-select v-model="form.visibleRange" |
|
|
|
|
clearable |
|
|
|
|
placeholder="请选择可见范围" |
|
|
|
|
@change="getData"> |
|
|
|
|
<el-option v-for="(item,index) in regions" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>课程分类:</label> |
|
|
|
|
<el-select v-model="form.categoryId" |
|
|
|
|
clearable |
|
|
|
|
placeholder="请选择课程分类" |
|
|
|
|
@change="getData"> |
|
|
|
|
<el-option label="不限" |
|
|
|
|
value=""></el-option> |
|
|
|
|
<el-option label="暂无分类" |
|
|
|
|
value="0"></el-option> |
|
|
|
|
<el-option v-for="(item,index) in classificationList" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.classificationName" |
|
|
|
|
:value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>课程类型:</label> |
|
|
|
|
<el-select v-model="form.courseType" |
|
|
|
|
clearable |
|
|
|
|
placeholder="请选择课程类型" |
|
|
|
|
@change="getData"> |
|
|
|
|
<el-option v-for="(item,index) in types" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>搜索:</label> |
|
|
|
|
<el-input placeholder="请输入理论课程名称/创建人" |
|
|
|
|
suffix-icon="el-icon-search" |
|
|
|
|
v-model="keyword" |
|
|
|
|
clearable |
|
|
|
|
size="small"></el-input> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div> |
|
|
|
|
<el-button v-auth="'平台自建:新增'" |
|
|
|
|
type="primary" |
|
|
|
|
round |
|
|
|
|
@click="addCourse">新增</el-button> |
|
|
|
|
<el-button v-auth="'平台自建:批量删除'" |
|
|
|
|
type="primary" |
|
|
|
|
round |
|
|
|
|
@click="delAllData">批量删除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
|
|
|
|
<el-table-column type="selection" width="80" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.$index + (page - 1) * pageSize + 1 }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="courseName" label="课程名称" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="可见范围" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ regionName[scope.row.visibleRange] }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="createTime" label="创建时间" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="courseClassification" label="课程类型" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.row.courseType == 1 ? '付费' : '免费' }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="founder" label="创建人" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="courseClassification" label="课程分类" align="center" show-overflow-tooltip> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center" width="250"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button v-auth="'平台自建:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button> |
|
|
|
|
<el-divider v-auth="'平台自建:编辑信息'" direction="vertical"></el-divider> |
|
|
|
|
<el-button v-auth="'平台自建:内容设置'" type="text" @click="config(scope.row)">内容设置</el-button> |
|
|
|
|
<el-divider v-auth="'平台自建:内容设置'" direction="vertical"></el-divider> |
|
|
|
|
<el-button v-auth="'平台自建:预览'" type="text" @click="preview(scope.row)">预览</el-button> |
|
|
|
|
<el-divider v-auth="'平台自建:预览'" direction="vertical"></el-divider> |
|
|
|
|
<el-button v-auth="'平台自建:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="可授权状态" align="center" width="120"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-switch |
|
|
|
|
v-auth="'平台自建:禁用'" |
|
|
|
|
v-model="scope.row.ztOpen" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1" |
|
|
|
|
style="margin: 0 10px 0 5px" |
|
|
|
|
:active-text="scope.row.ztOpen ? '关' : '开'" |
|
|
|
|
@change="switchOff($event,scope.row,scope.$index)" |
|
|
|
|
></el-switch> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"> |
|
|
|
|
</el-pagination> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="list" |
|
|
|
|
class="table" |
|
|
|
|
ref="table" |
|
|
|
|
stripe |
|
|
|
|
header-align="center" |
|
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
|
row-key="id"> |
|
|
|
|
<el-table-column type="selection" |
|
|
|
|
width="80" |
|
|
|
|
align="center" |
|
|
|
|
:reserve-selection="true"></el-table-column> |
|
|
|
|
<el-table-column type="index" |
|
|
|
|
width="100" |
|
|
|
|
label="序号" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.$index + (page - 1) * pageSize + 1 }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="courseName" |
|
|
|
|
label="课程名称" |
|
|
|
|
align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="可见范围" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ regionName[scope.row.visibleRange] }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="createTime" |
|
|
|
|
label="创建时间" |
|
|
|
|
align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="courseClassification" |
|
|
|
|
label="课程类型" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.row.courseType == 1 ? '付费' : '免费' }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="founder" |
|
|
|
|
label="创建人" |
|
|
|
|
align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="courseClassification" |
|
|
|
|
label="课程分类" |
|
|
|
|
align="center" |
|
|
|
|
show-overflow-tooltip> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" |
|
|
|
|
align="center" |
|
|
|
|
width="250"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button v-auth="'平台自建:编辑信息'" |
|
|
|
|
type="text" |
|
|
|
|
@click="editCourse(scope.row)">编辑信息</el-button> |
|
|
|
|
<el-divider v-auth="'平台自建:编辑信息'" |
|
|
|
|
direction="vertical"></el-divider> |
|
|
|
|
<el-button v-auth="'平台自建:内容设置'" |
|
|
|
|
type="text" |
|
|
|
|
@click="config(scope.row)">内容设置</el-button> |
|
|
|
|
<el-divider v-auth="'平台自建:内容设置'" |
|
|
|
|
direction="vertical"></el-divider> |
|
|
|
|
<el-button v-auth="'平台自建:预览'" |
|
|
|
|
type="text" |
|
|
|
|
@click="preview(scope.row)">预览</el-button> |
|
|
|
|
<el-divider v-auth="'平台自建:预览'" |
|
|
|
|
direction="vertical"></el-divider> |
|
|
|
|
<el-button v-auth="'平台自建:删除'" |
|
|
|
|
type="text" |
|
|
|
|
@click="handleDelete(scope.row)">删除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="可授权状态" |
|
|
|
|
align="center" |
|
|
|
|
width="120"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-switch v-auth="'平台自建:禁用'" |
|
|
|
|
v-model="scope.row.ztOpen" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1" |
|
|
|
|
style="margin: 0 10px 0 5px" |
|
|
|
|
:active-text="scope.row.ztOpen ? '关' : '开'" |
|
|
|
|
@change="switchOff($event,scope.row,scope.$index)"></el-switch> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background |
|
|
|
|
layout="total, prev, pager, next" |
|
|
|
|
:total="total" |
|
|
|
|
@current-change="handleCurrentChange" |
|
|
|
|
:current-page="page"> |
|
|
|
|
</el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import util from "@/libs/util"; |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
timer: null, |
|
|
|
|
regionName: ['本校内', '全平台可见', '指定院校区域'], |
|
|
|
|
regions: [ |
|
|
|
|
{ |
|
|
|
|
id: '', |
|
|
|
|
name: '不限' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '全平台' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '指定院校区域' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
types: [ |
|
|
|
|
{ |
|
|
|
|
id: '', |
|
|
|
|
name: '不限' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '付费' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '免费' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
form: { |
|
|
|
|
visibleRange: '', |
|
|
|
|
categoryId: '', |
|
|
|
|
courseType: '' |
|
|
|
|
}, |
|
|
|
|
keyword: "", |
|
|
|
|
classificationId: "", |
|
|
|
|
list: [], |
|
|
|
|
multipleSelection: [], |
|
|
|
|
classificationList: [], |
|
|
|
|
page: +this.$route.query.page || 1, // 当前页码 |
|
|
|
|
pageSize: 10, |
|
|
|
|
total: 0 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword: function(val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData(); |
|
|
|
|
}, 500); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getClassification(); |
|
|
|
|
this.getData(); |
|
|
|
|
this.$once('hook:beforeDestroy', function() { |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//原理论课程需求: |
|
|
|
|
// 用户创建的理论课程,禁用时职站首页以及学生登录后的理论课程模块看不到对应的课程,创建的老师在理论课程管理还是可以看到该理论课程,可以编辑,但是无法启用。 |
|
|
|
|
// 即中台禁用的理论课程,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。 |
|
|
|
|
//1.判断当前院校禁启用状态为要启用时候再判断当前课程中台禁启用的状态 |
|
|
|
|
getList() { |
|
|
|
|
this.$post(this.api.listTheoreticalCourse, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
keyWord: this.keyword, |
|
|
|
|
createPlatform: 0, |
|
|
|
|
platformSource: Setting.platformSource, |
|
|
|
|
...this.form |
|
|
|
|
}).then(({ page }) => { |
|
|
|
|
this.list = page.records; |
|
|
|
|
this.total = page.total; |
|
|
|
|
if (!this.list.length && this.total) { |
|
|
|
|
this.page--; |
|
|
|
|
this.getData(); |
|
|
|
|
} |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 获取redis缓存 |
|
|
|
|
getRedis() { |
|
|
|
|
this.$post(this.api.getRedisCache).then(({ data }) => { |
|
|
|
|
data && this.getList() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
timer: null, |
|
|
|
|
regionName: ['本校内', '全平台可见', '指定院校区域'], |
|
|
|
|
regions: [ |
|
|
|
|
{ |
|
|
|
|
id: '', |
|
|
|
|
name: '不限' |
|
|
|
|
}, |
|
|
|
|
getData() { |
|
|
|
|
this.getList() |
|
|
|
|
if (!Setting.isDev) { |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
this.timer = setInterval(this.getRedis, 1000) |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '全平台' |
|
|
|
|
}, |
|
|
|
|
initData() { |
|
|
|
|
this.page = 1; |
|
|
|
|
this.getData(); |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '指定院校区域' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
types: [ |
|
|
|
|
{ |
|
|
|
|
id: '', |
|
|
|
|
name: '不限' |
|
|
|
|
}, |
|
|
|
|
getClassification() { |
|
|
|
|
this.$post(this.api.listClassification, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 1000, |
|
|
|
|
platformSource: Setting.platformSource |
|
|
|
|
}).then(({ page }) => { |
|
|
|
|
this.classificationList = page.records |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '付费' |
|
|
|
|
}, |
|
|
|
|
changeType(type) { |
|
|
|
|
this.classificationId = type; |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '免费' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
form: { |
|
|
|
|
visibleRange: '', |
|
|
|
|
categoryId: '', |
|
|
|
|
courseType: '' |
|
|
|
|
}, |
|
|
|
|
keyword: "", |
|
|
|
|
classificationId: "", |
|
|
|
|
list: [], |
|
|
|
|
multipleSelection: [], |
|
|
|
|
classificationList: [], |
|
|
|
|
page: +this.$route.query.page || 1, // 当前页码 |
|
|
|
|
pageSize: 10, |
|
|
|
|
total: 0 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
keyword: function (val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData(); |
|
|
|
|
}, 500); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
this.getClassification(); |
|
|
|
|
this.getData(); |
|
|
|
|
this.$once('hook:beforeDestroy', function () { |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//原理论课程需求: |
|
|
|
|
// 用户创建的理论课程,禁用时职站首页以及学生登录后的理论课程模块看不到对应的课程,创建的老师在理论课程管理还是可以看到该理论课程,可以编辑,但是无法启用。 |
|
|
|
|
// 即中台禁用的理论课程,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。 |
|
|
|
|
//1.判断当前院校禁启用状态为要启用时候再判断当前课程中台禁启用的状态 |
|
|
|
|
getList () { |
|
|
|
|
this.$post(this.api.listTheoreticalCourse, { |
|
|
|
|
pageNum: this.page, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
keyWord: this.keyword, |
|
|
|
|
createPlatform: 0, |
|
|
|
|
platformSource: Setting.platformSource, |
|
|
|
|
...this.form |
|
|
|
|
}).then(({ page }) => { |
|
|
|
|
this.list = page.records; |
|
|
|
|
this.total = page.total; |
|
|
|
|
if (!this.list.length && this.total) { |
|
|
|
|
this.page--; |
|
|
|
|
this.getData(); |
|
|
|
|
} |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 获取redis缓存 |
|
|
|
|
getRedis () { |
|
|
|
|
this.$post(this.api.getRedisCache).then(({ data }) => { |
|
|
|
|
data && this.getList() |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
getData () { |
|
|
|
|
this.getList() |
|
|
|
|
// if (!Setting.isDev) { |
|
|
|
|
// clearInterval(this.timer) |
|
|
|
|
// this.timer = setInterval(this.getRedis, 1000) |
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
initData () { |
|
|
|
|
this.page = 1; |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
getClassification () { |
|
|
|
|
this.$post(this.api.listClassification, { |
|
|
|
|
pageNum: 1, |
|
|
|
|
pageSize: 1000, |
|
|
|
|
platformSource: Setting.platformSource |
|
|
|
|
}).then(({ page }) => { |
|
|
|
|
this.classificationList = page.records |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
changeType (type) { |
|
|
|
|
this.classificationId = type; |
|
|
|
|
this.initData(); |
|
|
|
|
}, |
|
|
|
|
preview (row) { |
|
|
|
|
this.$router.push(`/previewTheoreticalCourse?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
config (row) { |
|
|
|
|
this.$router.push(`/setTheoreticalCourse?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
addCourse () { |
|
|
|
|
this.$router.push("/addTheoreticalCourse"); |
|
|
|
|
}, |
|
|
|
|
editCourse (row) { |
|
|
|
|
this.$router.push(`/addTheoreticalCourse?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
handleDelete (row) { |
|
|
|
|
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.$post(`${this.api.delTheoreticalCourse}?ids=${row.id}`).then(res => { |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.initData(); |
|
|
|
|
}, |
|
|
|
|
preview(row) { |
|
|
|
|
this.$router.push(`/previewTheoreticalCourse?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
config(row) { |
|
|
|
|
this.$router.push(`/setTheoreticalCourse?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
addCourse() { |
|
|
|
|
this.$router.push("/addTheoreticalCourse"); |
|
|
|
|
}, |
|
|
|
|
editCourse(row) { |
|
|
|
|
this.$router.push(`/addTheoreticalCourse?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
handleDelete(row) { |
|
|
|
|
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange (val) { |
|
|
|
|
this.multipleSelection = val; |
|
|
|
|
}, |
|
|
|
|
delAllData () { |
|
|
|
|
const list = this.multipleSelection |
|
|
|
|
if (list.length != "") { |
|
|
|
|
this.$confirm(`确定要删除吗?`, "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
const data = [] |
|
|
|
|
list.map(e => { |
|
|
|
|
data.push('ids=' + e.id) |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.$post(`${this.api.delTheoreticalCourse}?ids=${row.id}`).then(res => { |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.initData(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange(val) { |
|
|
|
|
this.multipleSelection = val; |
|
|
|
|
}, |
|
|
|
|
delAllData() { |
|
|
|
|
const list = this.multipleSelection |
|
|
|
|
if (list.length != "") { |
|
|
|
|
this.$confirm(`确定要删除吗?`, "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
const data = [] |
|
|
|
|
list.map(e => { |
|
|
|
|
data.push('ids=' + e.id) |
|
|
|
|
}) |
|
|
|
|
this.$post(`${this.api.delTheoreticalCourse}?${data.join('&')}`).then(res => { |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.initData(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
util.errorMsg("请先选择数据 !"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.page = val; |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
switchOff(val, row) { |
|
|
|
|
this.$post(this.api.disabledTheoreticalCourse, { |
|
|
|
|
courseId: row.id, |
|
|
|
|
isOpen: val, |
|
|
|
|
type: 0 // 禁用平台来源(0中台,1职站) |
|
|
|
|
}).then(res => { |
|
|
|
|
val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功') |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
} |
|
|
|
|
this.$post(`${this.api.delTheoreticalCourse}?${data.join('&')}`).then(res => { |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.initData(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
util.errorMsg("请先选择数据 !"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange (val) { |
|
|
|
|
this.page = val; |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
switchOff (val, row) { |
|
|
|
|
this.$post(this.api.disabledTheoreticalCourse, { |
|
|
|
|
courseId: row.id, |
|
|
|
|
isOpen: val, |
|
|
|
|
type: 0 // 禁用平台来源(0中台,1职站) |
|
|
|
|
}).then(res => { |
|
|
|
|
val == 1 ? util.warningMsg('禁用成功') : util.successMsg('启用成功') |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|