fix 优化排课导出
This commit is contained in:
parent
9ce5530944
commit
e747323f26
@ -441,11 +441,12 @@ class TeacherScheduleTimeController extends Crud
|
||||
{
|
||||
try {
|
||||
$month = $request->get('month');
|
||||
$is_publish = $request->get('is_publish');
|
||||
$summary = \app\common\model\TeacherScheduleTime::order('ts.start_time asc')->alias('ts')
|
||||
->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('subject sb', 'ts.subject_id = sb.id')
|
||||
->where(['ts.is_publish' => 1, 'ts.month' => $month])
|
||||
->where(['ts.is_publish' => $is_publish, 'ts.month' => $month])
|
||||
->field('
|
||||
t.teacher_name,
|
||||
ts.time,
|
||||
@ -477,9 +478,10 @@ class TeacherScheduleTimeController extends Crud
|
||||
$worksheet->setCellValue('D1', 'UK Time');
|
||||
$worksheet->setCellValue('E1', 'Subject');
|
||||
$worksheet->setCellValue('F1', 'Tutor');
|
||||
$worksheet->setCellValue('G1', 'Duration');
|
||||
$worksheet->setCellValue('H1', 'Note');
|
||||
$worksheet->getStyle('A1:H1')->getFill()
|
||||
$worksheet->setCellValue('G1', 'Student');
|
||||
$worksheet->setCellValue('H1', 'Duration');
|
||||
$worksheet->setCellValue('I1', 'Note');
|
||||
$worksheet->getStyle('A1:I1')->getFill()
|
||||
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
|
||||
->getStartColor()->setRGB('4f81bd');
|
||||
|
||||
@ -504,6 +506,7 @@ class TeacherScheduleTimeController extends Crud
|
||||
$en_time = '';
|
||||
$subject_name = '';
|
||||
$teacher_name = '';
|
||||
$student_name = '';
|
||||
$hour = '';
|
||||
if (isset($export_data[$date])) {
|
||||
$merge_count = count($export_data[$date]);
|
||||
@ -513,6 +516,7 @@ class TeacherScheduleTimeController extends Crud
|
||||
$en_time = $schedule_time['en_time'];
|
||||
$subject_name = $schedule_time['english_name'];
|
||||
$teacher_name = $schedule_time['teacher_name'];
|
||||
$student_name = $schedule_time['student_name'];
|
||||
$hour = $schedule_time['hour'];
|
||||
}
|
||||
|
||||
@ -530,8 +534,9 @@ class TeacherScheduleTimeController extends Crud
|
||||
$worksheet->setCellValue('D' . $row, $en_time);
|
||||
$worksheet->setCellValue('E' . $row, $subject_name);
|
||||
$worksheet->setCellValue('F' . $row, $teacher_name);
|
||||
$worksheet->setCellValue('G' . $row, $hour);
|
||||
$worksheet->setCellValue('H' . $row, '');
|
||||
$worksheet->setCellValue('G' . $row, $student_name);
|
||||
$worksheet->setCellValue('H' . $row, $hour);
|
||||
$worksheet->setCellValue('I' . $row, '');
|
||||
}
|
||||
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
|
@ -29,7 +29,8 @@
|
||||
<!-- 表格行工具栏 -->
|
||||
<script type="text/html" id="table-bar">
|
||||
<!-- <button type="button" class="layui-btn layui-btn-xs" lay-event="edit" permission="app.admin.teacher.update">编辑</button>-->
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-bg-orange" lay-event="export_schedule" permission="app.admin.teacher.update">导出详情</button>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-bg-orange" lay-event="export_schedule" permission="app.admin.teacher.update">导出已发布</button>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-bg-orange" lay-event="export_unpublish_schedule" permission="app.admin.teacher.update">导出未发布</button>
|
||||
<!-- <button class="pear-btn pear-btn-xs tool-btn" lay-event="rest_password" permission="app.admin.teacher.update">重置密码</button>-->
|
||||
<!-- <button class="pear-btn pear-btn-xs tool-btn" lay-event="remove" permission="app.admin.teacher.delete">删除</button>-->
|
||||
</script>
|
||||
@ -169,6 +170,8 @@
|
||||
edit(obj);
|
||||
}else if (obj.event === "export_schedule") {
|
||||
export_schedule(obj);
|
||||
}else if (obj.event === "export_unpublish_schedule") {
|
||||
export_unpublish_schedule(obj);
|
||||
} else if (obj.event === "rest_password") {
|
||||
rest_password(obj);
|
||||
}
|
||||
@ -253,7 +256,34 @@
|
||||
let export_schedule = function(obj) {
|
||||
let month = obj.data['month'];
|
||||
layui.$.ajax({
|
||||
url: '/app/admin/teacherScheduleTime/exportSummary?month=' + month,
|
||||
url: '/app/admin/teacherScheduleTime/exportSummary?is_publish=1&month=' + month,
|
||||
type: "POST",
|
||||
dateType: "json",
|
||||
success: function (res) {
|
||||
if (res.code) {
|
||||
return layui.popup.failure(res.msg);
|
||||
}
|
||||
console.log(111,res.data)
|
||||
const link = document.createElement('a');
|
||||
link.style.display = 'none';
|
||||
// 设置下载地址
|
||||
link.setAttribute('href', res.data.file_url);
|
||||
// 设置文件名
|
||||
link.setAttribute('download', res.data.file_name);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
return layui.popup.success("操作成功", function () {
|
||||
parent.refreshTable();
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
});
|
||||
}
|
||||
});
|
||||
}// 老师课程安排
|
||||
let export_unpublish_schedule = function(obj) {
|
||||
let month = obj.data['month'];
|
||||
layui.$.ajax({
|
||||
url: '/app/admin/teacherScheduleTime/exportSummary?is_publish=0&month=' + month,
|
||||
type: "POST",
|
||||
dateType: "json",
|
||||
success: function (res) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user