江西小程序管理端
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.
 
 
 

313 lines
8.0 KiB

<template>
<view class="pageBgImg">
<topNavbar title="排课计划"></topNavbar>
<view class="pad">
<view class="card">
<view class="row">
<view class="lab">计划开始日期</view>
<view class="rightCon" @click="showClick('classBeginDate')">
<view class="inputBox">
<input type="text" v-model="form.classBeginDate" placeholder="请选择" disabled style="pointer-events: none;">
</view>
<view class="icon">
<u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
</view>
</view>
</view>
<view class="row">
<view class="lab">计划结束日期</view>
<view class="rightCon" @click="showClick('classEndDate')">
<view class="inputBox">
<input type="text" v-model="form.classEndDate" placeholder="请选择" disabled style="pointer-events: none;">
</view>
<view class="icon">
<u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
</view>
</view>
</view>
<view class="row">
<view class="lab">选择训练场地</view>
<view class="rightCon" @click="showSite=true">
<view class="inputBox">
<input type="text" v-model="form.siteName" placeholder="请选择" disabled style="pointer-events: none;">
</view>
<view class="icon">
<u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
</view>
</view>
</view>
<view class="row">
<view class="lab">选择开课时间段</view>
<view class="rightCon" @click="$goPage('/pages/recordEntry/operate/mySchedule/mould/mould')">
<view class="inputBox">
<input type="text" v-model="currentMould.templateName" placeholder="请选择" disabled style="pointer-events: none;">
</view>
<view class="icon">
<u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
</view>
</view>
</view>
<view class="blueBg">
<view class="time_row hui">
<text>时间段</text> <text>最多人数</text>
</view>
<view class="time_row" v-for="(item,index) in currentMould.detailVO" :key="index">
<text>{{item.startTime}} <text>-</text> {{item.endTime}}</text> <text>{{item.personCount}}</text>
</view>
</view>
<view class="row">
<view class="lab">训练科目</view>
<view class="rightCon">
<myRadio @changeRadio="changeRadioSubject" :radioData="radiolist1" :radioVal="{value: form.subject}"></myRadio>
</view>
</view>
<view class="row">
<view class="lab">选择教练车</view>
<view class="rightCon" @click="showCar=true">
<view class="inputBox">
<input type="text" v-model="form.carNumber" placeholder="请选择" disabled style="pointer-events: none;">
</view>
<view class="icon">
<u-icon name="arrow-right" :size="12" :color="'#696B72'"></u-icon>
</view>
</view>
</view>
<view class="row">
<view class="lab">开放范围</view>
<view class="rightCon">
<myRadio @changeRadio="changeRadioOpenRange" :radioData="radiolist3" :radioVal="{value: form.openRange}"></myRadio>
</view>
</view>
</view>
<view class="btnBg" @click="scheduleClassCreateFn">确认发布</view>
</view>
<u-datetime-picker
:show="show"
:minDate="minDate"
:maxDate="maxDate"
mode="date"
@confirm="changeDate"
@cancel="show=false"
></u-datetime-picker>
<u-picker :show="showSite" :columns="siteColumns" keyName="name" @confirm="changeSite" @cancel="showSite=false" ></u-picker>
<u-picker :show="showCar" :columns="carColumns" keyName="licnum" @confirm="changeCarNumber" @cancel="showCar=false" ></u-picker>
</view>
</template>
<script>
import { scheduleClassCreate, getClassDateLimit, trainingSiteList, carPage} from '@/config/api.js'
export default {
data() {
return {
tmpDateName:'',//选择日期临时变量
minDate: null,
maxDate: null,
show: false,
showSite: false,
showCar: false,
form: {
classDate: '',
carNumber: '',
subject: 0, //科目类别:0:不限;2:科目二;3:科目三
openRange: '1', //开放范围:0:自己的学员;1:绑定的驾校的学员
siteName: '',
siteId: ''
},
formToast: {
classBeginDate: '请选择开始时间',
classEndDate: '请选择结束时间',
siteId: '请选择场地',
carNumber: '请选择车辆',
},
currentMould: {},
siteColumns: [],
carColumns: [],
radiolist1: [{
name: '不限制',
id: 0,
disabled: false
},
{
name: '科目二',
id: 2,
disabled: false
},
{
name: '科目三',
id: 3,
disabled: false
},
],
radiolist3: [{
name: '我的学员',
id: 0,
disabled: false
},
{
name: '所有学员',
id: 1,
disabled: false
},
] //开放范围:0:自己的学员;1:绑定的驾校的学员
}
},
onLoad() {
this.form.deptId = this.vuex_deptId
this.form.coachId = this.vuex_coachId
this.getClassDateLimitFn()
this.trainingSiteListFn()
this.carPageFn()
uni.$on('chooseMould',(item)=>{
this.form.templateId = item.id
this.currentMould = item
console.log(item)
})
},
methods: {
// 点击显示选择日期组件
showClick(name) {
this.show = true
this.tmpDateName = name
},
// 选择车牌号
changeCarNumber(val) {
const item = val.value[0]
this.showCar = false
this.form.carNumber = item.licnum
// console.log()
},
// 发布排课计划
async scheduleClassCreateFn() {
for(let k in this.formToast) {
if(!this.form[k])
return this.$u.toast(this.formToast[k])
}
console.log(this.form)
const res = await scheduleClassCreate(this.form)
if(res.code==0) {
this.$goPage('/pages/recordEntry/operate/mySchedule/mySchedule')
}
console.log(res)
},
// 选择训练场地
changeSite(val) {
let item = val.value[0]
this.form.address = item.address
this.form.seq = item.seq
this.form.area = item.area
this.form.siteName = item.name
this.form.siteId = item.id
this.showSite = false
},
// 获取训练场地
async trainingSiteListFn() {
let obj = {
pageNo: 1,
pageSize: 100,
schoolId: this.vuex_userInfo.user.schoolId
}
const {data: res} = await trainingSiteList(obj)
this.siteColumns = [ res ]
console.log(res)
},
changeRadio(val) {
console.log(val)
},
changeRadioOpenRange(val) {
this.form.openRange = val
},
// 选择科目
changeRadioSubject(val) {
this.form.subject = val
console.log(this.form.subject)
},
// 选择日期
changeDate(val) {
this.form[this.tmpDateName] = this.$u.date(val.value, 'yyyy-mm-dd')
this.show = false
console.log(val)
},
// 获取排课日期范围
async getClassDateLimitFn() {
let obj = {
coachId: this.vuex_coachId
}
const {data: res} = await getClassDateLimit(obj)
this.minDate = new Date(res.beginDateLimit)*1 + 86400000
this.maxDate = new Date(res.endDateLimit)*1
},
async carPageFn() {
let obj = {
pageNo: 1,
pageSize: 40,
schoolId: this.vuex_schoolId,
coachId: this.vuex_coachId
}
const {data: res} = await carPage(obj)
this.carColumns = [res.list]
},
}
}
</script>
<style lang="scss" scoped>
.card {
padding: 10rpx 28rpx;
.row {
display: flex;
justify-content: space-between;
padding: 26rpx 0;
.lab {
font-weight: 500;
}
}
}
.btnBg {
width: 396rpx;
margin: 120rpx auto 0 auto;
}
.rightCon {
display: flex;
align-items: center;
.icon {
margin-left: 10rpx;
}
.inputBox {
flex: 1;
input {
text-align: right;
font-size: 28rpx;
color: #333;
}
}
}
.blueBg {
background-color: #E8F3FE;
padding: 12rpx 32rpx;
border-radius: 16rpx;
text-align: center;
.time_row {
display: flex;
justify-content: space-between;
padding: 12rpx 0;
&.hui {
color: #ADADAD;
}
text {
width: 170rpx;
}
}
}
</style>