Prechádzať zdrojové kódy

fix(inspection): 修复未选整改时展示默认流程的问题

- 添加 pending 状态 CSS 样式,隐藏未选择时的整改选项和流程区域
- 页面加载时通过草稿恢复逻辑避免展示数据库默认选项
- 用户选择整改选项后移除 pending 类以显示完整流程
- 修正质量与安全巡检子菜单 active 判断条件,移除多余的 information 排除
caipin 2 týždňov pred
rodič
commit
826be6f03d

+ 12 - 0
app/public/css/main.css

@@ -3245,6 +3245,12 @@ button.gy-stat:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
   }
 }
 
+.safe-inspection-need-pending .safe-inspection-need-options {
+    visibility: hidden;
+}
+.safe-inspection-need-pending .safe-inspection-flow {
+    display: none;
+}
 .safe-inspection-flow .flow-picker > .dropdown-menu {
     width: 220px;
 }
@@ -3401,6 +3407,12 @@ button.gy-stat:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
 }
 
 /* 质量巡检三阶段流程及概况 */
+.quality-inspection-need-pending .quality-inspection-need-options {
+    visibility: hidden;
+}
+.quality-inspection-need-pending .quality-inspection-flow {
+    display: none;
+}
 .quality-inspection-flow .flow-picker > .dropdown-menu {
     width: 220px;
 }

+ 1 - 0
app/public/js/quality_inspection_information.js

@@ -926,4 +926,5 @@ function showQualityInspectionNeed(value) {
     $('[name="quality-need-rectification"]').filter('[value="' + value + '"]').prop('checked', true);
     $('.quality-inspection-flow [data-flow-stage="2"], .quality-inspection-flow [data-flow-stage="3"]').toggleClass('d-none', value === 0);
     $('.quality-inspection-flow .flow-no-rectification').toggleClass('d-none', value !== 0);
+    $('.quality-inspection-need-pending').removeClass('quality-inspection-need-pending');
 }

+ 1 - 0
app/public/js/safe_inspection_information.js

@@ -926,4 +926,5 @@ function showSafeInspectionNeed(value) {
     $('[name="safe-need-rectification"]').filter('[value="' + value + '"]').prop('checked', true);
     $('.safe-inspection-flow [data-flow-stage="2"], .safe-inspection-flow [data-flow-stage="3"]').toggleClass('d-none', value === 0);
     $('.safe-inspection-flow .flow-no-rectification').toggleClass('d-none', value !== 0);
+    $('.safe-inspection-need-pending').removeClass('safe-inspection-need-pending');
 }

+ 4 - 2
app/view/quality/inspection_information.ejs

@@ -1,5 +1,5 @@
 <% include ./sub_menu.ejs %>
-<div class="panel-content">
+<div class="panel-content<%= inspection.flow_version === 1 && !inspection.readOnly ? ' quality-inspection-need-pending' : '' %>">
     <div class="panel-title">
         <div class="title-main d-flex justify-content-between">
             <% include ./sub_mini_menu.ejs %>
@@ -81,7 +81,7 @@
                         <% if (inspection.flow_version === 1) { %>
                         <tr>
                             <th class="text-center" width="150">是否整改</th>
-                            <td>
+                            <td class="quality-inspection-need-options">
                                 <% [1, 0].forEach(value => { %>
                                     <label class="mr-3 mb-0"><input type="radio" name="quality-need-rectification" value="<%= value %>" <%= inspection.need_rectification === value ? 'checked' : '' %> <%= inspection.readOnly ? 'disabled' : '' %>> <%= value ? '是' : '否' %></label>
                                 <% }); %>
@@ -518,6 +518,8 @@
     const fileList = JSON.parse(unescape('<%- escape(JSON.stringify(fileList)) %>')) || [];
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
     const deleteFilePermission = <%- deleteFilePermission %>;
+    // 在页面解析完成前恢复草稿,避免先展示数据库默认选项及其流程。
+    if (inspection.flow_version === 1) showQualityInspectionNeed(qualityInspectionNeedDraft());
 </script>
 <% if(!inspection.readOnly) { %>
 <script>

+ 1 - 1
app/view/quality/sub_memu_list.ejs

@@ -5,7 +5,7 @@
 <!--<nav-menu title="试验报告" url="/sp/<%- ctx.subProject.id %>/quality/tender/<%= ctx.tender.id %>/lab%>" ml="3" active="<%= ctx.url.indexOf('/lab') %>"></nav-menu>-->
 <% } else { %>
 <nav-menu title="巡检概况" url="/sp/<%- ctx.subProject.id %>/quality/tender/<%= ctx.tender.id %>/inspection/overview" ml="1" active="<%= ctx.url.indexOf('/inspection/overview') >= 0 ? 1 : -1 %>" icon="fa-pie-chart"></nav-menu>
-<nav-menu title="质量巡检" url="/sp/<%- ctx.subProject.id %>/quality/tender/<%= ctx.tender.id %>/inspection" ml="3" active="<%= ctx.url.includes('/inspection') && !ctx.url.includes('/overview') && !ctx.url.includes('/rectification') && !ctx.url.includes('/approval') && !ctx.url.includes('/information') ? 1 : -1 %>" ></nav-menu>
+<nav-menu title="质量巡检" url="/sp/<%- ctx.subProject.id %>/quality/tender/<%= ctx.tender.id %>/inspection" ml="3" active="<%= ctx.url.includes('/inspection') && !ctx.url.includes('/overview') && !ctx.url.includes('/rectification') && !ctx.url.includes('/approval') ? 1 : -1 %>" ></nav-menu>
 <nav-menu title="巡检整改" url="/sp/<%- ctx.subProject.id %>/quality/tender/<%= ctx.tender.id %>/inspection/rectification" ml="3" active="<%= ctx.url.indexOf('/inspection/rectification') >= 0 ? 1 : -1 %>" ></nav-menu>
 <nav-menu title="巡检批复" url="/sp/<%- ctx.subProject.id %>/quality/tender/<%= ctx.tender.id %>/inspection/approval" ml="3" active="<%= ctx.url.indexOf('/inspection/approval') >= 0 ? 1 : -1 %>" ></nav-menu>
 <% } %>

+ 4 - 2
app/view/safe/inspection_information.ejs

@@ -1,5 +1,5 @@
 <% include ./sub_menu.ejs %>
-<div class="panel-content">
+<div class="panel-content<%= inspection.flow_version === 1 && !inspection.readOnly ? ' safe-inspection-need-pending' : '' %>">
     <div class="panel-title">
         <div class="title-main d-flex justify-content-between">
             <% include ./sub_mini_menu.ejs %>
@@ -81,7 +81,7 @@
                         <% if (inspection.flow_version === 1) { %>
                         <tr>
                             <th class="text-center" width="150">是否整改</th>
-                            <td>
+                            <td class="safe-inspection-need-options">
                                 <% [1, 0].forEach(value => { %>
                                     <label class="mr-3 mb-0"><input type="radio" name="safe-need-rectification" value="<%= value %>" <%= inspection.need_rectification === value ? 'checked' : '' %> <%= inspection.readOnly ? 'disabled' : '' %>> <%= value ? '是' : '否' %></label>
                                 <% }); %>
@@ -518,6 +518,8 @@
     const fileList = JSON.parse(unescape('<%- escape(JSON.stringify(fileList)) %>')) || [];
     const whiteList = JSON.parse('<%- JSON.stringify(whiteList) %>');
     const deleteFilePermission = <%- deleteFilePermission %>;
+    // 在页面解析完成前恢复草稿,避免先展示数据库默认选项及其流程。
+    if (inspection.flow_version === 1) showSafeInspectionNeed(safeInspectionNeedDraft());
 </script>
 <% if(!inspection.readOnly) { %>
 <script>

+ 1 - 1
app/view/safe/sub_memu_list.ejs

@@ -2,7 +2,7 @@
 <% if (!ctx.url.includes('/inspection')) { %>
 <% } else { %>
 <nav-menu title="巡检概况" url="/sp/<%- ctx.subProject.id %>/safe/tender/<%= ctx.tender.id %>/inspection/overview" ml="1" active="<%= ctx.url.indexOf('/inspection/overview') >= 0 ? 1 : -1 %>" icon="fa-pie-chart"></nav-menu>
-<nav-menu title="安全巡检" url="/sp/<%- ctx.subProject.id %>/safe/tender/<%= ctx.tender.id %>/inspection" ml="3" active="<%= ctx.url.includes('/inspection') && !ctx.url.includes('/overview') && !ctx.url.includes('/rectification') && !ctx.url.includes('/approval') && !ctx.url.includes('/information') ? 1 : -1 %>" ></nav-menu>
+<nav-menu title="安全巡检" url="/sp/<%- ctx.subProject.id %>/safe/tender/<%= ctx.tender.id %>/inspection" ml="3" active="<%= ctx.url.includes('/inspection') && !ctx.url.includes('/overview') && !ctx.url.includes('/rectification') && !ctx.url.includes('/approval') ? 1 : -1 %>" ></nav-menu>
 <nav-menu title="巡检整改" url="/sp/<%- ctx.subProject.id %>/safe/tender/<%= ctx.tender.id %>/inspection/rectification" ml="3" active="<%= ctx.url.indexOf('/inspection/rectification') >= 0 ? 1 : -1 %>" ></nav-menu>
 <nav-menu title="巡检批复" url="/sp/<%- ctx.subProject.id %>/safe/tender/<%= ctx.tender.id %>/inspection/approval" ml="3" active="<%= ctx.url.indexOf('/inspection/approval') >= 0 ? 1 : -1 %>" ></nav-menu>
 <% } %>