From 7e535c03b0072880789eaaf0f03b86cbf716f772 Mon Sep 17 00:00:00 2001 From: zhuyu Date: Sun, 30 Mar 2025 17:59:00 +0800 Subject: [PATCH] feature: task --- application/admin/controller/oa/Task.php | 66 ++++++++++++++ application/admin/lang/zh-cn/oa/task.php | 7 +- application/admin/model/oa/Task.php | 2 +- application/admin/view/oa/task/add.html | 43 ---------- application/admin/view/oa/task/edit.html | 66 -------------- public/assets/js/backend/oa/schedule.js | 18 +--- public/assets/js/backend/oa/task.js | 105 +++++++++++++++++++---- 7 files changed, 158 insertions(+), 149 deletions(-) diff --git a/application/admin/controller/oa/Task.php b/application/admin/controller/oa/Task.php index 7ed0e46..4465789 100644 --- a/application/admin/controller/oa/Task.php +++ b/application/admin/controller/oa/Task.php @@ -69,4 +69,70 @@ class Task extends Backend return $this->view->fetch(); } + public function complete($ids) + { + if (false === $this->request->isPost()) { + $this->error(__("Invalid parameters")); + } + + if (empty($ids)) { + $this->error(__('Parameter %s can not be empty', 'id')); + } + + $task = $this->model->where('id', '=', $ids)->where('status', 1)->find(); + + if (!$task) { + $this->error('任务状态已变更,请刷新后操作'); + } + $task->save(['status' => 3]); + + $this->success(); + } + + public function pass($ids) + { + if (false === $this->request->isPost()) { + $this->error(__("Invalid parameters")); + } + + if (empty($ids)) { + $this->error(__('Parameter %s can not be empty', 'id')); + } + + $task = $this->model->where('id', '=', $ids)->where('status', 3)->find(); + + if (!$task) { + $this->error('任务状态已变更,请刷新后操作'); + } + $task->save(['status' => 4]); + + $this->success(); + } + + public function abort($ids) + { + if (false === $this->request->isPost()) { + $this->error(__("Invalid parameters")); + } + + if (empty($ids)) { + $this->error(__('Parameter %s can not be empty', 'id')); + } + + $reason = $this->request->post('remark'); + if (empty($reason)) { + $this->error('驳回原因不能为空'); + } + + $task = $this->model->where('id', '=', $ids)->where('status', 3)->find(); + + if (!$task) { + $this->error('任务状态已变更,请刷新后操作'); + } + $task->save(['status' => 5, 'refuse_reason' => $reason]); + + $this->success(); + } + + } diff --git a/application/admin/lang/zh-cn/oa/task.php b/application/admin/lang/zh-cn/oa/task.php index 08c8b86..ba93a5b 100644 --- a/application/admin/lang/zh-cn/oa/task.php +++ b/application/admin/lang/zh-cn/oa/task.php @@ -3,7 +3,7 @@ return [ 'Id' => 'ID', 'Admin_id' => '创建人id', - 'Exec_admin_id' => '执行人id', + 'Review_admin_id' => '审核人id', 'Type' => '任务类型', 'Type 1' => '每日任务', 'Type 2' => '每周任务', @@ -21,8 +21,8 @@ return [ 'Set status to 4' => '设为已通过', 'Status 5' => '已驳回', 'Set status to 5' => '设为已驳回', - 'Status 6' => '未执行', - 'Set status to 6' => '设为未执行', + 'Status 6' => '待执行', + 'Set status to 6' => '设为待执行', 'Refuse_reason' => '驳回原因', 'Expire_start_time' => '有效期开始时间', 'Expire_end_time' => '有效期结束时间', @@ -34,6 +34,7 @@ return [ 'Admin.nickname' => '昵称', 'Admin.password' => '密码', 'Admin.salt' => '密码盐', + 'Admin.area_ids' => '地区ID,英文逗号分隔', 'Admin.avatar' => '头像', 'Admin.email' => '电子邮箱', 'Admin.mobile' => '手机号码', diff --git a/application/admin/model/oa/Task.php b/application/admin/model/oa/Task.php index 43fa03e..c536521 100644 --- a/application/admin/model/oa/Task.php +++ b/application/admin/model/oa/Task.php @@ -62,6 +62,6 @@ class Task extends Model public function admin() { - return $this->belongsTo('app\admin\model\Admin', 'exec_admin_id', 'id', [], 'LEFT')->setEagerlyType(0); + return $this->belongsTo('app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0); } } diff --git a/application/admin/view/oa/task/add.html b/application/admin/view/oa/task/add.html index 175f2ee..3ddd5c7 100644 --- a/application/admin/view/oa/task/add.html +++ b/application/admin/view/oa/task/add.html @@ -1,11 +1,4 @@
- -
- -
- -
-
@@ -30,24 +23,6 @@
-
- -
- -
- {foreach name="statusList" item="vo"} - - {/foreach} -
- -
-
-
- -
- -
-
@@ -60,24 +35,6 @@
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-