From 92f806a0ae3de9be6e917d0670ae9ded8a227068 Mon Sep 17 00:00:00 2001 From: sven <121642038@qq.com> Date: Wed, 4 Dec 2019 10:31:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=9A=84=E8=BF=AD=E4=BB=A3=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ctrl/Agile.php | 21 +++++++------ app/public/dev/js/project/sprint.js | 36 ++++++++++------------- app/view/twig/project/setting_sprint.twig | 2 -- 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/app/ctrl/Agile.php b/app/ctrl/Agile.php index 2f11d567f..31f57b7b0 100644 --- a/app/ctrl/Agile.php +++ b/app/ctrl/Agile.php @@ -246,7 +246,6 @@ public function fetchClosedIssuesByProject() $this->ajaxSuccess('success', $data); } - /** * 获取项目中的迭代列表 * @throws \Exception @@ -356,9 +355,9 @@ public function addSprint() $notifyLogic = new NotifyLogic(); $notifyLogic->send(NotifyLogic::NOTIFY_FLAG_SPRINT_CREATE, $projectId, $msg); - $this->ajaxSuccess('ok'); + $this->ajaxSuccess('提示','操作成功'); } else { - $this->ajaxFailed('服务器错误', $msg); + $this->ajaxFailed('提示','服务器错误:'. $msg); } } @@ -406,7 +405,7 @@ public function updateSprint() } } if (!$changed) { - $this->ajaxSuccess('ok'); + $this->ajaxSuccess('提示','操作成功'); return; } list($ret, $msg) = $sprintModel->updateItem($sprintId, $info); @@ -418,9 +417,9 @@ public function updateSprint() $activityInfo['obj_id'] = $sprintId; $activityInfo['title'] = $info['name']; $activityModel->insertItem(UserAuth::getId(), $sprint['project_id'], $activityInfo); - $this->ajaxSuccess('ok'); + $this->ajaxSuccess('提示','操作成功'); } else { - $this->ajaxFailed('服务器错误', $msg); + $this->ajaxFailed('提示','服务器错误:'.$msg); } } @@ -465,9 +464,9 @@ public function deleteSprint() $activityInfo['title'] = $sprint['name']; $activityModel->insertItem(UserAuth::getId(), $sprint['project_id'], $activityInfo); - $this->ajaxSuccess('ok'); + $this->ajaxSuccess('提示','操作成功'); } else { - $this->ajaxFailed('服务器错误', '数据库删除迭代失败'); + $this->ajaxFailed('提示', '数据库删除迭代失败'); } } @@ -507,7 +506,7 @@ public function joinSprint() $model = new IssueModel(); list($ret, $msg) = $model->updateById($issueId, ['sprint' => $sprintId, 'sprint_weight' => 0]); if ($ret) { - $this->ajaxSuccess('success'); + $this->ajaxSuccess('提示','操作成功'); } else { $this->ajaxFailed('server_error:' . $msg); } @@ -679,9 +678,9 @@ public function setSprintActive() CacheKeyModel::getInstance()->clearCache('dict/' . $sprintModel->table); list($upRet, $msg) = $sprintModel->updateById($sprintId, ['active' => '1']); if ($upRet) { - $this->ajaxSuccess('success'); + $this->ajaxSuccess('提示','操作成功'); } else { - $this->ajaxFailed('server_error:' . $msg); + $this->ajaxFailed('提示','server_error:' . $msg); } } diff --git a/app/public/dev/js/project/sprint.js b/app/public/dev/js/project/sprint.js index 6917942a6..1123961c1 100644 --- a/app/public/dev/js/project/sprint.js +++ b/app/public/dev/js/project/sprint.js @@ -12,21 +12,14 @@ let Sprint = (function() { return _options; }; - Sprint.prototype.fetch = function(id) { - - }; - - Sprint.prototype.add = function() { - - }; Sprint.prototype.active = function(sprint_id) { - $.post("/agile/setSprintActive",{sprint_id:sprint_id},function(result){ - if(result.ret ==="200" ){ - notify_success('设置成功'); + $.post("/agile/setSprintActive",{sprint_id:sprint_id},function(resp){ + if(resp.ret ==="200" ){ + notify_success(resp.msg, resp.data); Sprint.prototype.fetchAll(); } else { - notify_error('设置失败'); - console.log(result); + notify_error(resp.msg, resp.data); + console.log(resp); } }); }; @@ -49,10 +42,10 @@ let Sprint = (function() { $.post("/agile/deleteSprint",{sprint_id:sprint_id},function(result){ if(result.ret ==="200" ){ //location.reload(); - notify_success('删除成功'); + notify_success(resp.msg, resp.data); $('#li_data_id_'+sprint_id).remove(); } else { - notify_error('删除失败'); + notify_error(resp.msg, resp.data); } }); swal.close(); @@ -83,7 +76,7 @@ let Sprint = (function() { $('#l_edit_status_'+resp.data.status).addClass('active'); $('#edit_status_'+resp.data.status).attr('checked',true); } else { - notify_error('数据获取失败'); + notify_error(resp.msg, resp.data); } }, error: function (res) { @@ -102,7 +95,7 @@ let Sprint = (function() { success: function (resp) { auth_check(resp); if(resp.ret ==="200" ){ - notify_success('操作成功'); + notify_success(resp.msg, resp.data); Sprint.prototype.fetchAll(); $('#modal-edit-sprint').modal('hide') } else { @@ -117,8 +110,10 @@ let Sprint = (function() { Sprint.prototype.add = function( ){ - if(is_empty($('add_name').val())){ - notify_error('迭代名称不能为空'); + let add_name_obj = $('#add_name'); + if(is_empty(add_name_obj.val())){ + notify_error('参数错误', '迭代名称不能为空'); + add_name_obj.focus(); return; } @@ -131,14 +126,14 @@ let Sprint = (function() { success: function (resp) { auth_check(resp); if(resp.ret ==="200" ){ - notify_success('操作成功'); + notify_success(resp.msg, resp.data); Sprint.prototype.fetchAll(); $('#add_name').val(''); $('#add_start_date').val(''); $('#add_end_date').val(''); $('#add_description').val(''); } else { - notify_error(resp.msg); + notify_error(resp.msg, resp.data); } }, error: function (res) { @@ -183,7 +178,6 @@ let Sprint = (function() { name: "sprint" }); } - }, error: function (res) { notify_error("请求数据错误" + res); diff --git a/app/view/twig/project/setting_sprint.twig b/app/view/twig/project/setting_sprint.twig index c5875bbca..b73f3c4b2 100644 --- a/app/view/twig/project/setting_sprint.twig +++ b/app/view/twig/project/setting_sprint.twig @@ -245,8 +245,6 @@ $('#btn-edit_save').click(function () { window.$sprint.update(); }); - - });