From 5979ce5abff605896c16214161449b909524e42c Mon Sep 17 00:00:00 2001 From: zhuyu Date: Mon, 26 May 2025 17:26:42 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/oa/Task.php | 18 ++- application/admin/lang/zh-cn/oa/task.php | 1 + .../admin/view/dashboard/task_complete.html | 9 +- application/admin/view/oa/task/review.html | 72 ++++++++++ public/assets/js/backend/oa/task.js | 131 +++++------------- 5 files changed, 127 insertions(+), 104 deletions(-) create mode 100644 application/admin/view/oa/task/review.html diff --git a/application/admin/controller/oa/Task.php b/application/admin/controller/oa/Task.php index 6f19cb2..13bae8b 100644 --- a/application/admin/controller/oa/Task.php +++ b/application/admin/controller/oa/Task.php @@ -140,18 +140,24 @@ class Task extends Backend $this->success(); } - public function review($ids) + public function review($ids = null) { + $row = $this->model->get($ids); + if (!$row) { + $this->error(__('No Results were found')); + } if (false === $this->request->isPost()) { - $this->error(__("Invalid parameters")); + $this->view->assign('row', $row); + return $this->view->fetch(); } - if (empty($ids)) { - $this->error(__('Parameter %s can not be empty', 'id')); + $params = $this->request->post('row/a'); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); } - $status = $this->request->post('status'); - $reason = $this->request->post('remark'); + $status = $params['status']; + $reason = $params['remark'] ?? ''; if ($status == 5) { if (empty($reason)) { diff --git a/application/admin/lang/zh-cn/oa/task.php b/application/admin/lang/zh-cn/oa/task.php index 2d44a1e..3455b6f 100644 --- a/application/admin/lang/zh-cn/oa/task.php +++ b/application/admin/lang/zh-cn/oa/task.php @@ -10,6 +10,7 @@ return [ 'Type 3' => '每月任务', 'Title' => '任务标题', 'Desc' => '任务描述', + 'Prove_desc' => '完成描述', 'Status' => '状态', 'Status 1' => '待完成', 'Set status to 1' => '设为待完成', diff --git a/application/admin/view/dashboard/task_complete.html b/application/admin/view/dashboard/task_complete.html index 1d8fd4f..6ea3c26 100644 --- a/application/admin/view/dashboard/task_complete.html +++ b/application/admin/view/dashboard/task_complete.html @@ -1,16 +1,15 @@
-

任务详情

- +
- {$row->title|htmlentities} +
- +
- {$row->desc|htmlentities} +
diff --git a/application/admin/view/oa/task/review.html b/application/admin/view/oa/task/review.html new file mode 100644 index 0000000..85fd17a --- /dev/null +++ b/application/admin/view/oa/task/review.html @@ -0,0 +1,72 @@ + + +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ {if $row.prove_file_path} + 预览 + {/if} +
+ +
+
+
+ + +
diff --git a/public/assets/js/backend/oa/task.js b/public/assets/js/backend/oa/task.js index 50bbaee..11a8189 100644 --- a/public/assets/js/backend/oa/task.js +++ b/public/assets/js/backend/oa/task.js @@ -33,25 +33,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'title', title: __('Title'), operate: 'LIKE'}, {field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5'),"6":__('Status 6')}, formatter: Table.api.formatter.status}, - { - field: 'buttons', - width: "120px", - title: __('附件'), - table: table, - events: Table.api.events.operate, - buttons: [ - { - name: 'detail', - text: __('查看附件'), - title: __('查看附件'), - classname: 'btn btn-xs btn-primary btn-preview', - extend: function(row) { - return 'data-type="' + row.filetype + '" data-url="' + row.url + '"'; - } - } - ], - formatter: Table.api.formatter.buttons - }, {field: 'prove_desc', title: __('Prove_desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'refuse_reason', title: __('Refuse_reason'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'expire_start_time', title: __('Expire_start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, @@ -60,79 +41,27 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, buttons:[ { - name: 'pass', - text:"通过", - title: '通过', - classname: 'btn btn-xs btn-success btn-click', - icon: 'fa fa-magic', - click: function (e, row) { - Layer.confirm("确定通过?", { - }, function (index) { - Fast.api.ajax({ - url: "oa/task/review/ids/"+ row.id, - data: {status:4} - }, function (data) { - Layer.closeAll(); - $(".btn-refresh").trigger("click"); - }); - layer.close(index); - }, function (index) { - layer.close(index); - }); - return false; - }, - - visible:function(row){ - if (row.status != 3) { - return false; - } - if (!Config.review) { - return false; - } - return true; - }, - }, - { - name: 'abort', - text:"驳回", - title: '驳回', - classname: 'btn btn-xs btn-info btn-click', - icon: 'fa fa-magic', - click: function (e, row) { - Layer.prompt({ - title: "填写驳回原因", - success: function (layero) { - $("input", layero).prop("placeholder", "填写驳回原因"); - } - }, function (value) { - Fast.api.ajax({ - url: "oa/task/review/ids/"+ row.id, - data: {status:5, remark: value}, - }, function (data, ret) { - Layer.closeAll(); - $(".btn-refresh").trigger("click"); - //return false; - }); - }); - return false; - }, - - visible:function(row){ - if (row.status != 3) { - return false; - } - if (!Config.review) { - return false; - } - return true; - }, + name: '审核', + title: __('审核'), + classname: 'btn btn-xs btn-primary btn-dialog', + icon: 'fa fa-list', + url: 'oa/task/review' } - ]} ] ] }); + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + review: function () { $(document).on('click', '.btn-preview', function (e) { e.preventDefault(); @@ -166,13 +95,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } }); - // 为表格绑定事件 - Table.api.bindevent(table); - }, - add: function () { - Controller.api.bindevent(); - }, - edit: function () { + // 点击通过按钮 + $("#btn-approve").click(function () { + $("#c-status").val("4"); + $("#review-form").submit(); // 提交表单 + }); + + // 点击驳回按钮,弹出 Layer.prompt 收理由 + $("#btn-reject").click(function () { + Layer.prompt({ + title: '请输入驳回理由', + formType: 2 // 多行输入框 + }, function (value, index) { + if (!value.trim()) { + Layer.msg("驳回理由不能为空"); + return; + } + $("#c-status").val("5"); + $("#reason").val(value.trim()); + $("#review-form").submit(); // 提交 + Layer.close(index); + }); + }); + Controller.api.bindevent(); }, api: {