From c7b76e1009f9ed8bdf1d707492ccdedd0d7c7d2d Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 18 Sep 2022 19:18:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E4=BD=9C=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=B9=E9=87=8F=E6=A0=87=E8=AE=B0=E5=B7=B2?= =?UTF-8?q?=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/ReportController.php | 42 +++++++++ .../js/pages/manage/components/Report.vue | 6 +- .../pages/manage/components/ReportReceive.vue | 92 ++++++++++++++++--- resources/assets/sass/pages/common.scss | 21 +++++ 4 files changed, 146 insertions(+), 15 deletions(-) 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 {