diff --git a/app/Admin/Controllers/KeywordController.php b/app/Admin/Controllers/KeywordController.php index f6e7748..34bec7d 100644 --- a/app/Admin/Controllers/KeywordController.php +++ b/app/Admin/Controllers/KeywordController.php @@ -37,7 +37,7 @@ class KeywordController extends AdminController TableColumn::make()->name('key')->label('KEY'), TableColumn::make()->name('value')->label('值'), TableColumn::make()->name('created_at')->label('创建时间')->type('datetime')->sortable(true), - $this->rowActionsOnlyEditAndDelete(true), + // $this->rowActionsOnlyEditAndDelete(true), ]); return $this->baseList($crud); diff --git a/app/Admin/Controllers/WarningNoticeController.php b/app/Admin/Controllers/WarningNoticeController.php index 7a9c795..601997f 100644 --- a/app/Admin/Controllers/WarningNoticeController.php +++ b/app/Admin/Controllers/WarningNoticeController.php @@ -35,6 +35,9 @@ class WarningNoticeController extends AdminController TableColumn::make()->name('status')->label('状态')->type('mapping')->map(WarningNotice::stateMapLabel())->className('text-primary'), TableColumn::make()->name('created_at')->label('报警时间')->type('datetime')->sortable(true), + amisMake()->Operation()->label(__('admin.actions'))->buttons([ + $this->updateState()->visibleOn('${status == 0}'), + ]), ]); return $this->baseList($crud); @@ -53,9 +56,21 @@ class WarningNoticeController extends AdminController ]); } + private function updateState(){ + return amisMake()->AjaxAction() + ->label('标记处理') + ->level('link') + ->confirmText('是否确认标记处理') + ->api('put:'.admin_url('warning-notice-mark').'/${id}'); + } + //标记已处理警报内容; - public function updateNotice() + public function updateNotice($id) { + $rows = WarningNotice::where('id', $id)->update([ + 'status'=> 1 + ]); + return $this->autoResponse($rows, '保存成功'); } } \ No newline at end of file diff --git a/app/Admin/routes.php b/app/Admin/routes.php index 69fbe8d..81ff341 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -56,6 +56,7 @@ Route::group([ $router->get('warning-setting', '\App\Admin\Controllers\WarningSettingController@settingIndex'); $router->post('warning-setting-save', '\App\Admin\Controllers\WarningSettingController@saveSettingConfig'); $router->get('warning-notice', '\App\Admin\Controllers\WarningNoticeController@index'); + $router->put('warning-notice-mark/{id}', '\App\Admin\Controllers\WarningNoticeController@updateNotice'); //监测点位 $router->resource('monitor-modes', \App\Admin\Controllers\MonitorModeController::class);