Skip to content

Commit

Permalink
优化项目设置的迭代管理
Browse files Browse the repository at this point in the history
  • Loading branch information
weichaoduo committed Dec 4, 2019
1 parent d4f75a4 commit 92f806a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 34 deletions.
21 changes: 10 additions & 11 deletions app/ctrl/Agile.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ public function fetchClosedIssuesByProject()
$this->ajaxSuccess('success', $data);
}


/**
* 获取项目中的迭代列表
* @throws \Exception
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -406,7 +405,7 @@ public function updateSprint()
}
}
if (!$changed) {
$this->ajaxSuccess('ok');
$this->ajaxSuccess('提示','操作成功');
return;
}
list($ret, $msg) = $sprintModel->updateItem($sprintId, $info);
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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('提示', '数据库删除迭代失败');
}
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
36 changes: 15 additions & 21 deletions app/public/dev/js/project/sprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
};
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -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;
}

Expand All @@ -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) {
Expand Down Expand Up @@ -183,7 +178,6 @@ let Sprint = (function() {
name: "sprint"
});
}

},
error: function (res) {
notify_error("请求数据错误" + res);
Expand Down
2 changes: 0 additions & 2 deletions app/view/twig/project/setting_sprint.twig
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@
$('#btn-edit_save').click(function () {
window.$sprint.update();
});
});
</script>
Expand Down

0 comments on commit 92f806a

Please sign in to comment.