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

fix(safe): 移除安全检查概览页面的年份选择功能

- 删除了控制器中的年份参数处理逻辑,统一使用当前年份
- 移除了CSS中年份选择器的相关样式定义
- 移除了JavaScript中年份选择器的事件监听器
- 更新了安全检查概览链接的路由路径
- 简化了服务层的数据处理逻辑,移除多多年份的支持
- 删除了视图中的年份选择表单元素
- 更新了底部说明文字的表述
caipin 3 недель назад
Родитель
Сommit
e21fdd2fa2

+ 1 - 3
app/controller/safe_controller.js

@@ -609,9 +609,7 @@ module.exports = app => {
             try {
             try {
                 if (!ctx.subProject.page_show.safeInspection) throw '该功能已关闭';
                 if (!ctx.subProject.page_show.safeInspection) throw '该功能已关闭';
                 const tender = await this.service.tender.getDataById(ctx.tender.id);
                 const tender = await this.service.tender.getDataById(ctx.tender.id);
-                const requestedYear = Number(ctx.query.year);
-                const currentYear = moment().year();
-                const year = Number.isInteger(requestedYear) && requestedYear >= 1970 && requestedYear <= currentYear ? requestedYear : currentYear;
+                const year = moment().year();
                 const renderData = {
                 const renderData = {
                     moment,
                     moment,
                     tender,
                     tender,

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

@@ -3395,9 +3395,6 @@ button.gy-stat:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
 .safe-inspection-overview .overview-trend {
 .safe-inspection-overview .overview-trend {
     height: 350px;
     height: 350px;
 }
 }
-.safe-inspection-overview .overview-year {
-    width: 100px;
-}
 .safe-inspection-overview .overview-status-links {
 .safe-inspection-overview .overview-status-links {
     gap: 8px;
     gap: 8px;
     flex-wrap: wrap;
     flex-wrap: wrap;

+ 0 - 3
app/public/js/safe_inspection_overview.js

@@ -3,9 +3,6 @@
 $(document).ready(function () {
 $(document).ready(function () {
     const $page = $('.safe-inspection-overview');
     const $page = $('.safe-inspection-overview');
     if (!$page.length) return;
     if (!$page.length) return;
-    $('#safe-overview-year').on('change', function () {
-        $('#safe-overview-year-form')[0].submit();
-    });
     const inspectionUrl = $page.attr('data-inspection-url');
     const inspectionUrl = $page.attr('data-inspection-url');
     const charts = [];
     const charts = [];
     const resize = function () { charts.forEach(function (chart) { chart.resize(); }); };
     const resize = function () { charts.forEach(function (chart) { chart.resize(); }); };

+ 1 - 1
app/public/js/safe_tender.js

@@ -13,7 +13,7 @@ const tenderListSpec = (function(){
             html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
             html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
             html.push('</span>');
             html.push('</span>');
             //html.push('<a href="/tender/' + node.id + '">', node[c.field], '</a>');
             //html.push('<a href="/tender/' + node.id + '">', node[c.field], '</a>');
-            html.push(`<a href="/sp/${spid}/safe/tender/${node.id}/${isInspection ? 'inspection' : 'stage'}" name="name" style="min-width: 200px;word-break:break-all;" id="${node.id}">${node.name}</a>`);
+            html.push(`<a href="/sp/${spid}/safe/tender/${node.id}/${isInspection ? 'inspection/overview' : 'stage'}" name="name" style="min-width: 200px;word-break:break-all;" id="${node.id}">${node.name}</a>`);
         }
         }
         html.push('</td>');
         html.push('</td>');
 
 

+ 1 - 8
app/service/safe_inspection.js

@@ -405,16 +405,11 @@ module.exports = app => {
             const submitted = Array(12).fill(0);
             const submitted = Array(12).fill(0);
             const completed = Array(12).fill(0);
             const completed = Array(12).fill(0);
             const needsRectification = Array(12).fill(0);
             const needsRectification = Array(12).fill(0);
-            const currentYear = moment().year();
-            let firstYear = Math.min(year, currentYear);
             for (const row of rows) {
             for (const row of rows) {
                 const reportYear = Number(row.report_year);
                 const reportYear = Number(row.report_year);
                 const completedYear = Number(row.completed_year);
                 const completedYear = Number(row.completed_year);
                 const reportMonth = Number(row.report_month);
                 const reportMonth = Number(row.report_month);
                 const completedMonth = Number(row.completed_month);
                 const completedMonth = Number(row.completed_month);
-                for (const value of [reportYear, completedYear]) {
-                    if (value >= 1970 && value <= currentYear) firstYear = Math.min(firstYear, value);
-                }
                 if (reportYear === year && reportMonth >= 1 && reportMonth <= 12) {
                 if (reportYear === year && reportMonth >= 1 && reportMonth <= 12) {
                     submitted[reportMonth - 1] += Number(row.inspection_count);
                     submitted[reportMonth - 1] += Number(row.inspection_count);
                     needsRectification[reportMonth - 1] += Number(row.rectification_count);
                     needsRectification[reportMonth - 1] += Number(row.rectification_count);
@@ -423,10 +418,8 @@ module.exports = app => {
                     completed[completedMonth - 1] += Number(row.inspection_count);
                     completed[completedMonth - 1] += Number(row.inspection_count);
                 }
                 }
             }
             }
-            const years = [];
-            for (let value = currentYear; value >= firstYear; value--) years.push(value);
             return {
             return {
-                year, years, months: submitted.map((count, index) => (index + 1) + '月'), submitted, completed,
+                year, months: submitted.map((count, index) => year + '年' + (index + 1) + '月'), submitted, completed,
                 ratios: submitted.map((count, index) => (count ? Number((needsRectification[index] * 100 / count).toFixed(1)) : 0)),
                 ratios: submitted.map((count, index) => (count ? Number((needsRectification[index] * 100 / count).toFixed(1)) : 0)),
                 hasData: submitted.some(count => count > 0) || completed.some(count => count > 0),
                 hasData: submitted.some(count => count > 0) || completed.some(count => count > 0),
             };
             };

+ 1 - 10
app/view/safe/inspection_overview.ejs

@@ -77,15 +77,6 @@
             <div class="card mb-3">
             <div class="card mb-3">
                 <div class="card-header d-flex align-items-center">
                 <div class="card-header d-flex align-items-center">
                     <strong>整改趋势</strong>
                     <strong>整改趋势</strong>
-                    <form class="ml-auto d-flex align-items-center" method="get" action="<%= inspectionUrl %>/overview" id="safe-overview-year-form">
-                        <label for="safe-overview-year" class="mb-0 mr-2">年份</label>
-                        <select id="safe-overview-year" name="year" class="form-control form-control-sm overview-year">
-                            <% overview.trend.years.forEach(year => { %>
-                                <option value="<%= year %>"<%= year === overview.trend.year ? ' selected' : '' %>><%= year %>年</option>
-                            <% }); %>
-                        </select>
-                        <button type="submit" class="btn btn-sm btn-outline-primary ml-2">查询</button>
-                    </form>
                 </div>
                 </div>
                 <div class="card-body">
                 <div class="card-body">
                     <% if (!overview.trend.hasData) { %><p class="text-center text-muted mb-0"><%= overview.trend.year %>年暂无上报或完成记录</p><% } %>
                     <% if (!overview.trend.hasData) { %><p class="text-center text-muted mb-0"><%= overview.trend.year %>年暂无上报或完成记录</p><% } %>
@@ -93,7 +84,7 @@
                 </div>
                 </div>
                 <div class="card-footer text-muted small">
                 <div class="card-footer text-muted small">
                     <div>首次上报数按实际首次提交月份统计,退回重报不重复计数;完成数按整个流程最终完成月份统计。</div>
                     <div>首次上报数按实际首次提交月份统计,退回重报不重复计数;完成数按整个流程最终完成月份统计。</div>
-                    <div>需整改占比为该月首次上报记录中,按当前保存的整改设置计算的需整改比例;年份仅筛选趋势,上方展示当前状态。</div>
+                    <div>需整改占比为该月首次上报记录中,按当前保存的整改设置计算的需整改比例;趋势统计当年数据,上方展示当前状态。</div>
                 </div>
                 </div>
             </div>
             </div>
         </div>
         </div>