This commit is contained in:
Dai 2024-09-22 21:53:31 +08:00
parent 1388426e54
commit 4632ef10d4
2 changed files with 16 additions and 4 deletions

View File

@ -58,18 +58,22 @@ class TeacherScheduleTimeController extends BaseController
$month = date('Y-m', strtotime($request_data['date']));
$student_schedule = TeacherScheduleTime::where(['teacher_id' => $request->teacher->id, 'is_publish' => 1])
->where(['month' => $month])
->with(['teacher', 'subject', 'studentSchedule'])
->with(['teacher', 'subject', 'oneStudentSchedule'])
->order('start_time asc')
->select()->toArray();
print '<pre>';
print_r($student_schedule);
die;
$array = [];
$stu_nmae = '';
foreach ($student_schedule as $k => &$v) {
if ($v['studentSchedule']) {
foreach ($v['studentSchedule'] as $k1 => $v1) {
if ($v['oneStudentSchedule']) {
foreach ($v['oneStudentSchedule'] as $k1 => $v1) {
if ($v1['is_publish']) {
$student[] = $v1['student_name'];
}
@ -110,7 +114,7 @@ class TeacherScheduleTimeController extends BaseController
'row_hight' => 30,//每行数据行高
'filed_id_width' => 60,//序号列的宽度
'filed_name_width' => 120,//玩家名称的宽度
'filed_data_width' => 120,//数据列的宽度
'filed_data_width' => 220,//数据列的宽度
'table_header' => ['', 'Week', 'Date', 'Time', 'Subject', 'Teacher', 'Student', 'Duration'],//表头文字
'column_text_offset_arr' => [45, 70, 70, 90, 55, 65, 65, 65],//表头文字左偏移量
'row_text_offset_arr' => [50, 110, 90, 110, 90, 90, 90, 90],//数据列文字左偏移量

View File

@ -53,6 +53,14 @@ class TeacherScheduleTime extends BaseModel
{
return $this->hasMany(StudentSchedule::class, 'teacher_schedule_time_id', 'id');
}
/**
* @desc 安排学生
* @return \think\model\relation\HasMany
*/
public function oneStudentSchedule()
{
return $this->hasOne(StudentSchedule::class, 'teacher_schedule_time_id', 'id');
}
public function studentScheduleOne1()
{