浏览代码

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

lishihao 2 年之前
父节点
当前提交
d716d3ce7d

+ 0 - 5
app/public/js/revise_price.js

@@ -82,11 +82,6 @@ $(document).ready(() => {
         getColor: function (sheet, data, row, col, defaultColor) {
             if (!data) return defaultColor;
             if (data.rela_lid && data.rela_cid) return '#f5deb3';
-
-            const samePrice = sheet.zh_data.find(x => {
-                return x.b_code === data.b_code && x.name === data.name && x.unit === data.unit && x.org_price === data.org_price && data.id !== x.id;
-            });
-            return !samePrice ? defaultColor : '#f5deb3';
         }
     };
     const priceBwSpreadSetting = {

+ 1 - 5
app/public/js/stage_audit.js

@@ -380,11 +380,8 @@ $(document).ready(function () {
 
     // 比uid大的序号进行调整
     function updateOrder(aid, num = 1) {
-        console.log('hello');
         const index = _.findIndex(auditorList, { aid });
-        console.log(index, auditorList.length);
         for (let i = index;i < auditorList.length; i++) {
-            console.log(i,i+num, auditorList.length);
             $('#admin-edit-shenpi tbody').children('tr').eq(i).find('.shenpi-order').text(i+num);
         }
     }
@@ -404,7 +401,7 @@ $(document).ready(function () {
                 auditorshtml.push('<span class="pull-right">'+ transFormToChinese(index) +'审</span>');
             }
             auditorshtml.push('</li>');
-            if (data.status === auditConst.status.uncheck) {
+            if (data.status === sam_auditConst.status.uncheck) {
                 lastAuditorHtml += '<li class="timeline-list-item pb-2 is_uncheck">\n' +
                     '                                            <div class="timeline-item-date">\n' +
                     '                                                \n' +
@@ -427,7 +424,6 @@ $(document).ready(function () {
                     '                                        </li>';
             }
         }
-        console.log(lastAuditorHtml);
         $('.last-auditor-list .is_uncheck').remove();
         $('.last-auditor-list').append(lastAuditorHtml);
         $('.auditors-list').html(auditorshtml.join(''));

+ 5 - 2
app/service/stage_audit.js

@@ -1032,6 +1032,9 @@ module.exports = app => {
                     // 计算该审批人最终数据
                     await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
                     // 复制一份最新数据给下一人
+                    // 保留审批人数据,覆盖到原报中并删除该审批人合同支付数据
+                    await this.ctx.service.stagePay.deleteAuditStagePays(this.ctx.stage, this.ctx.stage.times, 0, transaction);
+                    await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, 0, transaction, this.ctx.stage.times, 1);
                     await this.ctx.service.stagePay.deleteAuditStagePays(this.ctx.stage, this.ctx.stage.times, 1, transaction);
                     await this.ctx.service.stageJgcl.updateHistory(this.ctx.stage, transaction);
                     await this.ctx.service.stageBonus.updateHistory(this.ctx.stage, transaction);
@@ -1260,9 +1263,9 @@ module.exports = app => {
                     // 计算该审批人最终数据
                     await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
                     // 复制一份最新数据给下一人
+                    await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times - 1, curAudit.order + 1, transaction, this.ctx.stage.times, 0);
+                    await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times - 1, curAudit.order + 2, transaction, this.ctx.stage.times, 0);
                     await this.ctx.service.stagePay.deleteAuditStagePays(this.ctx.stage, this.ctx.stage.times, 0, transaction);
-                    await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times - 1, curAudit.order + 1, transaction);
-                    await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times - 1, curAudit.order + 2, transaction);
                     await this.ctx.service.stageJgcl.updateHistory(this.ctx.stage, transaction);
                     await this.ctx.service.stageBonus.updateHistory(this.ctx.stage, transaction);
                     await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);

+ 2 - 2
app/service/stage_pay.js

@@ -293,7 +293,7 @@ module.exports = app => {
          * @param transaction - 事务
          * @returns {Promise<*>}
          */
-        async copyAuditStagePays(stage, times, order, transaction) {
+        async copyAuditStagePays(stage, times, order, transaction, curTimes = stage.curTimes, curOrder = stage.curOrder) {
             if (!stage || !transaction || !times || order === undefined) {
                 throw '数据错误';
             }
@@ -303,7 +303,7 @@ module.exports = app => {
                         '     SP.`pre_tp`, SP.`end_tp`, SP.`pre_used`, SP.`pre_finish`, SP.`start_stage_order`, SP.`postil` ' +
                         '  FROM ?? As SP' +
                         '  WHERE SP.`sid` = ? AND SP.`stimes` = ? AND SP.`sorder` = ?';
-            const sqlParam = [this.tableName, times, order, this.tableName, stage.id, stage.curTimes, stage.curOrder];
+            const sqlParam = [this.tableName, times, order, this.tableName, stage.id, curTimes, curOrder];
             return await transaction.query(sql, sqlParam);
         }
 

+ 1 - 0
app/view/stage/audit_modal.ejs

@@ -969,6 +969,7 @@
 <script type="text/javascript">
     const csrf = '<%= ctx.csrf %>';
     const authMobile = '<%= authMobile %>';
+    const sam_auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
 </script>
 <% if (ctx.stage && (ctx.session.sessionUser.accountId === ctx.stage.user_id && (ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo))) { %>
 <script>