|
@@ -194,7 +194,7 @@ module.exports = app => {
|
|
|
let curStageData, preStageData;
|
|
|
responseData.data = await ctx.service.pos.getPosData(condition);
|
|
|
// 根据当前人,或指定对象查询数据
|
|
|
- console.time('cur');
|
|
|
+ //console.time('cur');
|
|
|
const curWhere = JSON.parse(ctx.request.body.data);
|
|
|
if (ctx.stage.readOnly) {
|
|
|
curStageData = await ctx.service.stagePos.getAuditorStageData(ctx.tender.id,
|
|
@@ -202,22 +202,22 @@ module.exports = app => {
|
|
|
} else {
|
|
|
curStageData = await ctx.service.stagePos.getLastestStageData(ctx.tender.id, ctx.stage.id, curWhere);
|
|
|
}
|
|
|
- console.timeEnd('cur');
|
|
|
+ //console.timeEnd('cur');
|
|
|
// 查询截止上期数据
|
|
|
- console.time('pre');
|
|
|
+ //console.time('pre');
|
|
|
if (ctx.stage.order > 1) {
|
|
|
preStageData = await ctx.service.stagePosFinal.getFinalData(ctx.tender.data, ctx.stage);
|
|
|
//responseData.data.preStageData = await ctx.service.stagePos.getEndStageData(ctx.tender.id, ctx.stage.order - 1);
|
|
|
} else {
|
|
|
preStageData = [];
|
|
|
}
|
|
|
- console.timeEnd('pre');
|
|
|
- console.time('assign');
|
|
|
+ //console.timeEnd('pre');
|
|
|
+ //console.time('assign');
|
|
|
this.ctx.helper.assignRelaData(responseData.data, [
|
|
|
{data: curStageData, fields: ['contract_qty', 'qc_qty', 'postil'], prefix: '', relaId: 'pid'},
|
|
|
{data: preStageData, fields: ['contract_qty', 'qc_qty'], prefix: 'pre_', relaId: 'pid'}
|
|
|
]);
|
|
|
- console.timeEnd('assign');
|
|
|
+ //console.timeEnd('assign');
|
|
|
ctx.body = responseData;
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
@@ -739,11 +739,33 @@ module.exports = app => {
|
|
|
async _getChangeDetailData(tid, sid, cid) {
|
|
|
const data = {};
|
|
|
data.attachments = await this.ctx.service.changeAtt.getChangeAttachment(cid);
|
|
|
+ data.bills = await this.ctx.service.changeAuditList.getAllDataByCondition({where: {cid: cid}});
|
|
|
data.addUsedBills = await this.ctx.service.stageChange.getUsedData(tid, cid);
|
|
|
data.curUsedBills = await this.ctx.service.stageChange.getStageUsedData(sid, cid);
|
|
|
return data;
|
|
|
}
|
|
|
/**
|
|
|
+ * 获取变更数据 Post(Ajax)
|
|
|
+ * @param ctx
|
|
|
+ * @returns {Promise<void>}
|
|
|
+ */
|
|
|
+ async getChangeData(ctx) {
|
|
|
+ try {
|
|
|
+ const data = {};
|
|
|
+ data.ledger = await ctx.service.ledger.getDataByTenderId(ctx.tender.id, -1);
|
|
|
+ data.usedChangesId = await ctx.service.stageChange.getStageUsedChangeId(ctx.stage.id);
|
|
|
+ data.changes = await ctx.service.change.getChangeAndUsedInfo(ctx.tender.id);
|
|
|
+ if (data.changes.length > 0) {
|
|
|
+ const change = data.changes[0];
|
|
|
+ change.detail = await this._getChangeDetailData(ctx.tender.id, ctx.stage.id, change.cid);
|
|
|
+ }
|
|
|
+ ctx.body = {err: 0, msg: '', data: data};
|
|
|
+ } catch (err) {
|
|
|
+ this.log(err);
|
|
|
+ ctx.body = {err: 1, msg: err.toString(), data: null};
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 变更令 (Get)
|
|
|
* @param ctx
|
|
|
* @returns {Promise<void>}
|
|
@@ -752,13 +774,6 @@ module.exports = app => {
|
|
|
try {
|
|
|
await this._getStageAuditViewData(ctx);
|
|
|
const renderData = await this._getDefaultRenderData(ctx);
|
|
|
- renderData.ledger = await ctx.service.ledger.getDataByTenderId(ctx.tender.id, -1);
|
|
|
- renderData.changes = await ctx.service.change.getChangeAndUsedInfo(ctx.tender.id);
|
|
|
- if (renderData.changes.length > 0) {
|
|
|
- const change = renderData.changes[0];
|
|
|
- change.detail = await this._getChangeDetailData(ctx.tender.id, ctx.stage.id, change.cid);
|
|
|
- }
|
|
|
- renderData.usedChangesId = await ctx.service.stageChange.getStageUsedChangeId(ctx.stage.id);
|
|
|
renderData.changeConst = changeConst;
|
|
|
renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.change);
|
|
|
await this.layout('stage/change.ejs', renderData);
|