|
@@ -4,6 +4,12 @@
|
|
|
<u-form-item label="班级名称" prop="name" required>
|
|
|
<u-input v-model="form.name" placeholder="请输入班级名称" />
|
|
|
</u-form-item>
|
|
|
+ <u-form-item label="培训方式" prop="classTypeInfo" required>
|
|
|
+ <u-input v-model="form.classTypeInfo" placeholder="请选择培训方式" type="select" @click="trainShow = true" />
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item v-if="form.classTypeDesc == 5" label="其他方式" prop="otherType">
|
|
|
+ <u-input v-model="form.otherType" placeholder="请填写其他方式" />
|
|
|
+ </u-form-item>
|
|
|
<u-form-item label="课程周期开始时间" prop="startDate" right-icon="arrow-right" required @click.native="startDateShow = true">
|
|
|
<u-input v-model="form.startDate" placeholder="请选择课程周期开始时间" disabled @click="startDateShow = true" />
|
|
|
</u-form-item>
|
|
@@ -51,6 +57,8 @@
|
|
|
<u-picker mode="time" v-model="startTimeShow" :params="startTimeParams" @confirm="setStartTime"></u-picker>
|
|
|
<u-picker mode="time" v-model="startDateShow" :params="cycleParams" @confirm="setStartDate"></u-picker>
|
|
|
<u-picker mode="time" v-model="endDateShow" :params="cycleParams" @confirm="setEndDate"></u-picker>
|
|
|
+ <!-- 培训方式 -->
|
|
|
+ <u-action-sheet :list="trainList" v-model="trainShow" @click="setTrain"></u-action-sheet>
|
|
|
<u-top-tips ref="uTips"></u-top-tips>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -73,6 +81,9 @@
|
|
|
form: {
|
|
|
classId: 0,
|
|
|
name: '',
|
|
|
+ classTypeDesc: '',
|
|
|
+ classTypeInfo: '',
|
|
|
+ otherType: '',
|
|
|
startDate: '',
|
|
|
endDate: '',
|
|
|
timeReqList: [{
|
|
@@ -88,6 +99,12 @@
|
|
|
message: '请输入班级名称',
|
|
|
trigger: 'change'
|
|
|
}],
|
|
|
+ classTypeInfo: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择培训方式',
|
|
|
+ trigger: 'change'
|
|
|
+ }],
|
|
|
startDate: [{
|
|
|
required: true,
|
|
|
message: '请选择课程周期开始时间',
|
|
@@ -111,6 +128,29 @@
|
|
|
trigger: 'change'
|
|
|
},
|
|
|
},
|
|
|
+ trainShow: false,
|
|
|
+ trainList: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ text: '一对一(或一对多)面授'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ text: '大班额面授课'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ text: '小班额面授课'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ text: '本班开班不受最低人数限制'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 5,
|
|
|
+ text: '其他方式'
|
|
|
+ },
|
|
|
+ ],
|
|
|
startTimeShow: false,
|
|
|
startTimeParams: {
|
|
|
year: false,
|
|
@@ -167,14 +207,49 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- this.form = JSON.parse(decodeURIComponent(options.form));
|
|
|
- this.form.id = parseInt(this.form.classId)
|
|
|
+ if(options.classId) {
|
|
|
+ this.form.id = parseInt(options.classId)
|
|
|
+ this.getClassInfo()
|
|
|
+ } else {
|
|
|
+ this.form = JSON.parse(decodeURIComponent(options.form));
|
|
|
+ this.form.id = parseInt(this.form.classId)
|
|
|
+ }
|
|
|
},
|
|
|
onReady() {
|
|
|
this.$refs.form.setRules(this.rules);
|
|
|
},
|
|
|
onShow() {},
|
|
|
methods: {
|
|
|
+ // 获取班级详情
|
|
|
+ getClassInfo() {
|
|
|
+ console.log(this.form.id);
|
|
|
+ NET.request(API.findById, {
|
|
|
+ id: this.form.id
|
|
|
+ }, 'POST').then( res => {
|
|
|
+ let getInfo = this.trainList.find(item => item.id == res.data.classTypeDesc)
|
|
|
+ let info = ''
|
|
|
+ if(!getInfo) {
|
|
|
+ info = '其他方式'
|
|
|
+ this.form = { ...res.data, classTypeInfo: info, classTypeDesc: 5, otherType: res.data.classTypeDesc, maxStudentCount: res.data.peopleNumber }
|
|
|
+ } else {
|
|
|
+ info = getInfo.text
|
|
|
+ this.form = { ...res.data, classTypeInfo: info, maxStudentCount: res.data.peopleNumber }
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: error.message,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 选择培训方式
|
|
|
+ setTrain(index) {
|
|
|
+ this.form.classTypeDesc = this.trainList[index].id
|
|
|
+ this.form.classTypeInfo = this.trainList[index].text
|
|
|
+ if(this.trainList[index].id = 5) {
|
|
|
+ this.form.otherType = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
// 设置课程周期开始时间
|
|
|
setStartDate(date) {
|
|
|
this.form.startDate = date.year + '-' + date.month + '-' + date.day
|
|
@@ -226,10 +301,19 @@
|
|
|
},
|
|
|
// 提交表单
|
|
|
submitForm() {
|
|
|
+ if(this.form.classTypeDesc == 5) {
|
|
|
+ if(!this.form.otherType) {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '请输入培训方式',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$refs.form.validate(valid => {
|
|
|
if (valid) {
|
|
|
NET.request(API.classUpdate, {
|
|
|
- ...this.form,
|
|
|
+ ...this.form, classTypeDesc : this.form.classTypeDesc == 5 ? this.form.otherType : this.form.classTypeDesc
|
|
|
}, 'POST').then(res => {
|
|
|
uni.removeStorageSync({
|
|
|
key: 'extraLessonsUserList'
|
|
@@ -238,11 +322,6 @@
|
|
|
title: '提交成功',
|
|
|
type: 'success',
|
|
|
})
|
|
|
- // setTimeout(() => {
|
|
|
- // uni.reLaunch({
|
|
|
- // url: '/pagesClass/classList'
|
|
|
- // })
|
|
|
- // }, 1000)
|
|
|
setTimeout(() => {
|
|
|
uni.navigateBack({})
|
|
|
}, 1000)
|