feature: dashboard

This commit is contained in:
zhuyu 2025-05-22 15:52:45 +08:00
parent 371703296c
commit 4f29e8bf82
3 changed files with 150 additions and 11 deletions

View File

@ -3,6 +3,8 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\model\Admin; use app\admin\model\Admin;
use app\admin\model\kpi\Template;
use app\admin\model\oa\Task;
use app\admin\model\User; use app\admin\model\User;
use app\common\controller\Backend; use app\common\controller\Backend;
use app\common\model\Attachment; use app\common\model\Attachment;
@ -108,9 +110,44 @@ class Dashboard extends Backend
public function task() public function task()
{ {
$a = []; $dayTasks = (new Task())
->where('exec_admin_id','=',$this->auth->id)
->where('type','=',1)
->select();
$this->assignconfig('a', $a); $weekTasks = (new Task())
->where('exec_admin_id','=',$this->auth->id)
->where('type','=',2)
->select();
$monthTasks = (new Task())
->where('exec_admin_id','=',$this->auth->id)
->where('type','=',3)
->select();
$this->view->assign('day', $dayTasks);
$this->view->assign('week', $weekTasks);
$this->view->assign('month', $monthTasks);
return $this->view->fetch();
}
public function kpi()
{
$groupIds = $this->auth->getGroupIds();
$groupId = $groupIds[0] ?? 0;
$kpiTemplate = (new Template())
->where('group_id','=', 6)
->with('kpiitem')
->find();
$kpiItems = $kpiTemplate['kpiitem'];
$this->view->assign('kpi_template', $kpiTemplate);
$this->view->assign('kpi_items', $kpiItems);
return $this->view->fetch(); return $this->view->fetch();
} }

View File

@ -0,0 +1,33 @@
<style>
</style>
<div class="row">
<h2>{$kpi_template->name|htmlentities}</h2>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>指标名称</th>
<th>目标值</th>
<th>目标值(单位)</th>
<th>指标描述</th>
<th>权重</th>
</tr>
</thead>
<tbody>
{foreach $kpi_items as $key => $item}
<tr>
<td>{$item->name|htmlentities}</td>
<td>{$item->target_value|htmlentities}</td>
<td>{$item->unit_text|htmlentities}</td>
<td>{$item->desc|htmlentities}</td>
<td>{$item->pivot->rate|htmlentities}</td>
</tr>
{/foreach}
</tbody>
</table>
<div class="row">
</div>

View File

@ -1,14 +1,83 @@
<style> <style>
.note-card {
width: 30%;
min-height: 150px;
border-radius: 8px;
padding: 1rem;
box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
margin: 1rem;
}
.note-container {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.bg-orange {
background-color: #ff8c42;
}
.bg-blue {
background-color: #4682b4;
}
.bg-purple {
background-color: #8a2be2;
}
.note-header {
background-color: white;
color: #000; /* ✅ 加这一行,确保文字是黑色的 */
text-align: center;
padding: 0.5rem;
font-weight: bold;
border-bottom: 1px solid #f0e68c;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
.note-title {
font-size: 2.4rem;
font-weight: bold;
margin: 0.3rem 0 0.1rem;
}
.note-desc {
font-size: 1.9rem;
margin: 0 0 0.6rem;
}
</style> </style>
<div class="row">
<div class="col"> <div>
每日任务 <h2>任务看板</h2>
</div>
<div class="container mt-5">
<div class="note-container">
<div class="note-card bg-orange">
<h3 class="note-header">每日任务</h3>
{foreach $day as $item}
<p class="note-title">{$item->title}</p>
<p class="note-desc">{$item->desc}</p>
<br>
{/foreach}
</div> </div>
<div class="col"> <div class="note-card bg-blue">
每周任务 <h3 class="note-header">每周任务</h3>
{foreach $week as $item}
<p class="note-title">{$item->title}</p>
<p class="note-desc">{$item->desc}</p>
<br>
{/foreach}
</div>
<div class="note-card bg-purple">
<h3 class="note-header">每月任务</h3>
{foreach $month as $item}
<p class="note-title">{$item->title}</p>
<p class="note-desc">{$item->desc}</p>
<br>
{/foreach}
</div> </div>
<div class="col">
每月任务
</div> </div>
</div> </div>