Procházet zdrojové kódy

his页面问题解决

wyq před 3 roky
rodič
revize
ee7f8de31e
3 změnil soubory, kde provedl 69 přidání a 55 odebrání
  1. 8 1
      src/css/staticInfo.less
  2. 57 50
      src/js/informationOut.js
  3. 4 4
      src/js/staticInfo.js

+ 8 - 1
src/css/staticInfo.less

@@ -524,6 +524,7 @@
     display: none;
     overflow: hidden;
     margin-top: 10px;
+    border:1px solid #D8D8D8;
     li {
       width: 50%;
       height: 30px;
@@ -533,6 +534,12 @@
       border-right: none;
       font-size: 14px;
       float: left;
-      
+      border-bottom: none;
+    }
+    &:nth-child(1) {
+      border-top: none;
+    }
+    &:nth-child(odd) {
+      border-left: none;
     }
   }

+ 57 - 50
src/js/informationOut.js

@@ -17,12 +17,11 @@ const {
   Toast
 } = require('./promise.js');
 const $ = require("jquery");
-require("./jquery-migrate");
-const jqprint = require("../js/jquery.PrintArea")
+const print = require("../js/jQuery.print")
 let printing = require('./../images/printing.png');
 let printing2 = require('./../images/printing2.png');
 let hel = require('./../images/icon-hel.png');
-let showName, noticeName, clinicalPathwayName, showLis = [], selectedDrop = 0, selectedTab = 0, isclick
+let showName, noticeName, clinicalPathwayName, showLis = [], selectedDrop = 0, selectedTab = 0, isclick,num
 
 //如果是子窗口,隐藏网页查看按钮
 function myBrowser() {
@@ -122,6 +121,7 @@ function showInfoSelect(){
     selectedDrop = idx;
     selectedTab = 0;
     showName = showLis[idx].name + "(" + showLis[idx].hisName + ")";
+    num = $(".activeTab").attr('data-num')
     showInfo(showLis[idx],2)
     $('.content .infos').scrollTop(0)
     $(".showWhich ul").css("display", "none")
@@ -140,6 +140,7 @@ function renderTitleShow() {
   document.title = showName;
   // $(".titleCont .title").html($(".tabList .tab:eq(" + selectedTab + ")").attr("data-title"));
   $(".titleCont .title").html($(".showWhich .showWhichSelect").attr("title"));
+  
 }
 function renderContent(list, contentWrapClassName) {
   $(`.${contentWrapClassName} .infos`).html('');
@@ -156,7 +157,6 @@ function renderContent(list, contentWrapClassName) {
     } else {
       str += item.title
     }
-    console.log(item)
     str += '</h2></div>' +
       '<div class="contentWrapper"><pre>' + item.content + '</pre><div></div>';
     str = `<div class="infoWrapper">${str}</div>`
@@ -184,9 +184,8 @@ function renderContent(list, contentWrapClassName) {
 }
 
 function renderContentscale(list, contentWrapClassName, name) {
-  $(`.${contentWrapClassName} .infos .infos-box`).html('');
   var pushInfo = []
-  var textType = []
+  $('.scaletitle').html(name);
   for (var i = 0; i < list[0].detailList.length; i++) {
     var item = list[0].detailList[i];
     if (item.textType == 11) {
@@ -216,15 +215,15 @@ function renderContentscale(list, contentWrapClassName, name) {
             its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
             str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
             if (it.selectType == 21 && item.resultType == 1) {
-              str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '"/>'
+              str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 22 && item.resultType == 1) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '"/>'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 21 && item.resultType == 2) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '"/>'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 22 && item.resultType == 2) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '"/>'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
             }
-            str += its.content
+            str += '<span class="inp">' + its.content + '</span>'
             if (item.resultType == 1) {
               str += '<span class="num">(' + its.score + ')</span>'
             }
@@ -249,7 +248,7 @@ function renderContentscale(list, contentWrapClassName, name) {
           var it = items.detailList[k];
           it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
           str = '<div class="contentList" data-id="' + it.parentId + '-' + it.groupNum + '"><div class="item-list">';
-          str += '<p class="item-title">' + it.content + '</p>'
+          str += it.content
           str += '<div class="item-content" data-id="' + it.id + '">'
           str += '</div></div></div>'
           $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
@@ -274,8 +273,6 @@ function renderContentscale(list, contentWrapClassName, name) {
   str += `<div class="result"><div class="result_box"><div class="result_left"><img src="./../images/icon-hel.png" class="hel"/><span>结果:</span></div><p id="result_title" class="result_title"></p><textarea id="inputs"></textarea></div></div>`
   str += `<div class="foot"><div class="foot_box"><div class="printing"><img src="./../images/printing.png" class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
   $(`.${contentWrapClassName} .infos .infos-box`).append(str);
-  // str = `<div class="foot"><div class="foot_box"><div class="printing"><img src=${printing} class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
-  // $(`.${contentWrapClassName} .infos`).after(str);
   function addScrollEvent() {
     var scrollTop = $(`.${contentWrapClassName} .infos .infos-box`).scrollTop()
     var divHeight = 0;
@@ -289,37 +286,24 @@ function renderContentscale(list, contentWrapClassName, name) {
     }
   }
   $(`.${contentWrapClassName} .infos .infos-box`).scroll(throttle(addScrollEvent, 200));
-  var mb = myBrowser();
-  if ("IE" == mb) {
-    $('.result_left').css({
-      'position': 'relative', //高度自动
-    })
-    $('.result_title').css({
-      'margin-left': '0', //高度自动
-    })
-  }
   addLinkClickEvent(contentWrapClassName);
   adjustHeight();
   adjustWidth()
   getcheck()
-  getResult(pushInfo, textType)
+  getResult(pushInfo)
   copy(name)
   getprinting()
 
 }
-
 function getprinting() {
   $('.printing').click(function () {
     $('.foot').hide()
-    // $('.hel').hide()
+    $('.scalebot').hide()
     $('#Print').css({
       'height': 'auto', //高度自动
-    }).jqprint();
+    }).print();
     $('.foot').show()
-    // $('.hel').show()
-    $('#Print').css({
-      'height': '100%', //高度自动
-    });
+    $('.scalebot').show()
   })
 }
 
@@ -331,7 +315,8 @@ function getcheck() {
     if ($radio.data('waschecked') == true) {
       $radio.prop('checked', false);
       $("input:radio[name='" + domName + "']").data('waschecked', false);
-      $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
+      $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#666666");
+      $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#333333");
       if (isclick) {
         getchecks()
         $(".score").html('');
@@ -344,6 +329,8 @@ function getcheck() {
       $("input:radio[name='" + domName + "']").data('waschecked', false);
       $radio.data('waschecked', true);
       $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
+      $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#C7C7C7");
+      $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#C7C7C7");
       if (isclick) {
         getchecks()
         $(".score").html('');
@@ -360,6 +347,8 @@ function getcheck() {
     $radio.parents('.contentList').each(function (i) {
       if ($(this).find('input[type="checkbox"]:checked').val() == undefined) {
         $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
+        $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#666666");
+        $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#333333");
         if (isclick) {
           getchecks()
           $(".score").html('');
@@ -369,6 +358,8 @@ function getcheck() {
         }
       } else {
         $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
+        $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#C7C7C7");
+        $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#C7C7C7");
         if (isclick) {
           getchecks()
           $(".score").html('');
@@ -385,7 +376,7 @@ function copy(name) {
   $(".copy").click(function () {
     var texts = document.getElementById("result_title").innerText;
     if (texts == '') {
-      Toast('结果为空,无法复制', 500, 'warn')
+      Toast('温馨提示:结果为空,无法复制', 500, 'warn')
       return
     }
     var inputs = document.getElementById("inputs");
@@ -411,7 +402,7 @@ function getchecks() {
     }
   });
 }
-function getResult(pushInfo, textType) {
+function getResult(pushInfo) {
   $(".but").click(function () {
     let arr = [];
     let multarr = []
@@ -421,6 +412,7 @@ function getResult(pushInfo, textType) {
     let key = false
     let proposal = ''
     let proposals = []
+    let scrollTop = []
     isclick = true
     $(".contentList").each(function (i) {
       if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
@@ -433,10 +425,15 @@ function getResult(pushInfo, textType) {
       } else {
         $(this).find(".item-titles").removeClass('chColor');
       }
+      scrollTop.push($(this).eq(0).find(".chColor").offset())
     });
+    // var v = scrollTop.indexOf(undefined)
+    // if (v) {
+    //   $(`.scale .infos`).scrollTop(v.top + 346)
+    // }
     if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
       $('input[type="radio"]:checked').each(function () {
-        if (!isNaN($(this).val())) {
+        if ($(this).attr("resultType") == 1) {
           num += parseFloat($(this).val())
         } else {
           arr.push($(this).attr("data_obj"))
@@ -444,7 +441,7 @@ function getResult(pushInfo, textType) {
         }
       });
       $('input[type="checkbox"]:checkbox:checked').each(function () {
-        if (!isNaN($(this).val())) {
+        if ($(this).attr("resultType") == 1) {
           num += parseFloat($(this).val())
         } else {
           arr.push($(this).attr("data_obj"))
@@ -456,23 +453,31 @@ function getResult(pushInfo, textType) {
         for (var i = 0; i < pushInfo.length; i++) {
           if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && !tmp) {
             result = pushInfo[i].result + '(' + num + '分' + ')'
-            proposal = pushInfo[i].pushInfo
+            if (proposals.join(";")) {
+              proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
+            } else {
+              proposal = pushInfo[i].pushInfo
+            }
             break
           } else if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && tmp) {
-            result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
-            proposal = pushInfo[i].pushInfo
+            result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
+            if (proposals.join(";")) {
+              proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
+            } else {
+              proposal = pushInfo[i].pushInfo
+            }
             break
           } else {
             result = tmp
+            proposal = proposals.join(";");
           }
         }
       } else {
         result = tmp
         proposal = proposals.join(";");
       }
-
       if (result == undefined) {
-        if ($.inArray(13, textType) > 0) {
+        if (num > 0) {
           $(".score").html('总分:' + num + '分');
         }
         $(".score").css('display', 'block')
@@ -482,9 +487,8 @@ function getResult(pushInfo, textType) {
         $(".hel").attr({
           "title": proposal
         });
-
         $(".result_title").html(result);
-        if ($.inArray(13, textType) > 0) {
+        if (num > 0) {
           $(".score").html('总分:' + num + '分');
         }
         $(".result").css('display', 'block')
@@ -521,39 +525,42 @@ function addLinkClickEvent(contentWrapClassName) {
 function renderTab(detailList, scale) {
   $(".tabList").html('')
   if (detailList['静态知识']) {
-    $(".tabList").append(`<span class="tab" data-module="staticKnowledge" data-title="` + showName + `">静态知识</span>`)
+    $(".tabList").append(`<span class="tab" data-num="1" data-module="staticKnowledge" data-title="` + showName + `">静态知识</span>`)
   }
   if (detailList['临床路径']) {
-    $(".tabList").append(`<span class="tab" data-module="clinicalPathway" data-title="` + clinicalPathwayName + `">临床路径</span>`)
+    $(".tabList").append(`<span class="tab" data-num="2" data-module="clinicalPathway" data-title="` + clinicalPathwayName + `">临床路径</span>`)
     //$(".tabBox .title").html(clinicalPathwayName);
   }
   if (detailList['注意事项']) {
-    $(".tabList").append(`<span class="tab" data-module="notice" data-title="` + noticeName + `">注意事项</span>`)
+    $(".tabList").append(`<span class="tab" data-num="2" data-module="notice" data-title="` + noticeName + `">注意事项</span>`)
     //$(".tabBox .title").html(noticeName);
   }
   if (!!scale && getUrlArgObject('type') == 8) {
-    $(".tabList").append(`<span class="tab" data-module="scale" data-title="` + showName + `">评估内容</span>`)
+    $(".tabList").append(`<span class="tab" data-num="2" data-module="scale" data-title="` + showName + `">评估内容</span>`)
     //$(".tabBox .title").html(noticeName);
   }
   let defaultModuleName
-  if ((getUrlArgObject('page') && getUrlArgObject('page') == 1 && scale && detailList['静态知识']) || (getUrlArgObject('scale') == 'scale' && detailList['静态知识'])) {
-    console.log(123)
+  if ((getUrlArgObject('page') && getUrlArgObject('page') == 1 && scale && detailList['静态知识']) || (getUrlArgObject('scale') == 'scale' && detailList['静态知识']) || num == 2) {
     $(".tabList .tab").eq(1).addClass("activeTab")
     defaultModuleName = $(".tabList .tab").eq(1).attr("data-module")
   } else {
-    console.log(2)
     $(".tabList .tab").eq(0).addClass("activeTab")
     defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
   }
+
   $(`.${defaultModuleName}`).css("display", "block")
   bindTabClick()
 }
 function bindTabClick(){
   $(".tabList .tab").on("click", function(){
+    if ($('.tabList').children('.tab').length == 1){
+      return
+    }
     const moduleName = $(this).attr("data-module")
     const display = $(`.${moduleName}`).css("display")
       selectedTab=$('.tabList .tab').index(this);
       // $(".titleCont .title").html($(this).attr('data-title'));
+    
     if(display == "none"){
       $(".activeTab").removeClass("activeTab")
       $(this).addClass("activeTab")

+ 4 - 4
src/js/staticInfo.js

@@ -364,10 +364,10 @@ function getResult(pushInfo) {
       }
       scrollTop.push($(this).eq(0).find(".chColor").offset())
     });
-    var v = scrollTop.find(value => value != undefined);
-    if(v){
-      $(`.scale .infos`).scrollTop(v.top + 346)
-    }
+    // var v = scrollTop.indexOf(undefined)
+    // if (v) {
+    //   $(`.scale .infos`).scrollTop(v.top + 346)
+    // }
     if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
       $('input[type="radio"]:checked').each(function () {
         if ($(this).attr("resultType") == 1) {