Commit a8383e09 authored by zhengke's avatar zhengke

1

parent 4ea6386e
......@@ -668,4 +668,52 @@ export function queryPersonnelBonusStatic(data) {
method: 'post',
data
})
}
/**
* 获取试听课程分页列表
* @param {JSON对象} data
*/
export function GetTrialLessonPage(data){
return request({
url: '/Course/GetTrialLessonPage',
method: 'post',
data
})
}
/**
* 删除试听课程列表
* @param {JSON对象} data
*/
export function RemoveTrialLesson(data){
return request({
url: '/Course/RemoveTrialLesson',
method: 'post',
data
})
}
/**
* 根据编号获取试听课程
* @param {JSON对象} data
*/
export function GetTrialLesson(data){
return request({
url: '/Course/GetTrialLesson',
method: 'post',
data
})
}
/**
* 根据编号获取试听课程
* @param {JSON对象} data
*/
export function SetTrialLesson(data){
return request({
url: '/Course/SetTrialLesson',
method: 'post',
data
})
}
\ No newline at end of file
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 400px;max-width:400px;">
<q-card-section>
<div class="text-h6">{{optionTitle}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<q-input filled stack-label maxlength="30" :dense="false" v-model="objOption.LessonName" ref="LessonName"
class="col-12 q-pb-lg" label="试听课程名称" :rules="[val => !!val || '请填写试听课程名称']" />
</div>
<div class="row wrap">
<q-select stack-label class="col-12 q-pb-lg" color="primary" filled label="试听课主讲老师"
option-value="TId" option-label="TeacherName" :options="TeacherList" v-model="objOption.TeacherId"
emit-value map-options />
</div>
<div class="row wrap">
<q-input filled stack-label :dense="false" v-model="objOption.ClassHourFee" ref="ClassHourFee"
class="col-12 q-pb-lg" label="课时费" @keyup.native="checkPrice(objOption,'ClassHourFee')" />
</div>
<div class="row wrap">
<q-select stack-label class="col-12 q-pb-lg" color="primary" filled label="核算方式" option-value="Id"
option-label="Name" :options="AccountTypeList" v-model="objOption.CalculateType" emit-value map-options />
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="saveListen" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
GetTrialLesson,
SetTrialLesson
} from '../../api/course/index'
import {
getTeacherDropDownList
} from '../../api/school/index';
export default {
props: {
saveObj: {
type: Object,
default: null
}
},
data() {
return {
persistent: true,
saveLoading: false,
objOption: {
Id: 0,
LessonName: '', //试听课程名称
TeacherId: '', //试听课主讲老师
ClassHourFee: '', //课时费
CalculateType: 1 //核酸方式1单次 2按月
},
TeacherList: [], //教师下拉
//核算方式
AccountTypeList: [{
Id: 1,
Name: '单次'
}, {
Id: 2,
Name: '按月'
}],
optionTitle: "",
}
},
created() {
this.GetTeacherList();
},
mounted() {
this.initObj();
},
methods: {
//获取教师下拉
GetTeacherList() {
getTeacherDropDownList({}).then(res => {
if (res.Code == 1) {
this.TeacherList = res.Data;
var obj = {
TeacherName: '请选择',
TId: 0
}
this.TeacherList.unshift(obj);
}
})
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.Id > 0) {
GetTrialLesson({
Id: this.saveObj.Id
}).then(res => {
if (res.Code == 1) {
let temData = res.Data;
this.objOption.Id = temData.Id;
this.objOption.LessonName = temData.LessonName;
this.objOption.TeacherId = temData.TeacherId;
this.objOption.ClassHourFee = temData.ClassHourFee;
this.objOption.CalculateType = temData.CalculateType;
}
});
this.optionTitle = "修改试听课程信息";
} else {
this.optionTitle = "新增试听课程信息";
this.objOption.Id = 0;
this.objOption.LessonName = '';
this.objOption.TeacherId = '';
this.objOption.ClassHourFee = '';
this.objOption.CalculateType = 1;
}
},
//关闭弹窗
closeSaveForm() {
this.$emit('close')
},
//保存菜单
saveListen() {
this.$refs.LessonName.validate();
if (!this.$refs.LessonName.hasError) {
this.saveLoading = true
SetTrialLesson(this.objOption).then(res => {
this.saveLoading = false;
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}
})
}
}
}
}
</script>
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input @change="resetSearch" clearable filled v-model="msg.LessonName" label="课程名称"
@clear="resetSearch" maxlength="30" />
</div>
</div>
</div>
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat
class="sticky-column-table no-bottom-table" separator="none" :data="dataList" :columns="columns" row-key="name">
<template v-slot:top="props">
<div class="col-2 q-table__title">试听课程管理</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="新增试听课" @click="addObj(null)" />
</div>
</template>
<template v-slot:body-cell-CalculateType="props">
<q-td>
{{props.row.CalculateType==1?'单次':'按月'}}
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.PageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
<template v-slot:body-cell-Id="props">
<q-td :props="props">
<div>
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="addObj(props.row)" />
<q-btn flat size="xs" icon="delete" color="negative" class="q-mr-xs" label="删除"
@click="deleteCustom(props.row.Id)" />
</div>
</q-td>
</template>
</q-table>
</div>
<listen-form v-if="isShowListenForm" :save-obj="customObj" @close="closeListenForm" @success="refreshPage">
</listen-form>
</div>
</template>
<script>
import {
GetTrialLessonPage,
RemoveTrialLesson
} from '../../api/course/index'
import listenForm from '../../components/course/listen-form'
export default {
meta: {
title: "试听课程管理"
},
components: {
listenForm
},
data() {
return {
columns: [{
name: 'LessonName',
label: '试听课程名称',
field: 'LessonName',
align: 'left'
}, {
name: 'TeacherId',
label: '试听课主讲老师',
align: 'left',
field: 'TeacherId'
}, {
name: 'ClassHourFee',
label: '课时费',
align: 'left',
field: 'ClassHourFee'
}, {
name: 'CalculateType',
label: '核算方式',
align: 'left',
field: 'CalculateType'
}, {
name: 'Id',
label: '操作',
field: 'Id'
}],
msg: {
PageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
LessonName: ""
},
dataList: [],
loading: true,
isShowListenForm: false,
customObj: {},
pageCount:0
}
},
mounted() {
this.getList()
},
methods: {
resetSearch(){
this.msg.PageIndex = 1;
this.getList();
},
changePage(val){
this.msg.PageIndex = val;
this.getList();
},
//删除
deleteCustom(Id) {
let delMsg = {
Id: Id
};
this.$q.dialog({
title: '提示信息',
message: '是否确定删除该试听课?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
RemoveTrialLesson(delMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '删除成功!',
position: 'top'
})
this.getList();
}
})
}).onCancel(() => {
});
},
getList() {
this.loading = true;
GetTrialLessonPage(this.msg).then(res => {
this.loading = false;
if (res.Code == 1) {
this.dataList = res.Data.PageData;
this.pageCount = res.Data.PageCount;
}
})
},
closeListenForm() {
this.isShowListenForm = false
},
refreshPage() {
this.getList();
},
addObj(obj) {
if (obj) {
this.customObj = obj
} else {
this.customObj = null
}
this.isShowListenForm = true;
}
},
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
......@@ -239,6 +239,11 @@ const routes = [{
component: () =>
import("pages/course/course.vue")
},
{
path: "/course/listenCourse", //试听课程管理
component: () =>
import("pages/course/listenCourse.vue")
},
{
path: "/course/lessonNotes", //课程教案
component: () =>
......
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