|
@@ -130,14 +130,9 @@ module.exports = app => {
|
|
|
const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(t.id);
|
|
|
t.contract_price = tenderInfo.deal_param.contractPrice;
|
|
|
|
|
|
- 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*/ });
|
|
|
- t.total_price = sum.total_price;
|
|
|
- t.deal_tp = sum.deal_tp;
|
|
|
- }
|
|
|
+ let bCalcTp = t.user_id === this.ctx.session.sessionUser.accountId && (
|
|
|
+ t.ledger_status === auditConst.ledger.status.checkNo || t.ledger_status === auditConst.ledger.status.uncheck);
|
|
|
t.advance_tp = await this.ctx.service.advance.getSumAdvance(t.id);
|
|
|
-
|
|
|
if (t.ledger_status === auditConst.ledger.status.checked) {
|
|
|
t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true);
|
|
|
if (t.lastStage && t.lastStage.status === auditConst.stage.status.uncheck &&
|
|
@@ -146,6 +141,15 @@ module.exports = app => {
|
|
|
}
|
|
|
if (t.lastStage) await this.ctx.service.stage.checkStageGatherData(t.lastStage);
|
|
|
t.completeStage = await this.ctx.service.stage.getLastestCompleteStage(t.id);
|
|
|
+ if ((!bCalcTp) && t.measure_type === measureType.gcl.value) {
|
|
|
+ bCalcTp = t.lastStage && t.lastStage.status !== auditConst.stage.status.checked && !t.lastStage.readOnly;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bCalcTp) {
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
if (t.lastStage) {
|
|
@@ -390,12 +394,8 @@ module.exports = app => {
|
|
|
async tenderInfo(ctx) {
|
|
|
try {
|
|
|
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*/ });
|
|
|
- tender.total_price = sum.total_price;
|
|
|
- tender.deal_tp = sum.deal_tp;
|
|
|
- }
|
|
|
+ let bCalcTp = tender.user_id === this.ctx.session.sessionUser.accountId && (
|
|
|
+ tender.ledger_status === auditConst.ledger.status.checkNo || tender.ledger_status === auditConst.ledger.status.uncheck);
|
|
|
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);
|
|
|
if (lastStage) {
|
|
@@ -435,6 +435,9 @@ module.exports = app => {
|
|
|
const times = lastStage.status === auditConst.stage.status.checkNo ? lastStage.times - 1 : lastStage.times;
|
|
|
lastStage.auditors = await ctx.service.stageAudit.getFinalAuditGroup(lastStage.id, times);
|
|
|
}
|
|
|
+ if ((!bCalcTp) && tender.measure_type === measureType.gcl.value) {
|
|
|
+ bCalcTp = lastStage.status !== auditConst.stage.status.checked && !lastStage.readOnly;
|
|
|
+ }
|
|
|
} else {
|
|
|
if (tender.ledger_status !== auditConst.ledger.status.uncheck) {
|
|
|
const status_name = await this.ctx.service.ledgerAudit.getStatusName(tender.id, tender.ledger_times);
|
|
@@ -446,6 +449,11 @@ module.exports = app => {
|
|
|
tender.status_users = status_name ? status_name.name : '';
|
|
|
}
|
|
|
}
|
|
|
+ if (bCalcTp) {
|
|
|
+ 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 tiModel = new tenderInfoModel(ctx);
|
|
|
const gclChapter = await tiModel.gatherChapter();
|
|
|
|
|
@@ -974,7 +982,6 @@ module.exports = app => {
|
|
|
await ctx.service.ledgerCooperation.changeAllStatus(status);
|
|
|
}
|
|
|
// }
|
|
|
- // console.log(postData);
|
|
|
await ctx.service.tenderInfo.saveTenderInfo(ctx.tender.id, { shenpi: postData });
|
|
|
let auditList = [];
|
|
|
if (data.status === shenpiConst.sp_status.gdspl) {
|