浏览代码

生成核查任务

zhouna 4 年之前
父节点
当前提交
ae8bf73f4e
共有 5 个文件被更改,包括 442 次插入324 次删除
  1. 24 0
      src/css/common.less
  2. 16 3
      src/css/creatCheckTask.less
  3. 17 1
      src/html/creatCheckTask.html
  4. 155 176
      src/js/allotCheckTask.js
  5. 230 144
      src/js/creatCheckTask.js

+ 24 - 0
src/css/common.less

@@ -295,5 +295,29 @@ input.canEditDept {
         padding:32px 38px;
 
     }
+    .footer{
+        text-align: center;
+        button{
+            width: 80px;
+            height: 32px;
+            background: #00A1FF;
+            border-radius: 4px;
+            color: #fff;
+            text-align: center;
+            line-height: 32px;
+            position: relative;
+            margin-bottom: 32px;
+            cursor: pointer;
+        }
+        .confirm{
+
+        }
+        .cancel{
+            margin-left: 20px;
+            color: #00A1FF;
+            border:1px #00A1FF solid;
+            background: #fff;
+        }
+    }
 
 }

+ 16 - 3
src/css/creatCheckTask.less

@@ -68,14 +68,15 @@ h2{
         text-align: center;
     }
     .operaItem{
-        cursor: pointer;
         img{
             width: 15px;
             height: 15px;
+            cursor: pointer;
         }
     }
     .taskCancel{
         color: #00A1FF;
+        cursor: pointer;
     }
     .disable{
         color: #ccc;
@@ -227,6 +228,13 @@ h2{
 }
 .selectDept{
     width: 160px;
+    i{
+        display: inline-block;
+        max-width: 118px;
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+    }
 }
 
 .filter,.reset,.export{
@@ -316,8 +324,8 @@ h2{
     cursor: pointer;
 }
 
-.deptItem:hover{
-    background-color: #EEF4FF;
+.deptItem:hover,.deptItem.active{
+    background-color: #E7F1FB;
     cursor: pointer;
 }
 .ellipsis{
@@ -436,6 +444,11 @@ h2{
         float: left;
     }
 }
+.modal-container .modal-box{
+   width: 400px;
+    left: 50%;
+    margin-left: -200px;
+}
 
 
 

+ 17 - 1
src/html/creatCheckTask.html

@@ -107,7 +107,7 @@
                         <th class="diagnose textCenter" valCode="diagnose">主诊断</th>
                         <th class="doctorName textCenter" valCode="value" code="value">筛选分值</th>
                         <th class="doctorName textCenter" valCode="creatStatus">生成状态</th>
-                        <th class="deptName textCenter" valCode="gmtCreate">生成日期</th>
+                        <th class="deptName textCenter" valCode="jobCreateTime" code="jobCreateTime">生成日期</th>
                         <th class="recordScoreOpera textCenter" style="width: 65px;">操作</th>
                     </tr>
                     </thead>
@@ -123,6 +123,22 @@
         </div>
         </div>
     </div>
+    <div class="modal-container">
+        <div class="cover"></div>
+        <div class="modal-box">
+            <div class="modal-title">
+                <span class="title">提示</span>
+                <a class="close fr">×</a>
+            </div>
+            <div class="modal-body">
+                <p>确定要生成这些任务吗?</p>
+            </div>
+            <div class="footer">
+                <button class="confirm">确定</button>
+                <button class="cancel">取消</button>
+            </div>
+        </div>
+    </div>
 </body>
 
 </html>

+ 155 - 176
src/js/allotCheckTask.js

@@ -24,20 +24,154 @@ let isPlacefile = getCookie('isPlacefile')||1
 /*if(isPlacefile != 1){
     data_desc=["behospital_date"]
 }*/
-$('.datapickerBox').append(`<img class="iconCalen" src=${iconCalenGrey} />`)
-$('.iconCalen').on("mouseenter", function(e){
-    $(this).attr("src", iconCalenBlue)
-})
-$('.iconCalen').on("mouseleave", function(e){
-    $(this).attr("src", iconCalenGrey)
-})
-$('.iconCalen').on("click", function(e){
-    $(this).parent().find("input").focus()
-})
-
-//
-$(".menu .page", parent.document).removeClass("active")
-$(parent.document).find(".menu .page[code=YH-ZKHC-FPRW]").addClass("active")
+
+$(function() {
+    //初始化日期
+    $.datepicker.regional['zh-CN'] = {
+        clearText: '清除',
+        clearStatus: '清除已选e799bee5baa6e59b9ee7ad9431333361303131日期',
+        closeText: '关闭',
+        closeStatus: '不改变当前选择',
+        prevText: '<上月',
+        prevStatus: '显示上月',
+        prevBigText: '<<',
+        prevBigStatus: '显示上一年',
+        nextText: '下月>',
+        nextStatus: '显示下月',
+        nextBigText: '>>',
+        nextBigStatus: '显示下一年',
+        currentText: '今天',
+        currentStatus: '显示本月',
+        monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        monthNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        yearNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        monthStatus: '选择月份',
+        yearStatus: '选择年份',
+        weekHeader: '周',
+        weekStatus: '年内周次',
+        dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
+        dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
+        dayNamesMin: ['日','一','二','三','四','五','六'],
+        dayStatus: '设置 DD 为一周起始',
+        dateStatus: '选择 m月 d日, DD',
+        dateFormat: 'yy-mm-dd',
+        firstDay: 1,
+        initStatus: '请选择日期',
+        isRTL: false};
+    $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
+    const days = new Date().getDate()-1;
+    let startDate = "-"+days+"d",endDate=new Date();
+    $( "#datepicker" ).datepicker({
+        changeMonth: true,
+        changeYear: true,
+        dateFormat:"yy-mm-dd",
+    }).datepicker( "setDate", startDate);
+    $( "#datepicker2" ).datepicker({
+        changeMonth: true,
+        changeYear: true,
+        dateFormat:"yy-mm-dd",
+    }).datepicker( "setDate",endDate);
+    $( "#datepicker3" ).datepicker({
+        changeMonth: true,
+        changeYear: true,
+        dateFormat:"yy-mm-dd",
+    }).datepicker( "setDate",startDate);
+    $( "#datepicker4" ).datepicker({
+        changeMonth: true,
+        changeYear: true,
+        dateFormat:"yy-mm-dd",
+    }).datepicker( "setDate",endDate);
+
+    $('.datapickerBox').append(`<img class="iconCalen" src=${iconCalenGrey} />`)
+    $('.iconCalen').on("mouseenter", function(e){
+        $(this).attr("src", iconCalenBlue)
+    })
+    $('.iconCalen').on("mouseleave", function(e){
+        $(this).attr("src", iconCalenGrey)
+    })
+    $('.iconCalen').on("click", function(e){
+        $(this).parent().find("input").focus()
+    })
+    //保存分配
+    $(".save-btn").click(function(){
+        allotTask(0);
+    })
+    //菜单选中状态
+    $(".menu .page", parent.document).removeClass("active")
+    $(parent.document).find(".menu .page[code=YH-ZKHC-FPRW]").addClass("active")
+    //表格容器高度计算
+    setBoxHeight();
+    $(window).resize(function() {
+        setBoxHeight();
+    });
+
+//切换tab
+    $(".tabBox .tabs button").on("click",(e)=>{
+        const me = e.target;
+        global_activeTabCode = $(me).attr("data-code");
+        $(".tabBox .tabs button").removeClass("active");
+        $(me).addClass("active");
+        clearCheckerFilter();
+        clearFilter();
+        //刷新质控员、任务列表
+        //getCheckerList();
+        const data = global_Checkers[+global_activeTabCode+4];
+        rendeCheckerList(data||[]);
+        renderCheckerTable(data);
+    });
+
+//任务筛选
+    $(".filter").on("click", function(e){
+        const behosDateStart = $("#datepicker3").val()         //出院日期
+        const behosDateEnd = $("#datepicker4").val()
+        const behosDateStartTime = new Date(behosDateStart).getTime()
+        const behosDateEndTime = new Date(behosDateEnd).getTime()
+        if(behosDateStartTime > behosDateEndTime){
+            $.alerModal({"message":'出院日期开始时间不能大于结束时间~',type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
+            return
+        }
+        getTabData(1)
+    })
+//重置
+    $(".abnormalClear").on("click", function(e){
+        clearFilter();
+        getTabData(1)
+    })
+
+//关闭弹窗事件
+    $(".modal-container .close").click(function(){
+        $(".modal-container").hide();
+    });
+
+//科室选择
+    $('.selectDept').on("click", function(e){
+        e.stopPropagation()
+        $(".checkerList ").css("display", "none")
+        $(".selectChecker .arrow").attr("src",iconDown)
+        $(".deptList ").css("display","block")
+
+    })
+//质控员选择
+    $('.selectChecker').on("click", function(e){
+        e.stopPropagation()
+        $(".deptList ").css("display", "none")
+        $(".selectChecker .arrow").attr("src",iconDown)
+        $(".checkerList").css("display","block")
+    })
+//关闭下拉事件
+    $(document).on("click", function(){
+        $(".deptList ").css("display", "none")
+        $(".checkerList").css("display", "none")
+        $(".selectDept .arrow").attr("src",iconDown)
+        $(".selectChecker .arrow").attr("src",iconDown)
+    })
+
+//获取科室列表
+    getDeptList()
+
+//获取核查人员列表
+    getCheckerList()
+});
 
 //高度适应
 function setBoxHeight() {
@@ -45,10 +179,11 @@ function setBoxHeight() {
     $('.table-cont').height(ht - 319 + 'px');
     $('.overAuto').height(ht - 174 + 'px');
 }
-setBoxHeight();
-$(window).resize(function() {
-    setBoxHeight();
-});
+
+//显示tab权限判断
+function showWhichTab(){
+
+}
 
 //病人列表获取筛选值
 function getFilterData(){
@@ -60,7 +195,7 @@ function getFilterData(){
 }
 
 //获取分配核查任务列表数据
-function getTabData(activePage){console.log(23)
+function getTabData(activePage){
     const filterData = getFilterData();
     const deptList=global_DeptId?[global_DeptId]:undefined;
     const param = {
@@ -97,34 +232,6 @@ function getTabData(activePage){console.log(23)
     })
 }
 
-//切换tab
-$(".tabBox .tabs button").on("click",(e)=>{
-    const me = e.target;
-    global_activeTabCode = $(me).attr("data-code");
-    $(".tabBox .tabs button").removeClass("active");
-    $(me).addClass("active");
-    clearCheckerFilter();
-    clearFilter();
-    //刷新质控员、任务列表
-    //getCheckerList();
-    const data = global_Checkers[+global_activeTabCode+4];
-    rendeCheckerList(data||[]);
-    renderCheckerTable(data);
-});
-
-//任务筛选
-$(".filter").on("click", function(e){
-    const behosDateStart = $("#datepicker3").val()         //出院日期
-    const behosDateEnd = $("#datepicker4").val()
-    const behosDateStartTime = new Date(behosDateStart).getTime()
-    const behosDateEndTime = new Date(behosDateEnd).getTime()
-    if(behosDateStartTime > behosDateEndTime){
-        $.alerModal({"message":'出院日期开始时间不能大于结束时间~',type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
-        return
-    }
-    getTabData(1)
-})
-
 function clearCheckerFilter(){
     $('.selectDept i').text('全部')
     $(".deptList").css("display", "none")
@@ -169,11 +276,6 @@ function clearFilter(){
     $("th[code]").removeClass("asc desc")
 }
 
-//重置
-$(".abnormalClear").on("click", function(e){
-    clearFilter();
-    getTabData(1)
-})
 //质控员列表渲染
 function renderCheckerTable(data,noTasksUpdate){
     let str = ``,code="";
@@ -224,7 +326,7 @@ function selectTaskTb(){
         const codes = global_TaskCodes.join(",")+",";
         if(it.is(".active")){
             $(this).find("img").attr('src',iconUnCheck);
-            global_TaskCodes = codes.replace(id+",","").split(",");
+            global_TaskCodes = codes.replace(id+",","").replace(/^,|,$/,'').split(",");
         }else{
             $(this).find("img").attr('src',iconCheck);
             global_TaskCodes.push(id);
@@ -258,36 +360,6 @@ function renderTab(data){
     $('.patientTable .tbody').html(str)
     selectTaskTb();
 }
-//选择病历等级
-/*$('.selectLevel').on("click", function(e){
-    e.stopPropagation()
-    $(".deptList ").css("display", "none")
-    $(".selectDept .arrow").attr("src",iconDown)
-    $(".checkList ").css("display", "none")
-    $(".selectCheck .arrow").attr("src",iconDown)
-    const showList =  $(".levelList ").css("display")
-    if(showList == "none" ||!showList){
-        $(".levelList ").css("display","block")
-        $(".selectLevel .arrow").attr("src",iconUp)
-    }else{
-        $(".levelList ").css("display", "none")
-        $(".selectLevel .arrow").attr("src",iconDown)
-    }
-})
-
-bindLeveldSelect()
-//病历等级选择
-function bindLeveldSelect(){
-    $('.levelItem').on("click",function(){
-        const levelItemName = $(this).attr("data-name")
-        const levelItemItemId = $(this).attr("data-id")
-        levelTemp =levelItemItemId
-        $('.selectLevel').html(levelItemName)
-        $(".levelList").css("display", "none")
-        $(".selectLevel").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
-        $('.selectLevel').removeClass('unSelect')
-    })
-}*/
 //任务数点击事件
 function bindTaskNumEvent(){
     $(".job-num").unbind("click").click(function(){
@@ -297,29 +369,6 @@ function bindTaskNumEvent(){
         getTasksList();
     })
 }
-//关闭弹窗事件
-$(".modal-container .close").click(function(){
-    $(".modal-container").hide();
-});
-
-//科室选择
-$('.selectDept').on("click", function(e){
-    e.stopPropagation()
-    $(".checkerList ").css("display", "none")
-    $(".selectChecker .arrow").attr("src",iconDown)
-    $(".deptList ").css("display","block")
-
-})
-//质控员选择
-$('.selectChecker').on("click", function(e){
-    e.stopPropagation()
-    $(".deptList ").css("display", "none")
-    $(".selectChecker .arrow").attr("src",iconDown)
-    $(".checkerList").css("display","block")
-})
-
-//获取科室列表
-getDeptList()
 function getDeptList(){
     post(api.getDeptList,{}).then(res =>{
         if(res.data.code == '0'){
@@ -331,8 +380,6 @@ function getDeptList(){
     })
 }
 
-//核查人员列表
-getCheckerList()
 function getCheckerList(){
     post(ywCheckApi.getCheckUserMap,{}).then(res =>{
         if(res.data.code == '0'){
@@ -474,67 +521,6 @@ function hideLoading(){
     $("#mainBox .loadingBox", parent.document).remove()
 }
 
-$(function() {
-    $.datepicker.regional['zh-CN'] = {
-    clearText: '清除',
-    clearStatus: '清除已选e799bee5baa6e59b9ee7ad9431333361303131日期',
-    closeText: '关闭',
-    closeStatus: '不改变当前选择',
-    prevText: '<上月',
-    prevStatus: '显示上月',
-    prevBigText: '<<',
-    prevBigStatus: '显示上一年',
-    nextText: '下月>',
-    nextStatus: '显示下月',
-    nextBigText: '>>',
-    nextBigStatus: '显示下一年',
-    currentText: '今天',
-    currentStatus: '显示本月',
-    monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
-    monthNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
-    yearNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
-    monthStatus: '选择月份',
-    yearStatus: '选择年份',
-    weekHeader: '周',
-    weekStatus: '年内周次',
-    dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
-    dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
-    dayNamesMin: ['日','一','二','三','四','五','六'],
-    dayStatus: '设置 DD 为一周起始',
-    dateStatus: '选择 m月 d日, DD',
-    dateFormat: 'yy-mm-dd',
-    firstDay: 1,
-    initStatus: '请选择日期',
-    isRTL: false};
-    $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
-    const days = new Date().getDate()-1;
-    let startDate = "-"+days+"d",endDate=new Date();
-    $( "#datepicker" ).datepicker({
-        changeMonth: true,
-        changeYear: true,
-        dateFormat:"yy-mm-dd",
-    }).datepicker( "setDate", startDate);
-    $( "#datepicker2" ).datepicker({
-        changeMonth: true,
-        changeYear: true,
-        dateFormat:"yy-mm-dd",
-    }).datepicker( "setDate",endDate);
-    $( "#datepicker3" ).datepicker({
-        changeMonth: true,
-        changeYear: true,
-        dateFormat:"yy-mm-dd",
-    }).datepicker( "setDate",startDate);
-    $( "#datepicker4" ).datepicker({
-        changeMonth: true,
-        changeYear: true,
-        dateFormat:"yy-mm-dd",
-    }).datepicker( "setDate",endDate);
-
-    //保存分配
-    $(".save-btn").click(function(){
-        allotTask(0);
-    })
-});
 function allotTask(flag){
     if(!global_CheckerId){
         toast("请先选择质控员");
@@ -626,10 +612,3 @@ function renderPagination(totalPage,activePage,totalNum){
     })
 
 }
-
-$(document).on("click", function(){
-    $(".deptList ").css("display", "none")
-    $(".checkerList").css("display", "none")
-    $(".selectDept .arrow").attr("src",iconDown)
-    $(".selectChecker .arrow").attr("src",iconDown)
-})

+ 230 - 144
src/js/creatCheckTask.js

@@ -2,7 +2,7 @@ const $ = require('jquery');
 require("../css/creatCheckTask.less");
 require('./modal.js');
 const {api,ywCheckApi} = require('./api.js')
-const {post,getCookie,getUrlArgObjectNew,emptyBox,downloadExportedData,expJson,initScroll,listenScroll,exportTimeLimit} = require('./utils.js')
+const {post,getCookie,emptyBox,listenScroll} = require('./utils.js')
 require('./../resource/jquery-ui/jquery-ui.min.js');
 require('./../resource/jquery-ui/jquery-ui.min.css');
 const iconCheck= require("./../images/icon_check.png")
@@ -16,11 +16,152 @@ const arrowLeft= require("./../images/arrow_left.png")
 const arrowRight = require("./../images/arrow_right.png")
 
 listenScroll()
-let tabList = [],  global_level="",global_status="0", global_deptId="",
-  data_desc=["leaveHospitalDate"],data_asc=[];
+let tabList = [],  global_level="",global_status="0", global_deptId=[],global_deptName="",
+  data_desc=["leaveHospitalDate"],data_asc=[],global_taskList=[],global_delOrAdd=1;//1生成0取消
 let global_activeTabCode = '1';    //激活的tab  code
 let isPlacefile = getCookie('isPlacefile')||1
 
+$(function() {
+    $('.datapickerBox').append(`<img class="iconCalen" src=${iconCalenGrey} />`)
+    $('.iconCalen').on("mouseenter", function(e){
+        $(this).attr("src", iconCalenBlue)
+    })
+    $('.iconCalen').on("mouseleave", function(e){
+        $(this).attr("src", iconCalenGrey)
+    })
+    $('.iconCalen').on("click", function(e){
+        $(this).parent().find("input").focus()
+    })
+
+    $(".menu .page", parent.document).removeClass("active")
+    $(parent.document).find(".menu .page[code=YH-ZKHC-SCRW]").addClass("active")
+
+    $(".filter").on("click", function(e){
+        getTabData(1)
+    })
+    $(".abnormalClear").on("click", function(e){
+        clearFilter();
+        getTabData(1)
+    })
+    //切换tab
+    $(".tabBox .tabs button").on("click",(e)=>{
+        const me = e.target;
+        global_activeTabCode = $(me).attr("data-code");
+        $(".tabBox .tabs button").removeClass("active");
+        $(me).addClass("active");
+        //更新列表并重置筛选条件
+        $(".abnormalClear").click();
+    });
+//选择生成状态
+    $('.selectStatus').on("click", function(e){
+        e.stopPropagation()
+        $(".statusList ").css("display", "none")
+        $(".selectStatus .arrow").attr("src",iconDown)
+        const showList =  $(".statusList ").css("display")
+        if(showList == "none" ||!showList){
+            $(".statusList ").css("display","block")
+            $(".selectStatus .arrow").attr("src",iconUp)
+        }else{
+            $(".statusList ").css("display", "none")
+            $(".selectStatus .arrow").attr("src",iconDown)
+        }
+    })
+//选择病历等级
+    $('.selectLevel').on("click", function(e){
+        e.stopPropagation()
+        $(".deptList ").css("display", "none")
+        $(".selectDept .arrow").attr("src",iconDown)
+        const showList =  $(".levelList ").css("display")
+        if(showList == "none" ||!showList){
+            $(".levelList ").css("display","block")
+            $(".selectLevel .arrow").attr("src",iconUp)
+        }else{
+            $(".levelList ").css("display", "none")
+            $(".selectLevel .arrow").attr("src",iconDown)
+        }
+    })
+    //科室选择
+    $('.selectDept').on("click", function(e){
+        e.stopPropagation();
+        $(".levelList ").css("display","none")
+        $(".selectLevel .arrow").attr("src",iconDown)
+        $(".deptList ").css("display","block")
+    })
+    $(".creatTask").click(function(){
+        $(".modal-container .modal-body p").text("确定要生成这些任务吗?");
+        $(".modal-container").show();
+        global_delOrAdd=1;
+    });
+    $(".modal-container .confirm").click(function(){
+        creatTask(global_delOrAdd)
+    });
+    $(".modal-container .cancel,.modal-container .close").click(function(){
+        global_taskList=[];
+        $(".modal-container").hide();
+    })
+//获取科室列表
+    getDeptList()
+    //出院日期初始化
+    $.datepicker.regional['zh-CN'] = {
+        clearText: '清除',
+        clearStatus: '清除已选日期',
+        closeText: '关闭',
+        closeStatus: '不改变当前选择',
+        prevText: '<上月',
+        prevStatus: '显示上月',
+        prevBigText: '<<',
+        prevBigStatus: '显示上一年',
+        nextText: '下月>',
+        nextStatus: '显示下月',
+        nextBigText: '>>',
+        nextBigStatus: '显示下一年',
+        currentText: '今天',
+        currentStatus: '显示本月',
+        monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        monthNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        yearNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        monthStatus: '选择月份',
+        yearStatus: '选择年份',
+        weekHeader: '周',
+        weekStatus: '年内周次',
+        dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
+        dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
+        dayNamesMin: ['日','一','二','三','四','五','六'],
+        dayStatus: '设置 DD 为一周起始',
+        dateStatus: '选择 m月 d日, DD',
+        dateFormat: 'yy-mm-dd',
+        firstDay: 1,
+        initStatus: '请选择日期',
+        isRTL: false};
+    const days = new Date().getDate()-1;
+    let startDate = "-"+days+"d",endDate=new Date();
+    $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
+    $( "#datepicker" ).datepicker({
+        changeMonth: true,
+        changeYear: true,
+        dateFormat:"yy-mm-dd",
+    }).datepicker( "setDate", startDate);
+    $( "#datepicker2" ).datepicker({
+        changeMonth: true,
+        changeYear: true,
+        dateFormat:"yy-mm-dd"
+    }).datepicker( "setDate",endDate);
+//获取列表数据
+    getTabData(1)
+    //状态选择
+    bindStatusSelect()
+    //等级选择
+    bindLeveldSelect()
+    //关闭下拉
+    $(document).on("click", function(){
+        $(".levelList ").css("display", "none")
+        $(".deptList ").css("display", "none")
+        $(".statusList ").css("display", "none")
+        $(".selectDept .arrow").attr("src",iconDown)
+        $(".selectLevel .arrow").attr("src",iconDown)
+        $(".selectStatus .arrow").attr("src",iconDown)
+    })
+});
 //判断有无某一权限
   function hasData(data){
     let trdObj = JSON.parse(getCookie("trdObj"))
@@ -33,6 +174,36 @@ let isPlacefile = getCookie('isPlacefile')||1
     }
     return false;
 }
+
+function bindCancelTaskEvent(){
+    $(".taskCancel").unbind("click").click(function(){
+        global_delOrAdd=0;
+        global_taskList = [$(this).attr("code")];
+        $(".modal-container .modal-body p").text("确定要取消该任务吗?");
+        $(".modal-container").show();
+    });
+}
+
+//生成任务
+function creatTask(flag){
+      const param={
+          behospitalCodeList:global_taskList,
+          jobType:global_activeTabCode,
+          checkStatus:flag,
+      };
+    post(ywCheckApi.addCheck,param).then(res =>{
+        if(res.data.code == '0'){
+            $(".modal-container").hide();
+            toast("操作成功!");
+            getTabData(1)
+        }else{
+            toast(res.data.msg);
+        }
+    }).catch((e) =>{
+
+    })
+}
+
 function getTabData(activePage){
     const filterData = getFilterData();
     const param = {
@@ -41,14 +212,16 @@ function getTabData(activePage){
         current:activePage,
         hospitalId:'',
         level:global_level,//病历等级
-        department: global_deptId.trim(),
+        department: global_deptId,
         asc:data_asc,     //升序
         desc:data_desc,       //降序
         size: 15,
-        ...filterData
+        ...filterData,
+        startDate:filterData.startDate+" 00:00:00",
+        endDate:filterData.endDate+" 23:59:59",
     }
     $('.pagination').html("")
-    $('.tbody').html(emptyBox('努力加载中...','',15))
+    $('.tbody').html(emptyBox('努力加载中...','',16))
     return post(ywCheckApi.getTaskList,param).then(res =>{
         if(res.data.code == '0'){
             const data = res.data.data;
@@ -63,20 +236,22 @@ function getTabData(activePage){
                 $('.pagination').html("")
             }
         }else{
-            $.alerModal({"message":res.data.msg,type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
+            toast(res.data.msg);
         }
     }).catch((e) =>{
     
     })
 }
 
-getTabData(1)
+function toast(msg){
+    $.alerModal({"message":msg,type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
+}
 
 function renderTab(data,hisId){
     let str = ``,code="";
     let hasSelectAll = true;
     if(data.length===0){
-      $('.tbody').html(emptyBox(null,15))
+      $('.tbody').html(emptyBox(null,16))
     //   initScroll("qcList","YX",1)
       return;
     }
@@ -86,12 +261,12 @@ function renderTab(data,hisId){
 
         str += `
             <tr  data-index=${i}>
-                <td class="operaItem taskCheck textCenter" code="${item.behospitalCode}"><img src="${iconUnCheck}" alt=""></td>`;
+                <td class="operaItem taskCheck textCenter"><img code="${item.behospitalCode}" src="${iconUnCheck}" alt=""></td>`;
         for(let i=0;i<titles.length;i++){
             code=$(titles[i]).attr('valCode');
             str +=  `<td class="textCenter"><span data-index=${i}>${ item[code] || "-"}<span></td>`
         }
-        str += `<td class="operaItem textCenter ${item.creatStatus=='0'?'taskCancel':'disable'}" code="${item.behospitalCode}">取消</td></tr>`
+        str += `<td class="operaItem textCenter ${item.creatStatus=='已生成'?'taskCancel':'disable'}" code="${item.behospitalCode}">取消</td></tr>`
     }
 
     if(data.length === 0){
@@ -105,6 +280,25 @@ function renderTab(data,hisId){
         $('.scoreOpera').attr("data-selectall",false)
     }
     $('.tbody').html(str)
+    bindTaskCheckEvent();
+    bindCancelTaskEvent();
+}
+
+function bindTaskCheckEvent(){
+      $(".taskCheck img").unbind("click").click(function(){
+          const code = $(this).attr("code");
+            if($(this).is(".active")){
+                let str = global_taskList.join(",")+",";
+                str = str.replace(code+",","").replace(/^,|,$/,'');console.log(str)
+                global_taskList = str.split(",");
+                $(this).attr('src',iconUnCheck).removeClass("active");
+            }else{
+                global_taskList.push(code);
+                $(this).attr('src',iconCheck).addClass("active");
+
+            }
+
+      });
 }
 
 //列表获取筛选值
@@ -116,7 +310,6 @@ function getFilterData(){
     return obj;
 }
 
-bindStatusSelect()
 //病历等级选择
 function bindStatusSelect(){
     $('.statusItem').on("click",function(){
@@ -128,7 +321,6 @@ function bindStatusSelect(){
     })
 }
 
-bindLeveldSelect()
 //病历等级选择
 function bindLeveldSelect(){
     $('.levelItem').on("click",function(){
@@ -165,13 +357,31 @@ function rendeDeptList(deptList){
 }
 //科室选择
 function bindDeptSelect(){
-    $('.deptItem').on("mousedown",function(){
-        const deptItemName = $(this).attr("data-name")
-        global_deptId = $(this).attr("data-id")
-        $('.selectDept i').text(deptItemName)
-        $('.selectDept').attr('title',deptItemName)
-        $(".deptList").css("display", "none")
-        $('.selectDept').removeClass('unSelect')
+    $('.deptItem').on("click",function(e){
+        e.stopPropagation();
+        const deptItemName = $(this).attr("data-name");
+        let str = global_deptId.join(",")+",";
+        const code=$(this).attr("data-id")
+        if(!code.trim()){
+            $(".deptItem").removeClass("active");
+            global_deptId = [];
+            global_deptName="";
+            $('.selectDept i').text('全部')
+            $('.selectDept').attr('title','全部')
+            return;
+        }
+        if($(this).is(".active")){
+            global_deptName = global_deptName.replace(deptItemName+",",'');
+            str = str.replace(code+",","").replace(/^,|,$/,'');
+            global_deptId = str.split(",");
+        }else{
+            global_deptName = global_deptName+deptItemName+",";
+            global_deptId.push(code);
+        }
+        $(this).toggleClass("active");
+        const name = global_deptName.replace(/,$/,'');
+        $('.selectDept i').text(name)
+        $('.selectDept').attr('title',name)
     })
 }
 function loading(){
@@ -213,121 +423,6 @@ function clearFilter(){
     global_status='0'
     $("th[code]").removeClass("asc desc")
 }
-$(function() {
-    $('.datapickerBox').append(`<img class="iconCalen" src=${iconCalenGrey} />`)
-    $('.iconCalen').on("mouseenter", function(e){
-        $(this).attr("src", iconCalenBlue)
-    })
-    $('.iconCalen').on("mouseleave", function(e){
-        $(this).attr("src", iconCalenGrey)
-    })
-    $('.iconCalen').on("click", function(e){
-        $(this).parent().find("input").focus()
-    })
-
-    $(".menu .page", parent.document).removeClass("active")
-    $(parent.document).find(".menu .page[code=YH-ZKHC-SCRW]").addClass("active")
-
-    $(".filter").on("click", function(e){
-        getTabData(1)
-    })
-    $(".abnormalClear").on("click", function(e){
-        clearFilter();
-        getTabData(1)
-    })
-    //切换tab
-    $(".tabBox .tabs button").on("click",(e)=>{
-       const me = e.target;
-        global_activeTabCode = $(me).attr("data-code");
-       $(".tabBox .tabs button").removeClass("active");
-       $(me).addClass("active");
-       //更新列表并重置筛选条件
-       $(".abnormalClear").click();
-    });
-//选择生成状态
-    $('.selectStatus').on("click", function(e){
-        e.stopPropagation()
-        $(".statusList ").css("display", "none")
-        $(".selectStatus .arrow").attr("src",iconDown)
-        const showList =  $(".statusList ").css("display")
-        if(showList == "none" ||!showList){
-            $(".statusList ").css("display","block")
-            $(".selectStatus .arrow").attr("src",iconUp)
-        }else{
-            $(".statusList ").css("display", "none")
-            $(".selectStatus .arrow").attr("src",iconDown)
-        }
-    })
-//选择病历等级
-    $('.selectLevel').on("click", function(e){
-        e.stopPropagation()
-        $(".deptList ").css("display", "none")
-        $(".selectDept .arrow").attr("src",iconDown)
-        const showList =  $(".levelList ").css("display")
-        if(showList == "none" ||!showList){
-            $(".levelList ").css("display","block")
-            $(".selectLevel .arrow").attr("src",iconUp)
-        }else{
-            $(".levelList ").css("display", "none")
-            $(".selectLevel .arrow").attr("src",iconDown)
-        }
-    })
-    //科室选择
-    $('.selectDept').on("click", function(e){
-        e.stopPropagation();
-        $(".levelList ").css("display","none")
-        $(".selectLevel .arrow").attr("src",iconDown)
-        $(".deptList ").css("display","block")
-    })
-//获取科室列表
-    getDeptList()
-    //出院日期初始化
-$.datepicker.regional['zh-CN'] = {
-    clearText: '清除',
-    clearStatus: '清除已选日期',
-    closeText: '关闭',
-    closeStatus: '不改变当前选择',
-    prevText: '<上月',
-    prevStatus: '显示上月',
-    prevBigText: '<<',
-    prevBigStatus: '显示上一年',
-    nextText: '下月>',
-    nextStatus: '显示下月',
-    nextBigText: '>>',
-    nextBigStatus: '显示下一年',
-    currentText: '今天',
-    currentStatus: '显示本月',
-    monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
-    monthNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
-    yearNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
-    monthStatus: '选择月份',
-    yearStatus: '选择年份',
-    weekHeader: '周',
-    weekStatus: '年内周次',
-    dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
-    dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
-    dayNamesMin: ['日','一','二','三','四','五','六'],
-    dayStatus: '设置 DD 为一周起始',
-    dateStatus: '选择 m月 d日, DD',
-    dateFormat: 'yy-mm-dd',
-    firstDay: 1,
-    initStatus: '请选择日期',
-    isRTL: false};
-    const days = new Date().getDate()-1;
-    let startDate = "-"+days+"d",endDate=new Date();
-    $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
-    $( "#datepicker" ).datepicker({
-        changeMonth: true,
-        changeYear: true,
-        dateFormat:"yy-mm-dd",
-    }).datepicker( "setDate", startDate);
-    $( "#datepicker2" ).datepicker({
-        changeMonth: true,
-        changeYear: true,
-        dateFormat:"yy-mm-dd"
-    }).datepicker( "setDate",endDate);
-   
-});
 
 //分页渲染
 function renderPagination(totalPage,activePage,totalNum){
@@ -389,12 +484,3 @@ function renderPagination(totalPage,activePage,totalNum){
     })
     
 }
-
-$(document).on("click", function(){
-    $(".levelList ").css("display", "none")
-    $(".deptList ").css("display", "none")
-    $(".statusList ").css("display", "none")
-    $(".selectDept .arrow").attr("src",iconDown)
-    $(".selectLevel .arrow").attr("src",iconDown)
-    $(".selectStatus .arrow").attr("src",iconDown)
-})