Browse Source

修复首页bug和重新上报bug

laiguoran 6 năm trước cách đây
mục cha
commit
17906f5e9f

+ 4 - 0
app/public/js/ledger.js

@@ -1427,5 +1427,9 @@ $(document).ready(function() {
         $('#upload-ledger-file').val('');
         $('#upload-ledger-sheets').html('');
     });
+
+    $('#hideSp').click(function () {
+        $('#sp-list2').modal('hide');
+    });
 });
 

+ 1 - 1
app/service/ledger_audit.js

@@ -273,7 +273,7 @@ module.exports = app => {
         async getAuditTender(auditorId) {
             const sql = 'SELECT la.`audit_id`, la.`times`, la.`audit_order`, la.`begin_time`, la.`end_time`, t.`id`, t.`name`, t.`project_id`, t.`type`, t.`user_id`, t.`ledger_status` ' +
                 'FROM ?? AS la, ?? AS t ' +
-                'WHERE (la.`audit_id` = ? and la.`status` = ?) OR (t.`user_id` = ? and t.`ledger_status` = ? and la.`status` = ? and la.`times` = (t.`ledger_times`-1))' +
+                'WHERE ((la.`audit_id` = ? and la.`status` = ?) OR (t.`user_id` = ? and t.`ledger_status` = ? and la.`status` = ? and la.`times` = (t.`ledger_times`-1)))' +
                 '    and la.`tender_id` = t.`id`';
             const sqlParam = [this.tableName, this.ctx.service.tender.tableName, auditorId, auditConst.status.checking, auditorId, auditConst.status.checkNo, auditConst.status.checkNo];
             return await this.db.query(sql, sqlParam);

+ 1 - 1
app/service/stage_audit.js

@@ -310,7 +310,7 @@ module.exports = app => {
                         '    s.`order` As `sorder`, s.`status` As `sstatus`,' +
                         '    t.`name`, t.`project_id`, t.`type`, t.`user_id` ' +
                         '  FROM ?? AS sa, ?? AS s, ?? As t ' +
-                        '  WHERE (sa.`aid` = ? and sa.`status` = ?) OR (s.`user_id` = ? and sa.`status` = ? and s.`status` = ? and sa.`times` = s.`times`)' +
+                        '  WHERE ((sa.`aid` = ? and sa.`status` = ?) OR (s.`user_id` = ? and sa.`status` = ? and s.`status` = ? and sa.`times` = s.`times`))' +
                         '    and sa.`sid` = s.`id` and sa.`tid` = t.`id`';
             const sqlParam = [this.tableName, this.ctx.service.stage.tableName, this.ctx.service.tender.tableName, auditorId, auditConst.status.checking, auditorId, auditConst.status.checkNo, auditConst.status.checkNo];
             return await this.db.query(sql, sqlParam);

+ 1 - 1
app/view/ledger/explode.ejs

@@ -44,7 +44,7 @@
                     <% if (tender.ledger_status === auditConst.status.uncheck) { %>
                         <a href="#sub-sp" data-toggle="modal" data-target="#sub-sp" class="btn btn-primary btn-sm pull-right">上报审批</a>
                     <% } else if (tender.ledger_status === auditConst.status.checkNo) { %>
-                        <a href="#sub-sp" data-toggle="modal" data-target="#sub-sp2" class="btn btn-primary btn-sm pull-right">重新上报</a>
+                        <a href="#sp-list2" data-toggle="modal" data-target="#sp-list2" class="btn btn-primary btn-sm pull-right">重新上报</a>
                     <% } %>
                 <% } %>
             </div>

+ 135 - 20
app/view/ledger/explode_modal.ejs

@@ -78,7 +78,7 @@
         </div>
     </div>
 </div>
-<% if (tender.ledger_status === auditConst.status.uncheck) { %>
+<% if (tender.ledger_status === auditConst.status.uncheck || tender.ledger_status === auditConst.status.checkNo) { %>
 <!--上报审批-->
 <div class="modal fade" id="sub-sp" data-backdrop="static">
     <div class="modal-dialog" role="document">
@@ -87,25 +87,6 @@
                 <h5 class="modal-title">上报审批</h5>
             </div>
             <div class="modal-body">
-                <!--<div class="form-group">-->
-                    <!--<label>搜索审批人</label>-->
-                    <!--<div class="input-group">-->
-                        <!--<input class="form-control" placeholder="请输入姓名进行检索" type="text" id="searchName">-->
-                        <!--<div class="input-group-append">-->
-                            <!--<button class="btn btn-outline-secondary" type="button" id="searchAccount"><i class="fa fa-search"></i></button>-->
-                        <!--</div>-->
-                    <!--</div>-->
-                <!--</div>-->
-                <!--<div class="card border-primary" id="searchResult" style="display: none">-->
-                    <!--<div class="card-body">-->
-                        <!--<h5 class="card-title">-->
-                            <!--<a href="javascript: void(0)" class="btn btn-primary btn-sm pull-right" id="addAuditor">添加</a>-->
-                            <!--<span>张三</span>-->
-                        <!--</h5>-->
-                        <!--<h6 class="card-subtitle mb-2 text-muted">监理</h6>-->
-                        <!--<p class="card-text">XXXXX公司</p>-->
-                    <!--</div>-->
-                <!--</div>-->
                 <div class="form-group">
                     <label>选择审批人</label>
                     <div class="input-group">
@@ -150,6 +131,140 @@
 </div>
 <% } %>
 <% if (tender.ledger_status === auditConst.status.checkNo) { %>
+<!--审批流程/结果-->
+<div class="modal fade" id="sp-list2" data-backdrop="static">
+    <div class="modal-dialog modal-lg" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">重新上报</h5>
+            </div>
+            <div class="modal-body">
+                <div class="row">
+                    <div class="col-4">
+                        <a href="#sub-sp" data-toggle="modal" data-target="#sub-sp" id="hideSp">修改审批流程</a>
+                        <div class="card mt-3">
+                            <ul class="list-group list-group-flush">
+                                <li class="list-group-item">
+                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- user.name %>  <small class="text-muted"><%- user.role %></small>
+                                </li>
+                                <% for (let i = 0; i < auditors.length; i++) { %>
+                                    <li class="list-group-item">
+                                        <% if (i < auditors.length - 1) { %>
+                                            <i class="fa fa-chevron-circle-down"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small>
+                                        <% } else {%>
+                                            <i class="fa fa fa-stop-circle"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small>
+                                        <% } %>
+                                    </li>
+                                <% } %>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="col-8 modal-height-500" style="overflow: auto">
+                        <% for (const ah of auditHistory) { %>
+                            <div class="card mt-3">
+                                <ul class="list-group list-group-flush">
+                                    <% for (let iA = 0; iA < ah.length; iA++) { %>
+                                        <% if (iA === 0) { %>
+                                            <li class="list-group-item">
+                                                <span class="text-success pull-right"><% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
+                                                <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
+                                                <p class="card-text"><small class="text-muted"><%- ah[iA].begin_time.toLocaleDateString() %></small></p>
+                                            </li>
+                                            <li class="list-group-item">
+                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
+                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %> pull-right"><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
+                                                <% } %>
+                                                <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
+                                                <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
+                                                    <p class="card-text mb-1"><%- ah[iA].opinion %></p>
+                                                    <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
+                                                <% } %>
+                                            </li>
+                                        <% } else if (iA === ah.length - 1) { %>
+                                            <li class="list-group-item">
+                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
+                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %> pull-right"><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
+                                                <% } %>
+                                                <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
+                                                <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
+                                                    <p class="card-text mb-1"><%- ah[iA].opinion %></p>
+                                                    <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
+                                                <% } %>
+                                            </li>
+                                        <% } else { %>
+                                            <li class="list-group-item">
+                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
+                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %> pull-right"><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
+                                                <% } %>
+                                                <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small></h5>
+                                                <% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %>
+                                                    <p class="card-text mb-1"><%- ah[iA].opinion %></p>
+                                                    <p class="card-text"><small class="text-muted"><%- ah[iA].end_time.toLocaleDateString() %></small></p>
+                                                <% } %>
+                                            </li>
+                                        <% } %>
+                                    <% } %>
+                                </ul>
+                            </div>
+                        <% } %>
+                        <% if (tender.ledger_status === auditConst.status.checking || tender.ledger_status === auditConst.status.checked) {%>
+                            <div class="card mt-3">
+                                <ul class="list-group list-group-flush">
+                                    <% for (let iA = 0; iA < auditors.length; iA++) { %>
+                                        <% if (iA === 0) { %>
+                                            <li class="list-group-item">
+                                                <span class="text-success pull-right"><% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
+                                                <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small></h5>
+                                                <p class="card-text"><small class="text-muted"><%- auditors[iA].begin_time.toLocaleDateString() %></small></p>
+                                            </li>
+                                            <li class="list-group-item">
+                                                <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
+                                                    <span class="<%- auditConst.statusClass[auditors[iA].status] %> pull-right"><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
+                                                <% } %>
+                                                <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
+                                                <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
+                                                    <p class="card-text mb-1"><%- auditors[iA].opinion %></p>
+                                                    <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
+                                                <% } %>
+                                            </li>
+                                        <% } else if (iA === auditors.length - 1) { %>
+                                            <li class="list-group-item">
+                                                <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
+                                                    <span class="<%- auditConst.statusClass[auditors[iA].status] %> pull-right"><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
+                                                <% } %>
+                                                <h5 class="card-title"><i class="fa fa-stop-circle <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
+                                                <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
+                                                    <p class="card-text mb-1"><%- auditors[iA].opinion %></p>
+                                                    <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
+                                                <% } %>
+                                            </li>
+                                        <% } else { %>
+                                            <li class="list-group-item">
+                                                <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
+                                                    <span class="<%- auditConst.statusClass[auditors[iA].status] %> pull-right"><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
+                                                <% } %>
+                                                <h5 class="card-title"><i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
+                                                <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %>
+                                                    <p class="card-text mb-1"><%- auditors[iA].opinion %></p>
+                                                    <p class="card-text"><small class="text-muted"><%- auditors[iA].end_time.toLocaleDateString() %></small></p>
+                                                <% } %>
+                                            </li>
+                                        <% } %>
+                                    <% } %>
+                                </ul>
+                            </div>
+                        <% } %>
+                    </div>
+                </div>
+            </div>
+            <form class="modal-footer" action="/tender/<%- tender.id %>/ledger/audit/start" method="post">
+                <button type="submit" class="btn btn-primary">确认上报</button>
+                <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
+            </form>
+        </div>
+    </div>
+</div>
 <!--重新审批-->
 <div class="modal fade" id="sub-sp2" data-backdrop="static">
     <div class="modal-dialog" role="document">