Browse Source

变更立项及申请bug修复

laiguoran 3 năm trước cách đây
mục cha
commit
93221ef6e8

+ 1 - 1
app/controller/change_controller.js

@@ -2534,7 +2534,7 @@ module.exports = app => {
                     throw '当前未打开标段';
                 }
                 const data = JSON.parse(ctx.request.body.data);
-                if (!data.code || data.code === '' || !data.name || data.name === '') {
+                if (!data.code || data.code === '') {
                     throw '变更申请编号不能为空';
                 }
 

+ 8 - 1
app/public/js/change_apply_audit.js

@@ -189,7 +189,7 @@ function checkAuditorFrom () {
         toastr.error('变更申请编号不能为空');
         flag = true;
     }
-    if (change.name === '') {
+    if (!change.name) {
         toastr.error('变更工程名称不能为空');
         flag = true;
     }
@@ -208,6 +208,13 @@ function auditCheck(i) {
     // const inlineRadio2 = $('#inlineRadio2:checked').val()
     const opinion = $('textarea[name="opinion"]').eq(i).val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ');
     $('textarea[name="opinion"]').eq(i).val(opinion);
+    console.log($('input[name="notice_code"]').val());
+    if ($('input[name="notice_code"]').val() !== undefined) {
+        if (_.trim($('input[name="notice_code"]').val()) === '') {
+            toastr.error('请输入变更通知书');
+            return false;
+        }
+    }
     // if (i === 1) {
     //     if (!inlineRadio1 && !inlineRadio2) {
     //         if (!$('#warning-text').length) {

+ 17 - 1
app/public/js/change_apply_information.js

@@ -155,7 +155,7 @@ $(document).ready(() => {
         } else {
             $(this).val(change[val_name]);
         }
-    })
+    });
 
     $('#apply-table textarea').blur(function () {
         const val_name = $(this).data('name');
@@ -171,6 +171,22 @@ $(document).ready(() => {
         } else {
             $(this).val(change[val_name]);
         }
+    });
+
+    $('#project-table select').change(function () {
+        const val_name = $(this).attr('data-name');
+        let val = _.trim($(this).val()) !== '' ? _.trim($(this).val()) : null;
+        if(change[val_name] !== val) {
+            const _self = $(this);
+            postData(preUrl + '/save', { name: val_name, val}, function (result) {
+                change[val_name] = val;
+                _self.val(change[val_name]);
+            }, function () {
+                _self.val(change[val_name]);
+            })
+        } else {
+            $(this).val(change[val_name]);
+        }
     })
 });
 

+ 17 - 1
app/public/js/change_project_information.js

@@ -153,7 +153,7 @@ $(document).ready(() => {
         } else {
             $(this).val(change[val_name]);
         }
-    })
+    });
 
     $('#project-table textarea').blur(function () {
         const val_name = $(this).data('name');
@@ -169,6 +169,22 @@ $(document).ready(() => {
         } else {
             $(this).val(change[val_name]);
         }
+    });
+
+    $('#project-table select').change(function () {
+        const val_name = $(this).attr('data-name');
+        let val = _.trim($(this).val()) !== '' ? _.trim($(this).val()) : null;
+        if(change[val_name] !== val) {
+            const _self = $(this);
+            postData(preUrl + '/save', { name: val_name, val}, function (result) {
+                change[val_name] = val;
+                _self.val(change[val_name]);
+            }, function () {
+                _self.val(change[val_name]);
+            })
+        } else {
+            $(this).val(change[val_name]);
+        }
     })
 });
 

+ 2 - 0
app/service/change_apply.js

@@ -16,6 +16,7 @@ const wxConst = require('../const/wechat_template');
 const pushType = require('../const/audit').pushType;
 const projectLogConst = require('../const/project_log');
 const codeRuleConst = require('../const/code_rule');
+const changeConst = require('../const/change');
 
 module.exports = app => {
     class ChangeApply extends app.BaseService {
@@ -52,6 +53,7 @@ module.exports = app => {
                     code,
                     project_code,
                     name,
+                    quality: changeConst.quality.common.name,
                 };
                 const operate = await this.transaction.insert(this.tableName, change);
 

+ 2 - 0
app/service/change_project.js

@@ -16,6 +16,7 @@ const wxConst = require('../const/wechat_template');
 const pushType = require('../const/audit').pushType;
 const projectLogConst = require('../const/project_log');
 const codeRuleConst = require('../const/code_rule');
+const changeConst = require('../const/change');
 
 module.exports = app => {
     class ChangeProject extends app.BaseService {
@@ -53,6 +54,7 @@ module.exports = app => {
                     in_time: new Date(),
                     code,
                     name,
+                    quality: changeConst.quality.common.name,
                 };
                 const operate = await this.transaction.insert(this.tableName, change);
 

+ 5 - 5
app/view/change/apply.ejs

@@ -66,19 +66,19 @@
                 <table class="table table-bordered">
                     <thead>
                     <tr>
-                        <th width="15%" id="sort_change">变更申请编号</th><th width="20%">变更工程名称</th><th width="5%">创建人</th>
-                        <th width="10%">创建时间</th><th width="5%">状态</th><th width="15%">立项编号</th>
-                        <th width="10%">变更通知书</th><th width="10%">通知书发出人</th><th width="10%">操作</th>
+                        <th width="15%" id="sort_change">变更申请编号</th><th width="20%">变更工程名称</th>
+                        <th width="10%">创建时间</th><th width="15%">变更立项书</th><th width="15%">变更通知书</th>
+                        <th width="10%">通知书发出人</th><th width="5%">审批状态</th><th width="10%">操作</th>
                     </tr>
                     </thead>
                     <tbody id="changeList">
                     <% for (const c of changes) { %>
                         <tr><td><a href="/tender/<%- tender.id %>/change/apply/<%- c.id %>/information"><%- c.code %></a></td><td><%- c.name %></td>
-                            <td><%- apply_username %></td><td><%- ctx.helper.formatFullDate(c.in_time) %></td>
-                            <td><span class="<%- auditConst.statusClass[c.status] %>"><%- auditConst.statusString[c.status] %></span></td>
+                            <td><%- ctx.helper.formatFullDate(c.in_time) %></td>
                             <td><%- c.project_code %></td>
                             <td><% if (c.notice_code) { %><a href="/tender/<%- tender.id %>/change/apply/<%- c.id %>/information/notice"><%- c.notice_code %></a><% } %></td>
                             <td><%- c.account_name %></td>
+                            <td><span class="<%- auditConst.statusClass[c.status] %>"><%- auditConst.statusString[c.status] %></span></td>
                             <td>
                                 <% if ((c.status === auditConst.status.uncheck || c.status === auditConst.status.checkNo) && c.uid === ctx.session.sessionUser.accountId) { %>
                                     <a href="/tender/<%- tender.id %>/change/apply/<%- c.id %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>

+ 12 - 3
app/view/change/apply_information.ejs

@@ -65,7 +65,7 @@
                             <td><input class="form-control form-control-sm" value="<%- change.c_new_code %>" data-name="c_new_code" <% if (change.readOnly) { %>readonly<% } %> type="text" placeholder=""></td>
                         </tr>
                         <tr>
-                            <th width="" class="text-center" style="vertical-align: middle">变更意向编号</th>
+                            <th width="" class="text-center" style="vertical-align: middle">变更立项编号</th>
                             <td><input class="form-control form-control-sm" value="<%- change.project_code %>" data-name="project_code" <% if (change.readOnly) { %>readonly<% } %> type="text" placeholder="自动读取,没有就为空,可编辑"></td>
                             <th width="" class="text-center" style="vertical-align: middle">原工程造价(元)</th>
                             <td><input class="form-control form-control-sm" type="text" value="<%- change.org_price %>" data-name="org_price" <% if (change.readOnly) { %>readonly<% } %> placeholder=""></td>
@@ -78,7 +78,16 @@
                         </tr>
                         <tr>
                             <th width="" class="text-center" style="vertical-align: middle">工程变更性质</th>
-                            <td><input class="form-control form-control-sm" type="text" value="<%- change.quality %>" data-name="quality" <% if (change.readOnly) { %>readonly<% } %> placeholder=""></td>
+                            <% if (change.readOnly) { %>
+                            <td><input class="form-control form-control-sm" type="text" value="<%- change.quality %>" data-name="quality" readonly placeholder=""></td>
+                            <% } else { %>
+                            <td><select class="form-control form-control-sm" name="quality" data-name="quality" <% if (change.readOnly) { %>readonly<% } %>>
+                                <% for (const q in changeConst.quality) { %>
+                                    <% const cQuality = changeConst.quality[q] %>
+                                    <option <% if (cQuality.name === change.quality) { %> selected<% } %>><%- cQuality.name %></option>
+                                <% } %>
+                            </select></td>
+                            <% } %>
                             <th width="" class="text-center" style="vertical-align: middle">工程造价增减(元)</th>
                             <td><input class="form-control form-control-sm" type="text" value="<%- change.crease_price %>" data-name="crease_price" <% if (change.readOnly) { %>readonly<% } %> placeholder=""></td>
                         </tr>
@@ -95,7 +104,7 @@
                             <td colspan="3"><textarea class="form-control form-control-sm" data-name="site_content" <% if (change.readOnly) { %>readonly<% } %> rows="3"><%- change.site_content %></textarea></td>
                         </tr>
                         <tr>
-                            <th width="" class="text-center" style="vertical-align: middle">内容摘要</th>
+                            <th width="" class="text-center" style="vertical-align: middle">变更内容</th>
                             <td colspan="3"><textarea class="form-control form-control-sm" data-name="content" <% if (change.readOnly) { %>readonly<% } %> rows="3"><%- change.content %></textarea></td>
                         </tr>
                     </table>

+ 2 - 2
app/view/change/apply_information_modal.ejs

@@ -397,7 +397,7 @@
                                                                             <% if (auditors[auditors.length - 1].aid === auditor.aid) { %>
                                                                                 <!--终审填写批复编号-->
                                                                                 <div class="form-group mt-3">
-                                                                                    <label><b class="text-danger">*&nbsp;</b>变更通知书</label>
+                                                                                    <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>
@@ -458,7 +458,7 @@
                                                                             <% if (auditors[auditors.length - 1].aid === auditor.aid) { %>
                                                                             <!--终审填写批复编号-->
                                                                             <div class="form-group mt-3">
-                                                                                <label><b class="text-danger">*&nbsp;</b>变更通知书</label>
+                                                                                <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>

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

@@ -31,8 +31,8 @@
                         <tr>
                             <th width="120" class="text-center" style="vertical-align: middle">变更工程名称</th>
                             <td><input class="form-control form-control-sm" value="<%- change.name %>" data-name="name" <% if (change.readOnly) { %>readonly<% } %> type="text" placeholder=""></td>
-                            <th width="140" class="text-center" style="vertical-align: middle">编号</th>
-                            <td><input class="form-control form-control-sm" type="text" value="<%- ctx.tender.info.deal_info.dealCode %>" data-name="peg" <% if (change.readOnly) { %>readonly<% } %> placeholder=""></td>
+                            <th width="140" class="text-center" style="vertical-align: middle">变更通知书编号</th>
+                            <td><input class="form-control form-control-sm" type="text" value="<%- change.notice_code %>" data-name="peg" <% if (change.readOnly) { %>readonly<% } %> placeholder=""></td>
                         </tr>
                         <tr>
                             <th width="" class="text-center" style="vertical-align: middle">承包人</th>

+ 6 - 6
app/view/change/information.ejs

@@ -155,7 +155,7 @@
                                     <textarea class="form-control form-control-sm" name="memo" rows="3"><%- ctx.helper.replaceStr(change.memo, /<br><br>/g, '\r\n') %></textarea>
                                 </div>
                                 <div class="form-group">
-                                    <label>变更类型</label>
+                                    <label>工程变更类型</label>
                                     <div class="checkbox">
                                         <% const changeType = change.type !== null && change.type !== '' ? change.type.split(',') : '' %>
                                         <% for (const t in changeConst.type) { %>
@@ -168,7 +168,7 @@
                                     </div>
                                 </div>
                                 <div class="form-group">
-                                    <label>变更类别 </label>
+                                    <label>工程变更类别 </label>
                                     <select class="form-control form-control-sm" name="class">
                                         <% for (const c in changeConst.class) { %>
                                             <% const cClass = changeConst.class[c] %>
@@ -177,7 +177,7 @@
                                     </select>
                                 </div>
                                 <div class="form-group">
-                                    <label>变更性质 </label>
+                                    <label>工程变更性质 </label>
                                     <select class="form-control form-control-sm" name="quality">
                                         <% for (const q in changeConst.quality) { %>
                                             <% const cQuality = changeConst.quality[q] %>
@@ -263,7 +263,7 @@
                                     <textarea class="form-control form-control-sm" rows="3" readonly><%- ctx.helper.replaceStr(change.memo, /<br><br>/g, '\r\n') %></textarea>
                                 </div>
                                 <div class="form-group">
-                                    <label>变更类型</label>
+                                    <label>工程变更类型</label>
                                     <div class="checkbox">
                                         <% const changeType = change.type !== null && change.type !== '' ? change.type.split(',') : '' %>
                                         <% for (const t in changeConst.type) { %>
@@ -277,7 +277,7 @@
                                     </div>
                                 </div>
                                 <div class="form-group">
-                                    <label>变更类别 </label>
+                                    <label>工程变更类别 </label>
                                     <select class="form-control form-control-sm" disabled>
                                         <% for (const c in changeConst.class) { %>
                                             <% const cClass = changeConst.class[c] %>
@@ -288,7 +288,7 @@
                                     </select>
                                 </div>
                                 <div class="form-group">
-                                    <label>变更性质 </label>
+                                    <label>工程变更性质 </label>
                                     <select class="form-control form-control-sm" disabled>
                                         <% for (const q in changeConst.quality) { %>
                                             <% const cQuality = changeConst.quality[q] %>

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

@@ -68,7 +68,7 @@
                     <tr>
                         <th width="20%" id="sort_change">变更立项书编号</th><th width="30%">变更工程名称</th>
                         <th width="10%">发起人</th><th width="10%">发起类型</th><th width="10%">发起时间</th>
-                        <th width="10%">状态</th><th width="10%">操作</th>
+                        <th width="10%">审批状态</th><th width="10%">操作</th>
                     </tr>
                     </thead>
                     <tbody id="changeList">

+ 11 - 2
app/view/change/project_information.ejs

@@ -68,7 +68,16 @@
                             <th width="120" class="text-center" style="vertical-align: middle">工程变更类别</th>
                             <td><input class="form-control form-control-sm" type="text" value="<%- change.class %>" data-name="class" <% if (change.readOnly) { %>readonly<% } %> placeholder=""></td>
                             <th width="120" class="text-center" style="vertical-align: middle">工程变更性质</th>
-                            <td><input class="form-control form-control-sm" type="text" value="<%- change.quality %>" data-name="quality" <% if (change.readOnly) { %>readonly<% } %> placeholder=""></td>
+                            <% if (change.readOnly) { %>
+                            <td><input class="form-control form-control-sm" type="text" value="<%- change.quality %>" data-name="quality" readonly placeholder=""></td>
+                            <% } else { %>
+                            <td><select class="form-control form-control-sm" name="quality" data-name="quality" <% if (change.readOnly) { %>readonly<% } %>>
+                            <% for (const q in changeConst.quality) { %>
+                                <% const cQuality = changeConst.quality[q] %>
+                                <option <% if (cQuality.name === change.quality) { %> selected<% } %>><%- cQuality.name %></option>
+                            <% } %>
+                            </select></td>
+                            <% } %>
                         </tr>
                         <tr>
                             <th width="120" class="text-center" style="vertical-align: middle">原工程造价(元)</th>
@@ -85,7 +94,7 @@
                             <td colspan="3"><textarea class="form-control form-control-sm" data-name="reason" <% if (change.readOnly) { %>readonly<% } %> rows="3"><%- change.reason %></textarea></td>
                         </tr>
                         <tr>
-                            <th width="120" class="text-center" style="vertical-align: middle">内容摘要</th>
+                            <th width="120" class="text-center" style="vertical-align: middle">变更内容</th>
                             <td colspan="3"><textarea class="form-control form-control-sm" data-name="content" <% if (change.readOnly) { %>readonly<% } %> rows="3"><%- change.content %></textarea></td>
                         </tr>
                     </table>