浏览代码

新增待办事项提醒(人才申报待初审)

sugangqiang 2 年之前
父节点
当前提交
bc98d8ec73
共有 3 个文件被更改,包括 215 次插入160 次删除
  1. 19 0
      app/admin/controller/Index.php
  2. 178 160
      app/admin/view/layout/right.html
  3. 18 0
      app/common/api/MenuApi.php

+ 19 - 0
app/admin/controller/Index.php

@@ -3,6 +3,8 @@
 namespace app\admin\controller;
 
 use app\admin\common\AdminController;
+use app\common\api\TalentState;
+use app\enterprise\model\Talent;
 
 /**
  * Description of Login
@@ -20,6 +22,23 @@ class Index extends AdminController {
         ];
         $menus = \app\common\api\MenuApi::getMenuListByRoleid($this->user["roleid"]);
         $vars["menus"] = $menus;
+
+        $codes = \app\common\api\MenuApi::getCodesByRoleId($this->user["roleid"]);
+        $backLogCount = 0;
+        if (in_array("talentInfo_first", $codes)) {
+            $where[] = ["e.type", "=", session("user")["type"]];
+            $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
+            $where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
+            $count = Talent::alias("ti")
+                            ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
+                            ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where createTime in (select max(createTime) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
+                            //->leftJoin("(select mainId,last_state,new_state,state,createTime,row_number() over (partition by mainId order by createTime desc) as rowIndex from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null) tl", "tl.mainId=ti.id and tl.rowIndex=1")
+                            ->where($where)->count();
+            $backlog = ["title" => "【人才认定申报】待初审", "url" => "$('a.J_menuItem[href=\"/admin/talent/fst_verify\"]').click()", "count" => $count];
+            $vars["backlog"][] = $backlog;
+            $backLogCount += $count;
+        }
+        $vars["backLogCount"] = $backLogCount;
         return view("", $vars);
     }
 

+ 178 - 160
app/admin/view/layout/right.html

@@ -4,7 +4,7 @@
        {else/}
        value="{$user.avatar}"
        {/if}
-    />
+       />
 <input type="hidden" id="name" value="{$user.name}">
 <input type="hidden" id="roleName" value="{$user.rolename}">
 <div id="page-wrapper" class="gray-bg dashbard-1">
@@ -57,6 +57,23 @@
                 <a href="javascript:;" class="active J_menuTab" data-id="/common/notice">公告栏</a>
             </div>
         </nav>
+        <div class="btn-group roll-nav roll-right" style='right:140px;{if condition="$backLogCount gt 0"}width:150px;{/if}'>
+            <button class="dropdown J_tabClose" data-toggle="dropdown" style="width:100%">待办事项({if condition="$backLogCount gt 0"}<span style="color:red;font-weight:bold;">{$backLogCount}</span>){/if}<span class="caret"></span>
+            </button>
+            {if condition="$backLogCount gt 0"}
+            <ul role="menu" class="dropdown-menu dropdown-menu-right">
+                {volist name="backlog" id="bl"}
+                <li class="J_tabShowActive">
+                    <a href="javascript:void(0);" onclick="{$bl.url}">{$bl.title}(<span style="color:red;font-weight:bold;">{$bl.count}</span>)</a>
+                </li>
+                {/volist}
+            </ul>
+            {else/}
+            <li class="J_tabShowActive">
+                暂无
+            </li>
+            {/if}
+        </div>
         <div class="btn-group roll-nav roll-right">
             <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>
             </button>
@@ -97,171 +114,172 @@
     }
 </style>
 <script type="text/javascript">
-    var task = null;
-    var time = 10;
-    window.onload=function (){
-        var locked = sessionStorage.getItem('locked');
-        if(locked)lockScreen();
-        // setTimeLockScreen();
-        initTime(time);
-    }
+                        var task = null;
+                        var time = 10;
+                        window.onload = function () {
+                            var locked = sessionStorage.getItem('locked');
+                            if (locked)
+                                lockScreen();
+                            // setTimeLockScreen();
+                            initTime(time);
+                        }
 
-    // 锁屏
-    function lockScreen() {
-        document.onkeydown = function () {
-            var e = window.event || arguments[0];
-            // 屏蔽 F12
-            if (e.keyCode === 123) {
-                return false;
-                // 屏蔽 Ctrl+Shift+I
-            } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode === 73)) {
-                return false;
-                // 屏蔽 Shift+F10
-            } else if ((e.shiftKey) && (e.keyCode === 121)) {
-                return false;
-            }
-        };
-        // 屏蔽右键单击
-        document.oncontextmenu = function () {
-            return false;
-        };
-        $('#locking').remove();
-        if ($("#avatar").val()) {
-            $('body').append('<div id="locking"><figure onclick="lockInput(this);"><img src="' +$("#avatar").val() + '" ></figure><h3>' + $("#name").val() + '</h3></div>');
-        }
-        setTimeout(function () {
-            $('#locking').addClass('lock-ani');
-        }, 200);
-        sessionStorage.setItem('locked', true);
-    }
+                        // 锁屏
+                        function lockScreen() {
+                            document.onkeydown = function () {
+                                var e = window.event || arguments[0];
+                                // 屏蔽 F12
+                                if (e.keyCode === 123) {
+                                    return false;
+                                    // 屏蔽 Ctrl+Shift+I
+                                } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode === 73)) {
+                                    return false;
+                                    // 屏蔽 Shift+F10
+                                } else if ((e.shiftKey) && (e.keyCode === 121)) {
+                                    return false;
+                                }
+                            };
+                            // 屏蔽右键单击
+                            document.oncontextmenu = function () {
+                                return false;
+                            };
+                            $('#locking').remove();
+                            if ($("#avatar").val()) {
+                                $('body').append('<div id="locking"><figure onclick="lockInput(this);"><img src="' + $("#avatar").val() + '" ></figure><h3>' + $("#name").val() + '</h3></div>');
+                            }
+                            setTimeout(function () {
+                                $('#locking').addClass('lock-ani');
+                            }, 200);
+                            sessionStorage.setItem('locked', true);
+                        }
 
-    // 锁屏输入
-    function lockInput(dom) {
-        $(dom).find('img').unwrap();
-        $('#locking').append('<div class="input-group">' +
-            '                   <input class="form-control form-control-lg" id="lockPassword" style="color: #333;" type="password" placeholder="请输入登录密码解锁">' +
-            '                   <div class="input-group-addon" style="background-color: #ccc;border: 1px solid #ccc;" onclick="unlockScreen();">' +
-            '                       <span class="input-group-text">' +
-            '                           <i class="fa fa-key " style="color: #555;font-weight: 900;"></i>' +
-            '                       </span>' +
-            '                   </div>' +
-            '                  </div>');
-        setTimeout(function () {
-            $('#locking .input-group').addClass('lock-input-ani');
-        }, 200);
-        $('#locking input').focus();
-    }
+                        // 锁屏输入
+                        function lockInput(dom) {
+                            $(dom).find('img').unwrap();
+                            $('#locking').append('<div class="input-group">' +
+                                    '                   <input class="form-control form-control-lg" id="lockPassword" style="color: #333;" type="password" placeholder="请输入登录密码解锁">' +
+                                    '                   <div class="input-group-addon" style="background-color: #ccc;border: 1px solid #ccc;" onclick="unlockScreen();">' +
+                                    '                       <span class="input-group-text">' +
+                                    '                           <i class="fa fa-key " style="color: #555;font-weight: 900;"></i>' +
+                                    '                       </span>' +
+                                    '                   </div>' +
+                                    '                  </div>');
+                            setTimeout(function () {
+                                $('#locking .input-group').addClass('lock-input-ani');
+                            }, 200);
+                            $('#locking input').focus();
+                        }
 
-    // 解锁
-    function unlockScreen() {
-        var password = $('#lockPassword').val();
-        var url = "/index/auth/valid_password";
-        $.ajax({
-            type: "post",
-            url: url,
-            dataType: "json",
-            async: false,
-            data: {"password":password},
-            contentType : 'application/x-www-form-urlencoded ',
-            success: function(data) {
-                if(data.code==200){
-                    $('#locking').fadeOut(300, function () {
-                        $('#locking').remove();
-                    });
-                    sessionStorage.removeItem('locked');
-                    document.onkeydown = function () {
-                        var e = window.event || arguments[0];
-                        // 屏蔽 F12
-                        if (e.keyCode === 123) {
-                            return true;
-                            // 屏蔽 Ctrl+Shift+I
-                        } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode === 73)) {
-                            return true;
-                            // 屏蔽 Shift+F10
-                        } else if ((e.shiftKey) && (e.keyCode === 121)) {
-                            return true;
+                        // 解锁
+                        function unlockScreen() {
+                            var password = $('#lockPassword').val();
+                            var url = "/index/auth/valid_password";
+                            $.ajax({
+                                type: "post",
+                                url: url,
+                                dataType: "json",
+                                async: false,
+                                data: {"password": password},
+                                contentType: 'application/x-www-form-urlencoded ',
+                                success: function (data) {
+                                    if (data.code == 200) {
+                                        $('#locking').fadeOut(300, function () {
+                                            $('#locking').remove();
+                                        });
+                                        sessionStorage.removeItem('locked');
+                                        document.onkeydown = function () {
+                                            var e = window.event || arguments[0];
+                                            // 屏蔽 F12
+                                            if (e.keyCode === 123) {
+                                                return true;
+                                                // 屏蔽 Ctrl+Shift+I
+                                            } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode === 73)) {
+                                                return true;
+                                                // 屏蔽 Shift+F10
+                                            } else if ((e.shiftKey) && (e.keyCode === 121)) {
+                                                return true;
+                                            }
+                                        };
+                                        // 屏蔽右键单击
+                                        document.oncontextmenu = function () {
+                                            return true;
+                                        };
+                                    } else {
+                                        if (data.status == 1) {
+                                            Feng.error(data.msg);
+                                        } else if (data.status == 2) {
+                                            window.location.href = "/index/auth/login";
+                                        }
+                                    }
+                                },
+                                error: function (data) {
+                                    window.location.href = "/index/auth/login";
+                                }
+                            });
                         }
-                    };
-                    // 屏蔽右键单击
-                    document.oncontextmenu = function () {
-                        return true;
-                    };
-                }else{
-                    if(data.status==1){
-                        Feng.error(data.msg);
-                    }else if(data.status==2){
-                        window.location.href = "/index/auth/login";
-                    }
-                }
-            },
-            error: function(data) {
-                window.location.href = "/index/auth/login";
-            }
-        });
-    }
 
-    function initTime(time) {
-        var locked = sessionStorage.getItem('locked');
-        var maxTime = 60*time;
-        task = setInterval(function () {
-            if(!locked){
-                lockScreen();
-            }
-        },1000*maxTime);
-        listenTime();
-    }
-    function listenTime() {
-        var body = document.querySelector('html');
-        body.addEventListener("click",restTime);
-        body.addEventListener("keyup",restTime);
-        body.addEventListener("keypress",restTime);
-        body.addEventListener("keydown",restTime);
-        body.addEventListener("mousemove",restTime);
-        body.addEventListener("mousewheel",restTime);
-    }
-    function restTime(){
-        if (task!=null){
-            clearInterval(task);
-        }
-        initTime(time);
-    }
+                        function initTime(time) {
+                            var locked = sessionStorage.getItem('locked');
+                            var maxTime = 60 * time;
+                            task = setInterval(function () {
+                                if (!locked) {
+                                    lockScreen();
+                                }
+                            }, 1000 * maxTime);
+                            listenTime();
+                        }
+                        function listenTime() {
+                            var body = document.querySelector('html');
+                            body.addEventListener("click", restTime);
+                            body.addEventListener("keyup", restTime);
+                            body.addEventListener("keypress", restTime);
+                            body.addEventListener("keydown", restTime);
+                            body.addEventListener("mousemove", restTime);
+                            body.addEventListener("mousewheel", restTime);
+                        }
+                        function restTime() {
+                            if (task != null) {
+                                clearInterval(task);
+                            }
+                            initTime(time);
+                        }
 
 
 
-    // function setTimeLockScreen(){
-    //     var locked = sessionStorage.getItem('locked');
-    //     (function($){
-    //         funObj = {
-    //             timeUserFun:'timeUserFun',
-    //         }
-    //         $[funObj.timeUserFun] = function(time){
-    //             var time = time || 5;    // 默认参数
-    //             var userTime = time*60;
-    //             var testUser = "";
-    //             var objTime = {
-    //                 init:0,
-    //                 time:function(){
-    //                     objTime.init += 1;
-    //                     if(objTime.init == userTime && !locked){
-    //                         lockScreen();
-    //                     }
-    //                 },
-    //                 eventFun:function(){
-    //                     clearInterval(testUser);
-    //                     objTime.init = 0;
-    //                     testUser = setInterval(objTime.time,1000);
-    //                 }
-    //             }
-    //             testUser = setInterval(objTime.time,1000);
-    //             var body = document.querySelector('html');
-    //             body.addEventListener("click",objTime.eventFun);
-    //             body.addEventListener("keyup",objTime.eventFun);
-    //             body.addEventListener("keypress",objTime.eventFun);
-    //             body.addEventListener("keydown",objTime.eventFun);
-    //             body.addEventListener("mousemove",objTime.eventFun);
-    //             body.addEventListener("mousewheel",objTime.eventFun);
-    //         }
-    //     })(window);
-    //     timeUserFun(5);
-    // }
+                        // function setTimeLockScreen(){
+                        //     var locked = sessionStorage.getItem('locked');
+                        //     (function($){
+                        //         funObj = {
+                        //             timeUserFun:'timeUserFun',
+                        //         }
+                        //         $[funObj.timeUserFun] = function(time){
+                        //             var time = time || 5;    // 默认参数
+                        //             var userTime = time*60;
+                        //             var testUser = "";
+                        //             var objTime = {
+                        //                 init:0,
+                        //                 time:function(){
+                        //                     objTime.init += 1;
+                        //                     if(objTime.init == userTime && !locked){
+                        //                         lockScreen();
+                        //                     }
+                        //                 },
+                        //                 eventFun:function(){
+                        //                     clearInterval(testUser);
+                        //                     objTime.init = 0;
+                        //                     testUser = setInterval(objTime.time,1000);
+                        //                 }
+                        //             }
+                        //             testUser = setInterval(objTime.time,1000);
+                        //             var body = document.querySelector('html');
+                        //             body.addEventListener("click",objTime.eventFun);
+                        //             body.addEventListener("keyup",objTime.eventFun);
+                        //             body.addEventListener("keypress",objTime.eventFun);
+                        //             body.addEventListener("keydown",objTime.eventFun);
+                        //             body.addEventListener("mousemove",objTime.eventFun);
+                        //             body.addEventListener("mousewheel",objTime.eventFun);
+                        //         }
+                        //     })(window);
+                        //     timeUserFun(5);
+                        // }
 </script>

+ 18 - 0
app/common/api/MenuApi.php

@@ -118,6 +118,24 @@ class MenuApi {
         return $tmp;
     }
 
+    public static function getCodesByRoleId($roleid) {
+        $roleids = explode(",", $roleid);
+        $tmpArray = [];
+        foreach ($roleids as $roleid) {
+            $role = Role::find($roleid);
+            $menu_ids = $role->sysRelation->column("menuid");
+            $tmpArray = array_merge((array) $tmpArray, (array) $menu_ids);
+        }
+        $codes = [];
+        if ($tmpArray) {
+            $where[] = ["status", "=", 1];
+            $where[] = ["delete", "=", 0];
+            $where[] = ["id", "in", array_unique($tmpArray)];
+            $codes = Menu::where($where)->column("code");
+        }
+        return $codes;
+    }
+
     public static function getPrivilagesByRoleid($roleid) {
         $role = Role::find($roleid);
         $menu_ids = $role->sysRelation->column("menuid");