Browse Source

日志更改状态

laiguoran 2 years ago
parent
commit
1f5c9e8ad6

+ 6 - 0
app/controller/construction_controller.js

@@ -345,6 +345,12 @@ module.exports = app => {
                         if (!logInfo.shenpi_uid) throw '请选择审签人再提交';
                         responseData.data = await ctx.service.constructionLog.start(logInfo.id);
                         break;
+                    case 'checkNo':
+                        if (logInfo.report_uid !== ctx.session.sessionUser.accountId) {
+                            throw '非当前填报人无法提交日志';
+                        }
+                        responseData.data = await ctx.service.constructionLog.checkNo(logInfo.id);
+                        break;
                     default: throw '参数有误';
                 }
                 ctx.body = responseData;

+ 17 - 12
app/public/js/construction_info.js

@@ -110,9 +110,9 @@ $(function () {
         });
     });
 
-    $('#start-btn').click(function () {
+    $('body').on('click', '#start-btn', function () {
         // 判断是否已选择审签人,有则提交
-        const username = $('#show-shenpi span').text();
+        const username = $('#show-shenpi span').text() || $('#show-shenpi-input').val();
         if (username == '') {
             toastr.error('请选择审签人再提交');
             return false;
@@ -123,18 +123,23 @@ $(function () {
     });
 
     $('#edit-start').click(function () {
-       $('#edit-end').show();
-       $('#edit-start').hide();
-       $('.edit-input').removeAttr('readonly');
-       $('.edit-textarea').removeAttr('readonly');
+        // $('#edit-end').show();
+        $('#edit-start').hide();
+        $('.edit-input').removeAttr('readonly');
+        $('.edit-textarea').removeAttr('readonly');
+        $(this).siblings('span').hide();
+        $(this).parents('.title-main').append('<a href="javascript:void(0);" id="start-btn" class="btn btn-sm btn-primary pull-right mr-2">提交审签</a>');
+        postData('/construction/' + tender_id + '/log/' + log_id + '/save', { type: 'checkNo' }, function (result) {
+            // window.location.reload();
+        });
     });
 
-    $('#edit-end').click(function () {
-        $('#edit-start').show();
-        $('#edit-end').hide();
-        $('.edit-input').attr('readonly', true);
-        $('.edit-textarea').attr('readonly', true);
-    });
+    // $('#edit-end').click(function () {
+    //     $('#edit-start').show();
+    //     $('#edit-end').hide();
+    //     $('.edit-input').attr('readonly', true);
+    //     $('.edit-textarea').attr('readonly', true);
+    // });
 
     $('#check-btn').click(function () {
         postData('/construction/' + tender_id + '/log/' + log_id + '/save', { type: 'checked' }, function (result) {

+ 4 - 0
app/service/construction_log.js

@@ -143,6 +143,10 @@ module.exports = app => {
             return await this.db.update(this.tableName, { id, status: constructionConst.status.checked, checked_time: new Date() });
         }
 
+        async checkNo(id) {
+            return await this.db.update(this.tableName, { id, status: constructionConst.status.uncheck });
+        }
+
         async deleteLog(id) {
             const transaction = await this.db.beginTransaction();
             try {

+ 3 - 3
app/view/construction/info.ejs

@@ -15,7 +15,7 @@
                 <!-- 提交审签后,可再次编辑,提供取消按钮 -->
                 <% if (logInfo.report_uid === ctx.session.sessionUser.accountId && logInfo.status === constructionConst.status.checking) { %>
                 <span class=" pull-right mr-2">|</span>
-                <a href="javascript:void(0);" id="edit-end" class="btn btn-sm btn-secondary pull-right mr-2" style="display: none">取消</a>
+                <!--<a href="javascript:void(0);" id="edit-end" class="btn btn-sm btn-secondary pull-right mr-2" style="display: none">取消</a>-->
                 <a href="javascript:void(0);" id="edit-start" data-target="#" class="btn btn-sm btn-outline-primary pull-right mr-2">编辑</a>
                 <% } %>
             </div>
@@ -58,7 +58,7 @@
                                 </div>
                                 <div class="col-6 form-group row mb-2">
                                     <label class="col-form-label col-2  text-right px-0">审签人:</label>
-                                    <% if (logInfo.status === constructionConst.status.uncheck && logInfo.report_uid === ctx.session.sessionUser.accountId) { %>
+                                    <% if (logInfo.status === constructionConst.status.uncheck && logInfo.report_uid === ctx.session.sessionUser.accountId && logInfo.start_time === null) { %>
                                         <div class="dropdown text-right align-middle pt-1" id="show-shenpi-btn" <% if (logInfo.shenpi_uid) { %>style="display: none" <% } %>>
                                             <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                 选择审批人
@@ -89,7 +89,7 @@
                                             <label class="col-form-label"><span><%- logInfo.shenpi_username %></span><i class="fa fa-remove text-danger px-1 remove-shenpi-btn" style="cursor: pointer"></i></label>
                                         </div>
                                     <% } else { %>
-                                    <input type="text" class="form-control form-control-sm col" value="<%- logInfo.shenpi_username %>" readonly>
+                                    <input type="text" id="show-shenpi-input" class="form-control form-control-sm col" value="<%- logInfo.shenpi_username %>" readonly>
                                     <% } %>
                                 </div>
                             </div>