瀏覽代碼

提示框修改

wyq 3 年之前
父節點
當前提交
e2a9f9032c
共有 3 個文件被更改,包括 146 次插入129 次删除
  1. 122 118
      src/js/promise.js
  2. 23 10
      src/js/staticInfo.js
  3. 1 1
      webpack.config.js

+ 122 - 118
src/js/promise.js

@@ -53,12 +53,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 +68,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 +103,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 +152,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,150 +192,150 @@ 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:"推荐用药"
+    name: "推荐用药"
   },
-    nursePush: {
-        background: "#E3FEFE",
-        icon: iconNursePush,
-        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"
+    name: "手术/操作",
+    location: "right"
+  },
+  nursePush: {
+    background: "#E3FEFE",
+    icon: iconNursePush,
+    name: "推荐护理",
+    location: "right"
   },
-    nursePush: {
-        background: "#E3FEFE",
-        icon: iconNursePush,
-        name: "推荐护理",
-        location: "right"
-    },
-  vigilancePush:{
+  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) {
@@ -351,23 +351,27 @@ const Toast = function (msg, duration) {
     setTimeout(function () { document.body.removeChild(m) }, d * 1000);
   }, duration);
 }
-const Toasts = function (msg, duration) {
-  duration = isNaN(duration) ? 3000 : duration;
-  var m = document.createElement('div');
-  m.innerHTML = `<img class="warn" style="margin-right:14px" src=${warn}/>` + msg;
-  m.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;";
-  $('.warn').css('margin-top', '10px')
-  document.body.appendChild(m);
+function toast(mess) {
+  var str = '<div class="mess"><span></span></div>';
+  $("body").append(str);
+  $(".mess").fadeIn().find("span").html(mess);
   setTimeout(function () {
-    var d = 0.5;
-    m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
-    m.style.opacity = '0';
-    setTimeout(function () { document.body.removeChild(m) }, d * 1000);
-  }, duration);
+    $(".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,
@@ -376,5 +380,5 @@ module.exports = {
   isIe8,
   titleConfig,
   titleConfigH,
-  Toast, Toasts 
+  Toast, Toasts
 }

+ 23 - 10
src/js/staticInfo.js

@@ -318,6 +318,17 @@ function getchecks() {
     }
   });
 }
+function isNumber(val) {
+
+  var regPos = /^\d+(\.\d+)?$/; //非负浮点数
+  var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
+  if (regPos.test(val) && regNeg.test(val)) {
+    return true;
+  } else {
+    return false;
+  }
+
+}
 function getResult(pushInfo, textType) {
   $(".but").click(function () {
     let arr = [];
@@ -326,7 +337,7 @@ function getResult(pushInfo, textType) {
     let num = 0
     let result
     let key = false
-
+    let proposal = ''
     $(".contentList").each(function (i) {
       if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
         $(this).find(".item-title").addClass('chColor');
@@ -342,31 +353,37 @@ function getResult(pushInfo, textType) {
     if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
       isclick = true
       $('input[type="radio"]:checked').each(function () {
-        if (Number($(this).val())) {
+        if (!isNaN($(this).val())) {
           num += parseFloat($(this).val())
         } else {
           arr.push($(this).attr("data_obj"))
         }
       });
       $('input[type="checkbox"]:checkbox:checked').each(function () {
-        if (Number($(this).val())) {
+        if (!isNaN($(this).val())) {
           num += parseFloat($(this).val())
         } else {
           multname = $(this).parents('.item-content').siblings('.item-titles').html()
           multarr.push($(this).attr("data_obj"))
         }
       });
+      
       if (multarr.join("、")){
+        console.log(1)
         arr.push(multname + multarr.join("、"))
       }
+      console.log(arr)
       tmp = arr.join(";");
       if (pushInfo.length > 0) {
         for (var i = 0; i < pushInfo.length; i++) {
           if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min) {
             if (tmp) {
               result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
+              proposal = pushInfo[i].pushInfo
+              
             } else {
               result = pushInfo[i].result + '(' + num + '分' + ')'
+              proposal = pushInfo[i].pushInfo
             }
           } else {
             if (tmp) {
@@ -377,6 +394,7 @@ function getResult(pushInfo, textType) {
       } else {
         result = tmp
       }
+      
       if (result == undefined) {
         if ($.inArray(13, textType) > 0) {
           $(".score").html('总分:' + num + '分');
@@ -385,11 +403,8 @@ function getResult(pushInfo, textType) {
         $(".copy").css('display', 'none')
         $(".foot").css('display', 'block')
       } else {
-        $(".result_title").attr({
-          "title": result
-        });
         $(".hel").attr({
-          "title": result
+          "title": proposal
         });
         $(".result_title").html(result);
         if ($.inArray(13, textType) > 0) {
@@ -400,10 +415,8 @@ function getResult(pushInfo, textType) {
         $(".copy").css('display', 'block')
         $(".foot").css('display', 'block')
       }
-
     } else {
-      console.log(11)
-      Toasts('温馨提示:必填选项不能为空~', 500)
+      Toasts('温馨提示:必填选项不能为空~')
     }
   })
   $(".printing").hover(

+ 1 - 1
webpack.config.js

@@ -4,7 +4,7 @@ const CleanWebpackPlugin = require('clean-webpack-plugin') // 清空打包目录
 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
 const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
 const webpack = require('webpack');
-const proxyHost = "http://192.168.2.236:6060";
+const proxyHost = "http://192.168.2.241:6060";
 module.exports = {
   entry: {
     index: path.resolve(__dirname, 'src/js', 'index.js'),