فهرست منبع

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 1 سال پیش
والد
کامیت
251c1fca55

+ 1 - 0
app/controller/revise_controller.js

@@ -513,6 +513,7 @@ module.exports = app => {
                     user,
                     user,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.revise.history),
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.revise.history),
                     nodeType: stdConst.nodeType,
                     nodeType: stdConst.nodeType,
+                    settleStatus: ctx.service.settle.settleStatus,
                 };
                 };
                 await this.layout('revise/history.ejs', renderData, 'revise/history_modal.ejs');
                 await this.layout('revise/history.ejs', renderData, 'revise/history_modal.ejs');
             } catch (err) {
             } catch (err) {

+ 1 - 1
app/public/js/change_information_show.js

@@ -230,7 +230,7 @@ $(document).ready(() => {
                 if (response.err === 0) {
                 if (response.err === 0) {
                     codeSuccess(btn);
                     codeSuccess(btn);
                     $("input[name='code']").removeAttr('readonly');
                     $("input[name='code']").removeAttr('readonly');
-                    // $("#re-shenpi-btn").removeAttr('disabled');
+                    $("#re-shenpi-btn").removeAttr('disabled');
                     $("#re-shenpi-btn2").removeAttr('disabled');
                     $("#re-shenpi-btn2").removeAttr('disabled');
                 } else {
                 } else {
                     toast(response.msg, 'error');
                     toast(response.msg, 'error');

+ 3 - 1
app/service/change.js

@@ -1896,7 +1896,9 @@ module.exports = app => {
                     const preAudit = onAuditor.usort >= 1 ? this._.find(auditors, { usort: onAuditor.usort - 1 }) : false;
                     const preAudit = onAuditor.usort >= 1 ? this._.find(auditors, { usort: onAuditor.usort - 1 }) : false;
                     const preAid = preAudit ? (preAudit.status !== auditStatus.checkAgain ? preAudit.uid : false) : change.uid;
                     const preAid = preAudit ? (preAudit.status !== auditStatus.checkAgain ? preAudit.uid : false) : change.uid;
                     // console.log(onAuditor, preAid);
                     // console.log(onAuditor, preAid);
-                    if (onAuditor.uid === preAid && preAudit.status === auditStatus.checkCancel) {
+                    if (!preAudit) {
+                        return;// 应对于管理员修改审批流把退回人删除,不存在上一审批人,不可撤回
+                    } else if (onAuditor.uid === preAid && preAudit.status === auditStatus.checkCancel) {
                         return;// 不可以多次撤回
                         return;// 不可以多次撤回
                     } else if (preAid === accountId && (preAid !== change.uid || (preAid === change.uid && preAudit.usite !== 0))) {
                     } else if (preAid === accountId && (preAid !== change.uid || (preAid === change.uid && preAudit.usite !== 0))) {
                         if (preAudit.status === auditStatus.checked) {
                         if (preAudit.status === auditStatus.checked) {

+ 2 - 2
app/service/change_apply_audit.js

@@ -290,7 +290,7 @@ module.exports = app => {
                 await transaction.delete(this.ctx.service.changeApplyHistory.tableName, { caid: caId });
                 await transaction.delete(this.ctx.service.changeApplyHistory.tableName, { caid: caId });
                 // todo 更新标段tender状态 ?
                 // todo 更新标段tender状态 ?
                 //  检查三方特殊推送
                 //  检查三方特殊推送
-                await this.ctx.service.specMsg.addChangeApplyMsg(transaction, pid, this.ctx.change, pushOperate.change_apply.flow);
+                await this.ctx.service.specMsg.addChangeApplyMsg(transaction, this.ctx.session.sessionProject.id, this.ctx.change, pushOperate.change_apply.flow);
                 await transaction.commit();
                 await transaction.commit();
             } catch (err) {
             } catch (err) {
                 await transaction.rollback();
                 await transaction.rollback();
@@ -956,7 +956,7 @@ module.exports = app => {
                     decimal: null,
                     decimal: null,
                 });
                 });
                 //  检查三方特殊推送
                 //  检查三方特殊推送
-                await this.ctx.service.specMsg.addChangeApplyMsg(transaction, pid, this.ctx.change, pushOperate.change_apply.flow);
+                await this.ctx.service.specMsg.addChangeApplyMsg(transaction, this.ctx.session.sessionProject.id, this.ctx.change, pushOperate.change_apply.flow);
                 await transaction.commit();
                 await transaction.commit();
                 result = true;
                 result = true;
             } catch (error) {
             } catch (error) {

+ 1 - 1
app/service/change_plan_audit.js

@@ -292,7 +292,7 @@ module.exports = app => {
                 };
                 };
                 await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
                 await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
                 //  检查三方特殊推送
                 //  检查三方特殊推送
-                await this.ctx.service.specMsg.addChangePlanMsg(transaction, pid, this.ctx.change, pushOperate.change_plan.flow);
+                await this.ctx.service.specMsg.addChangePlanMsg(transaction, this.ctx.session.sessionProject.id, this.ctx.change, pushOperate.change_plan.flow);
                 await transaction.delete(this.ctx.service.changePlanHistory.tableName, { cpid: cpId });
                 await transaction.delete(this.ctx.service.changePlanHistory.tableName, { cpid: cpId });
                 // todo 更新标段tender状态 ?
                 // todo 更新标段tender状态 ?
                 await transaction.commit();
                 await transaction.commit();

+ 1 - 1
app/service/change_project_audit.js

@@ -292,7 +292,7 @@ module.exports = app => {
                 await transaction.delete(this.ctx.service.changeProjectHistory.tableName, { cpid: cpId });
                 await transaction.delete(this.ctx.service.changeProjectHistory.tableName, { cpid: cpId });
                 // todo 更新标段tender状态 ?
                 // todo 更新标段tender状态 ?
                 //  检查三方特殊推送
                 //  检查三方特殊推送
-                await this.ctx.service.specMsg.addChangeProjectMsg(transaction, pid, this.ctx.change, pushOperate.change_project.flow);
+                await this.ctx.service.specMsg.addChangeProjectMsg(transaction, this.ctx.session.sessionProject.id, this.ctx.change, pushOperate.change_project.flow);
                 await transaction.commit();
                 await transaction.commit();
             } catch (err) {
             } catch (err) {
                 await transaction.rollback();
                 await transaction.rollback();

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 948 - 948
app/service/project_account.js


+ 193 - 129
app/view/change/apply_information_modal.ejs

@@ -919,152 +919,216 @@
 <script>
 <script>
     const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
     const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
     const csrf = '<%= ctx.csrf %>';
     const csrf = '<%= ctx.csrf %>';
+    const authMobile = '<%= authMobile %>';
 </script>
 </script>
 <script>
 <script>
-    $('.sp-location-list').on('shown.bs.modal', function () {
-        const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
-        const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
-        scrollBox.scrollTop(0);
-        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
-        const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
-        if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
-            scrollBox.scrollTop(hdheight - bdiv);
-        }
-    });
-    function divSearch(div) {
-        if (div.length > 0) {
-            return true;
+    $(function () {
+        $('.sp-location-list').on('shown.bs.modal', function () {
+            const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
+            const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
+            scrollBox.scrollTop(0);
+            const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
+            const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
+            if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
+                scrollBox.scrollTop(hdheight - bdiv);
+            }
+        });
+        function divSearch(div) {
+            if (div.length > 0) {
+                return true;
+            }
+            return false;
         }
         }
-        return false;
-    }
 
 
-    // 展开历史审核记录
-    $('.modal-body #fold-btn').click(function () {
-        const type = $(this).data('target')
-        const auditCard = $(this).parent().parent()
-        if (type === 'show') {
-            $(this).data('target', 'hide')
-            auditCard.find('.fold-card').slideDown('swing', () => {
-                auditCard.find('#fold-btn').text('收起历史审核记录')
-            })
-        } else {
-            $(this).data('target', 'show')
-            auditCard.find('.fold-card').slideUp('swing', () => {
-                auditCard.find('#fold-btn').text('展开历史审核记录')
-            })
-        }
-    });
+        // 展开历史审核记录
+        $('.modal-body #fold-btn').click(function () {
+            const type = $(this).data('target')
+            const auditCard = $(this).parent().parent()
+            if (type === 'show') {
+                $(this).data('target', 'hide')
+                auditCard.find('.fold-card').slideDown('swing', () => {
+                    auditCard.find('#fold-btn').text('收起历史审核记录')
+                })
+            } else {
+                $(this).data('target', 'show')
+                auditCard.find('.fold-card').slideUp('swing', () => {
+                    auditCard.find('#fold-btn').text('展开历史审核记录')
+                })
+            }
+        });
 
 
-    $('.sp-list-btn').click(function () {
-        const type = $(this).data('type')
-        if (type === 'hide') {
-            $('.sp-list-item').hide()
-            $('.modal-title').text('审批流程')
-        } else {
-            $('.sp-list-item').show()
-            $('.modal-title').text('重新上报')
-        }
-    });
+        $('.sp-list-btn').click(function () {
+            const type = $(this).data('type')
+            if (type === 'hide') {
+                $('.sp-list-item').hide()
+                $('.modal-title').text('审批流程')
+            } else {
+                $('.sp-list-item').show()
+                $('.modal-title').text('重新上报')
+            }
+        });
 
 
-    $('#re-shenpi-btn').click(function () {
-        const data = {
-            caid: parseInt('<%- ctx.change.id %>'),
-        };
-        <% if (ctx.session.sessionUser.loginStatus === 0) { %>
-        const code = $("#againForm input[name='code']").val();
-        if ($(this).hasClass('disabled')) {
-            return false;
-        }
-        if (code.length < 6) {
-            // alert('请填写正确的验证码');
-            toastr.error('请填写正确的验证码');
-            return false;
-        }
-        data.code = code;
-        <% } %>
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/apply/check/again?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
+        $('#re-shenpi-btn').click(function () {
+            const data = {
+                caid: parseInt('<%- ctx.change.id %>'),
+            };
+            <% if (ctx.session.sessionUser.loginStatus === 0) { %>
+            const code = $("#againForm input[name='code']").val();
+            if ($(this).hasClass('disabled')) {
+                return false;
+            }
+            if (code.length < 6) {
+                // alert('请填写正确的验证码');
+                toastr.error('请填写正确的验证码');
+                return false;
+            }
+            data.code = code;
+            <% } %>
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/apply/check/again?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
                 }
                 }
+            });
+        })
+
+        $('#re-shenpi-btn2').click(function () {
+            const data = {
+                caid: parseInt('<%- ctx.change.id %>'),
+            };
+            <% if (ctx.session.sessionUser.loginStatus === 0) { %>
+            const code = $("#reviseForm input[name='code']").val();
+            if ($(this).hasClass('disabled')) {
+                return false;
             }
             }
+            if (code.length < 6) {
+                // alert('请填写正确的验证码');
+                toast('请填写正确的验证码', 'error');
+                return false;
+            }
+            data.code = code;
+            <% } %>
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/apply/check/revise?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
         });
         });
-    })
 
 
-    $('#re-shenpi-btn2').click(function () {
-        const data = {
-            caid: parseInt('<%- ctx.change.id %>'),
-        };
         <% if (ctx.session.sessionUser.loginStatus === 0) { %>
         <% if (ctx.session.sessionUser.loginStatus === 0) { %>
-        const code = $("#reviseForm input[name='code']").val();
-        if ($(this).hasClass('disabled')) {
-            return false;
-        }
-        if (code.length < 6) {
-            // alert('请填写正确的验证码');
-            toast('请填写正确的验证码', 'error');
-            return false;
-        }
-        data.code = code;
-        <% } %>
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/apply/check/revise?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
-                }
+        // 重新审批获取手机验证码
+        // 获取验证码
+        let isPosting = false;
+        $("#get-code").click(function() {
+            if (isPosting) {
+                return false;
             }
             }
+            const btn = $(this);
+
+            $.ajax({
+                url: '/profile/code?_csrf_j=' + csrf,
+                type: 'post',
+                data: { mobile: authMobile, type: 'shenpi' },
+                dataTye: 'json',
+                error: function() {
+                    isPosting = false;
+                },
+                beforeSend: function() {
+                    isPosting = true;
+                },
+                success: function(response) {
+                    isPosting = false;
+                    if (response.err === 0) {
+                        codeSuccess(btn);
+                        $("input[name='code']").removeAttr('readonly');
+                        $("#re-shenpi-btn").removeAttr('disabled');
+                        $("#re-shenpi-btn2").removeAttr('disabled');
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
         });
         });
-    })
+        <% } %>
 
 
-    $('#cancel-revise-btn').click(function () {
-        const data = {
-            caid: parseInt('<%- ctx.change.id %>'),
-        };
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/apply/cancel/revise?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
+        $('#cancel-revise-btn').click(function () {
+            const data = {
+                caid: parseInt('<%- ctx.change.id %>'),
+            };
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/apply/cancel/revise?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
                 }
                 }
-            }
+            });
+        })
+
+        <% if (ctx.change && ctx.change.cancancel) { %>
+        $("#cancel-shenpi-btn").click(function () {
+            const data = {
+                caid: parseInt('<%- ctx.change.id %>'),
+            };
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/apply/cancel/audit?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function (response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
         });
         });
+        <% } %>
     })
     })
+    /**
+     * 获取成功后的操作
+     *
+     * @param {Object} btn - 点击的按钮
+     * @return {void}
+     */
+    function codeSuccess(btn) {
+        let counter = 60;
+        btn.addClass('disabled').text('重新获取 ' + counter + 'S');
+        btn.parent().siblings('input').removeAttr('readonly').attr('placeholder', '输入短信中的6位验证码');
+        const bindBtn = $("#bind-btn");
+        bindBtn.removeClass('btn-secondary disabled').addClass('btn-primary');
 
 
-    <% if (ctx.change && ctx.change.cancancel) { %>
-    $("#cancel-shenpi-btn").click(function () {
-        const data = {
-            caid: parseInt('<%- ctx.change.id %>'),
-        };
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/apply/cancel/audit?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function (response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
-                }
+        const countDown = setInterval(function() {
+            const countString = counter - 1 <= 0 ? '' : ' ' + (counter - 1) + 'S';
+            // 倒数结束后
+            if (countString === '') {
+                clearInterval(countDown);
+                btn.removeClass('disabled');
             }
             }
-        });
-    });
-    <% } %>
+            const text = '重新获取' + countString;
+            btn.text(text);
+            counter -= 1;
+        }, 1000);
+    }
 </script>
 </script>

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

@@ -138,12 +138,12 @@
                             <td>
                             <td>
                                 待修订
                                 待修订
                             </td>
                             </td>
-                        <% } else { %>
+                        <% } else if (c.changeAudit) { %>
                         <td>
                         <td>
                             <%- c.changeAudit.name %>-<%- c.changeAudit.jobs %>
                             <%- c.changeAudit.name %>-<%- c.changeAudit.jobs %>
                             <span class="<%- auditConst.auditStatusClass[c.changeAudit.status] %>"><%- auditConst.auditStatusString[c.changeAudit.status] %></span>
                             <span class="<%- auditConst.auditStatusClass[c.changeAudit.status] %>"><%- auditConst.auditStatusString[c.changeAudit.status] %></span>
                         </td>
                         </td>
-                        <% } %>
+                        <% } else { %><td></td><% } %>
                         <td><% if ((c.status === auditConst.status.uncheck || (((c.status === auditConst.status.back || c.status === auditConst.status.revise) && c.stageChangeNum === 0) && c.uid === uid)) && !ctx.tender.isTourist) { %><a href="#del-bg" cid="<%= c.cid %>" data-toggle="modal" data-target="#del-bg" class="btn btn-outline-danger btn-sm delete-cid-modal">删除</a><% } %></td>
                         <td><% if ((c.status === auditConst.status.uncheck || (((c.status === auditConst.status.back || c.status === auditConst.status.revise) && c.stageChangeNum === 0) && c.uid === uid)) && !ctx.tender.isTourist) { %><a href="#del-bg" cid="<%= c.cid %>" data-toggle="modal" data-target="#del-bg" class="btn btn-outline-danger btn-sm delete-cid-modal">删除</a><% } %></td>
                     </tr>
                     </tr>
                     <% } %>
                     <% } %>

+ 193 - 129
app/view/change/plan_information_modal.ejs

@@ -895,152 +895,216 @@
 <script>
 <script>
     const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
     const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
     const csrf = '<%= ctx.csrf %>';
     const csrf = '<%= ctx.csrf %>';
+    const authMobile = '<%= authMobile %>';
 </script>
 </script>
 <script>
 <script>
-    $('.sp-location-list').on('shown.bs.modal', function () {
-        const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
-        const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
-        scrollBox.scrollTop(0);
-        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
-        const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
-        if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
-            scrollBox.scrollTop(hdheight - bdiv);
-        }
-    });
-    function divSearch(div) {
-        if (div.length > 0) {
-            return true;
+    $(function () {
+        $('.sp-location-list').on('shown.bs.modal', function () {
+            const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
+            const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
+            scrollBox.scrollTop(0);
+            const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
+            const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
+            if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
+                scrollBox.scrollTop(hdheight - bdiv);
+            }
+        });
+        function divSearch(div) {
+            if (div.length > 0) {
+                return true;
+            }
+            return false;
         }
         }
-        return false;
-    }
 
 
-    // 展开历史审核记录
-    $('.modal-body #fold-btn').click(function () {
-        const type = $(this).data('target')
-        const auditCard = $(this).parent().parent()
-        if (type === 'show') {
-            $(this).data('target', 'hide')
-            auditCard.find('.fold-card').slideDown('swing', () => {
-                auditCard.find('#fold-btn').text('收起历史审核记录')
-            })
-        } else {
-            $(this).data('target', 'show')
-            auditCard.find('.fold-card').slideUp('swing', () => {
-                auditCard.find('#fold-btn').text('展开历史审核记录')
-            })
-        }
-    });
+        // 展开历史审核记录
+        $('.modal-body #fold-btn').click(function () {
+            const type = $(this).data('target')
+            const auditCard = $(this).parent().parent()
+            if (type === 'show') {
+                $(this).data('target', 'hide')
+                auditCard.find('.fold-card').slideDown('swing', () => {
+                    auditCard.find('#fold-btn').text('收起历史审核记录')
+                })
+            } else {
+                $(this).data('target', 'show')
+                auditCard.find('.fold-card').slideUp('swing', () => {
+                    auditCard.find('#fold-btn').text('展开历史审核记录')
+                })
+            }
+        });
 
 
-    $('.sp-list-btn').click(function () {
-        const type = $(this).data('type')
-        if (type === 'hide') {
-            $('.sp-list-item').hide()
-            $('.modal-title').text('审批流程')
-        } else {
-            $('.sp-list-item').show()
-            $('.modal-title').text('重新上报')
-        }
-    });
+        $('.sp-list-btn').click(function () {
+            const type = $(this).data('type')
+            if (type === 'hide') {
+                $('.sp-list-item').hide()
+                $('.modal-title').text('审批流程')
+            } else {
+                $('.sp-list-item').show()
+                $('.modal-title').text('重新上报')
+            }
+        });
 
 
-    $('#re-shenpi-btn').click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
-        <% if (ctx.session.sessionUser.loginStatus === 0) { %>
-        const code = $("#againForm input[name='code']").val();
-        if ($(this).hasClass('disabled')) {
-            return false;
-        }
-        if (code.length < 6) {
-            // alert('请填写正确的验证码');
-            toastr.error('请填写正确的验证码');
-            return false;
-        }
-        data.code = code;
-        <% } %>
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/plan/check/again?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
+        $('#re-shenpi-btn').click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            <% if (ctx.session.sessionUser.loginStatus === 0) { %>
+            const code = $("#againForm input[name='code']").val();
+            if ($(this).hasClass('disabled')) {
+                return false;
+            }
+            if (code.length < 6) {
+                // alert('请填写正确的验证码');
+                toastr.error('请填写正确的验证码');
+                return false;
+            }
+            data.code = code;
+            <% } %>
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/plan/check/again?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
                 }
                 }
+            });
+        })
+
+        $('#re-shenpi-btn2').click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            <% if (ctx.session.sessionUser.loginStatus === 0) { %>
+            const code = $("#reviseForm input[name='code']").val();
+            if ($(this).hasClass('disabled')) {
+                return false;
             }
             }
+            if (code.length < 6) {
+                // alert('请填写正确的验证码');
+                toast('请填写正确的验证码', 'error');
+                return false;
+            }
+            data.code = code;
+            <% } %>
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/plan/check/revise?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
         });
         });
-    })
 
 
-    $('#re-shenpi-btn2').click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
         <% if (ctx.session.sessionUser.loginStatus === 0) { %>
         <% if (ctx.session.sessionUser.loginStatus === 0) { %>
-        const code = $("#reviseForm input[name='code']").val();
-        if ($(this).hasClass('disabled')) {
-            return false;
-        }
-        if (code.length < 6) {
-            // alert('请填写正确的验证码');
-            toast('请填写正确的验证码', 'error');
-            return false;
-        }
-        data.code = code;
-        <% } %>
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/plan/check/revise?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
-                }
+        // 重新审批获取手机验证码
+        // 获取验证码
+        let isPosting = false;
+        $("#get-code").click(function() {
+            if (isPosting) {
+                return false;
             }
             }
+            const btn = $(this);
+
+            $.ajax({
+                url: '/profile/code?_csrf_j=' + csrf,
+                type: 'post',
+                data: { mobile: authMobile, type: 'shenpi' },
+                dataTye: 'json',
+                error: function() {
+                    isPosting = false;
+                },
+                beforeSend: function() {
+                    isPosting = true;
+                },
+                success: function(response) {
+                    isPosting = false;
+                    if (response.err === 0) {
+                        codeSuccess(btn);
+                        $("input[name='code']").removeAttr('readonly');
+                        $("#re-shenpi-btn").removeAttr('disabled');
+                        $("#re-shenpi-btn2").removeAttr('disabled');
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
         });
         });
-    })
+        <% } %>
 
 
-    $('#cancel-revise-btn').click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/plan/cancel/revise?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
+        $('#cancel-revise-btn').click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/plan/cancel/revise?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
                 }
                 }
-            }
+            });
+        })
+
+        <% if (ctx.change && ctx.change.cancancel) { %>
+        $("#cancel-shenpi-btn").click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/plan/cancel/audit?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function (response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
         });
         });
+        <% } %>
     })
     })
+    /**
+     * 获取成功后的操作
+     *
+     * @param {Object} btn - 点击的按钮
+     * @return {void}
+     */
+    function codeSuccess(btn) {
+        let counter = 60;
+        btn.addClass('disabled').text('重新获取 ' + counter + 'S');
+        btn.parent().siblings('input').removeAttr('readonly').attr('placeholder', '输入短信中的6位验证码');
+        const bindBtn = $("#bind-btn");
+        bindBtn.removeClass('btn-secondary disabled').addClass('btn-primary');
 
 
-    <% if (ctx.change && ctx.change.cancancel) { %>
-    $("#cancel-shenpi-btn").click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/plan/cancel/audit?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function (response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
-                }
+        const countDown = setInterval(function() {
+            const countString = counter - 1 <= 0 ? '' : ' ' + (counter - 1) + 'S';
+            // 倒数结束后
+            if (countString === '') {
+                clearInterval(countDown);
+                btn.removeClass('disabled');
             }
             }
-        });
-    });
-    <% } %>
+            const text = '重新获取' + countString;
+            btn.text(text);
+            counter -= 1;
+        }, 1000);
+    }
 </script>
 </script>

+ 192 - 129
app/view/change/project_information_modal.ejs

@@ -956,150 +956,213 @@
     const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
     const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
     const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
     const cur_uid = parseInt('<%- ctx.session.sessionUser.accountId %>');
     const csrf = '<%= ctx.csrf %>';
     const csrf = '<%= ctx.csrf %>';
-    $('.sp-location-list').on('shown.bs.modal', function () {
-        const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
-        const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
-        scrollBox.scrollTop(0);
-        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
-        const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
-        if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
-            scrollBox.scrollTop(hdheight - bdiv);
-        }
-    });
-    function divSearch(div) {
-        if (div.length > 0) {
-            return true;
+    const authMobile = '<%= authMobile %>';
+    $(function () {
+        $('.sp-location-list').on('shown.bs.modal', function () {
+            const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
+            const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
+            scrollBox.scrollTop(0);
+            const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
+            const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
+            if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 200 && hdheight - bdiv > 200) {
+                scrollBox.scrollTop(hdheight - bdiv);
+            }
+        });
+        function divSearch(div) {
+            if (div.length > 0) {
+                return true;
+            }
+            return false;
         }
         }
-        return false;
-    }
 
 
-    // 展开历史审核记录
-    $('.modal-body #fold-btn').click(function () {
-        const type = $(this).data('target')
-        const auditCard = $(this).parent().parent()
-        if (type === 'show') {
-            $(this).data('target', 'hide')
-            auditCard.find('.fold-card').slideDown('swing', () => {
-                auditCard.find('#fold-btn').text('收起历史审核记录')
-            })
-        } else {
-            $(this).data('target', 'show')
-            auditCard.find('.fold-card').slideUp('swing', () => {
-                auditCard.find('#fold-btn').text('展开历史审核记录')
-            })
-        }
-    });
+        // 展开历史审核记录
+        $('.modal-body #fold-btn').click(function () {
+            const type = $(this).data('target')
+            const auditCard = $(this).parent().parent()
+            if (type === 'show') {
+                $(this).data('target', 'hide')
+                auditCard.find('.fold-card').slideDown('swing', () => {
+                    auditCard.find('#fold-btn').text('收起历史审核记录')
+                })
+            } else {
+                $(this).data('target', 'show')
+                auditCard.find('.fold-card').slideUp('swing', () => {
+                    auditCard.find('#fold-btn').text('展开历史审核记录')
+                })
+            }
+        });
 
 
-    $('.sp-list-btn').click(function () {
-        const type = $(this).data('type')
-        if (type === 'hide') {
-            $('.sp-list-item').hide()
-            $('.modal-title').text('审批流程')
-        } else {
-            $('.sp-list-item').show()
-            $('.modal-title').text('重新上报')
-        }
-    });
+        $('.sp-list-btn').click(function () {
+            const type = $(this).data('type')
+            if (type === 'hide') {
+                $('.sp-list-item').hide()
+                $('.modal-title').text('审批流程')
+            } else {
+                $('.sp-list-item').show()
+                $('.modal-title').text('重新上报')
+            }
+        });
 
 
-    $('#re-shenpi-btn').click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
+        $('#re-shenpi-btn').click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            <% if (ctx.session.sessionUser.loginStatus === 0) { %>
+            const code = $("#againForm input[name='code']").val();
+            if ($(this).hasClass('disabled')) {
+                return false;
+            }
+            if (code.length < 6) {
+                // alert('请填写正确的验证码');
+                toastr.error('请填写正确的验证码');
+                return false;
+            }
+            data.code = code;
+            <% } %>
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/project/check/again?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
+        });
         <% if (ctx.session.sessionUser.loginStatus === 0) { %>
         <% if (ctx.session.sessionUser.loginStatus === 0) { %>
-        const code = $("#againForm input[name='code']").val();
-        if ($(this).hasClass('disabled')) {
-            return false;
-        }
-        if (code.length < 6) {
-            // alert('请填写正确的验证码');
-            toastr.error('请填写正确的验证码');
-            return false;
-        }
-        data.code = code;
-        <% } %>
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/project/check/again?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
+        // 重新审批获取手机验证码
+        // 获取验证码
+        let isPosting = false;
+        $("#get-code").click(function() {
+            if (isPosting) {
+                return false;
+            }
+            const btn = $(this);
+
+            $.ajax({
+                url: '/profile/code?_csrf_j=' + csrf,
+                type: 'post',
+                data: { mobile: authMobile, type: 'shenpi' },
+                dataTye: 'json',
+                error: function() {
+                    isPosting = false;
+                },
+                beforeSend: function() {
+                    isPosting = true;
+                },
+                success: function(response) {
+                    isPosting = false;
+                    if (response.err === 0) {
+                        codeSuccess(btn);
+                        $("input[name='code']").removeAttr('readonly');
+                        $("#re-shenpi-btn").removeAttr('disabled');
+                        $("#re-shenpi-btn2").removeAttr('disabled');
+                    } else {
+                        toastr.error(response.msg);
+                    }
                 }
                 }
+            });
+        });
+        <% } %>
+
+        $('#re-shenpi-btn2').click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            <% if (ctx.session.sessionUser.loginStatus === 0) { %>
+            const code = $("#reviseForm input[name='code']").val();
+            if ($(this).hasClass('disabled')) {
+                return false;
+            }
+            if (code.length < 6) {
+                // alert('请填写正确的验证码');
+                toastr.error('请填写正确的验证码');
+                return false;
             }
             }
+            data.code = code;
+            <% } %>
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/project/check/revise?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
+                }
+            });
         });
         });
-    })
 
 
-    $('#re-shenpi-btn2').click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
-        <% if (ctx.session.sessionUser.loginStatus === 0) { %>
-        const code = $("#reviseForm input[name='code']").val();
-        if ($(this).hasClass('disabled')) {
-            return false;
-        }
-        if (code.length < 6) {
-            // alert('请填写正确的验证码');
-            toastr.error('请填写正确的验证码');
-            return false;
-        }
-        data.code = code;
-        <% } %>
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/project/check/revise?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
+        $('#cancel-revise-btn').click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/project/cancel/revise?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function(response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
                 }
                 }
-            }
+            });
         });
         });
-    })
 
 
-    $('#cancel-revise-btn').click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/project/cancel/revise?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function(response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
+        <% if (ctx.change && ctx.change.cancancel) { %>
+        $("#cancel-shenpi-btn").click(function () {
+            const data = {
+                cpid: parseInt('<%- ctx.change.id %>'),
+            };
+            $.ajax({
+                url: '/tender/<%- tender.id %>/change/project/cancel/audit?_csrf_j=' + csrf,
+                type: 'post',
+                data: data,
+                dataTye: 'json',
+                success: function (response) {
+                    if (response.err === 0) {
+                        window.location.href = response.url;
+                    } else {
+                        toastr.error(response.msg);
+                    }
                 }
                 }
-            }
+            });
         });
         });
+        <% } %>
     })
     })
+    /**
+     * 获取成功后的操作
+     *
+     * @param {Object} btn - 点击的按钮
+     * @return {void}
+     */
+    function codeSuccess(btn) {
+        let counter = 60;
+        btn.addClass('disabled').text('重新获取 ' + counter + 'S');
+        btn.parent().siblings('input').removeAttr('readonly').attr('placeholder', '输入短信中的6位验证码');
+        const bindBtn = $("#bind-btn");
+        bindBtn.removeClass('btn-secondary disabled').addClass('btn-primary');
 
 
-    <% if (ctx.change && ctx.change.cancancel) { %>
-    $("#cancel-shenpi-btn").click(function () {
-        const data = {
-            cpid: parseInt('<%- ctx.change.id %>'),
-        };
-        $.ajax({
-            url: '/tender/<%- tender.id %>/change/project/cancel/audit?_csrf_j=' + csrf,
-            type: 'post',
-            data: data,
-            dataTye: 'json',
-            success: function (response) {
-                if (response.err === 0) {
-                    window.location.href = response.url;
-                } else {
-                    toastr.error(response.msg);
-                }
+        const countDown = setInterval(function() {
+            const countString = counter - 1 <= 0 ? '' : ' ' + (counter - 1) + 'S';
+            // 倒数结束后
+            if (countString === '') {
+                clearInterval(countDown);
+                btn.removeClass('disabled');
             }
             }
-        });
-    });
-    <% } %>
+            const text = '重新获取' + countString;
+            btn.text(text);
+            counter -= 1;
+        }, 1000);
+    }
 </script>
 </script>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1092 - 0
sql/update.sql