Просмотр исходного кода

悬浮窗口排版,登录统计完善

zhangweicheng 6 лет назад
Родитель
Сommit
45df2a8d4e
2 измененных файлов с 18 добавлено и 8 удалено
  1. 1 0
      logs/online_logs.js
  2. 17 8
      modules/complementary_ration_lib/models/searchModel.js

+ 1 - 0
logs/online_logs.js

@@ -13,6 +13,7 @@ async function saveOnlineTime(req) {
     let interval_time = 10 * 60 *1000;
     let start = req.session.online_start_time;
     let end = + new Date();
+    if(start === undefined) return req.session.online_start_time ==end;
     let online_times =  end - start;
     //1秒内只记一次就好
     if(online_times < 500) return;//如果间隔太短,则忽略

+ 17 - 8
modules/complementary_ration_lib/models/searchModel.js

@@ -8,6 +8,7 @@ const stdGljModel = mongoose.model('std_glj_lib_gljList');
 const compleRationSectionTreeModel = mongoose.model('complementary_ration_section_tree');
 let stdSectionTreeModel = require ('../../ration_repository/models/ration_section_tree').Model;
 let stdRationModel = require ('../../ration_repository/models/ration_item').Model;
+let gljUtil = require('../../../public/gljUtil');
 
 const compleRationLib = 'compleRationLib';
 
@@ -147,10 +148,13 @@ class SearchDao{
                 //对人材机进行排序
                 ration.rationGljList.sort(function (a, b) {
                     let gljA = gljIDMapping[a.gljId],
-                        gljB = gljIDMapping[b.gljId];
+                        gljB = gljIDMapping[b.gljId],
+                        seqs = gljUtil.getGljTypeSeq() ;
                     if(gljA && gljB){
-                        let aV = gljA.gljType + gljA.code,
-                            bV = gljB.gljType + gljB.code;
+                        let indA = seqs.indexOf(gljA.gljType)+"",
+                            indB = seqs.indexOf(gljB.gljType)+"";
+                        let aV = indA+gljA.gljType + gljA.code,
+                            bV = indB+gljB.gljType + gljB.code;
                         if(aV > bV) {
                             return 1;
                         } else if(aV < bV) {
@@ -159,17 +163,22 @@ class SearchDao{
                     }
                     return 0;
                 });
+
+                if(ration.jobContent && ration.jobContent.toString().trim() !== ''){
+                    hintsArr.push(`<label class="nomargin font_blue">工作内容:`);
+                    hintsArr = hintsArr.concat(ration.jobContent.split('\n'));
+                    hintsArr.push("</label>");
+                    hintsArr.push("");
+                }
+
                 for(let rationGlj of ration.rationGljList){
                     let glj = gljIDMapping[rationGlj.gljId];
                     if(glj){
-                        hintsArr.push(` ${glj.code} ${glj.name}${glj.specs ? ' ' + glj.specs : ''} ${glj.unit} ${rationGlj.consumeAmt}`);
+                        hintsArr.push(`<label class="nomargin ${glj.gljType==4?"font_blue":""}"> ${glj.code} ${glj.name}${glj.specs ? '&nbsp;&nbsp;&nbsp;' + glj.specs : ''}&nbsp;&nbsp&nbsp;${glj.unit}&nbsp;&nbsp;&nbsp;${rationGlj.consumeAmt}</label>`)
+                        //hintsArr.push(` ${glj.code} ${glj.name}${glj.specs ? ' ' + glj.specs : ''} ${glj.unit} ${rationGlj.consumeAmt}`);
                     }
                 }
                 hintsArr.push(`基价 元 ${ration.basePrice}`);
-                if(ration.jobContent && ration.jobContent.toString().trim() !== ''){
-                    hintsArr.push(`工作内容:`);
-                    hintsArr = hintsArr.concat(ration.jobContent.split('\n'));
-                }
                 if(ration.annotation && ration.annotation.toString().trim() !== ''){
                     hintsArr.push(`附注:`);
                     hintsArr = hintsArr.concat(ration.annotation.split('\n'));