From 94c3b86d1c8f30e5e01db306bfb0933f13c890fe Mon Sep 17 00:00:00 2001 From: zhuyu Date: Thu, 29 May 2025 18:17:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feature:=20=E5=B7=A5=E8=B5=84=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/oa/Task.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/controller/oa/Task.php b/application/admin/controller/oa/Task.php index c2a538c..6d85a19 100644 --- a/application/admin/controller/oa/Task.php +++ b/application/admin/controller/oa/Task.php @@ -107,7 +107,7 @@ class Task extends Backend $list[$k]['refuse_reason'] = $row['refuse_reason'] ?? ''; $list[$k]['fileurl'] = cdnurl($row['prove_file_path']); - $list[$k]['filetype'] = pathinfo($list[$k]['url'], PATHINFO_EXTENSION); + $list[$k]['filetype'] = pathinfo($list[$k]['fileurl'], PATHINFO_EXTENSION); } $result = array("total" => $list->total(), "rows" => $list->items()); From 3487f07a2c1548a238072dc24df7b085db8355a1 Mon Sep 17 00:00:00 2001 From: zhuyu Date: Fri, 30 May 2025 10:13:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feature:=20=E7=BB=93=E7=AE=97=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/salary/Detail.php | 48 ++++++++++++++++++- public/assets/js/backend/salary/detail.js | 35 ++++++++++++-- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/application/admin/controller/salary/Detail.php b/application/admin/controller/salary/Detail.php index 65432c5..aeab20d 100644 --- a/application/admin/controller/salary/Detail.php +++ b/application/admin/controller/salary/Detail.php @@ -103,13 +103,24 @@ class Detail extends Backend $queryRes[$targetAdminId][$itemId] = $queryDatum['item_value']; } + $querySettleData = Db::name('salary_settle') + ->whereIn('target_admin_id', $adminIds) + ->where('salary_month', '=', $month) + ->field('id,target_admin_id,settle_status') + ->select(); + $querySettleRes = []; + foreach ($querySettleData as $querySettleDatum) { + $targetAdminId = $querySettleDatum['target_admin_id']; + $querySettleRes[$targetAdminId] = $querySettleDatum['settle_status']; + } + foreach ($adminIds as $adminId) { $attrValue = []; $total = 0; foreach ($items as $item) { - $res[$adminId]['admin_id'] = $adminId; + $res[$adminId]['target_admin_id'] = $adminId; $res[$adminId]['name'] = $adminNames[$adminId]; $res[$adminId]['month'] = $month; @@ -132,6 +143,7 @@ class Detail extends Backend $jxTotal = ($attrValue['ZWJX'] - $attrValue['YYCB']) * $attrValue['TD'] / 100; $res[$adminId]['jx_total'] = $this->clean_number($jxTotal); $res[$adminId]['total'] = $this->clean_number($total + $jxTotal); + $res[$adminId]['settle_status'] = $querySettleRes[$adminId] ?? 0; } $res = array_values($res); @@ -297,4 +309,38 @@ class Detail extends Backend } + public function settle() + { + if (false === $this->request->isPost()) { + $this->error(__("Invalid parameters")); + } + + $targetAdminId = $this->request->get('target_admin_id'); + $month = $this->request->get('month'); + + + $settle = Db::name('salary_settle') + ->where('salary_month', $month) + ->where('target_admin_id', $targetAdminId) + ->field('target_admin_id,salary_month')->find(); + if (!empty($settle)) { + Db::name('salary_settle') + ->where('salary_month', $month) + ->where('target_admin_id', $targetAdminId) + ->save([ + 'settle_status' => 1, + ]); + $this->success(); + } + + Db::name('salary_settle')->insert([ + 'target_admin_id' => $targetAdminId, + 'salary_month' => $month, + 'settle_status' => 1, + ]); + + $this->success(); + } + + } diff --git a/public/assets/js/backend/salary/detail.js b/public/assets/js/backend/salary/detail.js index b3e40bd..faa3077 100644 --- a/public/assets/js/backend/salary/detail.js +++ b/public/assets/js/backend/salary/detail.js @@ -87,15 +87,44 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin { name: 'custom_edit', text: '编辑', - title: '编辑薪资', + title: '编辑', classname: 'btn btn-xs btn-success btn-dialog', icon: 'fa fa-edit', url: function (row) { // 注意这里拼接 admin_id 和 month - return 'salary/detail/custom_edit?target_admin_id=' + row.admin_id + '&month=' + row.month; + return 'salary/detail/custom_edit?target_admin_id=' + row.target_admin_id + '&month=' + row.month; }, extend: 'data-area=\'["800px", "600px"]\'', - } + }, + { + name: 'complete', + text:"结算", + title:"结算", + extend: 'data-toggle="tooltip" data-container="body"', + classname: 'btn btn-xs btn-success btn-magic btn-ajax', + icon: 'fa fa-cny', + url: function (row) { + // 注意这里拼接 admin_id 和 month + return 'salary/detail/settle?target_admin_id=' + row.target_admin_id + '&month=' + row.month; + }, + confirm: '确认结算?', + refresh: true, + success: function (data, ret) { + $("#table").bootstrapTable('refresh'); + return false; + }, + error: function (data, ret) { + Layer.alert(ret.msg); + return false; + }, + visible: function (row) { + //返回true时按钮显示,返回false隐藏 + if (row.settle_status != 1) { + return true; + } + return false; + } + }, ], events: Table.api.events.operate, formatter: Table.api.formatter.operate