Browse Source

bug472科室改下拉

zhouna 3 years ago
parent
commit
f2845ee370
2 changed files with 16 additions and 15 deletions
  1. 1 1
      src/html/dept/improveStatisticsDept.html
  2. 15 14
      src/js/dept/improveStatisticsDept.js

+ 1 - 1
src/html/dept/improveStatisticsDept.html

@@ -25,7 +25,7 @@
             <div class="filterBox clearfix">
                 <span class="filterItem typeFilter">
                     <span>科室:</span>
-                    <input type="text" class="selectDept canEditDept">
+                    <span class="selectDept canEditDept"></span>
                     <ul class="deptList filterDropList"></ul>
                 </span>
                 <span class="filterItem typeFilter">

+ 15 - 14
src/js/dept/improveStatisticsDept.js

@@ -13,7 +13,7 @@ const loadingImg = require("../../images/loading.gif")
 const arrowLeft= require("../../images/arrow_left.png")
 
 const arrowRight = require("../../images/arrow_right.png");
-//$(".selectCase").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
+$(".selectDept").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
 listenScroll()
 let isPlacefile = getCookie('isPlacefile')||1
 
@@ -299,8 +299,8 @@ function bindCaseSelect(){
   })
 }
 //科室下拉
-function getDeptList(val){
-  post(api.getDept,{inputStr:val||""}).then(res =>{
+function getDeptList(){
+  post(api.getDept,{}).then(res =>{
 	if(res.data.code == '0'){
 	  _deptList = res.data.data||[]
 	  rendeDeptList(_deptList)
@@ -323,7 +323,7 @@ function rendeDeptList(deptList){
 	str += `<li class="deptItem ellipsis" title=${deptList[i].deptName} data-id=${deptList[i].deptId} data-name=${deptList[i].deptName}> ${deptList[i].deptName}</li>`
   }
   $('.deptList').html(str)
-  $(".selectDept").val(deptList[0].deptName);
+  $(".selectDept").text(deptList[0].deptName).append(`<img class="arrow" src=${iconDown} alt="下拉">`);
   deptName=deptNameTemp=deptList[0].deptName;
   deptId=deptIdTemp=deptList[0].deptId;
   bindDeptSelect()
@@ -335,24 +335,25 @@ function bindDeptSelect(){
 	const deptItemId = $(this).attr("data-id")
 	deptNameTemp=deptItemName;
 	deptIdTemp =deptItemId||''
-	$('.selectDept').val(deptItemName)
+	$('.selectDept').text(deptItemName).append(`<img class="arrow" src=${iconDown} alt="下拉">`);
 	$('.selectDept ').attr('title',deptItemName)
 	$(".deptList").css("display", "none")
   })
   //科室下拉显示、选中事件
-  $('.selectDept').on("focus", function(e){
+  $('.selectDept').on("click", function(e){
 	e.stopPropagation()
-	$(".deptList ").css("display","block")
+	if($(".deptList:visible").length>0){
+	  $(".deptList").css("display", "none")
+	  $(".selectDept .arrow").attr("src",iconDown)
+	}else{
+	  $(".deptList").css("display","block")
+	  $(".selectDept .arrow").attr("src",iconUp)
+	}
   })
-  $('.selectDept').on("blur", function(e){
+  /*$('.selectDept').on("blur", function(e){
 	$(".deptList ").css("display", "none")
 	$(".selectDept .arrow").attr("src",iconDown)
-  })
-  $('.selectDept').on("input", function(e){
-	let val = $(this).val().trim()
-	deptName = deptNameTemp = val
-	getDeptList(deptName)
-  })
+  })*/
 }
 /*function loading(){
     const str = `