瀏覽代碼

feat: 计量台账审批流程增加选择退回流程、未选择红色提示功能

lanjianrong 5 年之前
父節點
當前提交
9f7e3c7ea5

+ 3 - 2
app/controller/stage_controller.js

@@ -1011,7 +1011,7 @@ module.exports = app => {
                     throw '您无权进行该操作';
                 }
                 const data = JSON.parse(ctx.request.body.data);
-                // data.checkType = parseInt(data.checkType);
+                data.checkType = parseInt(data.checkType);
                 // const data = {
                 //     checkType: parseInt(ctx.request.body.checkType),
                 //     opinion: ctx.request.body.opinion,
@@ -1027,7 +1027,8 @@ module.exports = app => {
 
                 await ctx.service.stageAudit.check(ctx.stage.id, data, ctx.stage.times);
 
-                ctx.body = { err: 0, msg: '', data: [] };// ctx.redirect(ctx.request.header.referer);
+                ctx.body = { err: 0, msg: '', data: [] };
+                // ctx.redirect(ctx.request.header.referer);
             } catch (err) {
                 // console.log(err);
                 this.log(err);

+ 2 - 3
app/public/js/material_audit.js

@@ -172,8 +172,7 @@ function auditCheck(i) {
             $('#reject-process').prepend('<p id="warning-text" style="color: red; margin: 0;">请选择退回流程</p>');
         }
         return false;
-    } else {
-        if ($('#warning-text').length) $('#warning-text').remove()
-        return true;
     }
+    if ($('#warning-text').length) $('#warning-text').remove()
+    return true;
 }

+ 9 - 2
app/public/js/stage_audit.js

@@ -164,7 +164,14 @@ function checkAuditorFrom () {
 }
 // texterea换行
 function auditCheck(i) {
-    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);
+    const inlineRadio1 = $('#inlineRadio1:checked').val()
+    const inlineRadio2 = $('#inlineRadio2:checked').val()
+    if (!inlineRadio1 && !inlineRadio2) {
+        if (!$('#warning-text').length) {
+            $('#reject-process').prepend('<p id="warning-text" style="color: red; margin: 0;">请选择退回流程</p>');
+        }
+        return false;
+    }
+    if ($('#warning-text').length) $('#warning-text').remove()
     return true;
 }

+ 1 - 1
app/view/measure/audit_modal.ejs

@@ -106,4 +106,4 @@
         </div>
     </div>
 </div>
-<% } %>
+<% } %>

+ 18 - 8
app/view/stage/audit_modal.ejs

@@ -238,7 +238,7 @@
         <!--审批退回-->
         <div class="modal fade" id="sp-back" data-backdrop="static">
             <div class="modal-dialog modal-lg" role="document">
-                <form class="modal-content modal-lg" action="<%- preUrl %>/audit/check" method="post" id="audit-check1">
+                <form class="modal-content modal-lg" action="<%- preUrl %>/audit/check" method="post" id="audit-check1" >
                     <div class="modal-header">
                         <h5 class="modal-title">审批退回</h5>
                     </div>
@@ -380,15 +380,17 @@
                                                         <label>审批意见<b class="text-danger">*</b></label>
                                                         <textarea class="form-control form-control-sm" name="opinion">不同意</textarea>
                                                     </div>
-                                                    <div class="alert alert-warning">
+                                                    <div id="reject-process" class="alert alert-warning">
                                                         <div class="form-check form-check-inline">
-                                                            <input class="form-check-input" type="radio" name="checkType" id="inlineRadio1" value="<%- auditConst.status.checkNo %>" <% if (auditors[iA].order === 1 || auditors[iA].aid === auditors[0].aid) { %>checked<% } %>>
+                                                            <!-- <input class="form-check-input" type="radio" name="checkType" id="inlineRadio1" value="<%- auditConst.status.checkNo %>" <% if (auditors[iA].order === 1 || auditors[iA].aid === auditors[0].aid) { %>checked<% } %>> -->
+                                                            <input class="form-check-input" type="radio" name="checkType" id="inlineRadio1" value="<%- auditConst.status.checkNo %>">
                                                             <label class="form-check-label" for="inlineRadio1">退回原报 <%- ctx.stage.user.name %></label>
                                                         </div>
                                                         <% if (auditors[iA].order > 1 && auditors[iA].aid !== auditors[0].aid) { %>
                                                             <% const auditorIndex = ctx.stage.auditors2.findIndex(function (item) { return item.aid === auditors[iA].aid }) %>
                                                             <div class="form-check form-check-inline">
-                                                                <input class="form-check-input" type="radio" name="checkType" id="inlineRadio2" value="<%- auditConst.status.checkNoPre %>" checked>
+                                                                <input class="form-check-input" type="radio" name="checkType" id="inlineRadio2" value="<%- auditConst.status.checkNoPre %>">
+                                                                <!-- <input class="form-check-input" type="radio" name="checkType" id="inlineRadio2" value="<%- auditConst.status.checkNoPre %>" checked> -->
                                                                 <label class="form-check-label" for="inlineRadio2">退回上一审批人 <%- ctx.stage.auditors2[auditorIndex-1].name %></label>
                                                             </div>
                                                         <% } %>
@@ -1530,16 +1532,24 @@
     });
     <% } %>
     $('#audit-check1').submit(function (e) {
-        $(this).parent().parent().modal('hide');
+        // $(this).parent().parent().modal('hide');
         const data = {
             opinion: $('[name=opinion]', this).val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' '),
             checkType: parseInt($('[name=checkType]:checked', this).val()),
         };
-        postData(this.action, data, function () {
+        if (!parseInt($('[name=checkType]:checked', this).val())) {
+            if (!$('#warning-text').length) {
+                $('#reject-process').prepend('<p id="warning-text" style="color: red; margin: 0;">请选择退回流程</p>');
+            }
+            return false;
+        } else {
+            postData(this.action, data, function () {
             window.location.reload();
         });
-        $('#hide-all').hide();
-        return false;
+        }
+        return false
+        // if ($('#warning-text').length) $('#warning-text').remove()
+
     });
     $('#audit-check3').submit(function (e) {
         $(this).parent().parent().modal('hide');