|
@@ -230,12 +230,11 @@ module.exports = app => {
|
|
|
const rela_tender = await ctx.subProject.rela_tender.split(',');
|
|
|
const result = tenderList.filter(x => { return rela_tender.indexOf(x.id + '') >= 0});
|
|
|
for (const r of result) {
|
|
|
- // 预付款附件未上传oss,暂不导入
|
|
|
- // r.advance = await ctx.service.advance.getAllDataByCondition({ columns: ['id', 'order', 'type'], where: { tid: r.id }});
|
|
|
- // r.advance.forEach(a => {
|
|
|
- // const type = advanceConst.typeCol.find(x => { return x.type === a.type });
|
|
|
- // if (type) a.type_str = type.name;
|
|
|
- // });
|
|
|
+ r.advance = await ctx.service.advance.getAllDataByCondition({ columns: ['id', 'order', 'type'], where: { tid: r.id }});
|
|
|
+ r.advance.forEach(a => {
|
|
|
+ const type = advanceConst.typeCol.find(x => { return x.type === a.type });
|
|
|
+ if (type) a.type_str = type.name;
|
|
|
+ });
|
|
|
r.stage = await ctx.service.stage.getAllDataByCondition({ columns: ['id', 'order'], where: { tid: r.id, status: auditConst.stage.status.checked } });
|
|
|
}
|
|
|
ctx.body = {err: 0, msg: '', data: result };
|
|
@@ -258,7 +257,14 @@ module.exports = app => {
|
|
|
}
|
|
|
async _loadAdvanceAtt(data) {
|
|
|
if (!data.stage) throw '参数错误';
|
|
|
- return await this.ctx.service.advanceFile.getAllDataByCondition({ where: { vid: data.stage }, order: [['id', 'desc']]});
|
|
|
+ const self = this;
|
|
|
+ const result = await this.ctx.service.advanceFile.getAllDataByCondition({ where: { vid: data.stage }, order: [['id', 'desc']]});
|
|
|
+ result.forEach(x => {
|
|
|
+ const info = path.parse(x.filename);
|
|
|
+ x.filename = info.name;
|
|
|
+ x.filesize = self.ctx.helper.sizeToBytes(x.filesize);
|
|
|
+ });
|
|
|
+ return result;
|
|
|
}
|
|
|
async loadRelaFiles(ctx) {
|
|
|
try {
|
|
@@ -273,10 +279,9 @@ module.exports = app => {
|
|
|
case 'stage':
|
|
|
files = await this._loadStageAtt(data);
|
|
|
break;
|
|
|
- // 预付款附件未上传oss,暂不导入
|
|
|
- // case 'advance':
|
|
|
- // files = await this._loadAdvanceAtt(data);
|
|
|
- // break;
|
|
|
+ case 'advance':
|
|
|
+ files = await this._loadAdvanceAtt(data);
|
|
|
+ break;
|
|
|
default: throw '未知文件类型';
|
|
|
}
|
|
|
ctx.body = {err: 0, msg: '', data: files };
|