Jelajahi Sumber

考核办法和排班管理业务

chenrj-PC\chenrj 9 tahun lalu
induk
melakukan
1138a4cbe1

+ 13 - 13
VisualInspection/js/assess_management/assess_item.js

@@ -44,7 +44,8 @@
      $("#dept_add").on("click", function() {
          var nodedata = check_item_tree.getSelectedNodes();
          edittype = "add"
-         loadData(nodedata)
+         loadData(nodedata);
+         $("#add_btn").html("添加");
          $('#addModal').modal('show')
      })
 
@@ -59,6 +60,7 @@
          }
          edittype = "edit"
          loadData(nodedata)
+         $("#add_btn").html("修改");
          $('#addModal').modal('show');
      });
 
@@ -71,15 +73,13 @@
              return;
          }
 
-         post_common_service("/checkItem/delete", {"id":nodedata[0].id  }, function(data){
+        deleteItem4Common(nodedata[0].id,"/checkItem/delete",function(){
             layer.msg('删除成功!', {
-                 time: 2000, //20s后自动关闭
-             });
-             check_item_tree.removeNode(nodedata[0]);
-             getCheckItems();
+                    time: 2000, //20s后自动关闭
+                });   
+            getCheckItems();
             table_init();
-         }, function(error){ })
-
+        }, function(error){ })
      });
 
      $('.datatable').datatable({
@@ -105,9 +105,9 @@ function modify_check_item( id ){
         $(".check_item_group").hide();
         $("#check_item_name").val(data.name);
         $("#check_item_score").val(data.score);
-        $("#add_btn").html("修改");
         $('#addModal').modal('show');
         $("#add_btn").attr("onclick","addCheckItem_v("+data.id+")");
+        $("#add_btn").html("修改");
     }, function(error){ })
 }
 
@@ -134,8 +134,8 @@ function addCheckItem_v(id){
 
 // 表格点击删除
 function delete_check_item(id ){
-    post_common_service("/checkItem/delete", {"id":id }, function(data){
-        layer.msg('删除成功!', {
+     deleteItem4Common(id,"/checkItem/delete",function(){
+         layer.msg('删除成功!', {
                 time: 2000, //20s后自动关闭
             });   
         getCheckItems();
@@ -340,7 +340,7 @@ function addCheckItem() {
             }, function() {
                 $('#addModal').modal('hide')
                 getCheckItems();
-                 table_init();
+                table_init();
             })
         },function(error){})
     }
@@ -360,7 +360,7 @@ function addCheckItem() {
             }, function() {
                 $('#addModal').modal('hide')
                 getCheckItems();
-                 table_init();
+                table_init();
             })
         },function(error){})
     }

+ 3 - 6
VisualInspection/js/assess_management/assess_way.js

@@ -10,10 +10,9 @@ function queryTable(){
                     {width: 30, text: '序号', flex: false, colClass: 'text-center',field:'num'},
                     {width: 160, text: '考核办法', flex: false,colClass: 'text-center',field:'name'},
                     {width: 80, text: '被考核部门',  flex: true, colClass: 'text-center',field:'checked_dept_id'},
-                    {width: 80, text: '被考核职位',  flex: false, colClass: 'text-center',field:'checked_position_id'},
-                    {width: 80, text: '被考核人员', flex: true, colClass: 'text-center',field:'checked_person_type'},
-                    {width: 60, text: '考核项',  flex: false, type: 'string',colClass: 'text-center modity-flag',field:'checked_item_num' },
-                    {width: 50, text: '操作',  flex: false, colClass: 'text-center',field:'id',oper:[
+                    {width: 100, text: '被考核职位',  flex: true, colClass: 'text-center',field:'checked_position_id'},
+                    {width: 100, text: '考核项',  flex: false, type: 'string',colClass: 'text-center modity-flag',field:'checked_item_num' },
+                    {width: 80, text: '操作',  flex: false, colClass: 'text-center',field:'id',oper:[
                          {func:'deleteCheckRule',text:'删除',col_class:'icon-remove-circle'}
                     ]},
                 ] ;
@@ -62,6 +61,4 @@ $(document).ready(function() {
         // alert($(this).html());
         changePage("/view/assess_management/assess_way_edit.html")
     });
-
-    
 });

+ 238 - 130
VisualInspection/js/assess_management/assess_way_edit.js

@@ -1,6 +1,6 @@
 
-
  var zdata = [];
+ var z_cache ;
  var check_item_tree = null;
  var edittype = "add";
  var cols = [{
@@ -31,56 +31,56 @@
  }];
  $(document).ready(function() {
 
-     $("#main_content_title").html("<span><a href='#'>考核项管理</a></span><span> / </span><span>考核项</span>")
+     $("#main_content_title").html("<span><a href='#'>考核项管理</a></span><span> / </span><span>考核项</span>");
 
      $('#dashboard').dashboard({ draggable: false });
      var zTreeObj;
      var zNodes = [];
-     check_item_tree = $.fn.zTree.init($("#check_item_tree"), {}, zNodes);
+     check_item_tree = $.fn.zTree.init($("#department_tree"), {}, zNodes);
 
      getCheckItems();
 
-    //  $("#dept_add").on("click", function() {
-    //      var nodedata = check_item_tree.getSelectedNodes();
-    //      edittype = "add"
-    //      loadData(nodedata)
-    //      $('#addModal').modal('show')
-    //  })
-
-    //  $("#dept_edit").on("click", function() {
-    //      //获取选中的节点
-    //      var nodedata = check_item_tree.getSelectedNodes();
-    //      if (nodedata.length < 1) {
-    //          layer.msg('请先选择部门!', {
-    //              time: 2000, //20s后自动关闭
-    //          });
-    //          return;
-    //      }
-    //      edittype = "edit"
-    //      loadData(nodedata)
-    //      $('#addModal').modal('show');
-    //  });
+     $("#dept_add").on("click", function() {
+         var nodedata = check_item_tree.getSelectedNodes();
+         edittype = "add"
+         loadData(nodedata);
+         $("#add_btn").html("添加");
+         $('#addModal').modal('show')
+     })
 
-     $("#dept_delete").on("click", function() {
+     $("#dept_edit").on("click", function() {
          //获取选中的节点
          var nodedata = check_item_tree.getSelectedNodes();
          if (nodedata.length < 1) {
-             layer.msg('请先选考核项!', {
+             layer.msg('请先选考核项!', {
                  time: 2000, //20s后自动关闭
              });
              return;
          }
-         checkItemDelete(nodedata[0].id, function(data) {
-             layer.msg('删除成功!', {
+         edittype = "edit"
+         loadData(nodedata)
+         $("#add_btn").html("修改");
+         $('#addModal').modal('show');
+     });
+
+     $("#dept_delete").on("click", function() {
+         var nodedata = check_item_tree.getSelectedNodes();
+         if (nodedata.length < 1) {
+             layer.msg('请选择考核项!', {
                  time: 2000, //20s后自动关闭
              });
-             check_item_tree.removeNode(nodedata[0]);
-         }, function(error) {
+             return;
+         }
 
-         });
+        deleteItem4Common(nodedata[0].id,"/checkItem/delete",function(){
+            layer.msg('删除成功!', {
+                    time: 2000, //20s后自动关闭
+                });   
+            getCheckItems();
+            table_init();
+        }, function(error){ })
      });
 
-
      $('.datatable').datatable({
          checkable: false,
          sortable: false,
@@ -89,24 +89,59 @@
              rows: []
          }
      });
+ });
+
+function table_init(){
+    $('.datatable').datatable('load', {
+        cols: cols,
+        rows: []
+    });
+}
 
+// 表格点击修改
+function modify_check_item( id ){
+   post_common_service("/checkItem/getById", {"id":id }, function(data){
+        $(".check_item_group").hide();
+        $("#check_item_name").val(data.name);
+        $("#check_item_score").val(data.score);
+        $('#addModal').modal('show');
+        $("#add_btn").attr("onclick","addCheckItem_v("+data.id+")");
+        $("#add_btn").html("修改");
+    }, function(error){ })
+}
 
- });
+function addCheckItem_v(id){
+    var name = $("#check_item_name").val();
+    var score = $("#check_item_score").val();
+    var data = {
+        "id":id ,
+        "name":name,
+        "score":score 
+    }
+    post_common_service( "checkItem/update",data,function(data){
+        layer.msg('修改成功!', {
+            time: 2000, //20s后自动关闭
+        }, function() {
+            $('#addModal').modal('hide');
+             $("#add_btn").attr("onclick","addCheckItem()");
+            getCheckItems();
+            table_init();
+        })
+    },function(error){})
 
-function checkItemDelete(id, success, fail) {
-    // var url = base_server_url + DEPT_DELETE + id
-    // ajaxDelete(url, "", function(response) {
-    //     var data = response;
-    //     if (data.result_code == 0) {
-    //         success(data.result_data)
-    //     } else {
-    //         fail(data.result_desc);
-    //     }
-    // }, function(error) {
-    //     fail("网络错误");
-    // });
 }
 
+// 表格点击删除
+function delete_check_item(id ){
+     deleteItem4Common(id,"/checkItem/delete",function(){
+         layer.msg('删除成功!', {
+                time: 2000, //20s后自动关闭
+            });   
+        getCheckItems();
+        table_init();
+    }, function(error){ })
+} 
+
  function getCheckItems() {
      function zTreeOnRename(event, treeId, treeNode, isCancel) {
          alert(treeNode.tId + ", " + treeNode.name);
@@ -116,47 +151,59 @@ function checkItemDelete(id, success, fail) {
          alert(treeNode.tId + ", " + treeNode.name);
      }
 
-     function zTreeOnClick(event, treeId, treeNode) {
-         // 父ID是否为空 -1
-         if(treeNode.pId != -1 && treeNode.Pid != null){
-                var data = { "parent_id":1 };
-                getCheckRuleItems("/checkItem/getByParentId",data,function(data){
-                    var rowdata = [];
-                    if (data != null && data.length > 0) {
-                        for (var i = 0; i < data.length; i++) {
-                            var check_item = data[i];
-                            var userdata = {};
-                            userdata["checked"] = false;
-                            userdata["data"] = [i + 1, check_item.name,check_item.score, '<a href="#" data-toggle="modal" data-target="#myModal"><i class="icon icon-edit"></i> 修改</a><a href="#"><i class="icon icon-remove-circle"></i> 删除</a>'];
-                            rowdata.push(userdata);
-                        }
+
+     function getTreeData(c_obj,id){
+        if(c_obj.id == id){
+            return c_obj ;
+        }else{
+            if(c_obj.subCheckItem!=null){
+                for(var i=0;i<c_obj.subCheckItem.length;i++){
+                    var tmp = getTreeData(c_obj.subCheckItem[i],id);
+                    if(tmp != null){
+                        return tmp ;
                     }
-                    // 使用data参数更新数据:
-                    $('.datatable').datatable('load', {
-                        cols: cols,
-                        rows: rowdata
-                    });
-                },function(){})
-         }else if(treeNode.id != -1){
-            var data = {"id":treeNode.id};
-            getCheckRuleItems("/checkItem/getById",data,function(data){
-                 var rowdata = [];
-                 if (data != null ) {
-                    var userdata = {};
-                    userdata["checked"] = false;
-                    userdata["data"] = [ 1, data.name, data.score, '<a href="#" data-toggle="modal" data-target="#myModal"><i class="icon icon-edit"></i> 修改</a>  <a href="#"><i class="icon icon-remove-circle"></i> 删除</a>'];
-                    rowdata.push(userdata);
-                 }
-
-                 // 使用data参数更新数据:
-                 $('.datatable').datatable('load', {
-                     cols: cols,
-                     rows: rowdata
-                 });
-            },function(){})
-         }
-     };
+                }
+            }
+            return null;
+        }
+     }
+
+     var seq = 0 ;
+
+     function getTree(obj,rowObj){
+        var userdata = {};
+        userdata["checked"] = false;
+        userdata["data"] = [++seq, obj.name, (obj.score!=null?obj.score:""), '<a href="javascript:void(0)" onclick="modify_check_item('+ obj.id +')"  ><i class="icon icon-edit"></i> 修改</a><a href="javascript:void(0)" onclick="delete_check_item('+ obj.id +')" ><i class="icon icon-remove-circle"></i> 删除</a>'];
+        rowObj.push(userdata);
+
+        if(obj.subCheckItem!=null){
+            for(var i=0; i<obj.subCheckItem.length;i++ ){
+                getTree(obj.subCheckItem[i],rowObj);
+            }
+        }
+        return rowObj;
+     }
+
+     function zTreeOnClick(event, treeId, treeNode) {
+
+        var rowdata = [];
+
+        seq = 0 ;
+
+        for(var i=0;i<z_cache.length;i++){
+            var treeObj = getTreeData(z_cache[i],treeNode.id) ;
+            if( treeObj != null){
+               rowdata = getTree(treeObj,rowdata);
+               break ;
+            }
+        }
 
+        // 使用data参数更新数据:
+        $('.datatable').datatable('load', {
+            cols: cols,
+            rows: rowdata
+        });
+     };
 
      var setting = {
          data: {
@@ -197,39 +244,36 @@ function checkItemDelete(id, success, fail) {
          }
      };
 
-    var data = {"id":3} ;
-
-    CheckRuleItems({"id":3} ,function(data){
-         zdata = [];
-         if(data!=null){
-            var m = data;
-            console.log(m);
-            var zdataItem = {};
-            zdataItem["id"] = -1;
-            zdataItem["value"] = m.id;
-            zdataItem["pId"] = -1;
-            zdataItem["name"] = m.name;
-            zdataItem["children"] = addobj(m);
-            zdata.push(zdataItem);
+     var data = {"id":3} ;
+     post_common_service("/checkRule/getById",data,function(data){
+        zdata = [];
+        z_cache = data ;
+         for (var i = 0; i < data.length; i++) {
+             var m = data[i];
+             var zdataItem = {};
+             zdataItem["id"] = m.id;
+             zdataItem["value"] = m.id;
+             zdataItem["pId"] = null;
+             zdataItem["score"] = m.score ;
+             zdataItem["name"] = m.name;
+             zdataItem["children"] = addobj(m);
+             zdata.push(zdataItem);
          }
-         check_item_tree = $.fn.zTree.init($("#check_item_tree"), setting, zdata)
-    },function(){} )
+         check_item_tree = $.fn.zTree.init($("#department_tree"), setting, zdata)
+     },function(error){})
  }
 
  function addobj(data) {
      var zdata = [];
-     if (typeof(data.check_items) != "undefinde" && data.check_items != null &&
-         data.check_items.length > 0) {
-         for (var i = 0; i < data.check_items.length; i++) {
-             var m = data.check_items[i];
+     if (typeof(data.subCheckItem) != "undefinde" && data.subCheckItem != null &&
+         data.subCheckItem.length > 0) {
+         for (var i = 0; i < data.subCheckItem.length; i++) {
+             var m = data.subCheckItem[i];
              var zdataItem = {};
              zdataItem["id"] = m.id;
              zdataItem["value"] = m.id;
-             if(data.parent_id!=null){
-                zdataItem["pId"] = data.parent_id;
-             }else{
-                zdataItem["pId"] = -1 ; 
-             }
+             zdataItem["pId"] = data.id;
+             zdataItem["score"] = m.score ;
              zdataItem["icon"] = "";
              zdataItem["name"] = m.name;
              zdataItem["children"] = addobj(m);
@@ -241,30 +285,94 @@ function checkItemDelete(id, success, fail) {
      }
  }
 
- function CheckRuleItems(data,success, fail) {
-    var url = base_server_url + "/checkRule/getById"
-    ajaxPost(url, data, function(response) {
-        var data = response;
-        if (data.result_code == 0) {
-            success(data.result_data)
-        } else {
-            fail(data.result_desc);
+// 增加和编辑框
+var dept_selectinput;
+var selectednodetemp;
+
+function loadData(nodedata) {
+    var pnode = nodedata;
+
+    if (edittype == "add") {
+        $("#check_item_name").val("") ;
+        $("#check_item_score").val("")
+    }
+    if (edittype == "edit") {
+        selectednodetemp = nodedata[0];
+        $("#check_item_name").val(nodedata[0].name);
+        $("#check_item_score").val(nodedata[0].score);
+        $("#add_btn").html("保存")
+        if (pnode != null && pnode.length > 0) {
+            pnode = [check_item_tree.getNodeByParam("id", pnode[0].pId, null)]
         }
-    }, function(error) {
-        fail("网络错误");
-    });
+    }
+    $(".check_item_group").show();
+    if(pnode[0] != null){
+        dept_selectinput = new TreeSelect({
+            element: '#check_item_select',
+            data: zdata,
+            valueKey: "id",
+            placeholder: "选择考核项分类",
+            selectvalue: pnode.length > 0 ? pnode[0].id : null
+        });
+    }else{
+        $(".check_item_group").hide();
+    }
+}
+
+
+function addCheckItem() {
+    //获取名称
+    var name = $("#check_item_name").val();
+    var score = $("#check_item_score").val();
+
+    var pid =   dept_selectinput!=null?dept_selectinput.value:null ;
+
+    var data = {
+        "name": name,
+        "score":score,
+        "parent_id": pid
+    }
+
+    if (edittype == "add") {
+        post_common_service( "checkItem/add",data,function(data){
+            layer.msg('添加成功!', {
+                time: 2000, //20s后自动关闭
+            }, function() {
+                $('#addModal').modal('hide')
+                getCheckItems();
+                table_init();
+            })
+        },function(error){})
+    }
+
+    if (edittype == "edit") {
+        data["id"] = selectednodetemp.id;
+        if (isSelfOrChild(pid, selectednodetemp)) {
+            layer.msg('不能添加到自身及自身下的子考核项!', {
+                time: 2000, //20s后自动关闭
+            })
+            return;
+        }
+
+         post_common_service( "checkItem/update",data,function(data){
+            layer.msg('修改成功!', {
+                time: 2000, //20s后自动关闭
+            }, function() {
+                $('#addModal').modal('hide')
+                getCheckItems();
+                table_init();
+            })
+        },function(error){})
+    }
 }
 
-function getCheckRuleItems(url,data, success, fail) {
-    var url = base_server_url + url
-    ajaxPost(url, data, function(response) {
-        var data = response;
-        if (data.result_code == 0) {
-            success(data.result_data)
-        } else {
-            fail(data.result_desc);
+function isSelfOrChild(id, node) {
+    if (id == node.id) return true;
+    if (typeof(node.children) == "undefinde" || node.children == null || node.children.length < 1) return false;
+    for (var i = 0; i < node.children.length; i++) {
+        if (isSelfOrChild(id, node.children[i])) {
+            return true;
         }
-    }, function(error) {
-        fail("网络错误");
-    });
+    }
+    return false;
 }

+ 49 - 0
VisualInspection/js/teamClass/check_team_schedule.js

@@ -0,0 +1,49 @@
+
+    
+   $(document).ready(function() {
+
+        $('#calendar').calendar();
+        var calendar = $('#calendar').data('zui.calendar');
+        var newEvents =
+        [
+            {title: '考核二班-晚班',  start: '2017-5-1 ', end: '2017-5-1 '},
+            {title: '考核三班-晚班',  start: '2017-5-1 ', end: '2017-5-1 '},
+            {title: '考核四班-晚班',  start: '2017-5-1 ', end: '2017-5-1 '},
+            {title: '考核一班-休息',  start: '2017-5-1 ', end: '2017-5-1 '},
+            {title: '考核二班-晚班',  start: '2017-5-12 ', end: '2017-5-12 '},
+            {title: '考核三班-晚班',  start: '2017-5-12 ', end: '2017-5-12 '},
+            {title: '考核四班-晚班',  start: '2017-5-12 ', end: '2017-5-12 '},
+            {title: '考核一班-休息',  start: '2017-5-12 ', end: '2017-5-12 '},
+            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11 '},
+            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11'},
+            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11 '},
+            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11 '},
+            {title: '未排班',  start: '2017-5-13 ', end: '2017-5-13 '},
+            {title: '未排班',  start: '2017-5-13 ', end: '2017-5-13'},
+            {title: '未排班',  start: '2017-5-13 ', end: '2017-5-13 '},
+           
+        ];
+        calendar.addEvents(newEvents);
+
+        // 请求稽查人员排班数据
+      
+        var data = {
+            "dept_id":1 ,
+            "start_time":new Date(),
+            "end_time":new Date()
+        }
+        post_common_service( "teamClass/getClassList",data,function(data){
+            console.log(data );
+        },function(error){})
+
+        $('#calendar').calendar().on("clickEvent.zui.calendar", function(event) {
+            console.log(event.event);
+            // alert(event.event.title);
+            // console.log("你点击了一个事件");
+            // 处理 clickEvent 事件
+            // ...
+            // 对话框弹出
+            $('#myModal').modal();
+        });
+
+   })

+ 1 - 1
VisualInspection/view/assess_management/assess_way.html

@@ -25,7 +25,7 @@
 
             <div class="row">
                 <!-- 使用一个div来显示数据表格 -->
-                <div class="datatable" data-checkable="true" data-sortable="true"></div>
+                <div class="datatable" data-checkable="false" data-sortable="false"></div>
             </div>
           
         </div>

+ 36 - 8
VisualInspection/view/assess_management/assess_way_edit.html

@@ -1,12 +1,13 @@
+
 <link rel="stylesheet" type="text/css" href="/css/user/userManager.css?__inline">
 <script type="text/javascript" src="/node_modules/zui/dist/lib/dashboard/zui.dashboard.min.js?__inline"></script>
 <link rel="stylesheet" type="text/css" href="/node_modules/zui/dist/lib/dashboard/zui.dashboard.min.css">
 <script type="text/javascript" src="/js/assess_management/assess_way_edit.js?__inline"></script>
 <div class="container-fluid ">
-    <div class="row" style="text-align:center;margin-bottom:10px;font-size:20px;">
-        收费站收费员视频考核管理办法
-    </div>
     <div id="dashboard" class="dashboard dashboard-draggable" data-height="500">
+        <div class="row" style="text-align:center;margin-bottom:10px;font-size:20px;">
+            收费站收费员视频考核管理办法
+        </div>
         <div class="row">
             <div class="col-md-3">
                 <div class="panel" data-id="1">
@@ -19,7 +20,7 @@
                         </div>
                     </div>
                     <div class="panel-body">
-                        <ul id="check_item_tree" class="ztree">
+                        <ul id="department_tree" class="ztree">
 
                         </ul>
                     </div>
@@ -30,7 +31,7 @@
                     <div class="panel-heading">
                         <span class="title">考核项详情</span>
                         <div class="panel-actions">
-                            <button type="button" class="btn" data-toggle="tooltip" title="添加人员"><i class="icon-plus"></i></button>
+                            <!--<button type="button" class="btn" data-toggle="tooltip" title="添加人员"><i class="icon-plus"></i></button>-->
                         </div>
                     </div>
                     <div class="panel-body no-padding" style="padding:0">
@@ -43,16 +44,43 @@
     </div>
 </div>
 
-
 <div class="modal fade" id="addModal">
     <div class="modal-dialog">
         <div class="modal-content">
             <div class="modal-header">
                 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
-                <h4 class="modal-title">添加部门</h4>
+                <h4 class="modal-title">考核项信息</h4>
             </div>
             <div class="modal-body">
-                <link rel="import" href="/view/user/addDept.html?__inline">
+                <div class="container-fluid ">
+                    <form class="form-horizontal">
+                        <div class="form-group">
+                            <label for="exampleInputAccount4" class="col-sm-2">名称:</label>
+                            <div class="col-md-6 col-sm-10">
+                                <input type="text" id="check_item_name" class="form-control" placeholder="名称">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label for="exampleInputAccount4" class="col-sm-2">分数:</label>
+                            <div class="col-md-6 col-sm-10">
+                                <input type="text" id="check_item_score" class="form-control" placeholder="分数">
+                            </div>
+                        </div>
+                        <div class="form-group check_item_group">
+                            <label for="exampleInputPassword4" class="col-sm-2">分类:</label>
+                            <div class="col-md-6 col-sm-10">
+                                <div id="check_item_select"></div>
+
+                            </div>
+                        </div>
+
+                        <div class="form-group">
+                            <div class="col-sm-offset-2 col-sm-10">
+                                <button type="button" id="add_btn" class="btn btn-default" onclick="addCheckItem()">添加</button>
+                            </div>
+                        </div>
+                    </form>
+                </div>
             </div>
         </div>
     </div>

+ 68 - 108
VisualInspection/view/term_management/check_stuff_schedule.html

@@ -1,81 +1,81 @@
-
     
-             <!--  start -->
+<!--  start -->
+<div class="container-fluid ">
+    <div class="row">
+        <div class="col-sm-12">
+            <div id="calendar" class="calendar"></div>
+        </div>
+    </div>
+</div>
+<!--   end -->         
+<!--对话框 开始-->
+<div class="modal fade" id="myModal">
+    <div class="modal-dialog">
+        <div class="modal-content">
+            
+        </div>
+        <div class="modal-content">
+    <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
+        <h4 class="modal-title">添加排班-2017-03-05</h4>
+    </div>
+    <div class="modal-body">
+            <!-- 添加对话框 -->
             <div class="container-fluid ">
-                    <div class="row">
-                        <div class="col-sm-12">
-                            <div id="calendar" class="calendar"></div>
+                <form class="form-horizontal">
+                    <div class="form-group">
+                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核一组</label>
+                        <div class="col-md-6 col-sm-8">
+                            <select type="text" class="form-control" >
+                                <option>选择班次</option>
+                            </select>
                         </div>
                     </div>
-            </div>
-           <!--   end -->         
-            <!--对话框 开始-->
-            <div class="modal fade" id="myModal">
-                    <div class="modal-dialog">
-                        <div class="modal-content">
-                            
+                    <div class="form-group">
+                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核二组</label>
+                        <div class="col-md-6 col-sm-8">
+                            <select type="text" class="form-control" >
+                                <option>选择班次</option>
+                            </select>
                         </div>
-                        <div class="modal-content">
-                    <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
-                        <h4 class="modal-title">添加排班-2017-03-05</h4>
                     </div>
-                    <div class="modal-body">
-                            <!-- 添加对话框 -->
-                            <div class="container-fluid ">
-                                <form class="form-horizontal">
-                                    <div class="form-group">
-                                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核一组</label>
-                                        <div class="col-md-6 col-sm-8">
-                                            <select type="text" class="form-control" >
-                                                <option>选择班次</option>
-                                            </select>
-                                        </div>
-                                    </div>
-                                    <div class="form-group">
-                                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核二组</label>
-                                        <div class="col-md-6 col-sm-8">
-                                            <select type="text" class="form-control" >
-                                                <option>选择班次</option>
-                                            </select>
-                                        </div>
-                                    </div>
-                                    <div class="form-group">
-                                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核三组</label>
-                                        <div class="col-md-6 col-sm-8">
-                                            <select type="text" class="form-control" >
-                                                <option>选择班次</option>
-                                            </select>
-                                        </div>
-                                    </div>
-                                    <div class="form-group">
-                                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核四组</label>
-                                        <div class="col-md-6 col-sm-8">
-                                            <select type="text" class="form-control" >
-                                                <option>选择班次</option>
-                                            </select>
-                                        </div>
-                                    </div>
-                                    
-                                    <hr>
-                                    
-                                    <div class="form-group">
-                                        <div class="col-sm-12">
-                                            <button type="submit" style="float:right;margin-right:3px;" class="btn btn-info">生成本月排班</button>
-                                            <button type="submit" style="float:right;margin-right:10px;" class="btn btn-info">生成今日排班</button>
-                                            <button type="submit" style="float:right;margin-right:10px;" class="btn btn">关闭</button>
-                                        </div>
-                                    </div>
-                                    </form>
-                            </div>
-                            <!--添加对话框结束-->
+                    <div class="form-group">
+                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核三组</label>
+                        <div class="col-md-6 col-sm-8">
+                            <select type="text" class="form-control" >
+                                <option>选择班次</option>
+                            </select>
+                        </div>
                     </div>
+                    <div class="form-group">
+                        <label for="exampleInputAccount4" class="col-sm-offset-1 col-sm-2">考核四组</label>
+                        <div class="col-md-6 col-sm-8">
+                            <select type="text" class="form-control" >
+                                <option>选择班次</option>
+                            </select>
+                        </div>
                     </div>
-                </div>
+                    
+                    <hr>
+                    
+                    <div class="form-group">
+                        <div class="col-sm-12">
+                            <button type="submit" style="float:right;margin-right:3px;" class="btn btn-info">生成本月排班</button>
+                            <button type="submit" style="float:right;margin-right:10px;" class="btn btn-info">生成今日排班</button>
+                            <button type="submit" style="float:right;margin-right:10px;" class="btn btn">关闭</button>
+                        </div>
+                    </div>
+                    </form>
             </div>
-            <!--对话框 结束-->
-  <link rel="stylesheet" type="text/css" href="/node_modules/zui/dist/lib/calendar/zui.calendar.css">   
+            <!--添加对话框结束-->
+    </div>
+    </div>
+</div>
+</div>
+<!--对话框 结束-->
+<link rel="stylesheet" type="text/css" href="/node_modules/zui/dist/lib/calendar/zui.calendar.css">   
 <script src="/node_modules/zui/dist/lib/calendar/zui.calendar.js"></script>
+<script src="/js/teamClass/check_team_schedule.js"></script>
 
 <style type="text/css" >
     span.time{
@@ -85,43 +85,3 @@
         text-align: center ;
     }
 </style>
-<script type="text/javascript">
-    
-   $(document).ready(function() {
-          $('#calendar').calendar();
-
-         var calendar = $('#calendar').data('zui.calendar');
-        var newEvents =
-        [
-            {title: '考核二班-晚班',  start: '2017-5-1 ', end: '2017-5-1 '},
-            {title: '考核三班-晚班',  start: '2017-5-1 ', end: '2017-5-1 '},
-            {title: '考核四班-晚班',  start: '2017-5-1 ', end: '2017-5-1 '},
-            {title: '考核一班-休息',  start: '2017-5-1 ', end: '2017-5-1 '},
-            {title: '考核二班-晚班',  start: '2017-5-12 ', end: '2017-5-12 '},
-            {title: '考核三班-晚班',  start: '2017-5-12 ', end: '2017-5-12 '},
-            {title: '考核四班-晚班',  start: '2017-5-12 ', end: '2017-5-12 '},
-            {title: '考核一班-休息',  start: '2017-5-12 ', end: '2017-5-12 '},
-            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11 '},
-            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11'},
-            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11 '},
-            {title: '未排班',  start: '2017-5-11 ', end: '2017-5-11 '},
-            {title: '未排班',  start: '2017-5-13 ', end: '2017-5-13 '},
-            {title: '未排班',  start: '2017-5-13 ', end: '2017-5-13'},
-            {title: '未排班',  start: '2017-5-13 ', end: '2017-5-13 '},
-            {title: '未排班',  start: '2017-5-13 ', end: '2017-5-13 '},
-        ];
-        calendar.addEvents(newEvents);
-
-        $('#calendar').calendar().on("clickEvent.zui.calendar", function(event) {
-            console.log(event.event);
-            // alert(event.event.title);
-            // console.log("你点击了一个事件");
-            // 处理 clickEvent 事件
-            // ...
-            // 对话框弹出
-            $('#myModal').modal();
-        });
-
-   })
-
-</script>

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/TeamClass.java

@@ -42,4 +42,6 @@ public class TeamClass {
     private Long dept_id;
     //班次类型(早、中、晚、全天)
     private Integer class_type;
+    
+    private String team_name ;
 }

+ 1 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/CheckItemMapper.xml

@@ -43,10 +43,9 @@
         <if test="name != null">name = #{name},</if>
         <if test="parent_id != null">parent_id = #{parent_id},</if>
         <if test="content != null">content = #{content},</if>
-        <if test="score != null">score = #{score},</if>
         <if test="score_type != null">score_type = #{score_type},</if>
         <if test="type != null">type = #{type},</if>
-        id =id 
+        id =id ,score = #{score}
         WHERE
         id = #{id}
     </update>

+ 6 - 5
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/TeamClassMapper.xml

@@ -5,6 +5,7 @@
         <id column="id" property="id" jdbcType="INTEGER" />
         <result column="work_date" property="work_date" jdbcType="DATE" />
         <result column="dept_id" property="dept_id" jdbcType="INTEGER" />
+        <result column="team_name" property="team_name" jdbcType="VARCHAR" />
         <result column="user_ids" property="user_ids" jdbcType="VARCHAR" />
         <result column="class_type" property="class_type" jdbcType="VARCHAR" />
         <result column="team_id" property="team_id" jdbcType="INTEGER" />
@@ -24,12 +25,12 @@
     </select>
     
     <select id="getClassList" parameterType="com.xintong.visualinspection.bean.TeamClass" resultMap="BaseResultMap" >
-        SELECT *
-        FROM sys_team_class
+        SELECT t.* ,st.name as team_name
+        FROM sys_team_class t left join sys_team st ON t.team_id = st.id
         WHERE 1=1
-        <if test="dept_id != null">AND dept_id = #{dept_id}</if>
-        <if test="start_time != null">AND work_date &gt;= #{start_time}</if>
-        <if test="end_time != null">AND work_date &lt;= #{end_time}</if>
+        <if test="dept_id != null">AND t.dept_id = #{dept_id}</if>
+        <if test="start_time != null">AND t.work_date &gt;= #{start_time}</if>
+        <if test="end_time != null">AND t.work_date &lt;= #{end_time}</if>
     </select>
 
     <insert id="insert" parameterType="com.xintong.visualinspection.bean.TeamClass" >

+ 27 - 34
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CheckItemServiceImpl.java

@@ -1,7 +1,9 @@
 package com.xintong.visualinspection.service.impl;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,46 +31,37 @@ public class CheckItemServiceImpl extends BaseService implements CheckItemServic
 	@Override
 	public List<CheckItem> getAll() {
 		List<CheckItem> list = checkItemDao.getAll();
-		List<CheckItem> resultList = new ArrayList<>();
-		// 一级父的数量
-		int pnum = 0;
-		for(int i=0;i<list.size();i++){
-			if(list.get(i).getParent_id()==null){
-				pnum++ ;
-			}else{
-				break ;
-			}
-		}
-		for(int i=0;i<pnum;i++){
-			resultList.add(addSubCheckItem(list,list.get(i)));
-		}
-		return resultList ;
+		return getCheckItems(list) ;
 	}
 
-	// 递归查询
-	private CheckItem addSubCheckItem(List<CheckItem> list,CheckItem checkItem){
-		Boolean _f = false ;
-		for(int j = 0; j < list.size() ; j++ ){
-			if(checkItem.getId() == list.get(j).getParent_id()){
-				_f = true ;
-				if(list.get(j).getScore()!=null){
-					 if(!(checkItem.getSubCheckItem()!=null)){
-						checkItem.setSubCheckItem(new ArrayList<>()); 
-					 }
-					 checkItem.getSubCheckItem().add(list.get(j));						 
-				}else{
-					 if(!(checkItem.getSubCheckItem()!=null)){
-							checkItem.setSubCheckItem(new ArrayList<>()); 
-					 }
-					checkItem.getSubCheckItem().add( addSubCheckItem(list,list.get(j) ));
+	
+	public List<CheckItem> getCheckItems(List<CheckItem> obj) {
+		List<CheckItem> checkItems = obj;
+		List<CheckItem> olist = new ArrayList<>();
+		Map<Long, List<CheckItem>> map = new HashMap<>();
+		// 找出所有父
+		for (CheckItem o : checkItems) {
+			if (o.getParent_id() != null && o.getParent_id()!=0) {
+				List<CheckItem> checkItemList = map.get(o.getParent_id());
+				if (checkItemList == null) {
+					checkItemList = new ArrayList<>();
 				}
-			}else{
-				if(_f){
-					break; 
+				checkItemList.add(o);
+				map.put(o.getParent_id(), checkItemList);
+			}
+		}
+		// 找出子
+		for (Long oid : map.keySet()) {
+			for (CheckItem m2 : checkItems) {
+				if (m2.getId() == oid) {
+					m2.setSubCheckItem(map.get(oid));
+					if (m2.getParent_id() == null || m2.getParent_id()==0) {
+						olist.add(m2);
+					}
 				}
 			}
 		}
-		return checkItem;
+		return olist;
 	}
 
 	@Override

+ 33 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CheckRuleServiceImpl.java

@@ -1,6 +1,9 @@
 package com.xintong.visualinspection.service.impl;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -8,6 +11,7 @@ import org.springframework.stereotype.Service;
 
 import com.xintong.visualinspection.bean.CheckItem;
 import com.xintong.visualinspection.bean.CheckRule;
+import com.xintong.visualinspection.dao.master.CheckItemDao;
 import com.xintong.visualinspection.dao.master.CheckRuleDao;
 import com.xintong.visualinspection.service.BaseService;
 import com.xintong.visualinspection.service.CheckRuleService;
@@ -24,6 +28,9 @@ public class CheckRuleServiceImpl extends BaseService implements CheckRuleServic
 
     @Autowired
     private CheckRuleDao checkRuleDao;
+    
+    @Autowired
+    private CheckItemDao checkItemDao ;
 
 	@Override
 	public List<CheckRule> getAll() {
@@ -33,10 +40,34 @@ public class CheckRuleServiceImpl extends BaseService implements CheckRuleServic
 
 	@Override
 	public CheckRule getById(Long id) {
-		// TODO Auto-generated method stub
-		return checkRuleDao.getOne(id);
+		// 这边要对所有取出来的checkItem数据进行处理
+		CheckRule obj = checkRuleDao.getOne(id);
+//		List<CheckItem> lists = checkItemDao.getAll();
+//		for(CheckItem checkItem : obj.getCheck_items()){
+//			
+//		}
+		return null ;
 	}
 
+//	public CheckItem getCheckPItems(List<CheckItem> ruleItemList,CheckItem obj) {
+//		for(CheckItem o : ruleItemList){
+//			if(obj.getParent_id() == o.getId()){
+//				if(o.getSubCheckItem()!=null){
+//					o.getSubCheckItem().add(obj);
+//				}else{
+//					o.setSubCheckItem(new ArrayList<>());
+//					o.getSubCheckItem().add(obj);
+//				}
+//				if(o.getParent_id()!=null && o.getParent_id()!=0){
+//					getCheckPItems(ruleItemList,o);
+//				}else{
+//					return o;
+//				}
+//			}
+//		}
+//		return obj ;
+//	}
+	
 	@Override
 	public List<CheckRule> getByName(String name) {
 		// TODO Auto-generated method stub