Jianghan 3 роки тому
батько
коміт
6d5f690a00
2 змінених файлів з 56 додано та 28 видалено
  1. 4 1
      src/front/group.go
  2. 52 27
      src/web/templates/project/task_group_list.html

+ 4 - 1
src/front/group.go

@@ -22,8 +22,11 @@ func (f *Front) GroupTaskListByGroup() {
 		status := f.GetString("status")
 		searchStr := f.GetString("search[value]")
 		search := strings.TrimSpace(searchStr)
+		user := f.GetSession("user").(map[string]interface{})
+		gid := qu.ObjToString(user["s_groupid"])
 		query := map[string]interface{}{
-			"s_stype": "group", //检索用户组任务
+			"s_stype":   "group", //检索用户组任务
+			"s_groupid": gid,
 		}
 		if status != "-1" { //任务状态
 			query["s_status"] = status

+ 52 - 27
src/web/templates/project/task_group_list.html

@@ -18,26 +18,29 @@
             <div class="col-xs-12">
                 <div class="box">
                     <div class="box-body">
-
-                        <div class="form-horizontal">
-                            <div class="box-body margin">
-                                <table id="dataTable" class="table table-bordered table-hover">
-                                    <thead>
-                                    <tr>
-                                        <th></th>
-                                        <th>项目名称</th>
-                                        <th>负责人</th>
-                                        <th>数据量</th>
-                                        <th>任务状态</th>
-                                        <th>完成进度</th>
-                                        <th>开始时间</th>
-                                        <th>完成时间</th>
-                                        <th>操作</th>
-                                    </tr>
-                                    </thead>
-                                </table>
-                            </div>
+                        <div id="status-div" class="col-xs-1" style="width: auto;float:right;">
+                            <label for="pushModelSelect">状态:
+                                <select class="form-control selectpicker" id="pushModelSelect">
+                                    <option value=-1>全部</option>
+                                    <option value=0>开启</option>
+                                    <option value=1>关闭</option>
+                                </select></label>
                         </div>
+                        <table id="dataTable" class="table table-bordered table-hover">
+                            <thead>
+                            <tr>
+                                <th></th>
+                                <th>项目名称</th>
+                                <th>负责人</th>
+                                <th>数据量</th>
+                                <th>任务状态</th>
+                                <th>完成进度</th>
+                                <th>开始时间</th>
+                                <th>完成时间</th>
+                                <th>操作</th>
+                            </tr>
+                            </thead>
+                        </table>
                     </div>
                     <!-- /.box-body -->
                 </div>
@@ -82,7 +85,7 @@
                 });
             },
             "columns": [
-                {"data": "", width: "1%"},
+                {"data": null, width: "1%"},
                 {"data": "s_projectname", width: "5%"},
                 {"data": "s_personname", width: "4%"},
                 {"data": "i_givenum", width: "4%"},
@@ -94,7 +97,7 @@
                         }else {
                             var dt = new Date()
                             dt.setTime(parseInt(val) * 1000);
-                            return dt.format("yyyy-MM-dd")
+                            return dt.format("yyyy-MM-dd hh:mm:ss")
                         }
                     }},
                 {"data": "i_completetime", width: "4%", render: function (val) {
@@ -103,23 +106,45 @@
                         }else {
                             var dt = new Date()
                             dt.setTime(parseInt(val) * 1000);
-                            return dt.format("yyyy-MM-dd")
+                            return dt.format("yyyy-MM-dd hh:mm:ss")
                         }
                     }},
                 {
                     "data": "_id", width: "11%", render: function (val, a, row, pos) {
                         tmp = '<div>' +
-                            '<a class="btn btn-sm btn-primary" href="/front/user/task/save?tid=' + val + '">查看</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-warning">分发</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-info">质检</a>&nbsp;&nbsp;' +
-                            '<a class="btn btn-sm btn-info">交付</a>&nbsp;&nbsp;' +
+                            '<a class="btn btn-sm btn-primary" href="/front/user/task/list?grouptaskid=' + val + '&s_sourceinfo='+row.s_sourceinfo+'">查看</a>&nbsp;&nbsp;' +
+                            // '<a class="btn btn-sm btn-warning">分发</a>&nbsp;&nbsp;' +
+                            '<a class="btn btn-sm btn-primary">质检</a>&nbsp;&nbsp;' +
+                            '<a class="btn btn-sm btn-primary">质检结果</a>&nbsp;&nbsp;' +
+                            '<a class="btn btn-sm btn-primary" onclick="deliverTask(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">交付</a>&nbsp;&nbsp;' +
                             '</div>';
                         return tmp
                     }
                 }
-            ]
+            ],
+            "initComplete": function () {
+                $("#dataTable_filter").append($('#status-div'))
+            }
         });
 
     });
 
+    function deliverTask(id, status) {
+        if (status === "已开始") {
+            $.ajax({
+                url: "/front/group/task/deliver",
+                type: 'POST',
+                data: {"taskid": id},
+                success: function (r) {
+                    if (r.success) {
+                        ttable.api().ajax.reload()
+                    } else {
+                        showTip(r.msg);
+                    }
+                }
+            })
+        }else {
+            showTip("操作不允许")
+        }
+    }
 </script>