浏览代码

返回路由设置

laiguoran 3 年之前
父节点
当前提交
76768c97ce

+ 3 - 0
app/controller/change_controller.js

@@ -2024,6 +2024,7 @@ module.exports = app => {
                     auditConst: audit.changeProject,
                     fileList,
                     whiteList,
+                    returnUrl: ctx.request.headers.referer,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.project_information),
                     preUrl: '/tender/' + ctx.tender.id + '/change/project/' + ctx.change.id + '/information',
                 };
@@ -2603,6 +2604,7 @@ module.exports = app => {
                     auditConst: audit.changeApply,
                     fileList,
                     whiteList,
+                    returnUrl: ctx.request.headers.referer,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.apply_information),
                     preUrl: '/tender/' + ctx.tender.id + '/change/apply/' + ctx.change.id + '/information',
                 };
@@ -2638,6 +2640,7 @@ module.exports = app => {
                     changeConst,
                     auditConst: audit.changeApply,
                     fileList,
+                    returnUrl: ctx.request.headers.referer,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.apply_information_notice),
                     preUrl: '/tender/' + ctx.tender.id + '/change/apply/' + ctx.change.id + '/information/notice',
                 };

+ 33 - 5
app/service/change_project.js

@@ -179,11 +179,39 @@ module.exports = app => {
          * @return {void}
          */
         async getCountByStatus(tenderId, status) {
-            if (this.ctx.tender.isTourist && status === 0) {
-                const sql5 = 'SELECT count(*) AS count FROM ?? WHERE tid = ? ORDER BY in_time DESC';
-                const sqlParam5 = [this.tableName, tenderId];
-                const result5 = await this.db.query(sql5, sqlParam5);
-                return result5[0].count;
+            if (this.ctx.tender.isTourist) {
+                let touristSql;
+                let touristSqlParam;
+                let touristResult;
+                switch (status) {
+                    case 0:
+                        touristSql = 'SELECT count(*) AS count FROM ?? WHERE tid = ? ORDER BY in_time DESC';
+                        touristSqlParam = [this.tableName, tenderId];
+                        touristResult = await this.db.query(touristSql, touristSqlParam);
+                        return touristResult[0].count;
+                    // case 1:
+                    //     touristSql = 'SELECT count(*) AS count FROM ?? WHERE tid = ? AND (status = ? OR status = ?) ORDER BY in_time DESC';
+                    //     touristSqlParam = [this.tableName, tenderId, audit.status.uncheck, audit.status.checking];
+                    //     touristResult = await this.db.query(touristSql, touristSqlParam);
+                    //     return touristResult[0].count;
+                    // case 5:
+                    //     touristSql = 'SELECT count(*) AS count FROM ?? WHERE tid = ? AND status = ? ORDER BY in_time DESC';
+                    //     touristSqlParam = [this.tableName, tenderId, audit.status.uncheck];
+                    //     touristResult = await this.db.query(touristSql, touristSqlParam);
+                    //     return touristResult[0].count;
+                    // case 2:
+                    //     touristSql = 'SELECT count(*) AS count FROM ?? WHERE tid = ? AND status = ? ORDER BY in_time DESC';
+                    //     touristSqlParam = [this.tableName, tenderId, audit.status.uncheck];
+                    //     touristResult = await this.db.query(touristSql, touristSqlParam);
+                    //     return touristResult[0].count;
+                    // case 4:
+                    //     touristSql = 'SELECT count(*) AS count FROM ?? WHERE tid = ? AND status = ? ORDER BY in_time DESC';
+                    //     touristSqlParam = [this.tableName, tenderId, status];
+                    //     touristResult = await this.db.query(touristSql, touristSqlParam);
+                    //     return touristResult[0].count;
+                    default:
+                        break;
+                }
             }
             switch (status) {
                 case 0: // 包含你的所有变更令

+ 1 - 1
app/view/change/apply_information.ejs

@@ -5,7 +5,7 @@
             <% include ../tender/tender_sub_mini_menu.ejs %>
             <div>
                 <div class="d-inline-block">
-                    <a href="/tender/<%- tender.id %>/change/apply"><i class="fa fa-chevron-left mr-2"></i><span>返回</span></a>
+                    <a <% if (returnUrl) { %>href="<%- returnUrl %>"<% } else { %>class="change_apply_sort_link" href="/tender/<%- tender.id %>/change/apply"<% } %>><i class="fa fa-chevron-left mr-2"></i><span>返回</span></a>
                 </div>
                 <div class="d-inline-block" id="change-apply-code">
                     <%- change.code %>

+ 1 - 1
app/view/change/apply_information_notice.ejs

@@ -5,7 +5,7 @@
             <% include ../tender/tender_sub_mini_menu.ejs %>
             <div>
                 <div class="d-inline-block">
-                    <a href="/tender/<%- tender.id %>/change/apply"><i class="fa fa-chevron-left mr-2"></i><span>返回</span></a>
+                    <a <% if (returnUrl) { %>href="<%- returnUrl %>"<% } else { %>class="change_apply_sort_link" href="/tender/<%- tender.id %>/change/apply"<% } %>><i class="fa fa-chevron-left mr-2"></i><span>返回</span></a>
                 </div>
                 <div class="d-inline-block" id="change-apply-code">
                     <%- change.code %>

+ 1 - 1
app/view/change/project_information.ejs

@@ -5,7 +5,7 @@
             <% include ../tender/tender_sub_mini_menu.ejs %>
             <div>
                 <div class="d-inline-block">
-                    <a href="/tender/<%- tender.id %>/change/project"><i class="fa fa-chevron-left mr-2"></i><span>返回</span></a>
+                    <a <% if (returnUrl) { %>href="<%- returnUrl %>"<% } else { %>class="change_project_sort_link" href="/tender/<%- tender.id %>/change/project"<% } %>><i class="fa fa-chevron-left mr-2"></i><span>返回</span></a>
                 </div>
                 <div class="d-inline-block" id="change-project-code">
                     <%- change.code %>