温红权 8 лет назад
Родитель
Сommit
ca4de61de2

+ 305 - 306
VisualInspection/js/assess_management/assess_way_edit.js

@@ -1,128 +1,127 @@
-
- var zdata = [];
- var z_cache ;
- var all_data = [] ;
- var check_rule_id ;
- var check_item_tree = null;
-
-var check_rule_tree = null ;
-
- var edittype = "add";
- var cols = [{
-     width: 10,
-     text: '序号',
-     type: 'number',
-     flex: false,
-     colClass: 'text-center'
- }, {
-     width: 160,
-     text: '名称',
-     type: 'string',
-     flex: false,
-     sort: 'down',
-     colClass: 'text-center'
- }, {
-     width: 40,
-     text: '分数',
-     type: 'string',
-     flex: false,
-     colClass: 'text-center'
- }, {
-     width: 60,
-     text: '操作',
-     type: 'string',
-     flex: false,
-     colClass: 'text-center'
- }];
- $(document).ready(function() {
+var zdata = [];
+var z_cache;
+var all_data = [];
+var check_rule_id;
+var check_item_tree = null;
+
+var check_rule_tree = null;
+
+var edittype = "add";
+var cols = [{
+    width: 10,
+    text: '序号',
+    type: 'number',
+    flex: false,
+    colClass: 'text-center'
+}, {
+    width: 160,
+    text: '名称',
+    type: 'string',
+    flex: false,
+    sort: 'down',
+    colClass: 'text-center'
+}, {
+    width: 40,
+    text: '分数',
+    type: 'string',
+    flex: false,
+    colClass: 'text-center'
+}, {
+    width: 60,
+    text: '操作',
+    type: 'string',
+    flex: false,
+    colClass: 'text-center'
+}];
+$(document).ready(function() {
     addBreadMenu("/view/assess_management/assess_way_edit.html", "考核项");
     //  $("#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($("#department_tree"), {}, zNodes);
-     check_rule_tree = $.fn.zTree.init($("#check_rule_tree"), {}, zNodes);
-     getCheckItems();
-
-     $("#dept_add").on("click", function() {
-         var nodedata = check_item_tree.getSelectedNodes();
-         edittype = "add"
-         loadData(nodedata);
-         $("#add_btn").html("添加");
-         $('#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)
-         $("#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后自动关闭
-             });
-             return;
-         }
-
-        if(nodedata[0].children.length > 0){
+    $('#dashboard').dashboard({ draggable: false });
+    var zTreeObj;
+    var zNodes = [];
+    check_item_tree = $.fn.zTree.init($("#department_tree"), {}, zNodes);
+    check_rule_tree = $.fn.zTree.init($("#check_rule_tree"), {}, zNodes);
+    getCheckItems();
+
+    $("#dept_add").on("click", function() {
+        var nodedata = check_item_tree.getSelectedNodes();
+        edittype = "add"
+        loadData(nodedata);
+        $("#add_btn").html("添加");
+        $('#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)
+        $("#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后自动关闭
+            });
+            return;
+        }
+
+        if (nodedata[0].children.length > 0) {
             layer.msg('请删除具体考核项!', {
-                 time: 2000, //20s后自动关闭
-             });
-             return;
+                time: 2000, //20s后自动关闭
+            });
+            return;
         }
 
-        delete4CheckRuleItem({"rule_id":check_rule_id,"id":nodedata[0].id},"/checkRuleItem/delete",function(){
+        delete4CheckRuleItem({ "rule_id": check_rule_id, "id": nodedata[0].id }, "/checkRuleItem/delete", function() {
             layer.msg('删除成功!', {
-                    time: 2000, //20s后自动关闭
-                });   
+                time: 2000, //20s后自动关闭
+            });
             getCheckItems();
             table_init();
-        }, function(error){ })
-     });
+        }, function(error) {})
+    });
 
-     $('.datatable').datatable({
-         checkable: false,
-         sortable: false,
-         data: {
-             cols: cols,
-             rows: []
-         }
-     });
- });
+    $('.datatable').datatable({
+        checkable: false,
+        sortable: false,
+        data: {
+            cols: cols,
+            rows: []
+        }
+    });
+});
 
 
-function delete4CheckRuleItem(param,url,okCb){
+function delete4CheckRuleItem(param, url, okCb) {
     //询问框
     layer.confirm('确定删除记录?', {
-        btn: ['删除','取消'] //按钮
-    }, function(){
+        btn: ['删除', '取消'] //按钮
+    }, function() {
         no_return_common_service(url, param, function(data) {
-            okCb();//重新加载表格数据
+            okCb(); //重新加载表格数据
             layer.msg(data, {
-                time: 2000//20s后自动关闭
+                time: 2000 //20s后自动关闭
             });
         }, function(error) {
-            alert(error);
+            // alert(error);
         });
-    }, function(index){
+    }, function(index) {
         layer.close(index);
     });
 }
 
-function table_init(){
+function table_init() {
     $('.datatable').datatable('load', {
         cols: cols,
         rows: []
@@ -130,100 +129,100 @@ function table_init(){
 }
 
 // 表格点击修改
-function modify_check_item( id ){
-   post_common_service("/checkItem/getById", {"id":id }, function(data){
+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").attr("onclick", "addCheckItem_v(" + data.id + ")");
         $("#add_btn").html("修改");
-    }, function(error){ })
+    }, function(error) {})
 }
 
-function addCheckItem_v(id){
+function addCheckItem_v(id) {
     var name = $("#check_item_name").val();
     var score = $("#check_item_score").val();
     var data = {
-        "id":id ,
-        "name":name,
-        "score":score 
+        "id": id,
+        "name": name,
+        "score": score
     }
-    post_common_service( "checkItem/update",data,function(data){
+    post_common_service("checkItem/update", data, function(data) {
         layer.msg('修改成功!', {
             time: 2000, //20s后自动关闭
         }, function() {
             $('#addModal').modal('hide');
-             $("#add_btn").attr("onclick","addCheckItem()");
+            $("#add_btn").attr("onclick", "addCheckItem()");
             getCheckItems();
             table_init();
         })
-    },function(error){})
+    }, function(error) {})
 
 }
 
 // 表格点击删除
-function delete_check_item(id ){
-     delete4CheckRuleItem( {"rule_id":check_rule_id,"id":id} ,"/checkItem/delete",function(){
-         layer.msg('删除成功!', {
-                time: 2000, //20s后自动关闭
-            });   
+function delete_check_item(id) {
+    delete4CheckRuleItem({ "rule_id": check_rule_id, "id": 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);
-     }
-
-     function zTreeOnRemove(event, treeId, treeNode) {
-         alert(treeNode.tId + ", " + treeNode.name);
-     }
-
-
-     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 ;
+    }, function(error) {})
+}
+
+function getCheckItems() {
+    function zTreeOnRename(event, treeId, treeNode, isCancel) {
+        alert(treeNode.tId + ", " + treeNode.name);
+    }
+
+    function zTreeOnRemove(event, treeId, treeNode) {
+        alert(treeNode.tId + ", " + treeNode.name);
+    }
+
+
+    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;
                     }
                 }
             }
             return null;
         }
-     }
+    }
 
-     var seq = 0 ;
+    var seq = 0;
 
-     function getTree(obj,rowObj){
+    function getTree(obj, rowObj) {
         var userdata = {};
         userdata["checked"] = false;
-        if(obj.score != null){
-            userdata["data"] = [++seq, obj.name, (obj.score!=null?obj.score:""), '<a href="javascript:void(0)" onclick="delete_check_item('+ obj.id +')" ><i class="icon icon-remove-circle"></i> 删除</a>'];
+        if (obj.score != null) {
+            userdata["data"] = [++seq, obj.name, (obj.score != null ? obj.score : ""), '<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);
+        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) {
+    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 ;
+        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;
             }
         }
 
@@ -232,118 +231,118 @@ function delete_check_item(id ){
             cols: cols,
             rows: rowdata
         });
-     };
-
-     var setting = {
-         data: {
-             simpleData: {
-                 enable: true,
-                 idKey: "id",
-                 pIdKey: "pId",
-                 rootPId: null
-             }
-         },
-         view: { //表示tree的显示状态
-             selectMulti: false //表示禁止多选
-         },
-         check: { //表示tree的节点在点击时的相关设置
-             enable: false, //是否显示radio/checkbox
-             chkStyle: "checkbox", //值为checkbox或者radio表示
-             checkboxType: { p: "", s: "" }, //表示父子节点的联动效果
-             radioType: "level" //设置tree的分组
-         },
-         callback: {
-             onRename: zTreeOnRename,
-             //  beforeDrop: zTreeBeforeDrop,
-             onRemove: zTreeOnRemove,
-             onClick: zTreeOnClick
-         },
-         edit: {
-             enable: true,
-             drag: {
-                 autoExpandTrigger: true,
-                 isMove: true,
-                 prev: false,
-                 next: true,
-                 inner: true,
-                 autoOpenTime: 0
-             },
-             showRenameBtn: false,
-             showRemoveBtn: false
-         }
-     };
-
-     $("#check_rule_item_name").html($.zui.store.get("check_rule_name"));
-
-     check_rule_id = $.zui.store.get("check_rule_id");
-
-     var data = {"id": check_rule_id } ;
-     post_common_service("/checkRule/getListById",data,function(data){
+    };
+
+    var setting = {
+        data: {
+            simpleData: {
+                enable: true,
+                idKey: "id",
+                pIdKey: "pId",
+                rootPId: null
+            }
+        },
+        view: { //表示tree的显示状态
+            selectMulti: false //表示禁止多选
+        },
+        check: { //表示tree的节点在点击时的相关设置
+            enable: false, //是否显示radio/checkbox
+            chkStyle: "checkbox", //值为checkbox或者radio表示
+            checkboxType: { p: "", s: "" }, //表示父子节点的联动效果
+            radioType: "level" //设置tree的分组
+        },
+        callback: {
+            onRename: zTreeOnRename,
+            //  beforeDrop: zTreeBeforeDrop,
+            onRemove: zTreeOnRemove,
+            onClick: zTreeOnClick
+        },
+        edit: {
+            enable: true,
+            drag: {
+                autoExpandTrigger: true,
+                isMove: true,
+                prev: false,
+                next: true,
+                inner: true,
+                autoOpenTime: 0
+            },
+            showRenameBtn: false,
+            showRemoveBtn: false
+        }
+    };
+
+    $("#check_rule_item_name").html($.zui.store.get("check_rule_name"));
+
+    check_rule_id = $.zui.store.get("check_rule_id");
+
+    var data = { "id": check_rule_id };
+    post_common_service("/checkRule/getListById", data, function(data) {
         zdata = [];
-        z_cache = data.check_items ;
-        if(data==null){
-            return ;
+        z_cache = data.check_items;
+        if (data == null) {
+            return;
         }
-         for (var i = 0; i < data.check_items.length; i++) {
-             var m = data.check_items[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);
-             zdataItem.open = true ;
-             zdata.push(zdataItem);
-         }
-         check_item_tree = $.fn.zTree.init($("#department_tree"), setting, zdata)
-     },function(error){})
-
-     // 查询所有的考核项
-    post_common_service("/checkItem/getAll","",function(data){
+        for (var i = 0; i < data.check_items.length; i++) {
+            var m = data.check_items[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);
+            zdataItem.open = true;
+            zdata.push(zdataItem);
+        }
+        check_item_tree = $.fn.zTree.init($("#department_tree"), setting, zdata)
+    }, function(error) {})
+
+    // 查询所有的考核项
+    post_common_service("/checkItem/getAll", "", function(data) {
         all_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);
-             zdataItem.open = true ;
-             all_data.push(zdataItem);
-         }
-          check_rule_tree = $.fn.zTree.init($("#check_rule_tree"), setting2, all_data)
-     },function(error){})
-
- }
-
- function addobj(data) {
-     var zdata = [];
-     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 = {};
+        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);
+            zdataItem.open = true;
+            all_data.push(zdataItem);
+        }
+        check_rule_tree = $.fn.zTree.init($("#check_rule_tree"), setting2, all_data)
+    }, function(error) {})
+
+}
+
+function addobj(data) {
+    var zdata = [];
+    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 = {};
             //   if(m.score != null){
             //      continue;
             //   }
-             zdataItem["id"] = m.id;
-             zdataItem["value"] = m.id;
-             zdataItem["pId"] = data.id;
-             zdataItem["score"] = m.score ;
-             zdataItem["icon"] = "";
-             zdataItem["name"] = m.name;
-             zdataItem["children"] = addobj(m);
-             zdataItem.open = false ;
-             zdata.push(zdataItem);
-         }
-         return zdata;
-     } else {
-         return [];
-     }
- }
+            zdataItem["id"] = m.id;
+            zdataItem["value"] = m.id;
+            zdataItem["pId"] = data.id;
+            zdataItem["score"] = m.score;
+            zdataItem["icon"] = "";
+            zdataItem["name"] = m.name;
+            zdataItem["children"] = addobj(m);
+            zdataItem.open = false;
+            zdata.push(zdataItem);
+        }
+        return zdata;
+    } else {
+        return [];
+    }
+}
 
 // 增加和编辑框
 var dept_selectinput;
@@ -353,12 +352,12 @@ function loadData(nodedata) {
     var pnode = nodedata;
 
     if (edittype == "add") {
-        $("#check_item_name").val("") ;
+        $("#check_item_name").val("");
         $("#check_item_score").val("")
     }
-  
+
     $(".check_item_group").show();
-    if(pnode[0] != null){
+    if (pnode[0] != null) {
         dept_selectinput = new TreeSelect({
             element: '#check_item_select',
             data: all_data,
@@ -366,7 +365,7 @@ function loadData(nodedata) {
             placeholder: "选择考核项分类",
             selectvalue: pnode.length > 0 ? pnode[0].id : null
         });
-    }else{
+    } else {
         dept_selectinput = new TreeSelect({
             element: '#check_item_select',
             data: all_data,
@@ -380,16 +379,16 @@ function loadData(nodedata) {
 function addCheckItem() {
     //获取名称 所有已经勾选的
     var nodedata = check_rule_tree.getCheckedNodes();
-    var datas = [] ;
-    for(var i=0;i< nodedata.length; i++ ){
-        if(nodedata[i].children.length >0 ){
+    var datas = [];
+    for (var i = 0; i < nodedata.length; i++) {
+        if (nodedata[i].children.length > 0) {
             continue;
         }
-        datas.push({ "rule_id":check_rule_id,"id":nodedata[i].id });
+        datas.push({ "rule_id": check_rule_id, "id": nodedata[i].id });
     }
 
     if (edittype == "add") {
-        post_common_service( "checkRuleItem/add/list",datas,function(data){
+        post_common_service("checkRuleItem/add/list", datas, function(data) {
             layer.msg('添加成功!', {
                 time: 2000, //20s后自动关闭
             }, function() {
@@ -397,7 +396,7 @@ function addCheckItem() {
                 getCheckItems();
                 table_init();
             })
-        },function(error){})
+        }, function(error) {})
     }
 }
 
@@ -414,37 +413,37 @@ function isSelfOrChild(id, node) {
 
 
 var setting2 = {
-         data: {
-             simpleData: {
-                 enable: true,
-                 idKey: "id",
-                 pIdKey: "pId",
-                 rootPId: null
-             }
-         },
-         view: { //表示tree的显示状态
-             selectMulti: false //表示禁止多选
-         },
-         check: { //表示tree的节点在点击时的相关设置
-             enable: true, //是否显示radio/checkbox
-             chkStyle: "checkbox", //值为checkbox或者radio表示
-             checkboxType: { p: "", s: "" }, //表示父子节点的联动效果
-             radioType: "level" //设置tree的分组
-         },
-         callback: {
-           
-         },
-         edit: {
-             enable: true,
-             drag: {
-                 autoExpandTrigger: true,
-                 isMove: true,
-                 prev: false,
-                 next: true,
-                 inner: true,
-                 autoOpenTime: 0
-             },
-             showRenameBtn: false,
-             showRemoveBtn: false
-         }
-     };
+    data: {
+        simpleData: {
+            enable: true,
+            idKey: "id",
+            pIdKey: "pId",
+            rootPId: null
+        }
+    },
+    view: { //表示tree的显示状态
+        selectMulti: false //表示禁止多选
+    },
+    check: { //表示tree的节点在点击时的相关设置
+        enable: true, //是否显示radio/checkbox
+        chkStyle: "checkbox", //值为checkbox或者radio表示
+        checkboxType: { p: "", s: "" }, //表示父子节点的联动效果
+        radioType: "level" //设置tree的分组
+    },
+    callback: {
+
+    },
+    edit: {
+        enable: true,
+        drag: {
+            autoExpandTrigger: true,
+            isMove: true,
+            prev: false,
+            next: true,
+            inner: true,
+            autoOpenTime: 0
+        },
+        showRenameBtn: false,
+        showRemoveBtn: false
+    }
+};

+ 46 - 47
VisualInspection/js/lib/mytable.js

@@ -1,4 +1,4 @@
-(function ($) {
+(function($) {
     'use strict';
 
     var con;
@@ -8,11 +8,11 @@
     var obj;
     /**
      * Datatable class
-     * 
+     *
      * @param object element           DOM element or jquery element
      * @param object options           Datatable options
      */
-    var mytable = function (element, options, flag) {
+    var mytable = function(element, options, flag) {
         // default options
         var DEFAULTS = {
             checkable: false,
@@ -30,15 +30,15 @@
         this.obj = this;
         $(element).html('');
         if (flag) return;
-        $(element).append('<div class=""><div class="my_table" data-checkable="true" data-sortable="true"></div></div>'
-            + '<div id="kkpager" class="" style="text-align:center"></div>');
+        $(element).append('<div class=""><div class="my_table" data-checkable="true" data-sortable="true"></div></div>' +
+            '<div id="kkpager" class="" style="text-align:center"></div>');
         this.getRemoteData(element, this.options, this);
         return this;
     };
 
     // Get options
     mytable.prototype = {
-        getRemoteData: function (element, options, obj) {
+        getRemoteData: function(element, options, obj) {
             if (!element) element = this.element;
             if (!options) options = this.options;
             var url = options.url;
@@ -46,46 +46,46 @@
             var pager = options.pager;
             this.getServerData(p_cur, options, element, obj);
         },
-        getRemoteData1: function (p_cur) {
+        getRemoteData1: function(p_cur) {
             this.getServerData(p_cur, this.options, this.element, this.obj);
         },
-        getServerData: function (p_cur, options, element, obj) {
+        getServerData: function(p_cur, options, element, obj) {
             var url = options.url;
             var pager = options.pager;
             var page_size = pager.page_size;
             var param = options.param;
             // var obj = this.obj;
-            post_common_service(url + "/" + p_cur + "/" + page_size, param, function (data) {
+            post_common_service(url + "/" + p_cur + "/" + page_size, param, function(data) {
                 console.log(data);
                 if (!data) {
                     data = { list: [] };
                     // return;
                 }
-                 // 这边把请求过来的数据缓存到table选择器中
-                $(element).data("data_cache",data.list);
-                element.tt_data=data.list;
-                options.tableData=data.list;
-                obj.setTable(data.list,element, options,p_cur); 
-                if(obj.options.pager && options.isShoWPager){
+                // 这边把请求过来的数据缓存到table选择器中
+                $(element).data("data_cache", data.list);
+                element.tt_data = data.list;
+                options.tableData = data.list;
+                obj.setTable(data.list, element, options, p_cur);
+                if (obj.options.pager && options.isShoWPager) {
                     options.pager = {
                         page_size: 10,
                         p_cur: data.pageNum, //页号
                         p_pages: data.pages, //总页码
                         p_totalRecords: data.total
-                        // 'cb':'getRemoteData
+                            // 'cb':'getRemoteData
                     }
                     obj.setPager();
                 }
-                if(data.list.length<=0){
-                     $("#kkpager").css("display","none");
-                }else{
-                     $("#kkpager").css("display","block");
+                if (data.list.length <= 0) {
+                    $("#kkpager").css("display", "none");
+                } else {
+                    $("#kkpager").css("display", "block");
                 }
-            }, function (error) {
-                alert(error);
+            }, function(error) {
+                // alert(error);
             });
         },
-        setTable: function (datas, element, options, p_cur) {
+        setTable: function(datas, element, options, p_cur) {
             var cols = options.cols;
             var newCols = []
             for (var i in cols) {
@@ -101,14 +101,13 @@
             var rowData = formatTableData(tableData, cols, p_cur);
 
             // 使用data参数更新数据:
-            $(element).find('.my_table').datatable('load',{
-                    cols: cols,
-                    rows:rowData
-                }
-            );
+            $(element).find('.my_table').datatable('load', {
+                cols: cols,
+                rows: rowData
+            });
             // $('#my_table').datatable({checkable: true});
 
-            $('a.lightbox-toggle').lightbox();//图片轮播
+            $('a.lightbox-toggle').lightbox(); //图片轮播
             function formatTableData(data, cols, p_cur) {
                 var rows = [];
                 for (var i = 0; i < data.length; i++) {
@@ -130,10 +129,10 @@
                         if (pics) {
                             var picArr = pics.split(',');
                             for (var j in picArr) {
-                                 
+
 
                                 var ispic = true;
-                                
+
                                 var src = picArr[j];
                                 if (!src.startWith("http"))
                                     src = base_image_server_url + src;
@@ -151,9 +150,9 @@
                                     src = src.split('.mp4')[0] + "_screen_0.png"
                                     ispic = false;
                                 }
-                                var pic =  (ispic ? '<a class="card lightbox-toggle" data-group="image-group-1" data-lightbox-group="example-3" href="' + src + '" style="width:60px;height:50px;float:left;">' : '<a class="card" onclick="video_paly(\'' + videosrc + '\')" href="javascript:void(0)" style="width:60px;height:50px;">') 
-                                    + '<img class="pic-class  img-thumbnail" style="width:60px;height:50px;" src="' + src + '" alt="">'+ (ispic ? '' : '<i class="icon icon-play-circle" style=" font-size: 30px;position: absolute;top: 10px;left: 15px;color: white;"></i>') 
-                                    + '</a>';
+                                var pic = (ispic ? '<a class="card lightbox-toggle" data-group="image-group-1" data-lightbox-group="example-3" href="' + src + '" style="width:60px;height:50px;float:left;">' : '<a class="card" onclick="video_paly(\'' + videosrc + '\')" href="javascript:void(0)" style="width:60px;height:50px;">') +
+                                    '<img class="pic-class  img-thumbnail" style="width:60px;height:50px;" src="' + src + '" alt="">' + (ispic ? '' : '<i class="icon icon-play-circle" style=" font-size: 30px;position: absolute;top: 10px;left: 15px;color: white;"></i>') +
+                                    '</a>';
                                 picStr += pic;
                             }
                         }
@@ -180,9 +179,9 @@
                                 dArr.push(obj[cols[i].field]);
                             }
                         } else {
-                            if (cols[i].nullvalue != undefined){
+                            if (cols[i].nullvalue != undefined) {
                                 dArr.push(cols[i].nullvalue);
-                            }else{
+                            } else {
                                 dArr.push('');
                             }
                         }
@@ -192,17 +191,18 @@
                 row.data = dArr;
                 return row;
             }
+
             function clearTable(cols, options, element) {
                 var checkable = options.checkable;
                 var sortable = options.sortable
-                $(element).find('.my_table').datatable( {
-                    checkable:checkable,
-                    sortable:sortable,
+                $(element).find('.my_table').datatable({
+                    checkable: checkable,
+                    sortable: sortable,
                     data: {
                         cols: cols,
                         rows: []
                     },
-                    checksChanged: function (event) {
+                    checksChanged: function(event) {
                         var checkArr = event.checks.checks;
                         var checkedIds = [];
                         for (var i = 0; i < checkArr.length; i++) {
@@ -218,7 +218,7 @@
                 console.log("执行清空");
             }
         },
-        setPager: function (data) {
+        setPager: function(data) {
             var pager = this.options.pager;
             var p_cur = pager.p_cur;
             var p_pages = pager.p_pages;
@@ -230,17 +230,17 @@
                 totalRecords: p_totalRecords,
                 isShowTotalRecords: true,
                 mode: 'click',
-                click: function (n) {
+                click: function(n) {
                     obj.options.pager.p_cur = n;
                     this.selectPage(n);
-                    obj.getRemoteData1(n);//调用获取数据方法
+                    obj.getRemoteData1(n); //调用获取数据方法
                     return false;
                 }
             }, true);
         }
     };
 
-    $.fn.mytable = function (options) {
+    $.fn.mytable = function(options) {
         if (typeof options == 'string') {
             switch (options) {
                 case 'getTableData':
@@ -252,7 +252,7 @@
                     return new mytable(this, options, true);
             }
         } else {
-            return this.each(function () {
+            return this.each(function() {
                 new mytable(this, options);
             });
         }
@@ -260,5 +260,4 @@
 
 
     $.fn.mytable.Constructor = mytable;
-}(jQuery));
-
+}(jQuery));

+ 78 - 76
VisualInspection/js/mytask/check.js

@@ -45,8 +45,8 @@ function initCheck() {
         getUserCheckCount();
         initCheckAppealBtns();
         setFeSelect("#fsList", $.checkTask.checked_dept);
-      
-        $("#lane").val($.checkTask.checked_location);      
+
+        $("#lane").val($.checkTask.checked_location);
         $("#check_time").val($.checkTask.check_period);
         // setLaneSelect("#lane", $.checkTask.checked_location);
         get_common_service('user/getUserById/' + $.checkTask.checked_person, null, function(data) {
@@ -152,7 +152,7 @@ function fullscreen() {
         shadeClose: false,
         content: "<div id='layer_content' >" + contenthtml + "</div>",
         success: function(layero, index) {
-    
+
             // slider_current_value = 90;
             $("#full_video_pos").val($("#video_pos").val());
 
@@ -161,10 +161,10 @@ function fullscreen() {
                 setVideoProcess(slideEvt.value);
             });
             $("#full_ex1").slider({ step: 5, min: 0, max: maxVV });
-            
-             $("#full_ex1").slider('setValue',slider_current_value);
-          
-            
+
+            $("#full_ex1").slider('setValue', slider_current_value);
+
+
 
             $("#full_fast_info").html($("#fast_info").html());
             $("#full_slow_info").html($("#slow_info").html());
@@ -218,21 +218,21 @@ function showCheckDetailCount() {
     var param = {
         "period_id": $.checkTask.period_id,
         "checked_person": $.checkTask.checked_person,
-        "status_search_type":1
+        "status_search_type": 1
     };
 
     var cols = [
-                {width: 40, text: '序号', type: 'number', flex: true, colClass: 'text-center',field: 'num'},
-                {width: 80, text: '任务名称', type: 'string', flex: true, sort: 'down',field: 'name'},
-                {width: 50, text: '考核人员', type: 'string', flex: true, colClass: '',field: 'checked_person_name'},
-                {width: 80, text: '扣分情况', type: 'string', flex: true, sort: 'down',field: 'score_details'},
-                {width: 70, text: '稽查时间段', type: 'string', flex: true, sort: 'down',field: 'check_period'}
-            ];
+        { width: 40, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
+        { width: 80, text: '任务名称', type: 'string', flex: true, sort: 'down', field: 'name' },
+        { width: 50, text: '考核人员', type: 'string', flex: true, colClass: '', field: 'checked_person_name' },
+        { width: 80, text: '扣分情况', type: 'string', flex: true, sort: 'down', field: 'score_details' },
+        { width: 70, text: '稽查时间段', type: 'string', flex: true, sort: 'down', field: 'check_period' }
+    ];
     $('#checked_user_task_datatable').mytable({
         'cols': cols,
         'url': "/task/getUserCheckedTaskByPage/",
         'param': param,
-        'isShoWPager':false
+        'isShoWPager': false
     });
 }
 
@@ -253,36 +253,36 @@ function initCheckAppealBtns() {
     }
 }
 
-function showAppealLayer(){
+function showAppealLayer() {
     layer.open({
-            type: 1,
-            title: "申诉详情",
-            closeBtn: 1,
-            shade: false,
-            maxmin: false,
-            shadeClose: true,
-            offset: 'rb',
-            content: $('#appeal_div'), //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
-            cancel:function(index){
-                layer.close(index);
-                layer.open({
-                    type: 1,
-                    title: "",
-                    closeBtn: 0,
-                    shade: false,
-                    maxmin: false,
-                    shadeClose: true,
-                    content:$('#hide_div'),
-                    offset: 'rb',
-                    btn: ['申诉详情'],
-                    yes:function(index){                        
-                        layer.close(index);
-                        showAppealLayer();
-                    }
-                });
-                return false;
-            }
-        });
+        type: 1,
+        title: "申诉详情",
+        closeBtn: 1,
+        shade: false,
+        maxmin: false,
+        shadeClose: true,
+        offset: 'rb',
+        content: $('#appeal_div'), //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
+        cancel: function(index) {
+            layer.close(index);
+            layer.open({
+                type: 1,
+                title: "",
+                closeBtn: 0,
+                shade: false,
+                maxmin: false,
+                shadeClose: true,
+                content: $('#hide_div'),
+                offset: 'rb',
+                btn: ['申诉详情'],
+                yes: function(index) {
+                    layer.close(index);
+                    showAppealLayer();
+                }
+            });
+            return false;
+        }
+    });
 }
 // 使用data参数更新数据:
 function queryCheckScores() {
@@ -342,9 +342,9 @@ function showEditCheckScore(id) {
     $("#check_score_text").val(rowData.check_item_score);
     setFeeUserSelect("#check_checked_person_select", rowData.checked_person);
     // $("#check_checked_person_select").val(rowData.checked_person);
-    $("#check_remark_text").tagsInput({'defaultText':'添加备注','width':'240px'});
+    $("#check_remark_text").tagsInput({ 'defaultText': '添加备注', 'width': '240px' });
     $("#check_remark_text").addTag(rowData.remark);
-    getTags("/score/getTopRemark",'#score_remark_div','#check_remark_text','remark');
+    getTags("/score/getTopRemark", '#score_remark_div', '#check_remark_text', 'remark');
 }
 
 function setFeeUserSelect(div, selectId) {
@@ -568,42 +568,42 @@ function changePerson(id) {
                 "checked_person": id,
             }
             post_common_service("task/update/", param1, function(task_data) {
-                checkHasScore(id,$.checkTask.checked_person);
+                checkHasScore(id, $.checkTask.checked_person);
                 //重置当前任务
                 $.checkTask = task_data;
                 //获取用户信息
                 get_common_service('user/getUserById/' + id, null, function(data) {
-                    changePersonContent(data);                  
-                })
+                        changePersonContent(data);
+                    })
                     //更新用户次数表
                 no_return_common_service('task/updateUserCount/', param, function(data) {
                     // changePersonContent(data);
                 })
                 layer.close(changePersonLayer);
             }, function(error) {
-                alert(error);
+                // alert(error);
             });
         }
     });
 }
 
-function checkHasScore(id,old_person){
+function checkHasScore(id, old_person) {
     var param = {
         "task_id": $.checkTask.id,
-        "checked_person":old_person
+        "checked_person": old_person
     };
     post_common_service("/score/getScoreList/1/10", param, function(data) {
-        if(data.list && data.list.length>0){
+        if (data.list && data.list.length > 0) {
             layer.confirm('是否要同步更改扣分人?', {
-                btn: ['是','否'],//按钮
+                btn: ['是', '否'], //按钮
                 shadeClose: true,
-                shade: 0 ,//不显示遮罩
-                offset:'r'
-            }, function(){
+                shade: 0, //不显示遮罩
+                offset: 'r'
+            }, function() {
                 var param = {
                     "task_id": $.checkTask.id,
-                    "checked_person":old_person,
-                    "new_checked_person":id
+                    "checked_person": old_person,
+                    "new_checked_person": id
                 };
                 post_common_service("/score/updateByTaskIdAndPerson/", param, function(data) {
                     layer.msg('更改成功!', {
@@ -612,12 +612,13 @@ function checkHasScore(id,old_person){
                     });
                     queryCheckScores();
                 });
-            }, function(){
+            }, function() {
 
             });
         }
     });
 }
+
 function showBigImg(src) {
     $('#userBigImg').attr("src", src);
     layer.open({
@@ -826,35 +827,35 @@ function showInvalid() {
         saveValidReason();
     }, ['400px', '500px'], '#invalid_div', 'r');
 
-    $('#apply_reason').tagsInput({'defaultText':'添加原因'});
-    getTags("/checkApply/getTopReason","#top_reason_div",'#apply_reason','apply_reason');
+    $('#apply_reason').tagsInput({ 'defaultText': '添加原因' });
+    getTags("/checkApply/getTopReason", "#top_reason_div", '#apply_reason', 'apply_reason');
 }
 
 function submitCheck4Appeal() {
-    var appeal_result=1;
+    var appeal_result = 1;
     //询问框
     layer.confirm('该申诉是否成功?', {
-        btn: ['成功','失败'],//按钮
+        btn: ['成功', '失败'], //按钮
         shadeClose: true,
-        shade: 0 ,//不显示遮罩
-        offset:'r'
-    }, function(){
-        appeal_result=1;
+        shade: 0, //不显示遮罩
+        offset: 'r'
+    }, function() {
+        appeal_result = 1;
         submitCheck4AppealResult(appeal_result);
-    }, function(){
-        appeal_result=2;
+    }, function() {
+        appeal_result = 2;
         submitCheck4AppealResult(appeal_result);
     });
-    
+
 
 }
 
-function submitCheck4AppealResult(appeal_result){
+function submitCheck4AppealResult(appeal_result) {
     var param = {
         "id": $.checkTask.id,
         "check_status": 14,
-        "appeal_id":$.checkTask.appeal.id,
-        "appeal_result":appeal_result
+        "appeal_id": $.checkTask.appeal.id,
+        "appeal_result": appeal_result
     }
     no_return_common_service("/task/taskEnd/", param, function(data) {
         layer.msg("提交成功", {
@@ -864,10 +865,11 @@ function submitCheck4AppealResult(appeal_result){
         redirectLastPage();
     });
 }
+
 function showPre4Appeal(id) {
     // $('#myModal').modal({name:"dd"});
     //预览提交把任务状态改为待提交
-    no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 17})
+    no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 17 })
     changePage("/view/mytask/taskDetail.html");
 }
 
@@ -943,7 +945,7 @@ function saveRecheckResult() {
     });
 }
 
-function addTag(text,tagDiv){
+function addTag(text, tagDiv) {
     if (!$(tagDiv).tagExist(text)) {
         $(tagDiv).addTag(text);
     }

+ 123 - 64
VisualInspection/js/statistics/assess_ranking.js

@@ -1,6 +1,30 @@
+var isshownumber = false;
+$(function() {
+    $('[data-toggle="tooltip"]').tooltip();
+
+    var url = "/statistics/employee/order/data?data=chek_count_show"
+    post_common_service(url, "", function(data) {
+            isshownumber = false;
+            if (typeof(data) == "undefined" || data == "") {
+                $("#show_check_text").html("隐藏");
+                $("#show_check").prop("checked", false)
+            } else {
+                if (data == "true") {
+                    isshownumber = true;
+                    $("#show_check_text").html("显示");
+                    $("#show_check").prop("checked", true)
+                } else {
+                    $("#show_check_text").html("隐藏");
+                    $("#show_check").prop("checked", false)
+                }
+            }
+            if (hasRole(ROLE_JICHA_ADMIN) || hasRole(ROLE_ADMIN)) {
+                $("#show_check_div").removeClass("hidden");
+            }
+        },
+        function(error) {
 
-
-$(function () {
+        });
     setVisit();
     var road_manager;
     if (roleContains("STATION")) {
@@ -26,22 +50,36 @@ $(function () {
         initQueryEmp(null, null);
     }
     // 道管中心选择变化
-    $("#center-manager").change(function () {
-        $("#fsList").empty();
-        if (GV(this) != '') {
-            getFsStationList(GV(this), function (options) {
-                $("#fsList").append(options);
-                var dept;
-                if (roleContains("STATION")) {
-                    dept = getCurrentUser().organid;
-                }
-                $("#fsList").val(dept);
-            });
-        }
-    })
-    // end
+    $("#center-manager").change(function() {
+            $("#fsList").empty();
+            if (GV(this) != '') {
+                getFsStationList(GV(this), function(options) {
+                    $("#fsList").append(options);
+                    var dept;
+                    if (roleContains("STATION")) {
+                        dept = getCurrentUser().organid;
+                    }
+                    $("#fsList").val(dept);
+                });
+            }
+        })
+        // end
 })
 
+function show_check_fun() {
+    var isshow = $("#show_check").prop("checked");
+    if (isshow) {
+        $("#show_check_text").html("显示");
+    } else {
+        $("#show_check_text").html("隐藏");
+    }
+
+    var url = "/statistics/employee/order/data?data=chek_count_show$" + isshow
+    post_common_service(url, "", function(data) {
+
+    }, function(error) {});
+}
+
 function queryEmpClick() {
 
     //每次点击前清空表格数据
@@ -89,8 +127,8 @@ function initQueryEmp(parent_dept_id, dept_id) {
     var endD = new Date();
     var now = new Date();
     var startD = new Date(now.getTime() - 7 * 24 * 3600 * 1000);
-    var start_time = startD.getFullYear() + "-" + (startD.getMonth()) + "-26";
-    var end_time = endD.getFullYear() + "-" + (endD.getMonth() + 1) + "-25";
+    var start_time = startD.getFullYear() + "-" + (startD.getMonth() > 10 ? startD.getMonth() : "0" + startD.getMonth()) + "-26";
+    var end_time = endD.getFullYear() + "-" + (endD.getMonth() + 1 > 10 ? endD.getMonth() + 1 : "0" + (endD.getMonth() + 1)) + "-25";
     var start_score = $("#start-score").val();
     var end_score = $("#end-score").val();
     var start_num = $("#start-num").val() != '' ? $("#start-num").val() : 0;
@@ -102,58 +140,74 @@ function initQueryEmp(parent_dept_id, dept_id) {
     var start_date = start_time + " 23:00:00";
     var end_date = end_time + " 23:00:00";
 
-    var start = new Date(start_date);
+    var start = moment(start_date);
     //开始日期取前一天的23:00
-    start.setDate(start.getDate() - 1);
-    start_date = start.Format("yyyy-MM-dd HH:mm:ss");
-    // alert("dd");
+
+    start_date = start.toDate().Format("yyyy-MM-dd HH:mm:ss");
+
     var param = {
         "parent_dept_id": parent_dept_id,
         "dept_id": dept_id,
         "start_date": start_date,
         "end_date": end_date,
     }
+
     var url = "statistics/employee/order";
     getEmployeeInfosClick(url, param, start_score, end_score, start_num, end_num);
 }
 /**
  * click
- * @param {*} url 
- * @param {*} param 
+ * @param {*} url
+ * @param {*} param
  */
 function getEmployeeInfosClick(url, param, start_score, end_score, start_num, end_num) {
-    post_common_service(url, param, function (data) {
+    post_common_service(url, param, function(data) {
 
         var strTbody = '';
         var count = 0;
+        var start_date_time = moment(param.end_date + "Z");
+        var now_date_time = moment();
+        var current_start_date = null;
+
+        if (now_date_time.date() >= 26) {
+            current_start_date = moment(now_date_time.format("YYYY-MM") + "-25 23:00:00Z").subtract(1, "month");
+        } else {
+            current_start_date = moment(now_date_time.format("YYYY-MM") + "-25 23:00:00Z").subtract(2, "month");
+        }
+
+        if (start_date_time.valueOf() <= current_start_date.valueOf()) {
+            isshownumber = true;
+
+        }
 
         for (var i = 0; i < data.length; i++) {
-            var score = 1000 - filterByZeroHandle(average(data[i]).toFixed(2), '0');
+            var score = 1000 - filterByZeroHandle(data[i].check_score_avg, '0');
             var check_number = filter(data[i].checked_num, '0');
             var flag = judgeParamFilter(data, i, score, start_score, end_score, check_number, start_num, end_num)
             if (flag) {
                 html = "";
                 if (hasRole(ROLE_JICHA_ADMIN) || hasRole(ROLE_ADMIN)) {
+                    isshownumber = true;
                     html += "<button id=\"user_" + data[i].user.id + "\" onClick='addTask(" + data[i].user.id + ",\"" + data[i].user.truename + "\",\"" + data[i].user.fee_station_name + "\",\"" + data[i].checked_num + "\",\"" + param.start_date + "\",\"" + param.end_date + "\")'  class=\"btn\" style='margin-left: 10px;padding: 0px;border: 0;background: none;' type=\"button\"><i class=\"icon icon-plus-sign\"></i></button>"
                 }
 
-                strTbody += "<tr><td width='4%;'>" + (count + 1) + "</td><td width='6%;'>" + data[i].user.fee_station_name + "</td>"
-                    + "<td width='6%;'>" + data[i].user.truename + "</td><td width='6%;'>" + data[i].user.position_name + "</td>"
-                    + "<td width='6%;'>" + data[i].user.workno + "</td><td width='4%;'>" + filter(data[i].company_ranking, '/') + "</td>"
-                    + "<td width='4%;'>" + filter(data[i].center_ranking, '/') + "</td><td width='4%;'>" + filter(data[i].fee_station_ranking, '/')
-                    + "</td><td width='4%;'>" + getItemScore(data[i], '环境') + "</td>"
-                    + "<td width='4%;'>" + getItemScore(data[i], '仪容仪表') + "</td><td width='4%;'>" + getItemScore(data[i], '表情') + "</td>"
-                    + "<td width='4%;'>" + getItemScore(data[i], '动作') + "</td><td width='4%;'>" + getItemScore(data[i], '文明用语') + "</td>"
-                    + "<td width='4%;'>" + getItemScore(data[i], '工作纪律') + "</td><td width='4%'>" + getItemScore(data[i], '便民服务') + "</td><td width='4%;'>"
-                    + getItemScore(data[i], '安全管理') + "</td><td width='4%;'>" + data[i].check_all_score + "</td>"
-                    + "<td width='6%;'>" + filter(data[i].checked_num, '0') + (data[i].checked_num < 6 ? html : "") + "</td><td width='4%;'>" + filterSlash(filterByZeroHandle(average(data[i]).toFixed(2), '0'), filter(data[i].checked_num + data[i].checked_m_num, '0')) + "</td>"
-                    + "<td width='4%;'>" + filterSlash(score, filter(data[i].checked_num + data[i].checked_m_num, '0')) + "</td><td width='4%;'>" + "</td><td width='4%;'>" + "</td></tr>";
+                strTbody += "<tr><td width='4%;'>" + (count + 1) + "</td><td width='6%;'>" + data[i].user.fee_station_name + "</td>" +
+                    "<td width='6%;'>" + data[i].user.truename + "</td><td width='6%;'>" + data[i].user.position_name + "</td>" +
+                    "<td width='6%;'>" + data[i].user.workno + "</td><td width='4%;'>" + filter(data[i].company_ranking, '/') + "</td>" +
+                    "<td width='4%;'>" + filter(data[i].center_ranking, '/') + "</td><td width='4%;'>" + filter(data[i].fee_station_ranking, '/') +
+                    "</td><td width='4%;'>" + getItemScore(data[i], '环境') + "</td>" +
+                    "<td width='4%;'>" + getItemScore(data[i], '仪容仪表') + "</td><td width='4%;'>" + getItemScore(data[i], '表情') + "</td>" +
+                    "<td width='4%;'>" + getItemScore(data[i], '动作') + "</td><td width='4%;'>" + getItemScore(data[i], '文明用语') + "</td>" +
+                    "<td width='4%;'>" + getItemScore(data[i], '工作纪律') + "</td><td width='4%'>" + getItemScore(data[i], '便民服务') + "</td><td width='4%;'>" +
+                    getItemScore(data[i], '安全管理') + "</td><td width='4%;'>" + data[i].check_all_score + "</td>" +
+                    "<td width='6%;'>" + (isshownumber ? (filter(data[i].checked_num, '0') + (data[i].checked_num < 6 ? html : "")) : "-") + "</td><td width='4%;'>" + filterSlash(filterByZeroHandle(data[i].check_score_avg, '0'), filter(data[i].checked_num + data[i].checked_m_num, '0')) + "</td>" +
+                    "<td width='4%;'>" + filterSlash(score, filter(data[i].checked_num + data[i].checked_m_num, '0')) + "</td><td width='4%;'>" + "</td><td width='4%;'>" + "</td></tr>";
                 count++;
             }
         }
         $(".table-tbody").append(strTbody);
         $("tr:gt(1):odd").css("background", "#EFEFEF");
-    }, function (error) {
+    }, function(error) {
         return "";
     });
 }
@@ -170,8 +224,8 @@ function showAddTaskListView(data, widthtemp, heighttemp, start_date, end_date)
 
 
     //计算日期
-    var satrtday = new Date(start_date);
-    var endday = new Date(end_date);
+    var satrtday = moment(start_date).toDate();
+    var endday = moment(end_date).toDate();
 
     var taskmap = new Map();
     var userClassmap = new Map();
@@ -189,7 +243,7 @@ function showAddTaskListView(data, widthtemp, heighttemp, start_date, end_date)
     for (var i = 0; i < userclasslist.length; i++) {
         var usercount = userclasslist[i];
 
-        var daytime = new Date(usercount.start_time)
+        var daytime = moment(usercount.start_time).toDate()
         if (daytime.getHours() >= 23) {
             daytime = new Date(daytime.valueOf() + (1000 * 60 * 60 * 24))
         }
@@ -219,6 +273,7 @@ function showAddTaskListView(data, widthtemp, heighttemp, start_date, end_date)
         var daytime = new Date(satrtday.valueOf() + i * 1000 * 60 * 60 * 24 - 1000 * 60 * 60 * 23);
         var workday = daytime.Format("yyyy-MM-dd HH:mm");
 
+
         var html1 = ""
         var html2 = ""
         var html3 = ""
@@ -249,11 +304,11 @@ function showAddTaskListView(data, widthtemp, heighttemp, start_date, end_date)
                         }
                     }
                 }
-                if ((new Date(tasktemp.end_time)).valueOf() - (new Date(tasktemp.start_time)).valueOf() < 1000 * 60 * 15) {
+                if ((moment(tasktemp.end_time).toDate()).valueOf() - (moment(tasktemp.start_time).toDate()).valueOf() < 1000 * 60 * 15) {
                     hasmin = true;
                 }
 
-                var name = (new Date(tasktemp.start_time)).Format("HH:mm") + "--" + (new Date(tasktemp.end_time)).Format("HH:mm")
+                var name = (moment(tasktemp.start_time).toDate()).Format("HH:mm") + "--" + (moment(tasktemp.end_time).toDate()).Format("HH:mm")
                 var classname = "btn-success";
                 if (hasmin) {
 
@@ -270,12 +325,12 @@ function showAddTaskListView(data, widthtemp, heighttemp, start_date, end_date)
                 }
 
 
-                var teamid = tasktemp.class_id + "_" + (typeof (tasktemp.unregular_id) == "undefined" ? "" : tasktemp.unregular_id)
+                var teamid = tasktemp.class_id + "_" + (typeof(tasktemp.unregular_id) == "undefined" ? "" : tasktemp.unregular_id)
 
                 if (tasktemp.class_type == 1) {
 
                     html2 += "<div class='row'><button class=\"btn " + classname + " classbtn\" id=" + teamid + "  data=" + workday + " onclick='selectTeamClass(this)'  type=\"button\">" + name + "</button></div>"
-                    //  html1 +='<div class="row"><label class="btn '+classname+'"><input type="radio" name="options" id="option2">'+name+'</label></div>'
+                        //  html1 +='<div class="row"><label class="btn '+classname+'"><input type="radio" name="options" id="option2">'+name+'</label></div>'
                     continue;
                 }
                 if (tasktemp.class_type == 2) {
@@ -315,7 +370,7 @@ function showAddTaskListView(data, widthtemp, heighttemp, start_date, end_date)
                     taskfail = true;
                 }
                 var classname = "btn-danger disabled";
-                var name = (new Date(usercounttemp.start_time)).Format("HH:mm") + "--" + (new Date(usercounttemp.end_time)).Format("HH:mm") + "<span class=\"label label-badge\">删</span>";
+                var name = (moment(usercounttemp.start_time).toDate()).Format("HH:mm") + "--" + (moment(usercounttemp.end_time).toDate()).Format("HH:mm") + "<span class=\"label label-badge\">删</span>";
                 if (hasin) {
                     continue;
                 }
@@ -459,12 +514,14 @@ function addTask(userid, username, stationname, checknum, start_date, end_date)
         "start_time": start_date,
         "end_time": end_date
     }
-    post_common_service(url, param, function (data) {
+
+    post_common_service(url, param, function(data) {
 
         var allheight = 600;
         var height = allheight - 150 - 45;
         var allwidth = 1100;
 
+
         var html = showAddTaskListView(data, allwidth, allheight, start_date, end_date);
 
 
@@ -476,10 +533,10 @@ function addTask(userid, username, stationname, checknum, start_date, end_date)
             area: [allwidth + 'px', allheight + 'px'], //宽高
             scrollbar: false,
             content: "<div id ='layerhtml'>" + html + "</div>",
-            cancel: function (index, layero) {
-                 layer.close(index);
+            cancel: function(index, layero) {
+                layer.close(index);
                 //  queryEmpClick();
-                 return false;
+                return false;
             }
         });
 
@@ -489,6 +546,7 @@ function addTask(userid, username, stationname, checknum, start_date, end_date)
 
 
 }
+
 function selectTeamClass(obj) {
     $("#selectedclass").html($(obj).attr('data') + " " + $(obj).html() + "的排班");
     $("#selectedclass").attr('data', obj.id);
@@ -506,7 +564,7 @@ function creatTask() {
 
     //获取userid
     var userid = $("#selectusers").val();
-    if (id != null && typeof (id) != "undefined") {
+    if (id != null && typeof(id) != "undefined") {
         var ids = id.split("_");
         var classid = ids[0];
         var unregular_id = ids[1];
@@ -522,7 +580,7 @@ function creatTask() {
             contentType: "application/json",
             dataType: "json",
             async: true,
-            success: function (response) {
+            success: function(response) {
                 var data = response;
                 if (data.result_code == 0) {
                     tip("生成成功", null)
@@ -535,7 +593,7 @@ function creatTask() {
                             "start_time": data_p.start_date,
                             "end_time": data_p.end_date
                         }
-                        post_common_service(url, param, function (data) {
+                        post_common_service(url, param, function(data) {
 
                             var allheight = 600;
                             var height = allheight - 150 - 45;
@@ -560,7 +618,7 @@ function creatTask() {
                     tip(data.result_desc, null)
                 }
             },
-            error: function (error) {
+            error: function(error) {
                 tip("网络错误", null)
             }
         })
@@ -577,8 +635,8 @@ function hasinList(task, list) {
     var hasin = false;
     for (var p = 0; p < list.length; p++) {
         var userclasscount = list[p];
-        if (typeof (task.unregular_id) == "undefined") {
-            if (typeof (userclasscount.unregular_id) == "undefined") {
+        if (typeof(task.unregular_id) == "undefined") {
+            if (typeof(userclasscount.unregular_id) == "undefined") {
                 if (task.class_id == userclasscount.class_id) {
                     return userclasscount;
                 } else {
@@ -588,7 +646,7 @@ function hasinList(task, list) {
                 continue;
             }
         } else {
-            if (typeof (userclasscount.unregular_id) == "undefined") {
+            if (typeof(userclasscount.unregular_id) == "undefined") {
                 continue;
             } else {
                 if (task.class_id == userclasscount.class_id && userclasscount.unregular_id == task.unregular_id) {
@@ -653,8 +711,8 @@ function average(obj) {
 
 /**
  * 过滤undefined
- * @param {*} value 
- * @param {*} default_display_value 
+ * @param {*} value
+ * @param {*} default_display_value
  */
 function filter(value, default_display_value) {
     if (value != '' && value != undefined) {
@@ -668,8 +726,8 @@ function filter(value, default_display_value) {
 
 /**
  * 获取扣分详情
- * @param {*} obj 
- * @param {*} check_item_name 
+ * @param {*} obj
+ * @param {*} check_item_name
  */
 function getItemScore(obj, check_item_name) {
     var names = obj.checked_socre_name;
@@ -685,8 +743,8 @@ function getItemScore(obj, check_item_name) {
 
 /**
  * 过滤除数为0和保留二位小数时出现的0.00
- * @param {*} value 
- * @param {*} default_display_value 
+ * @param {*} value
+ * @param {*} default_display_value
  */
 function filterByZeroHandle(value, default_display_value) {
     if (isNaN(value)) {
@@ -744,6 +802,7 @@ function param_method(start_score, end_score) {
         return true;
     }
 }
+
 function setVisit() {
     // if (roleContains("STATION")) {
     //     $("#center-manager").attr("disabled", "disabled");
@@ -752,4 +811,4 @@ function setVisit() {
     // if(roleContains("ROAD_MANAGER")){
     // 	$("#center-manager").attr("disabled","disabled");
     // }
-}
+}

+ 8 - 7
VisualInspection/js/statistics/personal_data_statistics.js

@@ -9,9 +9,11 @@ var check_type;
 var cur_status;
 var hide = false;
 // 默认初始化日期一个月
-$(".div-start input").val(new Date().getFullYear() + "-" + new Date().getMonth() + "-26");
-$(".div-end input").val(new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-25");
-var start_date = dateChange(new Date($(".div-start input").val() + " 00:00:00"), 60 * 60 * 1000);
+$(".div-start input").val(new Date().getFullYear() + "-" + (new Date().getMonth() > 10 ? new Date().getMonth() : "0" + new Date().getMonth()) + "-26");
+$(".div-end input").val(new Date().getFullYear() + "-" + (new Date().getMonth() + 1 > 10 ? new Date().getMonth() + 1 : "0" + (new Date().getMonth() + 1)) + "-25");
+
+var start_date = dateChange(moment($(".div-start input").val() + " 00:00:00"), 60 * 60 * 1000);
+
 var end_date = $(".div-end input").val() + " 23:00:00";
 
 /**
@@ -49,6 +51,7 @@ $(function() {
         var url_t = "/statistics/employee/order/detail"
         post_common_service(url_t, data_t, function(res) {
 
+
             var isshow_c = false;
             var isshow_l = false;
             if (typeof(res.currentP) != undefined && res.currentP != null) {
@@ -87,9 +90,7 @@ $(function() {
 
 
 
-        }, function(error) {
-
-        })
+        }, function(error) {})
 
 
 
@@ -299,7 +300,7 @@ $(function() {
     }
 
     function getInit() {
-        var start_date = dateChange(new Date($(".div-start input").val() + " 00:00:00"), 60 * 60 * 1000);
+        var start_date = dateChange(moment($(".div-start input").val() + " 00:00:00"), 60 * 60 * 1000);
         var end_date = $(".div-end input").val() + " 23:00:00";
         var user_id = $("#select-personal").val();
         // 页面初始化

+ 264 - 247
VisualInspection/js/util/util.js

@@ -77,7 +77,7 @@ function HandleError(error) {
                 layer.msg('登陆已经过期,将重新登陆!', {
                     time: 2000, //20s后自动关闭
                 }, function() {
-                    self.location = base_ui_url + UI_USER_LOGIN +"?time="+(Date.parse(new Date()));
+                    self.location = base_ui_url + UI_USER_LOGIN + "?time=" + (Date.parse(new Date()));
                 })
 
 
@@ -98,21 +98,22 @@ function GetQueryString(name) {
     }
     return null;
 }
-function getItemByIdFromArr(id,curDatas){
+
+function getItemByIdFromArr(id, curDatas) {
     var rowData;
-    for(var i=0;i<curDatas.length;i++){
-        if(id==curDatas[i].id){
+    for (var i = 0; i < curDatas.length; i++) {
+        if (id == curDatas[i].id) {
             rowData = curDatas[i];
-            break;            
+            break;
         }
     }
     return rowData;
 }
 
-function showPopup4Common(title,callback,area,divId,offset){
-    if(!area) area='auto';
-    if(!divId) divId='#form-div';
-    if(!offset) offset='auto';
+function showPopup4Common(title, callback, area, divId, offset) {
+    if (!area) area = 'auto';
+    if (!divId) divId = '#form-div';
+    if (!offset) offset = 'auto';
     //添加常量页面
     return layer.open({
         type: 1,
@@ -125,10 +126,10 @@ function showPopup4Common(title,callback,area,divId,offset){
         content: $(divId),
         btn: '保存',
         btnAlign: 'c', //按钮居中
-        shade: 0 ,//不显示遮罩
-        yes: function(index){
-            if(callback!=false){
-               callback();
+        shade: 0, //不显示遮罩
+        yes: function(index) {
+            if (callback != false) {
+                callback();
             }
             layer.close(index);
         }
@@ -136,123 +137,130 @@ function showPopup4Common(title,callback,area,divId,offset){
 }
 
 
-function deleteItem4Common(id,url,okCb,offset){
-    if(!offset) offset='auto';
+function deleteItem4Common(id, url, okCb, offset) {
+    if (!offset) offset = 'auto';
     //询问框
     layer.confirm('确定删除记录?', {
-        btn: ['删除','取消'], //按钮
-        offset:offset
-    }, function(){
-        var param ={"id":id};
+        btn: ['删除', '取消'], //按钮
+        offset: offset
+    }, function() {
+        var param = { "id": id };
         no_return_common_service(url, param, function(data) {
-            okCb();//重新加载表格数据
+            okCb(); //重新加载表格数据
             layer.msg(data, {
-                time: 2000//20s后自动关闭
+                time: 2000 //20s后自动关闭
             });
         }, function(error) {
-            alert(error);
+            // alert(error);
         });
-    }, function(index){
+    }, function(index) {
         layer.close(index);
     });
 }
 
-function addOrUpdateItem4Common(param,url,okCb){
+function addOrUpdateItem4Common(param, url, okCb) {
     no_return_common_service(url, param, function(data) {
-        if(okCb) okCb();//重新加载表格数据
+        if (okCb) okCb(); //重新加载表格数据
         layer.msg(data, {
-            time: 2000//20s后自动关闭
+            time: 2000 //20s后自动关闭
         });
     }, function(error) {
-        alert(error);
+        // alert(error);
     });
 }
 //获取道管中心列表
-function getRoadManagerList(){
-    get_common_service("/dept/getAllRM",null,function(data){
-        $.zui.store.set("cache_road_manager_list",data);
+function getRoadManagerList() {
+    get_common_service("/dept/getAllRM", null, function(data) {
+        $.zui.store.set("cache_road_manager_list", data);
         // cb(data);
     });
 }
-function setRoadManagerSelect(div,selectId,hasAll){
-     var rmList = $.zui.store.get("cache_road_manager_list");
-     setRoadManagerValue(rmList,div,selectId,hasAll);
+
+function setRoadManagerSelect(div, selectId, hasAll) {
+    var rmList = $.zui.store.get("cache_road_manager_list");
+    setRoadManagerValue(rmList, div, selectId, hasAll);
 }
-function setRoadManagerValue(data,div,selectId,hasAll){
-    var optStr = '';//<option value="">全部</option>';
-    if(hasAll) optStr = '<option value="">全部</option>';
-    for(var i in data) {
-        if(data[i].deptid==selectId)
-            optStr += '<option value="'+data[i].deptid+'" selected="selected">'+data[i].name+'</option>';
+
+function setRoadManagerValue(data, div, selectId, hasAll) {
+    var optStr = ''; //<option value="">全部</option>';
+    if (hasAll) optStr = '<option value="">全部</option>';
+    for (var i in data) {
+        if (data[i].deptid == selectId)
+            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
         else
-            optStr += '<option value="'+data[i].deptid+'">'+data[i].name+'</option>';
+            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
     }
     $(div).html('');
     $(div).html(optStr);
 }
 
 var cache_road_manager_fee_list_map;
-function getFeeList(callback){
-    get_common_service("/dept/getAllFs",null,function(data){
-        $.zui.store.set("cache_fee_station_list",data);
-        var map= new Map();
-        for(var i=0;i<data.length;i++) {
-            if(!map.get(data[i].parentid)){
-                map.put(data[i].parentid,[]);
+
+function getFeeList(callback) {
+    get_common_service("/dept/getAllFs", null, function(data) {
+        $.zui.store.set("cache_fee_station_list", data);
+        var map = new Map();
+        for (var i = 0; i < data.length; i++) {
+            if (!map.get(data[i].parentid)) {
+                map.put(data[i].parentid, []);
             }
             var arr = map.get(data[i].parentid);
             arr.push(data[i]);
         }
         cache_road_manager_fee_list_map = map;
-        if(callback) callback(data);
+        if (callback) callback(data);
     });
 }
-function setFeSelect(div,selectId){
+
+function setFeSelect(div, selectId) {
     var feeList = $.zui.store.get("cache_fee_station_list");
-    if(feeList){
-        setFeeSelectValue(feeList,div,selectId);
-    }else{
-        get_common_service("/dept/getAllFs",null,function(data){
-            setFeeSelectValue(data,div,selectId);
+    if (feeList) {
+        setFeeSelectValue(feeList, div, selectId);
+    } else {
+        get_common_service("/dept/getAllFs", null, function(data) {
+            setFeeSelectValue(data, div, selectId);
         });
     }
 }
-function setFeeSelectValue(data,div,selectId){
+
+function setFeeSelectValue(data, div, selectId) {
     var optStr = '<option value="">全部</option>';
-    for(var i in data) {
-        if(data[i].deptid==selectId)
-            optStr += '<option value="'+data[i].deptid+'" selected="selected">'+data[i].name+'</option>';
+    for (var i in data) {
+        if (data[i].deptid == selectId)
+            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
         else
-            optStr += '<option value="'+data[i].deptid+'">'+data[i].name+'</option>';
+            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
     }
     $(div).html('');
     $(div).html(optStr);
 }
-function setFeeSelectValueNoAll(data,div,selectId){
+
+function setFeeSelectValueNoAll(data, div, selectId) {
     var optStr = '';
-    for(var i in data) {
-        if(data[i].deptid==selectId)
-            optStr += '<option value="'+data[i].deptid+'" selected="selected">'+data[i].name+'</option>';
+    for (var i in data) {
+        if (data[i].deptid == selectId)
+            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
         else
-            optStr += '<option value="'+data[i].deptid+'">'+data[i].name+'</option>';
+            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
     }
     $(div).html('');
     $(div).html(optStr);
 }
-function setLaneSelect(div,selectId){
+
+function setLaneSelect(div, selectId) {
     var optStr = '';
-    var data =[];
-    for(var i =0;i<=8;i++) {
-        if(i==0)
-            data.push({id:i,name:'值机室'});
+    var data = [];
+    for (var i = 0; i <= 8; i++) {
+        if (i == 0)
+            data.push({ id: i, name: '值机室' });
         else
-            data.push({id:i,name:i+'车道'});
+            data.push({ id: i, name: i + '车道' });
     }
-    for(var i in data) {
-        if(i==selectId)
-            optStr += '<option value="'+data[i].id+'" selected="selected">'+data[i].name+'</option>';
+    for (var i in data) {
+        if (i == selectId)
+            optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].name + '</option>';
         else
-            optStr += '<option value="'+data[i].id+'">'+data[i].name+'</option>';
+            optStr += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
     }
     $(div).html('');
     $(div).html(optStr);
@@ -270,10 +278,10 @@ function setLaneSelect(div,selectId){
  * @time long
  * @format string 有默认值
  */
-function timeStamp2String(time,format){
-    if(time == "" || time == null)
-        return ;
-    if(format==undefined || format == "")
+function timeStamp2String(time, format) {
+    if (time == "" || time == null)
+        return;
+    if (format == undefined || format == "")
         format = "yyyy/MM/dd hh:mm:ss";
     var datetime = new Date();
     datetime.setTime(time);
@@ -283,25 +291,24 @@ function timeStamp2String(time,format){
 /**
  * @Func 时间格式化
  * @FuncName Format
- * (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 
+ * (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
  */
-Date.prototype.Format = function (fmt) { 
-	 var o = {
-	     "M+": this.getMonth() + 1, 
-	     "d+": this.getDate(), 
-	     "H+": this.getHours(), 
-	     "m+": this.getMinutes(), 
-	     "s+": this.getSeconds(), 
-	     "q+": Math.floor((this.getMonth() + 3) / 3), 
-	     "S": this.getMilliseconds()
-	 };
-	 if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
-	 for (var k in o)
-		 if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
-	 return fmt;
+Date.prototype.Format = function(fmt) {
+    var o = {
+        "M+": this.getMonth() + 1,
+        "d+": this.getDate(),
+        "H+": this.getHours(),
+        "m+": this.getMinutes(),
+        "s+": this.getSeconds(),
+        "q+": Math.floor((this.getMonth() + 3) / 3),
+        "S": this.getMilliseconds()
+    };
+    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
+    for (var k in o)
+        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+    return fmt;
 };
-String.prototype.trim = function()
-{
+String.prototype.trim = function() {
     // 用正则表达式将前后空格
     // 用空字符串替代。
     return this.replace(/(^\s*)|(\s*$)/g, "");
@@ -310,17 +317,17 @@ String.prototype.trim = function()
 /**
  * 提示框
  */
-function tip(data,timeout){
-    if(data==undefined || data=='')
-        return ;
+function tip(data, timeout) {
+    if (data == undefined || data == '')
+        return;
     layer.msg(data, {
-            time: (timeout!=null)?timeout:2000 //20s后自动关闭
-        });
+        time: (timeout != null) ? timeout : 2000 //20s后自动关闭
+    });
 }
 
-function showPopup4CommonBtns(title,area,divId,btns,callback1,callback2){
-    if(!area) area='auto';
-    if(!divId) divId='#form-div';
+function showPopup4CommonBtns(title, area, divId, btns, callback1, callback2) {
+    if (!area) area = 'auto';
+    if (!divId) divId = '#form-div';
     //添加常量页面
     return layer.open({
         type: 1,
@@ -331,10 +338,10 @@ function showPopup4CommonBtns(title,area,divId,btns,callback1,callback2){
         content: $(divId),
         btn: btns,
         btnAlign: 'c', //按钮居中
-        shade: 0 ,//不显示遮罩
-        yes: function(index){
-            if(callback!=false){
-               callback();
+        shade: 0, //不显示遮罩
+        yes: function(index) {
+            if (callback != false) {
+                callback();
             }
             layer.close(index);
         }
@@ -346,165 +353,170 @@ function getCurrentUser() {
     return user;
 }
 
-function hasRole(role){
+function hasRole(role) {
     var user = getCurrentUser();
     var roles = user.roles;
-    for(var i in roles){
-        if(roles[i].name==role) return true;
+    for (var i in roles) {
+        if (roles[i].name == role) return true;
     }
     return false;
 }
 
-function roleContains(role){
+function roleContains(role) {
     var user = getCurrentUser();
     var roles = user.roles;
-    for(var i in roles){
-        if(roles[i].name.indexOf(role) >= 0) return true;
+    for (var i in roles) {
+        if (roles[i].name.indexOf(role) >= 0) return true;
     }
     return false;
 }
 
-function setCheckmanSelect(div, selectId, notHaveUserId, callback){
-    post_common_service("/user/getAllCheckman",null,function(data){
+function setCheckmanSelect(div, selectId, notHaveUserId, callback) {
+    post_common_service("/user/getAllCheckman", null, function(data) {
         var optStr = '';
-        for(var i in data) {
-            if(data[i].id==notHaveUserId) continue;
-            if(data[i].id==selectId)
-                optStr += '<option value="'+data[i].id+'" selected="selected">'+data[i].truename+'</option>';
+        for (var i in data) {
+            if (data[i].id == notHaveUserId) continue;
+            if (data[i].id == selectId)
+                optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].truename + '</option>';
             else
-                optStr += '<option value="'+data[i].id+'">'+data[i].truename+'</option>';
+                optStr += '<option value="' + data[i].id + '">' + data[i].truename + '</option>';
         }
         $(div).html('');
         $(div).html(optStr);
-        if(callback) callback();
+        if (callback) callback();
     });
 }
-function genAppeaFiles(file_src){
+
+function genAppeaFiles(file_src) {
     initStringfunc();
     var files = file_src.split(",");
-    var optionStr="";
-    
-    for(var i in files) {
-        var fileSrc = base_image_server_url+files[i];
-        if(fileSrc.endWith("png") || fileSrc.endWith("jpg")||fileSrc.endWith("ico")){
-            if(ISCLIENT) {
-                optionStr+= '<a href="javascript:void(0)" onclick="showClientImg('+fileSrc+')"><img src="'+fileSrc+'" style="height:55px;margin:5px;"></a>';
-            }else{
-                optionStr+= '<a href="'+fileSrc+'" target="_blank"><img src="'+fileSrc+'" style="height:55px;margin:5px;"></a>';
+    var optionStr = "";
+
+    for (var i in files) {
+        var fileSrc = base_image_server_url + files[i];
+        if (fileSrc.endWith("png") || fileSrc.endWith("jpg") || fileSrc.endWith("ico")) {
+            if (ISCLIENT) {
+                optionStr += '<a href="javascript:void(0)" onclick="showClientImg(' + fileSrc + ')"><img src="' + fileSrc + '" style="height:55px;margin:5px;"></a>';
+            } else {
+                optionStr += '<a href="' + fileSrc + '" target="_blank"><img src="' + fileSrc + '" style="height:55px;margin:5px;"></a>';
             }
-        }else if(fileSrc.endWith("doc")|| fileSrc.endWith("docx")){
-            if(ISCLIENT) {
-                optionStr+= '<a href="javascript:void(0)" onclick="downloadClientfile('+fileSrc+')"><i class="icon icon-file-word icon-4x" style="vertical-align: middle"></a>';
-            }else{
-                optionStr+= '<a href="'+fileSrc+'" target="_blank"><i class="icon icon-file-word icon-4x" style="vertical-align: middle"></a>';
+        } else if (fileSrc.endWith("doc") || fileSrc.endWith("docx")) {
+            if (ISCLIENT) {
+                optionStr += '<a href="javascript:void(0)" onclick="downloadClientfile(' + fileSrc + ')"><i class="icon icon-file-word icon-4x" style="vertical-align: middle"></a>';
+            } else {
+                optionStr += '<a href="' + fileSrc + '" target="_blank"><i class="icon icon-file-word icon-4x" style="vertical-align: middle"></a>';
             }
-        }else if(fileSrc.endWith("txt")){
-            if(ISCLIENT) {
-                optionStr+= '<a href="javascript:void(0)" onclick="downloadClientfile('+fileSrc+')"><i class="icon icon-file-code icon-4x" style="vertical-align: middle"></a>';
-            }else{
-                optionStr+= '<a href="'+fileSrc+'" target="_blank"><i class="icon icon-file-code icon-4x" style="vertical-align: middle"></a>';
+        } else if (fileSrc.endWith("txt")) {
+            if (ISCLIENT) {
+                optionStr += '<a href="javascript:void(0)" onclick="downloadClientfile(' + fileSrc + ')"><i class="icon icon-file-code icon-4x" style="vertical-align: middle"></a>';
+            } else {
+                optionStr += '<a href="' + fileSrc + '" target="_blank"><i class="icon icon-file-code icon-4x" style="vertical-align: middle"></a>';
             }
         }
     }
     return optionStr;
 }
 initStringfunc();
-function initStringfunc(){
-    String.prototype.endWith = function(str){  
-        if(str==null || str=="" || this.length == 0 ||str.length > this.length){      
-        return false;  
-        }  
-        if(this.substring(this.length - str.length) == str){  
-            return true;  
-        }else{  
-            return false;  
-        }  
-    };  
-    
-    String.prototype.startWith = function(str){  
-    if(str == null || str== "" || this.length== 0 || str.length > this.length){  
-        return false;  
-    }   
-    if(this.substr(0,str.length) == str){  
-        return true;  
-    }else{  
-        return false;  
-    }         
-
-    };  
-}
-
-function showClientImg(src){
+
+function initStringfunc() {
+    String.prototype.endWith = function(str) {
+        if (str == null || str == "" || this.length == 0 || str.length > this.length) {
+            return false;
+        }
+        if (this.substring(this.length - str.length) == str) {
+            return true;
+        } else {
+            return false;
+        }
+    };
+
+    String.prototype.startWith = function(str) {
+        if (str == null || str == "" || this.length == 0 || str.length > this.length) {
+            return false;
+        }
+        if (this.substr(0, str.length) == str) {
+            return true;
+        } else {
+            return false;
+        }
+
+    };
+}
+
+function showClientImg(src) {
     callFunc("showImage", src);
 }
 
-function showClientVideo(src){
+function showClientVideo(src) {
     callFunc("showVideo", src);
 }
 
-function downloadClientfile(src){
+function downloadClientfile(src) {
     callFunc("downloadfile", src);
 }
 
-function setTeamUserSelect(div,selectId,classId){
-   post_common_service("/team/getTeamPersonsByUserClassId/"+classId,null,function(data){
+function setTeamUserSelect(div, selectId, classId) {
+    post_common_service("/team/getTeamPersonsByUserClassId/" + classId, null, function(data) {
         var optStr = '';
-        for(var i in data) {
-            if(data[i].positionid==4) data[i].truename=data[i].truename+'(班长)';
-            if(data[i].id==selectId)
-                optStr += '<option value="'+data[i].id+'" selected="selected">'+data[i].truename+'</option>';
+        for (var i in data) {
+            if (data[i].positionid == 4) data[i].truename = data[i].truename + '(班长)';
+            if (data[i].id == selectId)
+                optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].truename + '</option>';
             else
-                optStr += '<option value="'+data[i].id+'">'+data[i].truename+'</option>';
+                optStr += '<option value="' + data[i].id + '">' + data[i].truename + '</option>';
         }
         $(div).html('');
         $(div).html(optStr);
     });
 }
-function getJobList(callback){
-    var param={
-        "dept_id":1
+
+function getJobList(callback) {
+    var param = {
+        "dept_id": 1
     };
-    post_common_service("/job/getList/",param,function(data){
-        $.zui.store.set("cache_job_list",data);
+    post_common_service("/job/getList/", param, function(data) {
+        $.zui.store.set("cache_job_list", data);
         callback(data);
     });
 }
-function setJobSelect(div,selectId){
+
+function setJobSelect(div, selectId) {
     var jobList = $.zui.store.get("cache_job_list");
-    if(jobList) {
-        setJobSelectValue(jobList,div,selectId);
-    }else{
-        var param={
-            "dept_id":1
+    if (jobList) {
+        setJobSelectValue(jobList, div, selectId);
+    } else {
+        var param = {
+            "dept_id": 1
         };
-        post_common_service("/job/getList/",param,function(data){
-            setJobSelectValue(data,div,selectId);
+        post_common_service("/job/getList/", param, function(data) {
+            setJobSelectValue(data, div, selectId);
         });
     }
 }
 
-function setJobSelectValue(data,div,selectId){
+function setJobSelectValue(data, div, selectId) {
     var optStr = '<option value="">全部</option>';
-    for(var i in data) {
-        if(data[i].id==selectId)
-            optStr += '<option value="'+data[i].id+'" selected="selected">'+data[i].name+'</option>';
+    for (var i in data) {
+        if (data[i].id == selectId)
+            optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].name + '</option>';
         else
-            optStr += '<option value="'+data[i].id+'">'+data[i].name+'</option>';
+            optStr += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
     }
     $(div).html('');
     $(div).html(optStr);
 }
 var cache_fee_person_list_map;
-function getFeePersonList(callback){
+
+function getFeePersonList(callback) {
     // var param={
     //     "dept_id":1
     // };
-    post_common_service("/user/getFsUserList/",{},function(data){
-        $.zui.store.set("cache_fee_person_list",data);
-        var map= new Map();
-        for(var i=0;i<data.length;i++) {
-            if(!map.get(data[i].organid)){
-                map.put(data[i].organid,[]);
+    post_common_service("/user/getFsUserList/", {}, function(data) {
+        $.zui.store.set("cache_fee_person_list", data);
+        var map = new Map();
+        for (var i = 0; i < data.length; i++) {
+            if (!map.get(data[i].organid)) {
+                map.put(data[i].organid, []);
             }
             var arr = map.get(data[i].organid);
             arr.push(data[i]);
@@ -513,28 +525,29 @@ function getFeePersonList(callback){
         callback(data);
     });
 }
-function setFeePersonSelect(div,selectId,deptId){
+
+function setFeePersonSelect(div, selectId, deptId) {
     var jobList = $.zui.store.get("cache_fee_person_list");
-    if(deptId) {
+    if (deptId) {
         var map = cache_fee_person_list_map;
         jobList = map.get(deptId);
     }
-    if(jobList) {
-        setFeePersonSelectValue(jobList,div,selectId);
-    }else{
-        post_common_service("/user/getFsUserList/",{},function(data){
-            setFeePersonSelectValue(data,div,selectId);
+    if (jobList) {
+        setFeePersonSelectValue(jobList, div, selectId);
+    } else {
+        post_common_service("/user/getFsUserList/", {}, function(data) {
+            setFeePersonSelectValue(data, div, selectId);
         });
     }
 }
 
-function setFeePersonSelectValue(data,div,selectId){
+function setFeePersonSelectValue(data, div, selectId) {
     var optStr = '<option value="">全部</option>';
-    for(var i in data) {
-        if(data[i].id==selectId)
-            optStr += '<option value="'+data[i].id+'" selected="selected">'+data[i].truename+'</option>';
+    for (var i in data) {
+        if (data[i].id == selectId)
+            optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].truename + '</option>';
         else
-            optStr += '<option value="'+data[i].id+'">'+data[i].truename+'</option>';
+            optStr += '<option value="' + data[i].id + '">' + data[i].truename + '</option>';
     }
     $(div).html('');
     $(div).html(optStr);
@@ -544,57 +557,58 @@ function setFeePersonSelectValue(data,div,selectId){
  * 自定义Map对象
  */
 function Map() {
- 
+
     var mapObj = {};
- 
-    this.put = function (key, value) {
+
+    this.put = function(key, value) {
         mapObj[key] = value;
     };
- 
-    this.remove = function (key) {
+
+    this.remove = function(key) {
         if (mapObj.hasOwnProperty(key)) {
             delete mapObj[key];
         }
     };
- 
-    this.get = function (key) {
+
+    this.get = function(key) {
         if (mapObj.hasOwnProperty(key)) {
             return mapObj[key];
         }
         return null;
     };
- 
-    this.getKeys = function () {
+
+    this.getKeys = function() {
         var keys = [];
-        for(var k in mapObj){
+        for (var k in mapObj) {
             keys.push(k);
         }
         return keys;
     };
- 
+
     // 遍历map
-    this.each = function(fn){
-        for(var key in mapObj){
+    this.each = function(fn) {
+        for (var key in mapObj) {
             fn(key, mapObj[key]);
         }
     };
- 
-    this.toString = function () {
+
+    this.toString = function() {
         var str = "{";
-        for(var k in mapObj){
-            str += "\""+ k+"\" : \""+mapObj[k]+"\",";
+        for (var k in mapObj) {
+            str += "\"" + k + "\" : \"" + mapObj[k] + "\",";
         }
-        str = str.substring(0,str.length - 1) ;
+        str = str.substring(0, str.length - 1);
         str += "}";
         return str;
     }
 }
-function getTags(url,div,tagDiv,field){
+
+function getTags(url, div, tagDiv, field) {
     post_common_service(url, null, function(data) {
-        if(data){
-            var str="";
-            for(var i=0;i<data.length;i++){
-                str+='<a href="javascript:void(0)" onclick="addTag(\''+data[i][field]+'\',\''+tagDiv+'\')" style="float:left;margin:5px;"><span class="label label-success" style="padding:5px;">'+data[i][field]+'</span></a>';
+        if (data) {
+            var str = "";
+            for (var i = 0; i < data.length; i++) {
+                str += '<a href="javascript:void(0)" onclick="addTag(\'' + data[i][field] + '\',\'' + tagDiv + '\')" style="float:left;margin:5px;"><span class="label label-success" style="padding:5px;">' + data[i][field] + '</span></a>';
             }
             $(div).html(str);
         }
@@ -602,22 +616,25 @@ function getTags(url,div,tagDiv,field){
 }
 
 var nowStr;
-function getServerTime(){
-    get_common_service("/comm/getTime", "", function(data){
-        nowStr=data;
-        gettime();
-    },
-    function(data){
-        nowStr=moment().format('YYYY-MM-DD HH:mm:ss');
-        gettime();
-    });
+
+function getServerTime() {
+    get_common_service("/comm/getTime", "", function(data) {
+            nowStr = data;
+            gettime();
+        },
+        function(data) {
+            nowStr = moment().format('YYYY-MM-DD HH:mm:ss');
+            gettime();
+        });
 }
-function gettime(){
+
+function gettime() {
     nowStr = moment(nowStr).add(1, 's').format('YYYY-MM-DD HH:mm:ss');
     // console.log("时间:"+nowStr);
     settime();
 }
-function settime() {        
+
+function settime() {
     nowStr = moment(nowStr).format('YYYY-MM-DD HH:mm:ss');
     $("#time_p").html(nowStr);
     $("#main").css("min-height", window.innerHeight);

+ 9 - 4
VisualInspection/view/statistics/emp_ranking.html

@@ -83,7 +83,12 @@
                             <th rowspan="2" width="4%">道管排名</th>
                             <th rowspan="2" width="4%">收费站排名</th>
                             <th colspan="9" height="40px">考核扣分</th>
-                            <th rowspan="2" width="4%">受检次数</th>
+                            <th rowspan="2" width="4%">受检次数
+                                <div class="switch switch-inline hidden" id="show_check_div" data-toggle="tooltip" data-placement="right" title="收费站是否显示该列数据">
+                                    <input type="checkbox" id="show_check" onchange="show_check_fun()">
+                                    <label style="color: #000;" id="show_check_text">显示</label>
+                                </div>
+                            </th>
                             <th rowspan="2" width="4%">平均扣分(千分制)</th>
                             <th rowspan="2" width="4%">得分</th>
                             <th rowspan="2" width="4%">服务评价</th>
@@ -119,7 +124,7 @@
                             <th rowspan="2" width="4%">平均扣分(千分制)</th><th rowspan="2" width="4%">得分</th>
                             <th rowspan="2" width="4%">服务评价</th><th rowspan="2" width="4%">备注</th>
                         </tr>
-                        <tr style="display:none;"> 
+                        <tr style="display:none;">
                             <th width="4%">环境卫生</th><th width="4%">仪容仪表</th><th width="4%">表情</th>
                             <th width="4%">收费动作</th><th width="4%">文明用语</th><th width="4%">工作纪律</th>
                             <th width="4%">便民服务</th><th width="4%">安全管理</th>
@@ -128,8 +133,8 @@
                     </thead>
                     <tbody class="table-tbody" style="background:white; " align="center">
 
-                    </tbody>   
-                 </table>  
+                    </tbody>
+                 </table>
             </div>-->
     </div>
 </div>

+ 20 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/StatisticsController.java

@@ -5,11 +5,9 @@ import java.util.List;
 import java.util.Map;
 
 import com.xintong.visualinspection.pojo.UserRankingData;
+import com.xintong.visualinspection.util.CacheUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -46,6 +44,24 @@ public class StatisticsController extends BaseController {
     	return super.returnSuccessResult(lists);
     }
 
+    @RequestMapping(value = "/employee/order/data")
+    public String getEmployeeOrder(@RequestParam(required = false) String data){
+
+        String res = "";
+        if(data!=null){
+            String[] items = data.split("\\$");
+            //写
+            if(items.length>1){
+                CacheUtil.commonDataMap.put(items[0],items[1]);
+
+            }else{
+                //读
+                res = CacheUtil.commonDataMap.get(items[0]);
+            }
+        }
+        return super.returnSuccessResult((Object) res);
+    }
+
 
     /**
      * 获取用户排名详情

+ 2 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/UserController.java

@@ -70,10 +70,8 @@ public class UserController extends BaseController {
     	//返回成功
     	return returnResult(0, "退出成功", null);
     }
-    
-    
-    
-    
+
+
     
     /**
      * 添加用户

+ 8 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -8,6 +8,7 @@ import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.reflect.Method;
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -215,6 +216,13 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 			}
 
             StatisticsBo statisticsBo = lists.get(i);
+			//计算平均扣分
+            DecimalFormat df = new DecimalFormat(".##");
+            double count = statisticsBo.getChecked_num()+statisticsBo.getChecked_m_num();
+            Double sc = (statisticsBo.getCheck_all_score()+statisticsBo.getCheck_all_m_score())*1.00/(count==0?1:count);
+            statisticsBo.setCheck_score_avg(sc==0?"0":df.format(sc));
+
+
 
             // 累计道管排名
 			//获取道管id

+ 3 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/util/CacheUtil.java

@@ -17,7 +17,9 @@ import com.xintong.visualinspection.service.JobService;
 import com.xintong.visualinspection.service.UserService;
 
 public class CacheUtil {
-	
+
+    public static Map<String,String> commonDataMap = new HashMap<String,String>();
+
 	public static Map<Long,User> userMap = new HashMap<Long,User>();
 	
 	public static Map<Long,Organ> deptMap = new HashMap<Long,Organ>();

+ 1 - 1
VisualInspection_server/src/main/resources/application.properties

@@ -75,7 +75,7 @@ spring.redis.pool.min-idle=0
 spring.redis.timeout=0 
 
 
-log.path=/var/log/visual/
+log.path=./visual/
 log.file=visual
 log.lever=info
 log.MaxHistory=20

Разница между файлами не показана из-за своего большого размера
+ 19 - 2974
VisualInspection_server/visual/visual.log


Некоторые файлы не были показаны из-за большого количества измененных файлов