Forráskód Böngészése

变更页面及功能bug调整

laiguoran 3 éve
szülő
commit
c84141cc8f

+ 5 - 5
app/controller/change_controller.js

@@ -2024,7 +2024,7 @@ module.exports = app => {
                     auditConst: audit.changeProject,
                     fileList,
                     whiteList,
-                    returnUrl: ctx.request.headers.referer,
+                    returnUrl: this.app._.indexOf(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/project') !== -1 ? ctx.request.headers.referer : null,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.project_information),
                     preUrl: '/tender/' + ctx.tender.id + '/change/project/' + ctx.change.id + '/information',
                 };
@@ -2534,11 +2534,11 @@ module.exports = app => {
                     throw '当前未打开标段';
                 }
                 const data = JSON.parse(ctx.request.body.data);
-                if (!data.code || data.code === '') {
+                if (!data.code || data.code === '' || !data.name || data.name === '') {
                     throw '变更申请编号不能为空';
                 }
 
-                const change = await ctx.service.changeApply.add(tenderId, ctx.session.sessionUser.accountId, data.code, data.project_code);
+                const change = await ctx.service.changeApply.add(tenderId, ctx.session.sessionUser.accountId, data.code, data.project_code, data.name);
 
                 ctx.body = { err: 0, msg: '', data: change };
             } catch (err) {
@@ -2604,7 +2604,7 @@ module.exports = app => {
                     auditConst: audit.changeApply,
                     fileList,
                     whiteList,
-                    returnUrl: ctx.request.headers.referer,
+                    returnUrl: this.app._.indexOf(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/apply') !== -1 ? ctx.request.headers.referer : null,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.apply_information),
                     preUrl: '/tender/' + ctx.tender.id + '/change/apply/' + ctx.change.id + '/information',
                 };
@@ -2640,7 +2640,7 @@ module.exports = app => {
                     changeConst,
                     auditConst: audit.changeApply,
                     fileList,
-                    returnUrl: ctx.request.headers.referer,
+                    returnUrl: this.app._.indexOf(ctx.request.headers.referer, '/tender/' + ctx.tender.id + '/change/apply') !== -1 ? ctx.request.headers.referer : null,
                     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',
                 };

+ 10 - 0
app/public/js/change_apply.js

@@ -190,6 +190,7 @@ $(document).ready(() => {
         const data = {
             code: $('#bj-code').val(),
             project_code: $('#project-code').val(),
+            name: $('#bj-name').val(),
         };
         if (data.code || data.code !== '') {
             postData('/tender/'+ tenderId +'/change/apply/add', data, function (rst) {
@@ -205,6 +206,15 @@ $(document).ready(() => {
         }
     });
 
+    $('#project-code').change(function () {
+        if ($(this).val() === '') {
+            $('#bj-name').val('');
+        } else {
+            const info = _.find(changeProjectList, { code: $(this).val() });
+            $('#bj-name').val(info.name);
+        }
+    });
+
     //状态切换
     $('#status_select a').on('click', function () {
        const status = $(this).data('val');

+ 2 - 1
app/service/change_apply.js

@@ -30,7 +30,7 @@ module.exports = app => {
             this.tableName = 'change_apply';
         }
 
-        async add(tenderId, userId, code, project_code) {
+        async add(tenderId, userId, code, project_code, name) {
             const sql = 'SELECT COUNT(*) as count FROM ?? WHERE `tid` = ? AND `code` = ?';
             const sqlParam = [this.tableName, tenderId, code];
             const codeCount = await this.db.queryOne(sql, sqlParam);
@@ -51,6 +51,7 @@ module.exports = app => {
                     in_time: new Date(),
                     code,
                     project_code,
+                    name,
                 };
                 const operate = await this.transaction.insert(this.tableName, change);
 

+ 1 - 0
app/view/change/apply.ejs

@@ -107,4 +107,5 @@
     const cRuleFirst = parseInt('<%- c_rule_first %>');
     const ruleType = parseInt('<%- ruleType %>');
     const rulesType = '<%- rule_type %>';
+    const changeProjectList = JSON.parse(unescape('<%- escape(JSON.stringify(changeProjectList)) %>'));
 </script>

+ 8 - 0
app/view/change/apply_information_modal.ejs

@@ -394,6 +394,14 @@
                                                                             <label>审批意见<b class="text-danger">*</b></label>
                                                                             <textarea class="form-control form-control-sm"
                                                                                       name="opinion">同意</textarea>
+                                                                            <% if (auditors[auditors.length - 1].aid === auditor.aid) { %>
+                                                                                <!--终审填写批复编号-->
+                                                                                <div class="form-group mt-3">
+                                                                                    <label><b class="text-danger">*&nbsp;</b>变更通知书</label>
+                                                                                    <input class="form-control form-control-sm" value="BGTZ-<%- change.code %>" name="notice_code" type="text">
+                                                                                    <input type="hidden" name="notice_uid" value="<%- auditor.aid %>">
+                                                                                </div>
+                                                                            <% } %>
                                                                         <% } else { %>
                                                                             <p style="margin: 0;"><%- auditor.opinion %></p>
                                                                         <% } %>

+ 7 - 1
app/view/change/apply_modal.ejs

@@ -47,8 +47,14 @@
                         <% } %>
                     </select>
                 </div>
+                <input value="" type="hidden" id="bj-name">
                 <% } else { %>
-                    <input type="hidden" value="" id="project-code">
+                <div class="form-group">
+                    <label>变更工程名称<b class="text-danger">*</b></label>
+                    <input class="form-control form-control-sm" value="" type="text" id="bj-name">
+                    <div class="invalid-feedback" style="display: none" id="name_error_msg">名称超过100个字,请缩减名称。</div>
+                </div>
+                <input type="hidden" value="" id="project-code">
                 <% } %>
             </div>
             <div class="modal-footer">