任务接口

This commit is contained in:
chenyi 2017-01-02 08:14:17 +00:00
parent 0ab28d906e
commit 8fb6b9534a
2 changed files with 170 additions and 174 deletions

View File

@ -187,7 +187,6 @@
var bg_color = ["bg-yellow","bg-blue","bg-purple","bg-red"];
var jstr = htmlobj.responseText;
var robj = eval('('+jstr+')');
console.log(jstr);
var count=0;
if(robj["code"]==0){
var data = robj["data"];

View File

@ -79,37 +79,18 @@
<div class="col-md-3">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">未开始 · 4</h3>
<h3 class="box-title">未开始</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-toggle="modal" data-target="#myModal2"><i class="fa fa-plus"></i></button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="callout content-container-unstart">
<a href="#" class="task-content-a" data-toggle="modal" data-target="#myModal">
<div class="box-body" id="container_1">
<div class="callout content-container-unstart" id="mission_template" style="display:none">
<a href="javascript:showTaskDetail(1);" class="task-content-a">
<h4>前端原型开发</h4>
<p>开发出项目的前端原型。</p>
</a>
</div>
<div class="callout content-container-unstart">
<a href="#" class="task-content-a">
<h4>数据库建表</h4>
<p>建库建表。</p>
</a>
</div>
<div class="callout content-container-unstart">
<a href="#" class="task-content-a">
<h4>撰写测试用例</h4>
<p>根据需求撰写Rspec测试用例</p>
</a>
</div>
<div class="callout content-container-unstart">
<a href="#" class="task-content-a">
<h4>数据接口列表</h4>
<p>撰写前端需要的数据接口列表.</p>
</a>
</div>
</div>
<!-- /.box-body -->
@ -120,43 +101,13 @@
<div class="col-md-3">
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">进行中 · 5</h3>
<h3 class="box-title">进行中</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool"><i class="fa fa-plus"></i></button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="callout content-container-processing">
<a href="#" class="task-content-a">
<h4>前端原型开发</h4>
<p>开发出项目的前端原型。</p>
</a>
</div>
<div class="callout content-container-processing">
<a href="#" class="task-content-a">
<h4>数据库建表</h4>
<p>建库建表。</p>
</a>
</div>
<div class="callout content-container-processing">
<a href="#" class="task-content-a">
<h4>撰写测试用例</h4>
<p>根据需求撰写Rspec测试用例</p>
</a>
</div>
<div class="callout content-container-processing">
<a href="#" class="task-content-a">
<h4>数据接口列表</h4>
<p>撰写前端需要的数据接口列表.</p>
</a>
</div>
<div class="callout content-container-processing">
<a href="#" class="task-content-a">
<h4>测试</h4>
<p>测试</p>
</a>
</div>
<div class="box-body" id="container_2">
</div>
<!-- /.box-body -->
</div>
@ -166,43 +117,13 @@
<div class="col-md-3">
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">已完成 · 5</h3>
<h3 class="box-title">已完成</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool"><i class="fa fa-plus"></i></button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="callout content-container-success">
<a href="#" class="task-content-a">
<h4>前端原型开发</h4>
<p>开发出项目的前端原型。</p>
</a>
</div>
<div class="callout content-container-success">
<a href="#" class="task-content-a">
<h4>数据库建表</h4>
<p>建库建表。</p>
</a>
</div>
<div class="callout content-container-success">
<a href="#" class="task-content-a">
<h4>撰写测试用例</h4>
<p>根据需求撰写Rspec测试用例</p>
</a>
</div>
<div class="callout content-container-success">
<a href="#" class="task-content-a">
<h4>数据接口列表</h4>
<p>撰写前端需要的数据接口列表.</p>
</a>
</div>
<div class="callout content-container-success">
<a href="#" class="task-content-a">
<h4>测试</h4>
<p>测试</p>
</a>
</div>
<div class="box-body" id="container_3">
</div>
<!-- /.box-body -->
</div>
@ -212,43 +133,13 @@
<div class="col-md-3">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">已测试 · 5</h3>
<h3 class="box-title">已测试</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool"><i class="fa fa-plus"></i></button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="callout content-container-tested">
<a href="#" class="task-content-a">
<h4>前端原型开发</h4>
<p>开发出项目的前端原型。</p>
</a>
</div>
<div class="callout content-container-tested">
<a href="#" class="task-content-a">
<h4>数据库建表</h4>
<p>建库建表。</p>
</a>
</div>
<div class="callout content-container-tested">
<a href="#" class="task-content-a">
<h4>撰写测试用例</h4>
<p>根据需求撰写Rspec测试用例</p>
</a>
</div>
<div class="callout content-container-tested">
<a href="#" class="task-content-a">
<h4>数据接口列表</h4>
<p>撰写前端需要的数据接口列表.</p>
</a>
</div>
<div class="callout content-container-tested">
<a href="#" class="task-content-a">
<h4>测试</h4>
<p>测试</p>
</a>
</div>
<div class="box-body" id="container_4">
</div>
<!-- /.box-body -->
</div>
@ -257,6 +148,7 @@
<!-- /.col -->
</div>
<!-- row -->
<!-- 模态框Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
@ -266,7 +158,7 @@
&times;
</button>
<h4 class="modal-title" id="myModalLabel">
未开始列表
</h4>
</div>
<div class="modal-body">
@ -279,21 +171,21 @@
<!-- /.box-header -->
<div class="box-body">
<strong><i class="fa fa-book margin-r-5"></i>任务名称</strong>
<p class="text-muted">
<p class="text-muted" id="cy_task_name">
前端原型开发
</p>
<hr>
<strong><i class="fa fa-tasks margin-r-5"></i>任务内容</strong>
<p class="text-muted">开发出项目的前端原型。</p>
<p class="text-muted" id="cy_task_content">开发出项目的前端原型。</p>
<hr>
<strong><i class="fa fa-calendar margin-r-5"></i>截止时间</strong> 2016年12月8日
<strong><i class="fa fa-calendar margin-r-5"></i>截止时间</strong> <span id="cy_task_deadline">2016年12月8日</span>
<hr>
<strong><i class="fa fa-clock-o margin-r-5"></i>优先级</strong>
<div class="label label-danger" style="font-size:15px;font-weight:0 !important;">紧急</div>
<div class="label label-danger" style="font-size:15px;font-weight:0 !important;" id="cy_task_priority">紧急</div>
<hr>
<strong><i class="fa fa-file-text-o margin-r-5"></i>参与人员</strong>
<p>
杨诏陈翊
<p id="cy_task_users">
杨诏 陈翊
</p>
</div>
<!-- /.box-body -->
@ -310,53 +202,19 @@
<!-- Conversations are loaded here -->
<div class="direct-chat-messages">
<!-- Message. Default to the left -->
<div class="direct-chat-msg">
<div class="direct-chat-msg" id="cy_comments_template" style="display:none;">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name pull-left">杨诏</span>
<span class="direct-chat-timestamp pull-right">2016-12-7 2:00 pm</span>
<span class="direct-chat-name pull-left" id="cy_comment_name">杨诏</span>
<span class="direct-chat-timestamp pull-right" id="cy_comment_time">2016-12-7 2:00 pm</span>
</div>
<!-- /.direct-chat-info -->
<img class="direct-chat-img" src="../dist/img/avatar5.png" alt="message user image">
<!-- /.direct-chat-img -->
<div class="direct-chat-text">
<div class="direct-chat-text" id="cy_comment_content">
这个任务相当好!
</div>
<!-- /.direct-chat-text -->
</div>
<!-- /.direct-chat-msg -->
<!-- Message. Default to the left -->
<div class="direct-chat-msg">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name pull-left">陈翊</span>
<span class="direct-chat-timestamp pull-right">2016-12-7 2:00 pm</span>
</div>
<!-- /.direct-chat-info -->
<img class="direct-chat-img" src="../dist/img/avatar5.png" alt="message user image">
<!-- /.direct-chat-img -->
<div class="direct-chat-text">
@杨诏,说的对呀!
</div>
<!-- /.direct-chat-text -->
</div>
<!-- /.direct-chat-msg -->
<!-- Message. Default to the left -->
<div class="direct-chat-msg">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name pull-left">崔承旭</span>
<span class="direct-chat-timestamp pull-right">2016-12-7 2:00 pm</span>
</div>
<!-- /.direct-chat-info -->
<img class="direct-chat-img" src="../dist/img/avatar5.png" alt="message user image">
<!-- /.direct-chat-img -->
<div class="direct-chat-text">
@陈翊,说的对呀!
</div>
<!-- /.direct-chat-text -->
</div>
<!-- /.direct-chat-msg -->
</div>
<!--/.direct-chat-messages-->
<!-- Contacts are loaded here -->
<div class="direct-chat-contacts">
<ul class="contacts-list">
@ -416,7 +274,7 @@
&times;
</button>
<h4 class="modal-title" id="myModalLabel">
未开始列表
</h4>
</div>
<div class="modal-body">
@ -433,20 +291,20 @@
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">任务名称</label>
<div class="col-sm-6 col-md-push-2">
<input type="text" class="form-control" value="11" id="address" name="address" placeholder="地址">
<input type="text" id="cy_modify_taskname" class="form-control" value="11" id="address" name="address" placeholder="任务名称">
</div>
</div>
<!-- ./form-group -->
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">任务内容</label>
<div class="col-sm-6 col-md-push-2">
<textarea class="form-control" rows="3" placeholder="Enter ..."></textarea> </div>
<textarea class="form-control" rows="3" placeholder="Enter ..." id="cy_modify_taskcontent"></textarea> </div>
</div>
<!-- ./form-group -->
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">截止时间</label>
<div class="col-sm-6 col-md-push-2">
<input type="text" class="form-control" value="11" id="address" name="address" placeholder="地址">
<input type="text" class="form-control" value="11" id="cy_modify_taskdeadline" name="address" placeholder="截止时间">
</div>
</div>
<!-- ./form-group -->
@ -477,7 +335,7 @@
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">参与人员</label>
<div class="col-sm-6 col-md-push-2">
<select multiple="" class="form-control">
<select multiple="" class="form-control" id="cy_modify_select">
<option>杨诏</option>
<option>陈翊</option>
<option>崔承旭</option>
@ -501,7 +359,7 @@
<!-- row -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">
<button type="button" class="btn btn-primary" id="cy_submit_modify">
提交
</button>
</div>
@ -510,6 +368,7 @@
</div>
<!-- /.modal -->
</div>
</section>
<!-- content section -->
</div>
@ -518,6 +377,8 @@
<!-- ./wrapper -->
<center><strong>Copyright &copy; 2016 <a href="#">Ambition Inc.</a>.</strong> All rights reserved.</center>
<a id="cy_show_modal" style="display:none" data-toggle="modal" data-target="#myModal"></a>
<!-- jQuery 2.1.4 -->
<script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
@ -529,7 +390,143 @@
<!-- date select and query -->
<!-- Custom Scripts -->
<script>
$(document).ready(function(){
//获取某状态的任务列表
getTaskList(1,"container_1");
getTaskList(2,"container_2");
getTaskList(3,"container_3");
getTaskList(4,"container_4");
function getTaskList(type,container_id){
$.ajax({
type:"GET",
dataType:"json",
url:"/projects/project/status.json",
data:{
"project_id":parent.LoginUserInfo.selectProject,
"status_type":type
},
statusCode: {
200: function(rpstr) {// 请求成功
var color = ["","#d2d6de","#dd4b39","#00a65a","#00c0ef"];
if(rpstr.code=="0"){
var data=rsptr.data;
for(var i = 0; i < data.length; ++i){
var template = $("#mission_template");
var tp=template.clone("true");
tp.find("h4").html(data[i].name);
tp.find("p").html(data[i].content);
tp.attr("id","mission_"+data[i].id);
tp.children("a").attr("href","javascript:showTaskDetail("+data[i].id+")");
tp.css("border-left","8px solid"+color[type]);
tp.css("display","block");
$("#"+container_id).append(tp);
}
}
else{
//todo
}
},
401:function(){// 未授权
alert("未登录!");
}
}
});
}
});
//获取任务详情(修改模态框)
function showTaskDetail(mission_id){
//修改模态框
$.ajax({
type:"GET",
dataType:"json",
url:"/projects/detail.json",
data:{
"id":mission_id
},
statusCode: {
200: function(rpstr) {// 请求成功
if(rpstr.code=="0"){
var data=rsptr.data;
$("#cy_task_name").html(data.name);
$("#cy_task_content").html(data.content);
$("#cy_task_deadline").html(data.deadline);
var name_list_str = "";
for(var i=0; i < data.username.length; ++i){
if(i != 0){
name_list_str+='、'
}
name_list_str += data.username[i];
}
$("#cy_task_users").html(name_list_str);
if(data.priority==1){$("#cy_task_priority").html("普通");}
if(data.priority==2){$("#cy_task_priority").html("紧急");}
if(data.priority==3){$("#cy_task_priority").html("非常紧急");}
for(var i=0; i < data.comments.length; ++i){
var template = $("#cy_comments_template");
var tp=template.clone("true");
tp.find("#cy_comment_name").html(data.comments[i].nickname);
tp.find("#cy_comment_time").html(data.comments[i].time);
tp.find("#cy_comment_content").html(data.comments[i].content);
}
}
else{
//todo
}
},
401:function(){// 未授权
alert("未登录!");
}
}
});
//显示模态框
$("#cy_show_modal").click();
}
$("#cy_submit_modify").click(function cy_update_mission(){
var modify_name=$("#cy_modify_taskname").val();
var modify_content=$("#cy_modify_taskcontent").val();
var modify_deadline=$("#cy_modify_taskdeadline").val();
var modify_priority=1;
var modify_select=$("#cy_modify_select").find("option:selected").text();
for(var i = 1; i <= 3; ++i){
if($("#optionsRadios"+i).is(":checked")){
modify_priority = i;
}
}
if( modify_name.length>0 && modify_content.length>0 && modify_deadline.length>0){
$.ajax({
type:"patch",
dataType:"json",
url:"/missions/detail.json",
data:{
"id":parent.LoginUserInfo.selectProject,
"mission[name]":modify_name,
"mission[content]":modify_content,
"mission[deadline]":modify_deadline,
"mission[priority]":modify_priority,
"mission[users]":modify_select
},
statusCode: {
200: function(rpstr) {// 请求成功
var robj = rpstr;
if(robj["code"]==0){
alert("修改成功!");
window.location.reload();
}
},
422:function(){
alert("输入不符合要求,请重新输入!");
}
}
});
}else{
alert("请输入完整!");
}
})
</script>
</body>