Browse Source

标段管理菜单隐藏显示控制

MaiXinRong 2 months ago
parent
commit
e357137567

+ 1 - 0
app/const/sp_page_show.js

@@ -93,6 +93,7 @@ const defaultSetting = {
     openMaterialStageRepeat: 0,
     openContract: 1,
     openFinancial: 1,
+    openTenderContract: 1,
 };
 
 module.exports = {

+ 5 - 2
app/public/js/contract_tender.js

@@ -66,9 +66,12 @@ const tenderListSpec = (function(){
     }
     function getTenderTreeHeaderHtml() {
         const html = [];
+        const titleHeight = $('.panel-title').height();
+        html.push(`<table class="table table-hover table-bordered" id="progress-table">`);
         const left = $('#sub-menu').css('display') === 'none' ? 56 : 176;
-        html.push('<table class="table table-hover table-bordered" id="progress-table">')
-        html.push('<thead style="position: sticky;left:'+ left +'px;top: 0px;" class="text-center">', '<tr>');
+        const theadTop = Math.round(titleHeight - 1, 2);
+        const subMenuStyle = `style="position: fixed;left:${left}px;top: ${theadTop}px;"`;
+        html.push(`<thead ${subMenuStyle}>`, '<tr>');
         // html.push('<table class="table table-hover table-bordered">');
         // html.push('<thead style="position: fixed;left:56px;top: 34px;" class="text-center">', '<tr>');
         html.push('<th style="min-width: 200px" rowspan="2">', '标段名称', '</th>');

+ 5 - 2
app/public/js/tender_list.js

@@ -1,9 +1,12 @@
 const tenderListSpec = (function(){
     function getTenderTreeHeaderHtml() {
         const html = [];
+        const titleHeight = $('.panel-title').height();
+        html.push(`<table class="table table-hover table-bordered">`);
         const left = $('#sub-menu').css('display') === 'none' ? 56 : 176;
-        html.push('<table class="table table-hover table-bordered">');
-        html.push('<thead style="position: fixed;left:'+ left +'px;top: 34px;">', '<tr>');
+        const theadTop = Math.round(titleHeight - 2, 2);
+        const subMenuStyle = showListSubMenu ? `style="position: fixed;left:${left}px;top: ${theadTop}px;"` : `style="position: fixed; top: ${theadTop}px;"`;
+        html.push(`<thead ${subMenuStyle}>`, '<tr>');
         html.push('<th class="text-center" style="width: 40%">', '标段名称', tenderListOrder.getOrderButton('name'), '</th>');
         html.push('<th class="text-center" style="width: 9%">', '计量模式', '</th>');
         html.push('<th class="text-center" style="width: 9%">', '创建人', '</th>');

+ 5 - 2
app/public/js/tender_list_info.js

@@ -175,9 +175,12 @@ const tenderListSpec = (function(){
     function getTenderTreeHeaderHtml() {
         colSetCache = generateColSetCache();
         const html = [];
+        const titleHeight = $('.panel-title').height();
+        html.push(`<table class="table table-hover table-bordered">`);
         const left = $('#sub-menu').css('display') === 'none' ? 56 : 176;
-        html.push('<table class="table table-hover table-bordered">');
-        html.push('<thead style="position: fixed;left:'+ left +'px;top: 34px;">', '<tr>');
+        const theadTop = Math.round(titleHeight - 1, 2);
+        const subMenuStyle = showListSubMenu ? `style="position: fixed;left:${left}px;top: ${theadTop}px;"` : `style="position: fixed; top: ${theadTop}px;"`;
+        html.push(`<thead ${subMenuStyle}>`, '<tr>');
         if (colSetCache.name.show) html.push('<th class="text-center" style="min-width: 300px;">', colSetCache.name.alias, '</th>');
         if (colSetCache.measure_type.show) html.push('<th class="text-center" style="width: 85px">', colSetCache.measure_type.alias, '</th>');
         if (colSetCache.calc_flow.show) html.push('<th class="text-center" style="width: 125px">', colSetCache.calc_flow.alias, '</th>');

+ 5 - 2
app/public/js/tender_list_manage.js

@@ -61,9 +61,12 @@ const tenderListSpec = (function(){
     }
     function getTenderTreeHeaderHtml() {
         const html = [];
+        const titleHeight = $('.panel-title').height();
+        html.push(`<table class="table table-hover table-bordered">`);
         const left = $('#sub-menu').css('display') === 'none' ? 56 : 176;
-        html.push('<table class="table table-hover table-bordered">');
-        html.push('<thead style="position: fixed;left:'+ left +'px;top: 34px;">', '<tr>');
+        const theadTop = Math.round(titleHeight - 2, 2);
+        const subMenuStyle = showListSubMenu ? `style="position: fixed;left:${left}px;top: ${theadTop}px;"` : `style="position: fixed; top: ${theadTop}px;"`;
+        html.push(`<thead ${subMenuStyle}>`, '<tr>');
         html.push('<th class="text-center" style="width: 45%">', '标段名称', tenderListOrder.getOrderButton('name'), '</th>');
         html.push('<th class="text-center" style="width: 10%">', '创建人', '</th>');
         html.push('<th class="text-center" style="width: 15%">', '创建时间', tenderListOrder.getOrderButton('create_time'), '</th>');

+ 5 - 2
app/public/js/tender_list_progress.js

@@ -113,9 +113,12 @@ const tenderListSpec = (function(){
     }
     function getTenderTreeHeaderHtml() {
         const html = [];
+        const titleHeight = $('.panel-title').height();
+        html.push(`<table class="table table-hover table-bordered" id="progress-table">`);
         const left = $('#sub-menu').css('display') === 'none' ? 56 : 176;
-        html.push('<table class="table table-hover table-bordered" id="progress-table">')
-        html.push('<thead style="position: sticky;left:'+ left +'px;top: 0px;">', '<tr>');
+        const theadTop = Math.round(titleHeight - 2, 2);
+        const subMenuStyle = showListSubMenu ? `style="position: fixed;left:${left}px;top: ${theadTop}px;"` : `style="position: fixed; top: ${theadTop}px;"`;
+        html.push(`<thead ${subMenuStyle}>`, '<tr>');
         // html.push('<thead style="left:56px;top: 34px;">', '<tr>');
         html.push('<th style="width: 30%;min-width: 300px" class="text-center">', '标段名称', '</th>');
         html.push('<th class="text-center" style="width: 120px">', '计量进度', '</th>');

+ 1 - 3
app/public/js/tender_showhide.js

@@ -142,9 +142,7 @@ function setTopTr() {
             }
         }
     }
-    if ($("#progress-table").length === 0) {
-        $('.c-body table').css('margin-top', $(".c-body table>thead").height() - 4);
-    }
+    $('.c-body table').css('margin-top', $(".c-body table>thead").height() - 4);
 }
 
 function doTrStatus(node, status, all = '') {

+ 3 - 2
app/view/tender/index.ejs

@@ -23,7 +23,8 @@
     const pid = '<%- pid %>';
 
     const uphlname = 'user_' + uid + '_pro_' + pid + '_category_hide_list';
-
+    const showListSubMenu = <%- ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract %>;
+    <% if (ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract) { %>
     $.subMenu({
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
         toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
@@ -40,7 +41,7 @@
                 $('.c-body table thead').css('left', '176px');
             }
             autoFlashHeight();
-            setTopTr();
         }
     });
+    <% } %>
 </script>

+ 20 - 18
app/view/tender/info.ejs

@@ -22,23 +22,25 @@
     const uid = '<%- uid %>';
     const pid = '<%- pid %>';
     const uphlname = 'user_' + uid + '_pro_' + pid + '_category_hide_list';
-
-    $.subMenu({
-        menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
-        toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
-        key: 'list.menu.1.0.0',
-        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
-        callback: function (info) {
-            if (info.mini) {
-                $('.panel-title').addClass('fluid');
-                $('#sub-menu').removeClass('panel-sidebar');
-                $('.c-body table thead').css('left', '56px');
-            } else {
-                $('.panel-title').removeClass('fluid');
-                $('#sub-menu').addClass('panel-sidebar');
-                $('.c-body table thead').css('left', '176px');
+    const showListSubMenu = <%- ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract %>;
+    <% if (ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract) { %>
+        $.subMenu({
+            menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
+            toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
+            key: 'list.menu.1.0.0',
+            miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
+            callback: function (info) {
+                if (info.mini) {
+                    $('.panel-title').addClass('fluid');
+                    $('#sub-menu').removeClass('panel-sidebar');
+                    $('.c-body table thead').css('left', '56px');
+                } else {
+                    $('.panel-title').removeClass('fluid');
+                    $('#sub-menu').addClass('panel-sidebar');
+                    $('.c-body table thead').css('left', '176px');
+                }
+                autoFlashHeight();
             }
-            autoFlashHeight();
-        }
-    });
+        });
+    <% } %>
 </script>

+ 2 - 0
app/view/tender/list_sub_menu.ejs

@@ -1,3 +1,4 @@
+<% if (ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract) { %>
 <div class="panel-sidebar" id="sub-menu">
     <div class="sidebar-title text-center"><i class="fa fa-list-ul fa-fw"></i> 标段管理</div>
     <div class="scrollbar-auto">
@@ -13,3 +14,4 @@
         });
     </script>
 </div>
+<% } %>

+ 2 - 0
app/view/tender/list_sub_mini_menu.ejs

@@ -1,4 +1,5 @@
 <!--折起的菜单-->
+<% if (ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract) { %>
 <div class="min-side" id="sub-mini-menu" style="display: none;">
     <div class="side-switch" data-toggle="tooltip" data-placement="left" data-original-title="点击这里打开收起的菜单栏">
         <i class="fa fa-bars mt-2"></i>
@@ -14,3 +15,4 @@
         el: '.side-menu',
     });
 </script>
+<% } %>

+ 3 - 1
app/view/tender/manage.ejs

@@ -22,7 +22,8 @@
     const pid = '<%- pid %>';
     const uphlname = 'user_' + uid + '_pro_' + pid + '_category_hide_manange_list';
     const cache = <%- ctx.session.sessionUser.is_admin %>;
-
+    const showListSubMenu = <%- ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract %>;
+    <% if (ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract) { %>
     $.subMenu({
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
         toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
@@ -41,4 +42,5 @@
             autoFlashHeight();
         }
     });
+    <% } %>
 </script>

+ 3 - 1
app/view/tender/progress.ejs

@@ -21,7 +21,8 @@
     const uid = '<%- uid %>';
     const pid = '<%- pid %>';
     const uphlname = 'user_' + uid + '_pro_' + pid + '_category_hide_list';
-
+    const showListSubMenu = <%- ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract %>;
+    <% if (ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract) { %>
     $.subMenu({
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
         toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
@@ -40,4 +41,5 @@
             autoFlashHeight();
         }
     });
+    <% } %>
 </script>

+ 4 - 1
app/view/tender/sub_menu.ejs

@@ -1,6 +1,9 @@
-<div class="panel-title">
+<div class="panel-title fluid">
     <div class="title-main d-flex">
+        <% if (ctx.subProject.page_show.openConstruction || ctx.subProject.page_show.openTenderContract) { %>
+        <% console.log(1); %>
         <% include ./list_sub_mini_menu.ejs %>
+        <% } %>
         <div>
             <div class="d-inline-block mr-2">
                 <% if (ctx.session.sessionUser.is_admin) { %>