This commit is contained in:
许允枞 2025-04-02 10:56:00 +08:00
parent c276b14086
commit 59139615e1
4 changed files with 49 additions and 8 deletions

View File

@ -127,10 +127,11 @@ export default {
const selected = this.courseList.find(item => item.id === this.formData.courseId); const selected = this.courseList.find(item => item.id === this.formData.courseId);
if (selected) { if (selected) {
this.formData.courseName = selected.name; this.formData.courseName = selected.name;
this.formData.courseType = selected.courseType; this.formData.courseType = selected.type;
} else { } else {
this.formData.courseName = ''; this.formData.courseName = '';
} }
console.log('当前课程', this.formData)
}, },
handleCoachChange() { handleCoachChange() {
const selected = this.coachList.find(item => item.id === this.formData.coachUserId); const selected = this.coachList.find(item => item.id === this.formData.coachUserId);

View File

@ -12,7 +12,8 @@
<el-table-column label="科目" prop="subjectStr" align="center" width=""></el-table-column> <el-table-column label="科目" prop="subjectStr" align="center" width=""></el-table-column>
<el-table-column label="教练" align="center" width=""> <el-table-column label="教练" align="center" width="">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.coachId" placeholder="请选择" @change="handleChange(scope.row)"> <el-select v-model="scope.row.coachId" placeholder="请选择" :disabled="scope.row.disable"
@change="handleChange(scope.row)">
<el-option <el-option
v-for="item in scope.row.coachList" v-for="item in scope.row.coachList"
:key="item.coachId" :key="item.coachId"
@ -34,7 +35,8 @@
<script> <script>
import * as SchoolCourseOrderApi from '@/views/drivingSchool/DriveSchoolPay/api'; import * as SchoolCourseOrderApi from '@/views/drivingSchool/DriveSchoolPay/api';
import {getCoachByCourseId} from "@/views/drivingSchool/schoolCoachCourse/api/achoolCoachCourse"; import {getCoachByCourseId} from "@/views/drivingSchool/schoolCoachCourse/api/achoolCoachCourse";
import {saveProcess} from "@/views/drivingSchool/process/api"; import {getAllByUserIdAndCourseId, saveProcess} from "@/views/drivingSchool/process/api";
import {nextTick} from "vue";
export default { export default {
name: "AssignmentCoach", name: "AssignmentCoach",
@ -48,6 +50,7 @@ export default {
// 12 // 12
formLoading: false, formLoading: false,
process: [], process: [],
selectCoach: [],
// //
formRules: {}, formRules: {},
orderId: '', orderId: '',
@ -58,6 +61,7 @@ export default {
async open(data) { async open(data) {
this.dialogVisible = true; this.dialogVisible = true;
this.orderId = data.id this.orderId = data.id
await this.getAllByUserIdAndCourseId(data.userId, data.courseId)
this.getData(data) this.getData(data)
this.reset(); this.reset();
}, },
@ -101,6 +105,8 @@ export default {
for (let i = 1; i <= 4; i++) { for (let i = 1; i <= 4; i++) {
//ressubjecti //ressubjecti
const coachArr = res.data.filter(item => item.subject === i + '') const coachArr = res.data.filter(item => item.subject === i + '')
const item = { const item = {
subject: i, subject: i,
subjectStr: subjectArr[i - 1], subjectStr: subjectArr[i - 1],
@ -113,8 +119,10 @@ export default {
userId: data.userId, userId: data.userId,
userName: data.userName, userName: data.userName,
userMobile: data.userPhone, userMobile: data.userPhone,
status: 0 status: 0,
disable: false
} }
//dataidcoachArr //dataidcoachArr
if (data.coachUserId) { if (data.coachUserId) {
const selectedCoach = coachArr.find(item => item.coachId == data.coachUserId); const selectedCoach = coachArr.find(item => item.coachId == data.coachUserId);
@ -126,9 +134,35 @@ export default {
if (i === 1) { if (i === 1) {
item.status = 1 item.status = 1
} }
this.process.push(item)
//this.selectCoachisubject
if (this.selectCoach.some(item => item.subject == i)) {
const selectedCoach = this.selectCoach.find(item => item.subject == i)
const selectedCoachId = selectedCoach.coachId + ''
const selectedCoachName = selectedCoach.coachName
//
item.coachId = selectedCoachId
item.coachName = selectedCoachName
item.disable = true
//coachArrid
if (!coachArr.some(item => item.coachId == selectedCoachId)) {
// disabletrue
item.coachList.push(selectedCoach)
}
}
nextTick(() => {
this.$set(this.process, this.process.length, item)
})
} }
}, },
async getAllByUserIdAndCourseId(userId, courseId) {
const params = {
userId: userId,
courseId: courseId
}
const res = await getAllByUserIdAndCourseId(params)
this.selectCoach = res.data
},
handleChange(row) { handleChange(row) {
// //
//selectedCoachIdcoachListname //selectedCoachIdcoachListname

View File

@ -73,7 +73,7 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope"> <template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)">修改</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="openAssignmentCoach(scope.row)" v-if="scope.row.paymentStatus == 2 && scope.row.ifAssignmentCoach == 0">分配教练</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="openAssignmentCoach(scope.row)" v-if="scope.row.paymentStatus == 2 && scope.row.ifAssignmentCoach == 0 && scope.row.ifEnd == false">分配教练</el-button>
<el-button size="mini" type="text" icon="el-icon-close" @click="openEndOrder(scope.row)" v-if="scope.row.paymentStatus == 2 && scope.row.ifEnd == false">终止</el-button> <el-button size="mini" type="text" icon="el-icon-close" @click="openEndOrder(scope.row)" v-if="scope.row.paymentStatus == 2 && scope.row.ifEnd == false">终止</el-button>
<el-button size="mini" type="text" icon="el-icon-plus" @click="openAddForm(scope.row)" v-if="scope.row.paymentStatus == 2 && scope.row.ifEnd == true && scope.row.isCreated == false">快速创建订单</el-button> <el-button size="mini" type="text" icon="el-icon-plus" @click="openAddForm(scope.row)" v-if="scope.row.paymentStatus == 2 && scope.row.ifEnd == true && scope.row.isCreated == false">快速创建订单</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
@ -170,12 +170,10 @@ export default {
}, },
/** 分配教练*/ /** 分配教练*/
openAssignmentCoach(data) { openAssignmentCoach(data) {
console.log('data',data)
this.$refs["assignmentCoachRef"].open(data); this.$refs["assignmentCoachRef"].open(data);
}, },
/** 分配教练*/ /** 分配教练*/
openEndOrder(data) { openEndOrder(data) {
console.log('data',data)
this.$refs["endOrderRef"].open(data); this.$refs["endOrderRef"].open(data);
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */

View File

@ -51,3 +51,11 @@ export function saveProcess(data) {
data: data data: data
}) })
} }
// 根据用户id和课程id查询进度
export function getAllByUserIdAndCourseId(params) {
return request({
url: '/process/getAllByUserIdAndCourseId',
method: 'get',
params
})
}