Explorar el Código

分配任务bug

zhouna hace 4 años
padre
commit
16a037edc0
Se han modificado 1 ficheros con 29 adiciones y 13 borrados
  1. 29 13
      src/js/allotCheckTask.js

+ 29 - 13
src/js/allotCheckTask.js

@@ -19,7 +19,10 @@ const arrowRight = require("./../images/arrow_right.png")
 listenScroll()
 let tabList = [], data_desc=["leaveHospitalDate"],data_asc=[],task_desc=["leaveHospitalDate"],task_asc=[];
 let global_DeptCheckers = {},global_Checkers={4:[],5:[],6:[]},global_CheckerId='',global_CheckerName='',
-    global_DeptId='',global_DeptMId="",global_DeptAllId='',global_deptData = {},global_activeTabCode='0',
+    global_DeptId='',//左边质控员科室筛选id
+    global_DeptMId="",  //左边质检员选中/数字点击科室id
+    global_DeptAllId='',    //右边任务科室筛选id(非科室任务才有)
+    global_deptData = {},global_activeTabCode='0',
     global_TaskCodes=[],global_TaskDept=[],global_deleted=false,global_score='';
 
 let isPlacefile = getCookie('isPlacefile')||1
@@ -184,7 +187,9 @@ $(function() {
 //关闭弹窗事件
     $(".modal-container .close").click(function(){
         $(".modal-container").hide();
-        if(global_deleted){     //移除过刷新相关列表
+        if(global_deleted){
+            //移除后关闭弹窗时清空质控员选中状态:质控员id/name/科室id及右侧选中任务code
+            //并刷新左侧和右侧列表
             global_CheckerId='';
             global_CheckerName='';
             global_DeptMId='';
@@ -198,6 +203,8 @@ $(function() {
     $('.selectDept').on("click", function(e){
         e.stopPropagation()
         $(".checkerList ").css("display", "none")
+        $(".deptAllList ").css("display","none")
+        $(".scoreList ").css("display","none")
         $(".selectChecker .arrow").attr("src",iconDown)
         $(".deptList ").css("display","block")
 
@@ -207,6 +214,8 @@ $(function() {
     $('.selectScore').on("click", function(e){
         e.stopPropagation();
         $(".deptList ").css("display","none")
+        $(".checkerList ").css("display", "none")
+        $(".deptAllList ").css("display","none")
         $(".selectDept .arrow").attr("src",iconDown)
         $(".selectScore .arrow").attr("src",iconDown)
         $(".scoreList ").css("display","block")
@@ -216,7 +225,8 @@ $(function() {
     $('.selectAllDept').on("click", function(e){
         e.stopPropagation()
         $(".checkerList ").css("display", "none")
-        $(".selectChecker .arrow").attr("src",iconDown)
+        $(".scoreList").css("display", "none")
+        $(".deptList ").css("display", "none")
         $(".deptAllList ").css("display","block")
 
     })
@@ -224,7 +234,7 @@ $(function() {
     $('.selectChecker').on("click", function(e){
         e.stopPropagation()
         $(".deptList ").css("display", "none")
-        $(".selectChecker .arrow").attr("src",iconDown)
+        $(".scoreList").css("display", "none")
         $(".checkerList").css("display","block")
     })
 //关闭下拉事件
@@ -232,9 +242,11 @@ $(function() {
         $(".deptList ").css("display", "none")
         $(".deptAllList ").css("display", "none")
         $(".checkerList").css("display", "none")
+        $(".scoreList").css("display", "none")
+        /*$(".scoreDept .arrow").attr("src",iconDown)
         $(".selectDept .arrow").attr("src",iconDown)
         $(".selectAllDept .arrow").attr("src",iconDown)
-        $(".selectChecker .arrow").attr("src",iconDown)
+        $(".selectChecker .arrow").attr("src",iconDown)*/
     })
 
     getScoreTabList((data)=>{rendeScoreList(data)})
@@ -421,7 +433,8 @@ function bindScoreSelect(){
 }
 //质控员列表渲染
 function renderCheckerTable(d){
-    const data = d?d:global_Checkers[+global_activeTabCode+4];
+    const totalArr = global_DeptId.trim()?global_DeptCheckers[global_DeptId]:global_Checkers[+global_activeTabCode+4];
+    const data = d?d:totalArr;
     let str = ``,code="";
     global_CheckerId="";
     if(!data||data.length===0){
@@ -557,7 +570,7 @@ function getTasksList(){
     post(ywCheckApi.getTaskByUserId,{
         jobType:global_activeTabCode,
         checkId:global_CheckerId,
-        deptList:[global_DeptMId],
+        deptList:global_DeptMId.trim()?[global_DeptMId]:[],
         asc:task_asc,
         desc:task_desc,
         size:500,
@@ -588,7 +601,7 @@ function renderTaskTable(data) {
             code = $(titles[i]).attr('valCode');
             str += `<td class="textCenter"><span data-index=${i}>${ item[code] || "-"}<span></td>`
         }
-        str+=`<td class="operaItem textCenter"><a class="delete ${item.delFlag?'':'disable'}" code="${item.behospitalCode}">移除</a></td><tr>`
+        str+=`<td class="operaItem textCenter"><a class="delete ${item.delFlag?'':'disable'}" deptId="${item.behospitalDept}" code="${item.behospitalCode}">移除</a></td><tr>`
     }
     $('.taskTable .tbody').html(str);
     bindDeleteEvent();
@@ -612,6 +625,7 @@ function bindDeleteEvent(){
         });
         $(".del-pop .del-confirm").unbind("click").click(function(){
             global_deleted=true;
+            $(".del-pop").hide();
             allotTask(1);
         });
     });
@@ -775,13 +789,15 @@ function allotTask(flag){
     post(ywCheckApi.allotTask,param).then(res =>{
         if(res.data.code == '0'){
             //分配成功后清空两侧列表选中状态
-            global_CheckerId='';
-            global_CheckerName='';
-            global_DeptMId='';
             global_TaskCodes=[];
             if(flag){
-                getTasksList();       //移除时更新已分配任务列表弹窗数据
-            }else{      //移除时不刷新核查人和待核查列表,关闭移除弹窗后再更新,避免第1个移除后id被清除
+                //移除时更新已分配任务列表弹窗数据,
+                // 不刷新核查人和待核查列表,关闭移除弹窗后再更新,避免第1个移除后id被清除
+                getTasksList();
+            }else{
+                global_CheckerId='';
+                global_CheckerName='';
+                global_DeptMId='';
                 getCheckerList();
                 getTabData(1);
             }