Quellcode durchsuchen

toast样式修改

wyq vor 3 Jahren
Ursprung
Commit
ad36d87a99
5 geänderte Dateien mit 127 neuen und 137 gelöschten Zeilen
  1. BIN
      src/images/icon-success.png
  2. BIN
      src/images/icon-warning.png
  3. 1 1
      src/js/cdssHorizontal.js
  4. 118 128
      src/js/promise.js
  5. 8 8
      src/js/staticInfo.js

BIN
src/images/icon-success.png


BIN
src/images/icon-warning.png


+ 1 - 1
src/js/cdssHorizontal.js

@@ -348,7 +348,7 @@ function renderScale(list, showNum, type, hasInfo) {
     $('.moduleItem.evaluation').append(renderLongStr(titleConfigH["scalePush"].name, longStr, titleConfigH["scalePush"].location))
     $('.moduleItem.evaluation').css("display", "block")
     $('.moduleItem.evaluation').children(".shortBox").children(".pushItemBox").children(".pushItemName").addClass("evaluationtitle")
-    $('.moduleItem.evaluation').children(".longBox").children(".pushItemBox").children(".pushItemName").addClass("evaluationtitle")
+    $('.moduleItem.evaluation').children(".longStrBox").children(".longBox").children(".pushItemBox").children(".pushItemName").addClass("evaluationtitle")
   }
 }
 

+ 118 - 128
src/js/promise.js

@@ -2,7 +2,8 @@ const qs = require('qs');
 const $ = require("jquery");
 // var Promise = require('./rePromise');
 var Promise = require("bluebird");
-let warn = require('./../images/icon-warns.png').replace(/^undefined/g, '')
+let warn = require('./../images/icon-warning.png').replace(/^undefined/g, '')
+let success = require('./../images/icon-success.png').replace(/^undefined/g, '')
 let iconWarning = require('./../images/icon_waring_white.png').replace(/^undefined/g, '')
 let iconWarning1 = require('./../images/icon_warning.png').replace(/^undefined/g, '')
 let iconSymptomPush = require('./../images/icon_symptom_push.png').replace(/^undefined/g, '')
@@ -53,12 +54,12 @@ window.console = window.console || (function () {
 
 const config = {
   pushInner: '/sys/push/push',
-  indicationPush: '/sys/push/indicationPush',
-  indicationPushCache: '/sys/mr/getIndicationMr',
+  indicationPush:'/sys/push/indicationPush',
+    indicationPushCache: '/sys/mr/getIndicationMr',
   calculate: '/api/data/calc/calculate',
   disclaimer: '/sys/disclaimerInfo/getDisclaimerInfo',
   information: '/kl/conceptInfo/getStaticKnowledge',
-  getStaticKnowledgeForHIS: '/kl/conceptInfo/getStaticKnowledgeForHIS', //对接一对多
+  getStaticKnowledgeForHIS:'/kl/conceptInfo/getStaticKnowledgeForHIS', //对接一对多
   informationMore: '/api/data/conceptDetail/getConceptDetails',
   pushScale: '/api/data/push/pushScale',
   getSysSetInfoDatas: '/sys/plan/getSysPlanInfoDatas',
@@ -68,20 +69,20 @@ const config = {
   getStaticKnowledge: '/kl/conceptInfo/staticKnowledgeIndex',//静态知识检索
   getStaticScale: '/api/data/search/getScale',
   dictionaryInfo: '/sys/dictionaryInfo/getList', //字典信息
-  getPushSet: '/sys/plan/getSysPlanInfoDatas', //获取推送配置
-  analyse: '/api/data/mrqc/analyse',
-  getHosptDeptUsal: '/api/data/concept/getHosptDeptUsal', //获取科室常用标签
-  caseWritingPrompt: '/sys/mrqc/caseWritingPrompt',//病历书写规范提示
-  followUp: '/sys/push/pushPlan', //随访计划
-  ruleTypeMap: {     //大数据推送参数featureType对应
-    '22': '1,2',
-    '11': '3',
-    '8': '4,5'
+  getPushSet:'/sys/plan/getSysPlanInfoDatas', //获取推送配置
+  analyse:'/api/data/mrqc/analyse',
+  getHosptDeptUsal:'/api/data/concept/getHosptDeptUsal', //获取科室常用标签
+  caseWritingPrompt:'/sys/mrqc/caseWritingPrompt',//病历书写规范提示
+  followUp:'/sys/push/pushPlan', //随访计划
+  ruleTypeMap:{     //大数据推送参数featureType对应
+    '22':'1,2',
+    '11':'3',
+    '8':'4,5'
   },
-  staticSearch: '/kl/conceptInfo/staticIndexPage', //检索静态知识
+  staticSearch:'/kl/conceptInfo/staticIndexPage', //检索静态知识
 }
-const isLocal = window.location.hostname.indexOf('localhost') != -1;
-const imageUrlPrefix = isLocal ? 'http://192.168.2.241:82' : 'http://' + window.location.hostname + ':82';
+const isLocal = window.location.hostname.indexOf('localhost') !=-1;
+const imageUrlPrefix = isLocal ?'http://192.168.2.241:82':'http://'+window.location.hostname+':82';
 // const getUrlArgObject = function(parm) {  
 //   var query = decodeURI(window.location.search);
 //   var args = qs.parse(qs.parse(query.substr(1)));
@@ -103,24 +104,24 @@ const getUrlArgObject = function getQueryString(name) {
 }
 
 const get = function (url, data) {
-  return new Promise((resolve, reject) => {
-    $.ajax({
-      method: 'get',
-      url: url,
-      //data: data,
-      contentType: "application/json; charset=UTF-8",
-      beforeSend: function (xmlHttp) {
-        xmlHttp.setRequestHeader("If-Modified-Since", "0");
-        xmlHttp.setRequestHeader("Cache-Control", "no-cache");
-      },
-      success: function (res) {
-        resolve({ data: res });
-      },
-      error: function (error) {
-        reject(error);
-      },
+    return new Promise((resolve, reject) => {
+        $.ajax({
+            method: 'get',
+            url: url,
+            //data: data,
+            contentType: "application/json; charset=UTF-8",
+            beforeSend: function (xmlHttp) {
+                xmlHttp.setRequestHeader("If-Modified-Since", "0");
+                xmlHttp.setRequestHeader("Cache-Control", "no-cache");
+            },
+            success: function (res) {
+                resolve({data: res});
+            },
+            error: function (error) {
+                reject(error);
+            },
+        });
     });
-  });
 }
 const post = function (url, data) {
   return new Promise((resolve, reject) => {
@@ -152,7 +153,7 @@ const newinConf = {
 const newWindowLocationTcm = `width=800, height=600, left=${newinConf.left}, top=${newinConf.top},resizable=yes, scrollbars=yes`
 const newWindowLocation = `width=${newinConf.width}, height=${newinConf.height}, left=${newinConf.left}, top=${newinConf.top},resizable=yes, scrollbars=yes`
 const openNewWin = function (url, isTcm) {
-  window.open(url, newinConf.openMode, isTcm ? newWindowLocationTcm : newWindowLocation)
+    window.open(url, newinConf.openMode, isTcm ? newWindowLocationTcm : newWindowLocation)
 }
 
 //判断浏览器是否为Ie8
@@ -192,157 +193,164 @@ const throttle = function (fn, threshhold) {
 }
 
 const titleConfig = {
-  warning: {
+  warning:{
     background: "#FFE8DD",
     icon: iconWarning1,
-    name: "智能警示"
+    name:"智能警示"
   },
-  symptomPush: {
+  symptomPush:{
     background: "#EEF5FD",
     icon: iconSymptomPush,
-    name: "推荐症状"
+    name:"推荐症状"
   },
-  diagPush: {
+  diagPush:{
     background: "#EEF5FD",
     icon: iconDiagPush2,
-    name: "智能诊断"
+    name:"智能诊断"
   },
-  checkupPush: {
+  checkupPush:{
     background: "#EEF5FD",
     icon: iconCheckupPush,
-    name: "推荐体格检查"
+    name:"推荐体格检查"
   },
-  scalePush: {
+  scalePush:{
     background: "#EEF5FD",
     icon: iconScalePush,
-    name: "推荐量表"
+    name:"推荐量表"
   },
-  lisPush: {
+  lisPush:{
     background: "#ECF4FC",
     icon: iconLisPush,
-    name: "推荐检验"
+    name:"推荐检验"
   },
-  pacsPush: {
+  pacsPush:{
     background: "#ECF4FC",
     icon: iconPacsPush,
-    name: "推荐检查"
+    name:"推荐检查"
   },
-  drugPush: {
+  drugPush:{
     background: "#E3FEFE",
     icon: iconDrugPush,
-    name: "推荐用药"
-  },
-  nursePush: {
-    background: "#E3FEFE",
-    icon: iconNursePush,
-    name: "推荐护理"
+    name:"推荐用药"
   },
-  operationPush: {
+    nursePush: {
+        background: "#E3FEFE",
+        icon: iconNursePush,
+        name: "推荐护理"
+    },
+  operationPush:{
     background: "#E3FEFE",
     icon: iconOperationPush,
-    name: "推荐手术及操作"
+    name:"推荐手术及操作"
   },
-  generaTreatPush: {
+  generaTreatPush:{
     background: "#E3FEFE",
     icon: iconTreat,
-    name: "一般治疗"
+    name:"一般治疗"
   },
-  casewritingPush: {
+  casewritingPush:{
     background: "#FFE8DD",
     icon: iconCaseWrite,
-    name: "病历书写规范提示"
+    name:"病历书写规范提示"
   }
 }
 const titleConfigH = {
-  warning: {
+  warning:{
     background: "#FFE8DD",
     icon: iconWarning1,
-    name: "智能警示",
-    location: "left"
+    name:"智能警示",
+    location:"left"
   },
-  symptomPush: {
+  symptomPush:{
     background: "#EEF5FD",
     icon: iconSymptomPush,
-    name: "推荐症状",
-    location: "left"
+    name:"推荐症状",
+    location:"left"
   },
-  diagPush: {
+  diagPush:{
     background: "#FAECED",
     icon: iconDiagPush,
-    name: "智能诊断",
-    location: "left"
+    name:"智能诊断",
+    location:"left"
   },
-  checkupPush: {
+  checkupPush:{
     background: "#EEF5FD",
     icon: iconCheckupPush,
-    name: "体格检查",
-    location: "left"
+    name:"体格检查",
+    location:"left"
   },
-  scalePush: {
+  scalePush:{
     background: "#EEF5FD",
     icon: iconScalePush,
-    name: "推荐量表",
-    location: "left"
+    name:"推荐量表",
+    location:"left"
   },
-  lisPush: {
+  lisPush:{
     background: "#ECF4FC",
     icon: iconLisPush,
-    name: "推荐检验",
-    location: "left"
+    name:"推荐检验",
+    location:"left"
   },
-  pacsPush: {
+  pacsPush:{
     background: "#ECF4FC",
     icon: iconPacsPush,
-    name: "推荐检查",
-    location: "left"
+    name:"推荐检查",
+    location:"left"
   },
-  generaTreatPush: {
+  generaTreatPush:{
     background: "#E3FEFE",
     icon: iconTreat,
-    name: "一般治疗",
-    location: "right"
+    name:"一般治疗",
+    location:"right"
   },
-  drugPush: {
+  drugPush:{
     background: "#E3FEFE",
     icon: iconDrugPush,
-    name: "推荐用药",
-    location: "right"
+    name:"推荐用药",
+    location:"right"
   },
-  operationPush: {
+  operationPush:{
     background: "#E3FEFE",
     icon: iconOperationPush,
-    name: "手术/操作",
-    location: "right"
-  },
-  nursePush: {
-    background: "#E3FEFE",
-    icon: iconNursePush,
-    name: "推荐护理",
-    location: "right"
+    name:"手术/操作",
+    location:"right"
   },
-  vigilancePush: {
+    nursePush: {
+        background: "#E3FEFE",
+        icon: iconNursePush,
+        name: "推荐护理",
+        location: "right"
+    },
+  vigilancePush:{
     background: "#FFE8DD",
     icon: iconWarning,
-    name: "警惕",
-    location: "left"
+    name:"警惕",
+    location:"left"
   },
-  treat: {
+  treat:{
     background: "#FFE8DD",
     icon: iconTreat,
-    name: "治疗方案"
+    name:"治疗方案"
   },
-  casewritingPush: {
+  casewritingPush:{
     background: "#E3FEFE",
     icon: iconTreat,
-    name: "病历书写规范提示",
-    location: "left"
+    name:"病历书写规范提示",
+    location:"left"
   }
 }
-const Toast = function (msg, duration) {
+const Toast = function (msg, duration,type) {
   duration = isNaN(duration) ? 3000 : duration;
   var m = document.createElement('div');
-  m.innerHTML = msg;
-  m.style.cssText = "max-width:60%;min-width: 150px;padding:0 14px;height: 30px;color: #fff;line-height: 30px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: #333;font-size: 16px;";
+  console.log(type)
+  if(type == 'warn'){
+    m.innerHTML = `<img class="warn" style="margin-right:14px" src=${warn} />` + msg;
+  }else if(type == 'success'){
+    m.innerHTML = `<img class="warn" style="margin-right:14px" src=${success} />` + msg;
+  }
+  
+  m.style.cssText = "display:flex;align-items:center;max-width:60%;min-width: 150px;padding:10px 14px;height: 30px;color: #fff;line-height: 30px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: #333;font-size: 16px;";
+  $('.warn').css('margin-top','10px')
   document.body.appendChild(m);
   setTimeout(function () {
     var d = 0.5;
@@ -351,27 +359,9 @@ const Toast = function (msg, duration) {
     setTimeout(function () { document.body.removeChild(m) }, d * 1000);
   }, duration);
 }
-function toast(mess) {
-  var str = '<div class="mess"><span></span></div>';
-  $("body").append(str);
-  $(".mess").fadeIn().find("span").html(mess);
-  setTimeout(function () {
-    $(".mess").fadeOut();
-  }, 2000)
-}
-const Toasts = function (mess) {
-  var str = `<div id="mess"><img class="warn" style="margin-right:14px" src=${warn} /><span></span></div>`;
-  $("body").append(str);
-  $("#mess").fadeIn().find("span").html(mess);
-  document.getElementById("mess").style.cssText = "display:flex;align-items:center;max-width:60%;min-width: 150px;padding:0 14px;height: 30px;color: #FFB609;line-height: 30px;text-align: center;border-radius: 4px;position: fixed;top: 75px;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: #FDF6EA;font-size: 16px;";
-  setTimeout(function () {
-    $("#mess").fadeOut();
-  }, 1000)
-
-}
 module.exports = {
   config,
-  get,
+    get,
   post,
   getUrlArgObject,
   imageUrlPrefix,
@@ -380,5 +370,5 @@ module.exports = {
   isIe8,
   titleConfig,
   titleConfigH,
-  Toast, Toasts
+  Toast
 }

+ 8 - 8
src/js/staticInfo.js

@@ -15,8 +15,7 @@ const {
   config,
   getUrlArgObject,
   openNewWin,
-  Toast,
-  Toasts
+  Toast
 } = require('./promise.js');
 const $ = require("jquery");
 require("./jquery-migrate");
@@ -118,8 +117,6 @@ function renderContentscale(list, contentWrapClassName, name) {
   var textType = []
   for (var i = 0; i < list[0].detailList.length; i++) {
     var item = list[0].detailList[i];
-    console.log(item.resultType)
-    textType.push(item.textType)
     if (item.textType == 11) {
       anchors = '<li><i></i><a href="#' + contentWrapClassName + i +
         '">' + item.content + '</a></li><li class="anchor-line"></li>';
@@ -134,8 +131,10 @@ function renderContentscale(list, contentWrapClassName, name) {
       $(`.${contentWrapClassName} .anchors ul`).append(anchors);
       for (var j = 0; j < item.subList.length; j++) {
         var items = item.subList[j];
+        
         for (var k = 0; k < items.detailList.length; k++) {
           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">';
           if (it.selectType == 21) {
@@ -161,8 +160,9 @@ function renderContentscale(list, contentWrapClassName, name) {
             }
             str += its.content
             if (item.resultType == 1) {
-              str += '<span class="num">' + '(' + its.score + ')' + '</span>'
+              str += '<span class="num">' + '(' + parseFloat(((its.score * it.factor + it.constant) * item.factor + item.constant)) + ')' + '</span>'
             }
+            
             str += '</label>'
             str += `${its.match == 1 ? `<img class="recommend" src=${recommend} />` : ``}</div>`
             $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "] .contentList .item-content[data-id=" + its.parentId + "]").append(str);
@@ -288,7 +288,7 @@ function copy(name) {
   $(".copy").click(function () {
     var texts = document.getElementById("result_title").innerText;
     if (texts == '') {
-      Toast('结果为空,无法复制', 500)
+      Toast('结果为空,无法复制', 500, 'warn')
       return
     }
     var inputs = document.getElementById("inputs");
@@ -296,7 +296,7 @@ function copy(name) {
     console.log(inputs.value)
     inputs.select(); // 选中文本
     document.execCommand("copy"); // 执行浏览器复制命令
-    Toast('复制成功', 500)
+    Toast('复制成功', 500, 'success')
     setTimeout(() => {
       window.close()
     }, 500)
@@ -406,7 +406,7 @@ function getResult(pushInfo, textType) {
         $(".foot").css('display', 'block')
       }
     } else {
-      Toasts('温馨提示:必填选项不能为空~')
+      Toast('温馨提示:必填选项不能为空~',500,'warn')
     }
   })
   $(".printing").hover(