mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-02 06:54:19 +00:00
no message
This commit is contained in:
parent
8b406c594b
commit
3e149ed3c2
@ -20,6 +20,7 @@ use App\Models\User;
|
||||
use App\Models\WebSocketDialog;
|
||||
use App\Module\Base;
|
||||
use App\Module\BillExport;
|
||||
use App\Module\BillMultipleExport;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Arr;
|
||||
use Madzipper;
|
||||
@ -1067,7 +1068,21 @@ class ProjectController extends AbstractController
|
||||
} elseif ($task->complete_at) {
|
||||
$statusText = '已完成';
|
||||
}
|
||||
$datas[] = [
|
||||
if (!isset($datas[$task->ownerid])) {
|
||||
$datas[$task->ownerid] = [
|
||||
'index' => 1,
|
||||
'nickname' => Base::filterEmoji(User::userid2nickname($task->ownerid)),
|
||||
'styles' => ["A1:P1" => ["font" => ["bold" => true]]],
|
||||
'data' => [],
|
||||
];
|
||||
}
|
||||
$datas[$task->ownerid]['index']++;
|
||||
if ($statusText === '未完成') {
|
||||
$datas[$task->ownerid]['styles']["P{$datas[$task->ownerid]['index']}"] = ["font" => ["color" => ["rgb" => "ff0000"]]]; // 未完成
|
||||
} elseif ($statusText === '已完成' && $task->end_at && Carbon::parse($task->complete_at)->gt($task->end_at)) {
|
||||
$datas[$task->ownerid]['styles']["P{$datas[$task->ownerid]['index']}"] = ["font" => ["color" => ["rgb" => "436FF6"]]]; // 已完成超期
|
||||
}
|
||||
$datas[$task->ownerid]['data'][] = [
|
||||
$task->id,
|
||||
$task->parent_id ?: '-',
|
||||
Base::filterEmoji($task->project?->name) ?: '-',
|
||||
@ -1087,6 +1102,19 @@ class ProjectController extends AbstractController
|
||||
];
|
||||
}
|
||||
});
|
||||
if (empty($datas)) {
|
||||
return Base::retError('没有任何数据');
|
||||
}
|
||||
//
|
||||
$sheets = [];
|
||||
foreach ($userid as $ownerid) {
|
||||
$data = $datas[$ownerid] ?? [
|
||||
'nickname' => Base::filterEmoji(User::userid2nickname($ownerid)),
|
||||
'styles' => ["A1:P1" => ["font" => ["bold" => true]]],
|
||||
'data' => [],
|
||||
];
|
||||
$sheets[] = BillExport::create()->setTitle($data['nickname'] ?: $ownerid)->setHeadings($headings)->setData($data['data'])->setStyles($data['styles']);
|
||||
}
|
||||
//
|
||||
$fileName = User::userid2nickname($userid[0]) ?: $userid[0];
|
||||
if (count($userid) > 1) {
|
||||
@ -1094,7 +1122,8 @@ class ProjectController extends AbstractController
|
||||
}
|
||||
$fileName .= '任务统计_' . Base::time() . '.xls';
|
||||
$filePath = "temp/task/export/" . date("Ym", Base::time());
|
||||
$res = BillExport::create()->setHeadings($headings)->setData($datas)->store($filePath . "/" . $fileName);
|
||||
$export = new BillMultipleExport($sheets);
|
||||
$res = $export->store($filePath . "/" . $fileName);
|
||||
if ($res != 1) {
|
||||
return Base::retError('导出失败,' . $fileName . '!');
|
||||
}
|
||||
|
||||
@ -849,9 +849,7 @@ class SystemController extends AbstractController
|
||||
$secondEnd = strtotime("2000-01-01 {$time[1]}") - strtotime("2000-01-01 00:00:00");
|
||||
//
|
||||
$headings = [];
|
||||
$headings[] = '成员ID';
|
||||
$headings[] = '成员名称';
|
||||
$headings[] = '成员邮箱';
|
||||
$headings[] = '签到人';
|
||||
$headings[] = '签到日期';
|
||||
$headings[] = '班次时间';
|
||||
$headings[] = '首次签到时间';
|
||||
@ -867,7 +865,8 @@ class SystemController extends AbstractController
|
||||
foreach ($users as $user) {
|
||||
$records = UserCheckinRecord::whereUserid($user->userid)->whereBetween("created_at", [$startD, $endD])->orderBy('id')->get();
|
||||
//
|
||||
$styles = ["A1:I1" => ["font" => ["bold" => true]]];
|
||||
$nickname = Base::filterEmoji($user->nickname);
|
||||
$styles = ["A1:G1" => ["font" => ["bold" => true]]];
|
||||
$datas = [];
|
||||
$startT = $startD->timestamp;
|
||||
$endT = $endD->timestamp;
|
||||
@ -888,25 +887,23 @@ class SystemController extends AbstractController
|
||||
$lastResult = "正常";
|
||||
if (empty($firstTimestamp)) {
|
||||
$firstResult = "缺卡";
|
||||
$styles["G{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]];
|
||||
$styles["E{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]];
|
||||
} elseif ($firstTimestamp > $startT + $secondStart) {
|
||||
$firstResult = "迟到";
|
||||
$styles["G{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]];
|
||||
$styles["E{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]];
|
||||
}
|
||||
if (empty($lastTimestamp)) {
|
||||
$lastResult = "缺卡";
|
||||
$styles["I{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]];
|
||||
$styles["G{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]];
|
||||
} elseif ($lastTimestamp < $startT + $secondEnd) {
|
||||
$lastResult = "早退";
|
||||
$styles["I{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]];
|
||||
$styles["G{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]];
|
||||
}
|
||||
}
|
||||
$firstTimestamp = $firstTimestamp ? date("H:i", $firstTimestamp) : "-";
|
||||
$lastTimestamp = $lastTimestamp ? date("H:i", $lastTimestamp) : "-";
|
||||
$datas[] = [
|
||||
$user->userid,
|
||||
$user->nickname,
|
||||
$user->email,
|
||||
"{$nickname} (ID: {$user->userid})",
|
||||
date("Y-m-d", $startT),
|
||||
implode("-", $time),
|
||||
$firstTimestamp,
|
||||
@ -916,7 +913,7 @@ class SystemController extends AbstractController
|
||||
];
|
||||
$startT += 86400;
|
||||
}
|
||||
$sheets[] = BillExport::create()->setTitle($user->nickname)->setHeadings($headings)->setData($datas)->setStyles($styles);
|
||||
$sheets[] = BillExport::create()->setTitle($nickname ?: $user->userid)->setHeadings($headings)->setData($datas)->setStyles($styles);
|
||||
}
|
||||
if (empty($sheets)) {
|
||||
return Base::retError('没有任何数据');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user