|
@@ -338,9 +338,9 @@ module.exports = app => {
|
|
|
const stage = await this.ctx.service.stage.getDataById(data.stage);
|
|
|
switch (data.sub_type) {
|
|
|
case 'att':
|
|
|
- return await this.ctx.service.stageAtt.getAllDataByCondition({ where: { tid: data.tender_id, sid: stage.order }, order: [['id', 'desc']]});
|
|
|
+ return await this.ctx.service.stageAtt.getAllDataByCondition({ where: { tid: data.tender_id, sid: stage.order }, orders: [['id', 'desc']]});
|
|
|
case 'dealPay':
|
|
|
- const payAtt = await this.ctx.service.payAtt.getStageData({ sid: stage.id });
|
|
|
+ const payAtt = await this.ctx.service.payAtt.getAllDataByCondition({ where: { sid: stage.id}, orders: [['id', 'desc']] });
|
|
|
return payAtt;
|
|
|
case 'stageIm':
|
|
|
const imFiles = [];
|
|
@@ -370,17 +370,35 @@ module.exports = app => {
|
|
|
}
|
|
|
async _loadChangePlanAtt(data) {
|
|
|
if (!data.selectId) throw '参数错误';
|
|
|
+ const self = this;
|
|
|
const result = await this.ctx.service.changePlanAtt.getAllDataByCondition({ where: { cpid: data.selectId }, 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 _loadChangeProjectAtt(data) {
|
|
|
if (!data.selectId) throw '参数错误';
|
|
|
+ const self = this;
|
|
|
const result = await this.ctx.service.changeProjectAtt.getAllDataByCondition({ where: { cpid: data.selectId }, 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 _loadChangeApplyAtt(data) {
|
|
|
if (!data.selectId) throw '参数错误';
|
|
|
+ const self = this;
|
|
|
const result = await this.ctx.service.changeApplyAtt.getAllDataByCondition({ where: { caid: data.selectId }, 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) {
|
|
@@ -389,6 +407,7 @@ module.exports = app => {
|
|
|
if (!data.type) throw '参数错误';
|
|
|
|
|
|
let files;
|
|
|
+ console.log(data);
|
|
|
switch(data.type) {
|
|
|
case 'ledger':
|
|
|
files = await this._loadLedgerAtt(data);
|
|
@@ -413,6 +432,7 @@ module.exports = app => {
|
|
|
break;
|
|
|
default: throw '未知文件类型';
|
|
|
}
|
|
|
+ console.log(files);
|
|
|
ctx.body = {err: 0, msg: '', data: files };
|
|
|
} catch (error) {
|
|
|
ctx.helper.log(error);
|