fix 教师时间导出添加单个教师筛选
This commit is contained in:
parent
88dcf90c04
commit
7b97647c7e
@ -495,7 +495,11 @@ class TeacherScheduleTimeController extends Crud
|
|||||||
*/
|
*/
|
||||||
public function exportScheduleIndex(Request $request)
|
public function exportScheduleIndex(Request $request)
|
||||||
{
|
{
|
||||||
return view('teacher-schedule-time/export_schedule_index');
|
|
||||||
|
//获取所有老师
|
||||||
|
$teacher = Teacher::order('id asc')->field('id,teacher_name,account')->select()->toArray();
|
||||||
|
|
||||||
|
return view('teacher-schedule-time/export_schedule_index', [ 'teacher' => $teacher]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -509,9 +513,13 @@ class TeacherScheduleTimeController extends Crud
|
|||||||
|
|
||||||
$summary = \app\common\model\TeacherScheduleTime::order('ts.month desc')->alias('ts')
|
$summary = \app\common\model\TeacherScheduleTime::order('ts.month desc')->alias('ts')
|
||||||
->leftJoin('teacher t', 'ts.teacher_id = t.id')
|
->leftJoin('teacher t', 'ts.teacher_id = t.id')
|
||||||
->leftJoin('student_schedule ss', 'ts.id = ss.teacher_schedule_time_id and t.id = ss.teacher_id')
|
->leftJoin('student_schedule ss', 'ts.id = ss.teacher_schedule_time_id and t.id = ss.teacher_id');
|
||||||
|
|
||||||
|
if($request->get('teacher_id')){
|
||||||
|
$summary->where('ts.teacher_id', $request->get('teacher_id'));
|
||||||
|
}
|
||||||
// ->where(['ts.is_publish' => 1])
|
// ->where(['ts.is_publish' => 1])
|
||||||
->field('
|
$summary->field('
|
||||||
ts.month,
|
ts.month,
|
||||||
COUNT(DISTINCT ts.teacher_id) AS teacher_count,
|
COUNT(DISTINCT ts.teacher_id) AS teacher_count,
|
||||||
|
|
||||||
@ -562,6 +570,8 @@ class TeacherScheduleTimeController extends Crud
|
|||||||
try {
|
try {
|
||||||
$month = $request->get('month');
|
$month = $request->get('month');
|
||||||
$is_publish = $request->get('is_publish');
|
$is_publish = $request->get('is_publish');
|
||||||
|
|
||||||
|
|
||||||
$summary = \app\common\model\TeacherScheduleTime::order('ts.start_time asc')->alias('ts')
|
$summary = \app\common\model\TeacherScheduleTime::order('ts.start_time asc')->alias('ts')
|
||||||
->leftJoin('teacher t', 'ts.teacher_id = t.id')
|
->leftJoin('teacher t', 'ts.teacher_id = t.id')
|
||||||
->leftJoin('student_schedule ss', 'ts.id = ss.teacher_schedule_time_id and t.id = ss.teacher_id')
|
->leftJoin('student_schedule ss', 'ts.id = ss.teacher_schedule_time_id and t.id = ss.teacher_id')
|
||||||
@ -580,8 +590,11 @@ class TeacherScheduleTimeController extends Crud
|
|||||||
sb.english_name,
|
sb.english_name,
|
||||||
ss.student_name
|
ss.student_name
|
||||||
')
|
')
|
||||||
->group('ts.id')
|
->group('ts.id');
|
||||||
->select()->toArray();
|
if($request->get('teacher_id')){
|
||||||
|
$summary->where('ts.teacher_id', $request->get('teacher_id'));
|
||||||
|
}
|
||||||
|
$summary->select()->toArray();
|
||||||
|
|
||||||
$export_data = [];
|
$export_data = [];
|
||||||
foreach ($summary as $item) {
|
foreach ($summary as $item) {
|
||||||
@ -595,7 +608,7 @@ class TeacherScheduleTimeController extends Crud
|
|||||||
$worksheet->setCellValue('A1', 'Week');
|
$worksheet->setCellValue('A1', 'Week');
|
||||||
$worksheet->setCellValue('B1', 'Date');
|
$worksheet->setCellValue('B1', 'Date');
|
||||||
$worksheet->setCellValue('C1', 'China TIme');
|
$worksheet->setCellValue('C1', 'China TIme');
|
||||||
$worksheet->setCellValue('D1', 'UK Time');
|
$worksheet->setCellValue('D1', 'Local Time(Tutor)');
|
||||||
$worksheet->setCellValue('E1', 'Subject');
|
$worksheet->setCellValue('E1', 'Subject');
|
||||||
$worksheet->setCellValue('F1', 'Tutor');
|
$worksheet->setCellValue('F1', 'Tutor');
|
||||||
$worksheet->setCellValue('G1', 'Student');
|
$worksheet->setCellValue('G1', 'Student');
|
||||||
|
@ -9,6 +9,43 @@
|
|||||||
</head>
|
</head>
|
||||||
<body class="pear-container">
|
<body class="pear-container">
|
||||||
|
|
||||||
|
<!-- 顶部查询表单 -->
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<form class="layui-form top-search-from">
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">教师</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<select lay-search="" name="teacher_id" id="teacher_id">
|
||||||
|
<option value="">请选择或搜索</option>
|
||||||
|
{foreach $teacher as $item}
|
||||||
|
<option value="{$item['id']}">{$item['teacher_name']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="layui-form-item layui-inline">
|
||||||
|
<label class="layui-form-label"></label>
|
||||||
|
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="table-query">
|
||||||
|
<i class="layui-icon layui-icon-search"></i>查询
|
||||||
|
</button>
|
||||||
|
<button type="reset" class="pear-btn pear-btn-md" lay-submit lay-filter="table-reset">
|
||||||
|
<i class="layui-icon layui-icon-refresh"></i>重置
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-btn">
|
||||||
|
<a class="layui-hide">展开<i class="layui-icon layui-icon-down"></i></a>
|
||||||
|
<a class="layui-hide">收起<i class="layui-icon layui-icon-up"></i></a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 数据表格 -->
|
<!-- 数据表格 -->
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
@ -255,8 +292,9 @@
|
|||||||
// 老师课程安排
|
// 老师课程安排
|
||||||
let export_schedule = function(obj) {
|
let export_schedule = function(obj) {
|
||||||
let month = obj.data['month'];
|
let month = obj.data['month'];
|
||||||
|
let teacher_id = layui.$('#teacher_id').val();
|
||||||
layui.$.ajax({
|
layui.$.ajax({
|
||||||
url: '/app/admin/teacherScheduleTime/exportSummary?is_publish=1&month=' + month,
|
url: '/app/admin/teacherScheduleTime/exportSummary?is_publish=1&month=' + month +'&teacher_id=' + teacher_id,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dateType: "json",
|
dateType: "json",
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user