| 
					
				 | 
			
			
				@@ -42,7 +42,7 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (const t of tenderList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (t.user_id === this.ctx.session.sessionUser.accountId && ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        const sum = await this.ctx.service.ledger.addUp({tender_id: t.id/*, is_leaf: true*/}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        const sum = await this.ctx.service.ledger.addUp({ tender_id: t.id/* , is_leaf: true*/ }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         t.total_price = sum.total_price; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         t.deal_tp = sum.deal_tp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -50,8 +50,7 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (!t.lastStage) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (t.lastStage.status === auditConst.stage.status.uncheck && t.lastStage.user_id !== this.ctx.session.sessionUser.accountId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            t.lastStage = await this.ctx.service.stage.getLastestStage(t.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (t.lastStage.status === auditConst.stage.status.uncheck && t.lastStage.user_id !== this.ctx.session.sessionUser.accountId) { t.lastStage = await this.ctx.service.stage.getLastestStage(t.id); } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (!t.lastStage) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         await this.ctx.service.stage.checkStageGatherData(t.lastStage); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -118,7 +117,7 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } catch (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 console.log('error', err); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 this.log(err); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                this.ctx.redirect('/dashboard') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.ctx.redirect('/dashboard'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -126,6 +125,8 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             this.jsFiles = this.app.jsFiles.tender.list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            const { path = 'list' } = await ctx.service.settingShow.getDefaultPath(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ctx.curListUrl = path; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             const renderData = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 accountInfo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 userPermission, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -269,7 +270,8 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         async deleteTender(ctx) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const data = JSON.parse(ctx.request.body.data), result = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const data = JSON.parse(ctx.request.body.data), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    result = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (!(data instanceof Array) && (data.length === 0)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw '提交数据有误'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -278,9 +280,9 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         result.push(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ctx.body = {err: 0, msg: '', data: result}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ctx.body = { err: 0, msg: '', data: result }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } catch (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ctx.body = {err: 1, msg: err.toString(), data: []} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ctx.body = { err: 1, msg: err.toString(), data: [] }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -295,12 +297,12 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const tender = ctx.tender.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (tender.user_id === this.ctx.session.sessionUser.accountId && ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tender.ledger_status === auditConst.ledger.status.checkNo || tender.ledger_status === auditConst.ledger.status.uncheck)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    const sum = await this.ctx.service.ledger.addUp({tender_id: tender.id/*, is_leaf: true*/}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    const sum = await this.ctx.service.ledger.addUp({ tender_id: tender.id/* , is_leaf: true*/ }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tender.total_price = sum.total_price; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tender.deal_tp = sum.deal_tp; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const stages = await ctx.service.stage.getValidStages(ctx.tender.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                const lastStage = stages.length > 0 ? stages[0] : null; //await ctx.service.stage.getLastestStage(ctx.tender.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                const lastStage = stages.length > 0 ? stages[0] : null; // await ctx.service.stage.getLastestStage(ctx.tender.id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (lastStage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     await this.ctx.service.stage.checkStageGatherData(lastStage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tender.gather_tp = ctx.helper.add(lastStage.contract_tp, lastStage.qc_tp); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -319,17 +321,17 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const monthProgress = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (const s of stages) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (s.s_time) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        let progress = monthProgress.find(function (x) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        let progress = monthProgress.find(function(x) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             return x.month === s.s_time; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (!progress) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            progress = {month: s.s_time}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            progress = { month: s.s_time }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             monthProgress.push(progress); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         progress.tp = ctx.helper.add(ctx.helper.add(progress.tp, s.contract_tp), s.qc_tp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                monthProgress.sort(function (x, y) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                monthProgress.sort(function(x, y) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return Date.parse(x.month) - Date.parse(y.month); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let sum = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -340,7 +342,7 @@ module.exports = app => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     p.end_ratio = ctx.helper.mul(ctx.helper.div(p.end_tp, tender.sum, 4), 100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 const renderData = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    tender: tender, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tender, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tenderInfo: ctx.tender.info, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     tenderMenu: this.menu.tenderMenu, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     preUrl: '/tender/' + ctx.tender.id, 
			 |