Commit f806f19f authored by zhuangXW's avatar zhuangXW

修改个人开课,企业开课

parent d8957ae6
...@@ -112,7 +112,7 @@ export function importExcel(data) { ...@@ -112,7 +112,7 @@ export function importExcel(data) {
// 根据查询参数分页查询可开课的课程 // 根据查询参数分页查询可开课的课程
export function queryBLessonWithTrial(query) { export function queryBLessonWithTrial(query) {
return request({ return request({
url: '/blesson/queryBLessonWithTrial', url: '/teatrialcourse/queryNoSchoolBegins',
method: 'get', method: 'get',
params: query params: query
}) })
......
...@@ -289,7 +289,8 @@ ...@@ -289,7 +289,8 @@
prop="applicantUnit" prop="applicantUnit"
> >
<el-select <el-select
v-model="queryLessonParams.applicantUnit" v-model="form.applicantUnit"
placeholder="请选择开课单位"
filterable filterable
style="width: 400px" style="width: 400px"
> >
...@@ -308,7 +309,8 @@ ...@@ -308,7 +309,8 @@
prop="lessonType" prop="lessonType"
> >
<el-select <el-select
v-model="queryLessonParams.lessonType" v-model="form.lessonType"
placeholder="请选择课程类型"
filterable filterable
style="width: 400px" style="width: 400px"
@change="handleLessonTypeChange" @change="handleLessonTypeChange"
...@@ -331,8 +333,9 @@ ...@@ -331,8 +333,9 @@
prop="classPlan" prop="classPlan"
> >
<el-select <el-select
v-model="queryLessonParams.classPlan" v-model="form.classPlan"
filterable filterable
placeholder="请选择课程方案"
style="width: 400px" style="width: 400px"
> >
<el-option <el-option
...@@ -346,7 +349,7 @@ ...@@ -346,7 +349,7 @@
</div> </div>
<div> <div>
<el-form-item label="难度等级" prop="difficultyClassify"> <el-form-item label="难度等级" prop="difficultyClassify">
<el-select v-model="queryLessonParams.difficultyClassify" placeholder="难度等级" clearable style="width: 400px"> <el-select v-model="form.difficultyClassify" placeholder="请选择难度等级" clearable style="width: 400px">
<el-option <el-option
v-for="item in difficultyOptions" v-for="item in difficultyOptions"
:key="item.dictValue" :key="item.dictValue"
...@@ -364,17 +367,18 @@ ...@@ -364,17 +367,18 @@
<div> <div>
<el-form-item <el-form-item
label="开始时间" label="开始时间"
prop="createTime" prop="beginDate"
> >
<span> <span>
<el-date-picker <el-date-picker
v-model="addLessonForm.beginDate" v-model="form.beginDate"
style="width: 400px" style="width: 400px"
type="date" type="date"
placeholder="-" placeholder="请选择开始时间"
:editable="false" :editable="false"
format="yyyy-MM-dd" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:picker-options="pickerOptionsBegin"
/> />
</span> </span>
</el-form-item> </el-form-item>
...@@ -382,17 +386,18 @@ ...@@ -382,17 +386,18 @@
<div> <div>
<el-form-item <el-form-item
label="结束时间" label="结束时间"
prop="endTime" prop="endDate"
> >
<span> <span>
<el-date-picker <el-date-picker
v-model="addLessonForm.endDate" v-model="form.endDate"
style="width: 400px" style="width: 400px"
type="date" type="date"
placeholder="-" placeholder="请选择结束时间"
:editable="false" :editable="false"
format="yyyy-MM-dd" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
/> />
</span> </span>
</el-form-item> </el-form-item>
...@@ -406,8 +411,9 @@ ...@@ -406,8 +411,9 @@
prop="isPay" prop="isPay"
> >
<el-select <el-select
v-model="addLessonForm.isPay" v-model="form.isPay"
filterable filterable
placeholder="请选择开课类型"
style="width: 400px" style="width: 400px"
> >
<el-option <el-option
...@@ -430,9 +436,9 @@ ...@@ -430,9 +436,9 @@
prop="remarks" prop="remarks"
> >
<el-input <el-input
v-model="addLessonForm.remarks" v-model="form.remarks"
style="width: 1100px" style="width: 1100px"
placeholder="备注" placeholder="请输入备注"
clearable clearable
:maxlength="30" :maxlength="30"
size="small" size="small"
...@@ -450,6 +456,7 @@ ...@@ -450,6 +456,7 @@
<el-table ref="multipleTable" class="DBXXClass" border :data="lessonList" :row-key="getRoKey" @selection-change="handleSelectionChange"> <el-table ref="multipleTable" class="DBXXClass" border :data="lessonList" :row-key="getRoKey" @selection-change="handleSelectionChange">
<el-table-column <el-table-column
type="selection" type="selection"
:reserve-selection="true"
/> />
<el-table-column <el-table-column
...@@ -457,7 +464,6 @@ ...@@ -457,7 +464,6 @@
type="index" type="index"
width="70" width="70"
align="center" align="center"
:reserve-selection="true"
/> />
<el-table-column label="课程名称" prop="lessonName" show-overflow-tooltip> <el-table-column label="课程名称" prop="lessonName" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -466,43 +472,45 @@ ...@@ -466,43 +472,45 @@
</el-table-column> </el-table-column>
<el-table-column label="开课单位" prop="applicantUnit" show-overflow-tooltip> <el-table-column label="开课单位" prop="applicantUnit" show-overflow-tooltip>
{{ getUnitName(queryLessonParams.applicantUnit) }} {{ getUnitName(form.applicantUnit) }}
</el-table-column> </el-table-column>
<el-table-column label="课程类型" prop="lessonType" show-overflow-tooltip> <el-table-column label="课程类型" prop="lessonType" show-overflow-tooltip>
{{ queryLessonParams.lessonType === '0' ? '企业课程' : '院校课程' }} {{ form.lessonType === '0' ? '企业课程' : '院校课程' }}
</el-table-column> </el-table-column>
<el-table-column label="课程方案" prop="class" show-overflow-tooltip> <el-table-column label="课程方案" prop="classPlan" show-overflow-tooltip>
{{ getClassPlanName(queryLessonParams.classPlan) }} {{ getClassPlanName(form.classPlan) }}
</el-table-column> </el-table-column>
<el-table-column label="难度等级" prop="class" show-overflow-tooltip> <el-table-column label="难度等级" prop="difficultyClassify" show-overflow-tooltip>
{{ getDifficultyLevelName(queryLessonParams.difficultyClassify) }} <template slot-scope="scope">
{{ getDifficultyLevelName(scope.row.difficultyClassify) }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="开始日期" prop="createTime" show-overflow-tooltip> <el-table-column label="开始日期" prop="beginDate" show-overflow-tooltip>
<template> <template>
{{ addLessonForm.beginDate }} {{ form.beginDate }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="结束日期" prop="endTime" show-overflow-tooltip> <el-table-column label="结束日期" prop="endDate" show-overflow-tooltip>
<template> <template>
{{ addLessonForm.endDate }} {{ form.endDate }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="开课类型" prop="isPay" :show-overflow-tooltip="true"> <el-table-column label="开课类型" prop="isPay" :show-overflow-tooltip="true">
{{ addLessonForm.isPay === 0 ? '试用' : '付费' }} {{ form.isPay === 0 ? '试用' : '付费' }}
</el-table-column> </el-table-column>
<el-table-column label="备注" prop="remarks" show-overflow-tooltip> <el-table-column label="备注" prop="remarks" show-overflow-tooltip>
<template> <template>
{{ addLessonForm.remarks }} {{ form.remarks }}
</template> </template>
</el-table-column> </el-table-column>
...@@ -512,7 +520,7 @@ ...@@ -512,7 +520,7 @@
:total="total1" :total="total1"
:page.sync="queryLessonParams.page" :page.sync="queryLessonParams.page"
:limit.sync="queryLessonParams.rows" :limit.sync="queryLessonParams.rows"
@pagination="handleLessonQuery" @pagination="handleLessonQueryPage"
/> />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="handleClose">取 消</el-button> <el-button class="cancelBtn" @click="handleClose">取 消</el-button>
...@@ -892,6 +900,20 @@ export default { ...@@ -892,6 +900,20 @@ export default {
dicts: ['tec_classify', 'job_classify'], dicts: ['tec_classify', 'job_classify'],
data() { data() {
return { return {
pickerOptions: {
disabledDate: (time) => {
if (this.form.beginDate) {
return time.getTime() <= new Date(this.form.beginDate).getTime()
}
}
},
pickerOptionsBegin: {
disabledDate: (time) => {
if (this.form.endDate) {
return time.getTime() >= new Date(this.form.endDate).getTime()
}
}
},
total1: 0, total1: 0,
lessonList: [], lessonList: [],
difficultyOptions: [], difficultyOptions: [],
...@@ -1061,7 +1083,26 @@ export default { ...@@ -1061,7 +1083,26 @@ export default {
}, },
deptOptions: [], deptOptions: [],
rules: {} rules: {
applicantUnit: [
{ required: true, message: '请选择开课单位' }
],
lessonType: [
{ required: true, message: '请选择课程类型' }
],
classPlan: [
{ required: true, message: '请选择课程方案' }
],
beginDate: [
{ required: true, message: '请选择开始时间', trigger: 'change' }
],
endDate: [
{ required: true, message: '请选择结束时间', trigger: 'change' }
],
isPay: [
{ required: true, message: '请选择开课类型' }
]
}
} }
}, },
computed: { computed: {
...@@ -1110,7 +1151,7 @@ export default { ...@@ -1110,7 +1151,7 @@ export default {
console.log(this.multipleSelection) console.log(this.multipleSelection)
}, },
getRoKey(row) { getRoKey(row) {
return row.id return row.businessId
}, },
// 获取课程类型 // 获取课程类型
getLessonType() { getLessonType() {
...@@ -1211,35 +1252,42 @@ export default { ...@@ -1211,35 +1252,42 @@ export default {
/** 查找可以开课的课程*/ /** 查找可以开课的课程*/
handleLessonQuery() { handleLessonQuery() {
const query = { this.$refs.lessonRef.validate(valid => {
page: 1, if (valid) {
rows: 10, const query = {
applicantUnit: this.queryLessonParams.applicantUnit, page: 1,
classPlan: this.queryLessonParams.classPlan, rows: 10,
lessonType: this.queryLessonParams.lessonType, applicantUnit: this.form.applicantUnit,
applicantType: '2', classPlan: this.form.classPlan,
difficultyClassify: this.queryLessonParams.difficultyClassify lessonType: this.form.lessonType,
} applicantType: '2',
difficultyClassify: this.form.difficultyClassify
queryBLessonWithTrial(query).then(res => { }
this.lessonList = res.rows queryBLessonWithTrial(query).then(res => {
this.total1 = res.total this.lessonList = res.records
this.total1 = res.total
console.log(res) })
}
console.log(this.lessonList) })
},
handleLessonQueryPage() {
this.$refs.lessonRef.validate(valid => {
if (valid) {
const query = {
page: this.queryLessonParams.page,
rows: this.queryLessonParams.rows,
applicantUnit: this.form.applicantUnit,
classPlan: this.form.classPlan,
lessonType: this.form.lessonType,
applicantType: '2',
difficultyClassify: this.form.difficultyClassify
}
queryBLessonWithTrial(query).then(res => {
this.lessonList = res.records
this.total1 = res.total
})
}
}) })
// if (res.code == 200) {
// this.lessonList = res.rows
// this.total1 = res.total
// console.log("res1111")
// } else {
// console.log("res2222211")
// }
//
// })
// console.log("res",this.setList)
}, },
/** 3.当用户选中单位时将单位选择框禁用**/ /** 3.当用户选中单位时将单位选择框禁用**/
handleUnitChange(value) { handleUnitChange(value) {
...@@ -1277,28 +1325,25 @@ export default { ...@@ -1277,28 +1325,25 @@ export default {
}, },
handleLessonClear() { handleLessonClear() {
this.resetQueryLesson() this.form = {
this.resetAddLessonForm()
},
resetAddLessonForm() {
this.addLessonForm = {
unitId: '', unitId: '',
unitName: '', unitName: '',
applicant: '',
lessonId: '', lessonId: '',
lessonName: '', lessonName: '',
beginDate: null, beginDate: null,
endDate: null endDate: null,
isPay: '',
jobClassification: '',
technicalClassification: '',
remarks: ''
} }
this.lessonList = [] this.resetQueryLesson()
this.total1 = 0
}, },
resetQueryLesson() { resetQueryLesson() {
this.queryLessonParams = { this.$refs.lessonRef.resetFields()
coursePlan: '', this.total1 = 0
lessonType: '' this.lessonList = []
}
this.form.settingList = []
}, },
/** 5.关闭时请表单想和列表数据清空**/ /** 5.关闭时请表单想和列表数据清空**/
handleClose() { handleClose() {
...@@ -1312,15 +1357,10 @@ export default { ...@@ -1312,15 +1357,10 @@ export default {
}, },
/** 6.重置方法**/ /** 6.重置方法**/
resetAddFrom() { resetAddFrom() {
this.addForm = { this.$refs.lessonRef.resetFields()
unitId: '', this.total1 = 0
unitName: '', this.lessonList = []
lessonId: '', this.multipleSelection = []
lessonName: '',
beginDate: null,
endDate: null
}
this.form.settingList = []
}, },
/** 7.当课程有值是将课程label查询*/ /** 7.当课程有值是将课程label查询*/
handleLessonChange(value) { handleLessonChange(value) {
...@@ -1551,17 +1591,21 @@ export default { ...@@ -1551,17 +1591,21 @@ export default {
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
if (this.multipleSelection.length === 0) {
return this.$message.error('请选择课程')
}
console.log('提交') console.log('提交')
const form = this.multipleSelection const form = this.multipleSelection
form.forEach(item => { form.forEach(item => {
item.applicantUnit = this.queryLessonParams.applicantUnit item.applicantUnit = this.form.applicantUnit
item.lessonId = item.businessId item.lessonId = item.businessId
item.remarks = this.addLessonForm.remarks item.remarks = this.form.remarks
item.applicantType = 2 item.applicantType = 2
item.isPay = this.addLessonForm.isPay item.isPay = this.form.isPay
item.beginTrialTime = this.addLessonForm.beginDate item.beginTrialTime = this.form.beginDate
item.endTrialTime = this.addLessonForm.endDate item.endTrialTime = this.form.endDate
item.businessId = null item.businessId = null
item.tecClassify = null
item.flag = '0' item.flag = '0'
item.jobClassification = item.jobClassify item.jobClassification = item.jobClassify
item.technicalClassification = item.tecClassify item.technicalClassification = item.tecClassify
...@@ -1570,7 +1614,7 @@ export default { ...@@ -1570,7 +1614,7 @@ export default {
const addForm = { const addForm = {
settingList: form, settingList: form,
applicantUnit: this.addLessonForm.applicantUnit, applicantUnit: this.form.applicantUnit,
applicantType: 2 applicantType: 2
} }
batchAddTeaTrialCourse(addForm).then(res => { batchAddTeaTrialCourse(addForm).then(res => {
...@@ -1580,6 +1624,8 @@ export default { ...@@ -1580,6 +1624,8 @@ export default {
this.open1 = false this.open1 = false
this.getList() this.getList()
this.$message.success('添加成功') this.$message.success('添加成功')
} else {
this.$message.error(res.message)
} }
}) })
......
...@@ -1269,8 +1269,14 @@ export default { ...@@ -1269,8 +1269,14 @@ export default {
} }
findVideoUrl(params).then(res => { findVideoUrl(params).then(res => {
// this.playerOptions.sources[0].src = 'http://vjs.zencdn.net/v/oceans.mp4' // this.playerOptions.sources[0].src = 'http://vjs.zencdn.net/v/oceans.mp4'
this.videoList = res.data.ossInfoList[0] === null ? [] : res.data.ossInfoList if (res.data) {
this.playerOptions.sources[0].src = urlDecrypt(res.data.videoUrl) this.videoList = res.data.ossInfoList[0] === null ? [] : res.data.ossInfoList
}
if (res.data) {
this.playerOptions.sources[0].src = urlDecrypt(res.data.videoUrl)
} else {
this.playerOptions.sources[0].src = urlDecrypt(null)
}
console.log('111111', urlDecrypt(res.data.videoUrl)) console.log('111111', urlDecrypt(res.data.videoUrl))
}) })
this.firstUpload = false this.firstUpload = false
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.lessonType === '0'" label="课程方案:" prop="classPlan" :rules="[{ required: status !== '3', message: '请选择课程方案', trigger: 'change' }]"> <el-form-item label="课程方案:" prop="classPlan" :rules="[{ required: status !== '3', message: '请选择课程方案', trigger: 'change' }]">
<el-select <el-select
v-model="form.classPlan" v-model="form.classPlan"
filterable filterable
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
class="normalSelct" class="normalSelct"
> >
<el-option <el-option
v-for="(items,index) in coursePlanOptions" v-for="(items,index) in form.lessonType === '0' ?coursePlanOptions : coursePlanOptionsC"
:key="index" :key="index"
:label="items.dictLabel" :label="items.dictLabel"
:value="items.dictValue" :value="items.dictValue"
...@@ -68,21 +68,6 @@ ...@@ -68,21 +68,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-else label="课程方案:" prop="classPlan" :rules="[{ required: status !== '3', message: '请选择课程方案', trigger: 'change' }]">
<el-select
v-model="form.classPlan"
filterable
multiple
class="normalSelct"
>
<el-option
v-for="(items,index) in coursePlanOptionsC"
:key="index"
:label="items.dictLabel"
:value="items.dictValue"
/>
</el-select>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
......
...@@ -602,7 +602,8 @@ ...@@ -602,7 +602,8 @@
prop="applicant" prop="applicant"
> >
<el-select <el-select
v-model="queryLessonParams.applicant" v-model="form.applicant"
placeholder="请选择申请人"
filterable filterable
style="width: 400px" style="width: 400px"
> >
...@@ -622,9 +623,10 @@ ...@@ -622,9 +623,10 @@
prop="lessonType" prop="lessonType"
> >
<el-select <el-select
v-model="queryLessonParams.lessonType" v-model="form.lessonType"
filterable filterable
style="width: 400px" style="width: 400px"
placeholder="请选择课程类型"
@change="handleLessonTypeChange" @change="handleLessonTypeChange"
> >
<el-option <el-option
...@@ -645,9 +647,10 @@ ...@@ -645,9 +647,10 @@
prop="classPlan" prop="classPlan"
> >
<el-select <el-select
v-model="queryLessonParams.classPlan" v-model="form.classPlan"
filterable filterable
style="width: 400px" style="width: 400px"
placeholder="请选择课程方案"
> >
<el-option <el-option
v-for="item in coursePlanOptions" v-for="item in coursePlanOptions"
...@@ -660,7 +663,7 @@ ...@@ -660,7 +663,7 @@
</div> </div>
<div> <div>
<el-form-item label="难度等级" prop="difficultyClassify"> <el-form-item label="难度等级" prop="difficultyClassify">
<el-select v-model="queryLessonParams.difficultyClassify" placeholder="难度等级" clearable style="width: 400px"> <el-select v-model="form.difficultyClassify" placeholder="请选择难度等级" clearable style="width: 400px">
<el-option <el-option
v-for="item in difficultyOptions" v-for="item in difficultyOptions"
:key="item.dictValue" :key="item.dictValue"
...@@ -678,17 +681,18 @@ ...@@ -678,17 +681,18 @@
<div> <div>
<el-form-item <el-form-item
label="开始时间" label="开始时间"
prop="createTime" prop="beginDate"
> >
<span> <span>
<el-date-picker <el-date-picker
v-model="addLessonForm.beginDate" v-model="form.beginDate"
style="width: 400px" style="width: 400px"
type="date" type="date"
placeholder="-" placeholder="请选择开始时间"
:editable="false" :editable="false"
format="yyyy-MM-dd" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:picker-options="pickerOptionsBegin"
/> />
</span> </span>
</el-form-item> </el-form-item>
...@@ -696,17 +700,18 @@ ...@@ -696,17 +700,18 @@
<div> <div>
<el-form-item <el-form-item
label="结束时间" label="结束时间"
prop="endTime" prop="endDate"
> >
<span> <span>
<el-date-picker <el-date-picker
v-model="addLessonForm.endDate" v-model="form.endDate"
style="width: 400px" style="width: 400px"
type="date" type="date"
placeholder="-" placeholder="请选择结束时间"
:editable="false" :editable="false"
format="yyyy-MM-dd" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
/> />
</span> </span>
</el-form-item> </el-form-item>
...@@ -720,8 +725,9 @@ ...@@ -720,8 +725,9 @@
prop="isPay" prop="isPay"
> >
<el-select <el-select
v-model="addLessonForm.isPay" v-model="form.isPay"
filterable filterable
placeholder="请选择开课类型"
style="width: 400px" style="width: 400px"
> >
<el-option <el-option
...@@ -744,9 +750,9 @@ ...@@ -744,9 +750,9 @@
prop="remarks" prop="remarks"
> >
<el-input <el-input
v-model="addLessonForm.remarks" v-model="form.remarks"
style="width: 1100px" style="width: 1100px"
placeholder="备注" placeholder="请输入备注"
clearable clearable
:maxlength="30" :maxlength="30"
size="small" size="small"
...@@ -764,6 +770,7 @@ ...@@ -764,6 +770,7 @@
<el-table ref="multipleTable" class="DBXXClass" border :data="lessonList" :row-key="getRoKey" @selection-change="handleSelectionChange"> <el-table ref="multipleTable" class="DBXXClass" border :data="lessonList" :row-key="getRoKey" @selection-change="handleSelectionChange">
<el-table-column <el-table-column
type="selection" type="selection"
reserve-selection
/> />
<el-table-column <el-table-column
...@@ -771,7 +778,6 @@ ...@@ -771,7 +778,6 @@
type="index" type="index"
width="70" width="70"
align="center" align="center"
:reserve-selection="true"
/> />
<el-table-column label="开课名称" prop="lessonName" show-overflow-tooltip> <el-table-column label="开课名称" prop="lessonName" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -780,43 +786,46 @@ ...@@ -780,43 +786,46 @@
</el-table-column> </el-table-column>
<el-table-column label="申请人" prop="applicantUnit" show-overflow-tooltip> <el-table-column label="申请人" prop="applicantUnit" show-overflow-tooltip>
{{ getUserName(queryLessonParams.applicant) || '-' }} {{ getUserName(form.applicant) || '-' }}
</el-table-column> </el-table-column>
<el-table-column label="课程类型" prop="lessonType" show-overflow-tooltip> <el-table-column label="课程类型" prop="lessonType" show-overflow-tooltip>
{{ queryLessonParams.lessonType === '0' ? '企业课程' : '院校课程' }} {{ form.lessonType === '0' ? '企业课程' : '院校课程' }}
</el-table-column> </el-table-column>
<el-table-column label="课程方案" prop="class" show-overflow-tooltip> <el-table-column label="课程方案" prop="class" show-overflow-tooltip>
{{ getClassPlanName(queryLessonParams.classPlan) }} {{ getClassPlanName(form.classPlan) }}
</el-table-column> </el-table-column>
<el-table-column label="难度等级" prop="class" show-overflow-tooltip> <el-table-column label="难度等级" prop="class" show-overflow-tooltip>
{{ getDifficultyLevelName(queryLessonParams.difficultyClassify) }} <!-- {{ getDifficultyLevelName(form.difficultyClassify) }}-->
<template slot-scope="scope">
{{ getDifficultyLevelName(scope.row.difficultyClassify) }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="开始日期" prop="createTime" show-overflow-tooltip> <el-table-column label="开始日期" prop="createTime" show-overflow-tooltip>
<template> <template>
{{ addLessonForm.beginDate }} {{ form.beginDate }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="结束日期" prop="endTime" show-overflow-tooltip> <el-table-column label="结束日期" prop="endTime" show-overflow-tooltip>
<template> <template>
{{ addLessonForm.endDate }} {{ form.endDate }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="开课类型" prop="isPay" :show-overflow-tooltip="true"> <el-table-column label="开课类型" prop="isPay" :show-overflow-tooltip="true">
{{ addLessonForm.isPay === 0 ? '试用' : '付费' }} {{ form.isPay === 0 ? '试用' : '付费' }}
</el-table-column> </el-table-column>
<el-table-column label="备注" prop="remarks" show-overflow-tooltip> <el-table-column label="备注" prop="remarks" show-overflow-tooltip>
<template> <template>
{{ addLessonForm.remarks }} {{ form.remarks }}
</template> </template>
</el-table-column> </el-table-column>
...@@ -826,7 +835,7 @@ ...@@ -826,7 +835,7 @@
:total="total1" :total="total1"
:page.sync="queryLessonParams.page" :page.sync="queryLessonParams.page"
:limit.sync="queryLessonParams.rows" :limit.sync="queryLessonParams.rows"
@pagination="handleLessonQuery" @pagination="handleLessonPage"
/> />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="handleClose">取 消</el-button> <el-button class="cancelBtn" @click="handleClose">取 消</el-button>
...@@ -858,6 +867,20 @@ export default { ...@@ -858,6 +867,20 @@ export default {
name: 'TryoutApplication', name: 'TryoutApplication',
data() { data() {
return { return {
pickerOptions: {
disabledDate: (time) => {
if (this.form.beginDate) {
return time.getTime() <= new Date(this.form.beginDate).getTime()
}
}
},
pickerOptionsBegin: {
disabledDate: (time) => {
if (this.form.endDate) {
return time.getTime() >= new Date(this.form.endDate).getTime()
}
}
},
total1: 0, total1: 0,
lessonList: [], lessonList: [],
// 查询参数 // 查询参数
...@@ -877,6 +900,7 @@ export default { ...@@ -877,6 +900,7 @@ export default {
difficultyOptions: [], difficultyOptions: [],
lessonTypeOptions: [], lessonTypeOptions: [],
coursePlanOptions: [], coursePlanOptions: [],
multipleSelection: [],
coursePlanOptionsC: [], coursePlanOptionsC: [],
addLessonForm: { addLessonForm: {
applicant: '', applicant: '',
...@@ -901,7 +925,24 @@ export default { ...@@ -901,7 +925,24 @@ export default {
dialogVisible: false, dialogVisible: false,
// 表单验证 // 表单验证
rules: { rules: {
applicant: [
{ required: true, message: '请选择申请人' }
],
lessonType: [
{ required: true, message: '请选择课程类型' }
],
classPlan: [
{ required: true, message: '请选择课程方案' }
],
beginDate: [
{ required: true, message: '请选择开始时间', trigger: 'change' }
],
endDate: [
{ required: true, message: '请选择结束时间', trigger: 'change' }
],
isPay: [
{ required: true, message: '请选择开课类型' }
]
}, },
tableData: [], tableData: [],
valueOptions: [ valueOptions: [
...@@ -916,6 +957,7 @@ export default { ...@@ -916,6 +957,7 @@ export default {
}, },
// 表单参数 // 表单参数
form: { form: {
applicant: null,
settingList: [] settingList: []
}, },
open: false, open: false,
...@@ -992,6 +1034,15 @@ export default { ...@@ -992,6 +1034,15 @@ export default {
this.getDifficultyLevel() this.getDifficultyLevel()
}, },
methods: { methods: {
handleStartDateChange(value) {
if (this.addLessonForm.endDate) {
const startDate = new Date(value).getTime()
const endDate = new Date(this.addLessonForm.endDate).getTime()
if (startDate > endDate) {
this.addLessonForm.endDate = value
}
}
},
// 获取难度等级 // 获取难度等级
getDifficultyLevel() { getDifficultyLevel() {
getDict('difficulty_grade').then(res => { getDict('difficulty_grade').then(res => {
...@@ -1024,11 +1075,10 @@ export default { ...@@ -1024,11 +1075,10 @@ export default {
console.log(this.multipleSelection) console.log(this.multipleSelection)
}, },
getRoKey(row) { getRoKey(row) {
return row.id return row.businessId
}, },
handleLessonClear() { handleLessonClear() {
this.resetQueryLesson() this.resetQueryLesson()
this.resetAddLessonForm()
}, },
resetAddLessonForm() { resetAddLessonForm() {
this.addLessonForm = { this.addLessonForm = {
...@@ -1044,11 +1094,9 @@ export default { ...@@ -1044,11 +1094,9 @@ export default {
}, },
resetQueryLesson() { resetQueryLesson() {
this.queryLessonParams = { this.$refs.lessonRef.resetFields()
coursePlan: '', this.total1 = 0
lessonType: '' this.lessonList = []
}
this.form.settingList = []
}, },
getLessonType() { getLessonType() {
getDict('lesson_type').then(res => { getDict('lesson_type').then(res => {
...@@ -1058,23 +1106,41 @@ export default { ...@@ -1058,23 +1106,41 @@ export default {
}, },
/** 查找可以开课的课程*/ /** 查找可以开课的课程*/
handleLessonQuery() { handleLessonQuery() {
const query = { this.$refs.lessonRef.validate(valid => {
page: 1, if (valid) {
rows: 10, const query = {
applicant: this.queryLessonParams.applicant, page: 1,
classPlan: this.queryLessonParams.classPlan, rows: 10,
lessonType: this.queryLessonParams.lessonType, applicant: this.form.applicant,
applicantType: '1', classPlan: this.form.classPlan,
difficultyClassify: this.queryLessonParams.difficultyClassify lessonType: this.form.lessonType,
} applicantType: '1',
console.log(query) difficultyClassify: this.form.difficultyClassify
queryBLessonWithTrial(query).then(res => { }
this.lessonList = res.rows queryBLessonWithTrial(query).then(res => {
this.total1 = res.total this.lessonList = res.records
this.total1 = res.total
console.log(res) })
}
console.log(this.lessonList) })
},
handleLessonPage() {
this.$refs.lessonRef.validate(valid => {
if (valid) {
const query = {
page: this.queryLessonParams.page,
rows: this.queryLessonParams.rows,
applicant: this.form.applicant,
classPlan: this.form.classPlan,
lessonType: this.form.lessonType,
applicantType: '1',
difficultyClassify: this.form.difficultyClassify
}
queryBLessonWithTrial(query).then(res => {
this.lessonList = res.records
this.total1 = res.total
})
}
}) })
}, },
/** 处理课程类型变化*/ /** 处理课程类型变化*/
...@@ -1146,7 +1212,6 @@ export default { ...@@ -1146,7 +1212,6 @@ export default {
/** 5.关闭时请表单想和列表数据清空**/ /** 5.关闭时请表单想和列表数据清空**/
handleClose() { handleClose() {
this.resetAddFrom() this.resetAddFrom()
this.handleLessonClear()
this.open = false this.open = false
this.open1 = false this.open1 = false
this.$nextTick().then(() => { this.$nextTick().then(() => {
...@@ -1484,26 +1549,28 @@ export default { ...@@ -1484,26 +1549,28 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
if (this.multipleSelection.length === 0) {
return this.$message.error('请选择课程')
}
console.log('提交') console.log('提交')
const form = this.multipleSelection const form = this.multipleSelection
form.forEach(item => { form.forEach(item => {
item.applicant = this.queryLessonParams.applicant item.applicant = this.form.applicant
item.lessonId = item.businessId item.lessonId = item.businessId
item.remarks = this.addLessonForm.remarks item.remarks = this.form.remarks
item.applicantType = 1 item.applicantType = 1
item.isPay = this.addLessonForm.isPay item.isPay = this.form.isPay
item.beginTrialTime = this.addLessonForm.beginDate item.beginTrialTime = this.form.beginDate
item.endTrialTime = this.addLessonForm.endDate item.endTrialTime = this.form.endDate
item.businessId = null item.businessId = null
item.tecClassify = null
item.flag = '0' item.flag = '0'
item.jobClassification = item.jobClassify item.jobClassification = item.jobClassify
item.technicalClassification = item.tecClassify item.technicalClassification = item.tecClassify
}) })
console.log(form)
const addForm = { const addForm = {
settingList: form, settingList: form,
applicant: this.addLessonForm.applicant, applicant: this.form.applicant,
applicantType: 1 applicantType: 1
} }
batchAddTeaTrialCourse(addForm).then(res => { batchAddTeaTrialCourse(addForm).then(res => {
...@@ -1513,6 +1580,8 @@ export default { ...@@ -1513,6 +1580,8 @@ export default {
this.open1 = false this.open1 = false
this.loadData() this.loadData()
this.$message.success('添加成功') this.$message.success('添加成功')
} else {
this.$message.error(res.message)
} }
}) })
...@@ -1551,9 +1620,10 @@ export default { ...@@ -1551,9 +1620,10 @@ export default {
}, },
/** 6.重置方法**/ /** 6.重置方法**/
resetAddFrom() { resetAddFrom() {
this.addForm = { this.form = {
unitId: '', unitId: '',
unitName: '', unitName: '',
applicant: '',
lessonId: '', lessonId: '',
lessonName: '', lessonName: '',
beginDate: null, beginDate: null,
...@@ -1564,6 +1634,9 @@ export default { ...@@ -1564,6 +1634,9 @@ export default {
remarks: '' remarks: ''
} }
this.form.settingList = [] this.form.settingList = []
this.lessonList = []
this.multipleSelection = []
this.total1 = 0
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment