Przeglądaj źródła

fix: 预付款后台新增记录报错修复

lanjianrong 5 lat temu
rodzic
commit
92f6b66b33

+ 0 - 2
app/controller/advance_controller.js

@@ -88,7 +88,6 @@ module.exports = app => {
                 }
             }
             data.auditHistory = auditHistory;
-            console.log('data.auditHistory', data.auditHistory);
             data.fileList = await ctx.service.advanceFile.getAdvanceFiles({ vid: ctx.advance.id });
             return data;
         }
@@ -107,7 +106,6 @@ module.exports = app => {
                     ctx.advance.auditHistory.push(await ctx.service.advanceAudit.getAuditors(ctx.advance.id, i));
                 }
             }
-            console.log('ctx.advance.auditHistory', ctx.advance.auditHistory);
             // 获取审批流程中左边列表
             ctx.advance.auditors2 = await ctx.service.advanceAudit.getAuditGroupByList(ctx.advance.id, times);
             if (ctx.advance.status === auditConst.status.uncheck || ctx.advance.status === auditConst.status.checkNo) {

+ 3 - 3
app/public/js/advance.js

@@ -33,9 +33,9 @@ $(document).ready(function () {
         $('#file-content').empty()
         let html = `<thead>
                             <tr>
-                                <th>文件名</th>
-                                <th>上传时间</th>
-                                <th>操作</th>
+                                <th width="70%">文件名</th>
+                                <th width="20%">上传时间</th>
+                                <th width="10%">操作</th>
                             </tr>
                         </thead>`
         fileList.forEach(file => {

+ 8 - 3
app/service/advance.js

@@ -74,9 +74,14 @@ module.exports = app => {
             const { ctx } = this;
             const uid = ctx.session.sessionUser.accountId;
             const tid = ctx.tender.id;
-            const latestOrder = await this.getLastestAdvance(tid, type);
-            console.log('latestOrder', latestOrder);
-            const order = !latestOrder ? 1 : latestOrder.order + 1;
+            let latestOrder = await this.getLastestAdvance(tid, type);
+            if (!latestOrder) {
+                latestOrder = {
+                    order: 1,
+                    prev_amount: 0.00,
+                    prev_total_amount: 0.00,
+                };
+            }
             const record = await this.db.insert(this.tableName, { type, uid, tid, status: auditConst.status.uncheck, order, prev_amount: latestOrder.prev_total_amount, prev_total_amount: latestOrder.prev_total_amount });
             return await this.getDataById(record.insertId);
         }