Browse Source

屏蔽浏览器右键菜单
定额库名称的简化处理
下拉取费专业固定项10

zhongzewei 6 years ago
parent
commit
f2d7b538fa

+ 2 - 1
config/gulpConfig.js

@@ -29,7 +29,8 @@ module.exports = {
     ],
     login_jspaths:[
         'public/web/url_util.js',
-        'web/users/js/login.js'
+        'web/users/js/login.js',
+        'public/web/headerOpr.js'
     ],
     pm_css:[
         'lib/ztree/css/zTreeStyle.css',

+ 5 - 4
modules/pm/facade/pm_facade.js

@@ -180,7 +180,6 @@ async function copyProject(userID, compilationID,data,newProjectID = null) {
     projectMap['copy'].document.userID = userID;
     projectMap['copy'].document.compilation = compilationID;
     projectMap['copy'].document.createDateTime = new Date();
-
     //清单、定额ID生成任务
     let IDtasks = [
         createIDsAndReturn(originalID,billsModel),
@@ -188,7 +187,6 @@ async function copyProject(userID, compilationID,data,newProjectID = null) {
         getProjectGLJIDAndReturn(originalID,newProjectID)
     ];
     let [billMap,rationMap,projectGLJMap] = await Promise.all(IDtasks);
-
     //所有复制任务异步处理,提升效率  复制清单,定额,4个文件,项目工料机, 定额工料机,人工系数,工程量明细,定额安装增加费,安装增加费
     let copyTasks = [
         createProject(projectMap),
@@ -235,8 +233,11 @@ async function getProjectGLJIDAndReturn(originalID,newProjectID) {
     let IDMap = {};
     let datas = [];
     let result = await gljListModel.find({project_id:originalID}, '-_id');
-    for(let d of result){
-        let newID = await getCounterID("glj_list");
+    let gljCount = await counter.counterDAO.getIDAfterCountSync(counter.moduleName.glj_list, result.length);
+    for(let i = 0; i < result.length; i++){
+        let d = result[i];
+        let newID = gljCount.sequence_value - (result.length - 1) + i;
+        //let newID = await getCounterID("glj_list");
         IDMap[d.id] = newID;
         d._doc.project_id = newProjectID;
         d._doc.id = newID;

+ 2 - 1
public/counter/counter.js

@@ -20,7 +20,8 @@ const COUNTER_MODULE_NAME = {
     template_bills: 'temp_bills',
     billsLib: 'billsLib',
     coeList: 'coeList',
-    complementaryCoeList: 'complementary_coe_list'
+    complementaryCoeList: 'complementary_coe_list',
+    glj_list: 'glj_list'
 }
 /*const PROJECT_COUNTER = 'projects', USER_COUNTER = 'users', BILL_COUNTER = 'bills', RATION_COUNTER = 'rations',
     REPORT_COUNTER = 'rptTemplates', FEE_COUNTER = 'fees'*/

+ 21 - 1
public/web/headerOpr.js

@@ -58,9 +58,29 @@ const CommonHeader = (function () {
             getCategoryList(-1, '联系客服');
         });
     }
-    return {getCategoryList, addEventListener}
+    //取消浏览器自带右键
+    //@return {void}
+    function banNavigatorContextMenu() {
+        document.oncontextmenu = function(event) {
+            if (window.event) {
+                event = window.event;
+            }
+            try {
+                var the = event.srcElement;
+                if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
+                    return false;
+                }
+                return true;
+            } catch (e) {
+                return false;
+            }
+        }
+    }
+    return {getCategoryList, addEventListener, banNavigatorContextMenu};
 })();
 
+CommonHeader.banNavigatorContextMenu();
+
 $(document).ready(function(){
     CommonHeader.addEventListener();
 });

+ 5 - 8
web/building_saas/main/html/main.html

@@ -158,13 +158,11 @@
                                  relaPanel="#de">定额库</a>
                           </li>
 
-                          <li class="nav-item dropdown show">
-                              <a class="nav-link dropdown-toggle more" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">更多</a>
-                              <div class="dropdown-menu show" x-placement="bottom-start"
-                                   style="position: absolute; transform: translate3d(-107px, 32px, 0px); top: 0px; left: 0px; will-change: transform;">
-                                  <a class="dropdown-item right-nav-link" href="javascript:void(0)" id="locateTab"
-                                     relapanel="#locate">查找定位</a>
-                                  <a class="dropdown-item" data-toggle="tab" href="#sqpz" role="tab">书签批注</a>
+                          <li class="nav-item dropdown">
+                              <!--<a class="nav-link dropdown-toggle more" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">更多</a>-->
+                              <div class="dropdown-menu">
+                                  <a class="dropdown-item  right-nav-link"  href="javascript:void(0)" id = 'locateTab' relaPanel="#locate">查找定位</a>
+                                  <!-- <a class="dropdown-item" data-toggle="tab" href="#sqpz" role="tab">书签批注</a>-->
                               </div>
                           </li>
 
@@ -2038,7 +2036,6 @@
                 $("#checkCount").text(checkCount);
 
             }
-
             /*$(document).ready(function(){
                 document.addEventListener('visibilitychange', function() {
                     if(document.hidden){ //页面不可见状态

+ 3 - 3
web/building_saas/main/js/views/billsElf.js

@@ -168,7 +168,7 @@ const BillsElf = (function() {
             workBookWidth = ($(window).width() - $('.main').find('.main-nav').width() - $('.main-side').width()) * 5 / 6,
             headers = elfItem.headers;
         if(workBook){
-            workBookWidth -= 60;
+            workBookWidth -= 55;
             const sheet = workBook.getActiveSheet();
             sheet.suspendEvent();
             sheet.suspendPaint();
@@ -461,9 +461,9 @@ const BillsElf = (function() {
             }
             let height = cellRect.height;
             let options = getOptions(node.data, bills.selected.elf.datas);
-            top = options.length - 2 > 4 ? top - 4 * height : top - (options.length - 2) * height - 5;
+            top = options.length - 2 > 4 ? top - 4 * height : top - (options.length - 2) * height;
             let $editInput = $(`<div style="height: ${height}px; background: ${cellStyle.backColor};overflow: hidden; white-space: nowrap; text-overflow: ellipsis">${node.data.options}</div>`),
-                $optDiv = $(`<div style="position: fixed; width: ${cellRect.width}px; top: ${top}px;background: ${cellStyle.backColor};border: 1px solid; overflow: auto; height: ${options.length > 6 ? height*6 : height*options.length+5}px; font-size: 0.9rem;"></div>`);
+                $optDiv = $(`<div style="position: fixed; width: ${cellRect.width}px; top: ${top}px;background: ${cellStyle.backColor};border: 1px solid; overflow: auto; height: ${options.length > 6 ? height*6+5 : height*options.length+5}px; font-size: 0.9rem;"></div>`);
             for(let opt of options){
                 let $opt = $(`<div title="${opt.name ? opt.name : ''}" class="elf-options" style="height: ${height}px;overflow: hidden; white-space: nowrap; text-overflow: ellipsis"></div>`),
                     $optInput = $(`<input rank="${opt.rank}" value="${opt.ID}" style="margin-left: 5px; vertical-align: middle" type="checkbox" 

+ 1 - 0
web/building_saas/main/js/views/main_tree_col.js

@@ -306,6 +306,7 @@ let MainTreeCol = {
             ) {
                 // var names = new GC.Spread.Sheets.CellTypes.ComboBox();
                 var names = sheetCommonObj.getDynamicCombo();
+                names._maxDropDownItems = 10;
                 names.items(projectObj.project.calcProgram.compiledTemplateNames);
                 return names;
             }

+ 40 - 0
web/building_saas/main/js/views/std_ration_lib.js

@@ -188,8 +188,48 @@ var rationLibObj = {
             SheetDataHelper.loadSheetData(setting, rationLibObj.sectionRationsSpread.getActiveSheet(), datas);
             rationLibObj.setTagForHint(rationSheet, datas);
         };
+        //定额名称的处理:
+        /*
+         * 1、从定额库提取的名称,是否含有空格:
+         * 1.1、无,则不处理。
+         * 1.2、有,则取第一个空格前的文本,与定额所属节点名称(去掉前面和后面的编号、括号、空格,保留中间的中文及符号)比较是否相同:
+         * 1.2.1、不同,则不处理。
+         * 1.2.2、相同,则将定额名称显示为去除第一个空格及空格之前的文本。
+         */
+        //@param {String}sectionName(章节名称) {Array}datas(定额数据)
+        function simplifyName(sectionName, datas){
+            if (!sectionName || !datas || datas.length === 0) {
+                return;
+            }
+            //提取需要匹配的章节名称
+            //去掉前缀
+            let toMatchArr = sectionName.split(' '),
+                toMatchStr = toMatchArr[toMatchArr.length - 1];
+            //去掉后缀
+            let sectionReg = /\(\w{9,}\)/g,
+                regMatch = toMatchStr.match(sectionReg);
+            if (regMatch) {
+                toMatchStr = toMatchStr.replace(regMatch[regMatch.length - 1], '');
+            }
+            //简化匹配到的定额名称
+            for (let data of datas) {
+                //第一个空格前的字符串去进行匹配,没有则不匹配
+                let nameArr = data.name.split(' ');
+                if (nameArr.length <= 1) {
+                    continue;
+                }
+                let matchName = nameArr[0];
+                if (matchName === toMatchStr) {
+                    nameArr.shift();
+                    data.name = nameArr.join(' ');
+                }
+            }
+        }
         if (sectionID) {
             CommonAjax.post('/complementaryRation/api/getRationGljItemsBySection', {user_Id: userID, sectionId: sectionID, type: me.curLibType}, function (datas) {
+                let chapterSheet = me.rationChapterSpread.getActiveSheet();
+                let sectionName = chapterSheet.getText(chapterSheet.getActiveRowIndex(), chapterSheet.getActiveColumnIndex());
+                simplifyName(sectionName, datas);
                 showDatas(datas, rationLibObj.sectionRationsSetting);
                 if(me.doAfterLoadGetRations){
                     me.doAfterLoadGetRations(datas);

+ 1 - 0
web/users/html/login.html

@@ -112,6 +112,7 @@
     <script src="/lib/bootstrap/bootstrap.min.js"></script>
     <script src="/web/building_saas/js/global.js"></script>
     <script type="text/javascript" src="/web/users/js/login.js"></script>
+    <script src="/public/web/headerOpr.js"></script>
     <!-- endinject -->
 </body>