feature: schedule

This commit is contained in:
zhuyu 2025-05-21 17:04:52 +08:00
parent 905e6091ca
commit db33a9b225
2 changed files with 24 additions and 5 deletions

View File

@ -93,7 +93,13 @@ class Schedule extends Backend
}
$res = [];
$admins = Db::name('admin')->field('id,nickname')->select();
if (!$this->auth->isSuperAdmin()) {
$admins = Db::name('admin')->where('id', $this->auth->id)->field('id,nickname')->select();
} else{
$admins = Db::name('admin')->field('id,nickname')->select();
}
$admins = array_column($admins, NULL, 'id');
$adminIds = array_keys($admins);
@ -111,19 +117,25 @@ class Schedule extends Backend
$res[$adminId][$tmpDate] = '无';
$res[$adminId]['admin_id'] = $adminId;
$res[$adminId]['name'] = $adminNames[$adminId];
$res[$adminId]['editable'] = $this->auth->isSuperAdmin() ? 1 : 0;
}
$dates[] = $tmpDate;
$tmpDate = date('Y-m-d', strtotime($tmpDate) + 86400);
}
$queryData = $this->model
$builder = $this->model
->with([
'admin'
])
->where('date', '>=', $startDate)
->where('date', '<=', $endDate)
->select();
->where('date', '<=', $endDate);
if (!$this->auth->isSuperAdmin()) {
$builder = $builder->where('exec_admin_id', $this->auth->id);
}
$queryData = $builder->select();
foreach ($queryData as $queryDatum) {
$queryDatum = $queryDatum->toArray();

View File

@ -86,7 +86,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'editable'], function
{value: '中班', text: '中班'},
{value: '晚班', text: '晚班'},
{value: '行政班', text: '行政班'},
]
],
noeditFormatter: function (value, row, index) {
if (row.editable === 1) {
return false;
} else {
return value;
}
},
}
});
}