diff --git a/app/Http/Controllers/Api/ReportController.php b/app/Http/Controllers/Api/ReportController.php index 986979fd5..fe8b08ce9 100755 --- a/app/Http/Controllers/Api/ReportController.php +++ b/app/Http/Controllers/Api/ReportController.php @@ -392,6 +392,48 @@ class ReportController extends AbstractController return Base::retSuccess("success", $one); } + /** + * @api {get} api/report/mark 05. 标记已读/未读 + * + * @apiVersion 1.0.0 + * @apiGroup report + * @apiName mark + * + * @apiParam {Number} id 报告id(组) + * @apiParam {Number} action 操作 + * - read: 标记已读(默认) + * - unread: 标记未读 + * + * @apiSuccess {Number} ret 返回状态码(1正确、0错误) + * @apiSuccess {String} msg 返回信息(错误描述) + * @apiSuccess {Object} data 返回数据 + */ + public function mark(): array + { + $user = User::auth(); + // + $id = Request::input('id'); + $action = Request::input('action'); + // + if (is_array($id)) { + if (count(Base::arrayRetainInt($id)) > 100) { + return Base::retError("最多只能操作100条数据"); + } + $builder = Report::whereIn("id", Base::arrayRetainInt($id)); + } else { + $builder = Report::whereId(intval($id)); + } + $builder ->chunkById(100, function ($list) use ($action, $user) { + /** @var Report $item */ + foreach ($list as $item) { + $item->receivesUser()->updateExistingPivot($user->userid, [ + "read" => $action === 'unread' ? 0 : 1, + ]); + } + }); + return Base::retSuccess("操作成功"); + } + /** * @api {get} api/report/last_submitter 06. 获取最后一次提交的接收人 * diff --git a/resources/assets/js/pages/manage/components/Report.vue b/resources/assets/js/pages/manage/components/Report.vue index 2db4e43fe..76127a575 100644 --- a/resources/assets/js/pages/manage/components/Report.vue +++ b/resources/assets/js/pages/manage/components/Report.vue @@ -5,7 +5,7 @@ - + - +
+ +
+ + +
+ + +
diff --git a/resources/assets/sass/pages/common.scss b/resources/assets/sass/pages/common.scss index 2f56c14c2..682de0dff 100755 --- a/resources/assets/sass/pages/common.scss +++ b/resources/assets/sass/pages/common.scss @@ -528,6 +528,27 @@ body { text-align: center; margin-top: 20px; } + + .table-attach { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + margin-top: 20px; + .select-box { + margin-right: 12px; + .ivu-select { + width: auto; + max-width: 200px; + margin-right: 3px; + } + } + .ivu-page { + padding: 0; + margin-top: 0; + margin-left: 12px; + } + } } .page-container {