From 7cbf0c5a018e446b698a0d7d89f385e445a91b49 Mon Sep 17 00:00:00 2001 From: zhuyu Date: Thu, 29 May 2025 15:42:23 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E5=B7=A5=E8=B5=84=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/salary/Detail.php | 15 ++++++++++++++- .../admin/view/salary/detail/custom_add.html | 18 ++++++++++++------ .../admin/view/salary/detail/custom_edit.html | 4 ++-- .../admin/view/salary/detail/custom_index.html | 6 ++++++ public/assets/js/backend/salary/detail.js | 3 +-- 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/application/admin/controller/salary/Detail.php b/application/admin/controller/salary/Detail.php index fcbdd29..d2d7f6f 100644 --- a/application/admin/controller/salary/Detail.php +++ b/application/admin/controller/salary/Detail.php @@ -164,8 +164,21 @@ class Detail extends Backend if (false === $this->request->isPost()) { - $items = Db::name('salary_item')->field('id,name')->select(); + $items = Db::name('salary_item')->field('id,type,name')->select(); + $typeMap = [ + 1 => '应发工资', + 2 => '应扣款项', + 3 => '其他' + ]; + $groupedItems = []; + foreach ($items as $item) { + $type = $item['type']; + $label = $typeMap[$type]; + $groupedItems[$label][] = $item; + } + + $this->view->assign('groupedItems', $groupedItems); $this->view->assign('items', $items); return $this->view->fetch(); } diff --git a/application/admin/view/salary/detail/custom_add.html b/application/admin/view/salary/detail/custom_add.html index 74b4e6a..25e6326 100644 --- a/application/admin/view/salary/detail/custom_add.html +++ b/application/admin/view/salary/detail/custom_add.html @@ -12,13 +12,19 @@ - {foreach $items as $item} -
- -
- -
+ {foreach $groupedItems as $groupName => $group} +
+
+ + {foreach $group as $index => $item} + {if $index % 2 == 0}
{/if} + +
+ +
+ {if $index % 2 == 1 || $index == count($group) - 1}
{/if} + {/foreach} {/foreach}