فهرست منبع

Merge branch 'dev-1.1.4' into 'dev-1.1.4'

进一步优化

See merge request lihong/thmz_system!67
huangshuhua 1 سال پیش
والد
کامیت
54612f86ca
1فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 10 6
      src/main/resources/static/js/mz/pharmacy-cell-number.js

+ 10 - 6
src/main/resources/static/js/mz/pharmacy-cell-number.js

@@ -266,7 +266,7 @@ function refeshTable() {
             tempCurrentList = tempCurrentList.filter((x) => !tempPastList.some((item) => x.patient_id === item.patient_id));
             //删除并返回数组的第一个元素
             let c = tempCurrentList.shift();
-            let name = c.name;
+            let name = noPassByName(c.name);
             let flag = (!isEmpty(c.lineUp) && c.lineUp!==10000);
             if(name.length > 3){
                 $("#current" + i).html((flag?'<span style="font-size:32px; "><span class="number-name">&nbsp;'+c.lineUp+'&nbsp;</span>&nbsp;':'')+name+"</span>");
@@ -304,11 +304,15 @@ function currentListClear(data) {
 
 function noPassByName(str) {
     if (null != str && str !== '') {
-        if (str.length === 2) {
-            return str.replace(/.*(?=[\u4e00-\u9fa5])/, "*")
-        } else if (str.length > 2) {
-            return str.replace(/(?<=[\u4e00-\u9fa5]).*(?=[\u4e00-\u9fa5])/, "*")
-        }
+        return str.replace(/(^.{1})(.+)$/g, function (...args) {
+            let tempStr = ''
+            if (args[2] && args[2].length) {
+                tempStr = Array.from({
+                    length: args[2].length
+                }).join('*')
+            }
+            return str.length === 2 ? (args[1] + '*') : (args[1] + tempStr + str.slice(-1))
+        })
     } else {
         return str
     }