diff --git a/api/app/lib/controllers/report/achievement.js b/api/app/lib/controllers/report/achievement.js index a2acf0d..8cfedb1 100644 --- a/api/app/lib/controllers/report/achievement.js +++ b/api/app/lib/controllers/report/achievement.js @@ -12,7 +12,7 @@ async function getReceivedDetail(ctx) { } let findOption = { where: where, - order: [['id', 'DESC']] + order: [['id', 'ASC']] } if (!toExport) {//非导出时考虑分页 if (limit) { @@ -132,7 +132,7 @@ async function getAchievementDetail(ctx) { } let findOption = { where: where, - order: [['id', 'DESC']] + order: [['id', 'ASC']] } if (!toExport) {//非导出时考虑分页 if (limit) { @@ -349,7 +349,7 @@ async function getContractDetail(ctx) { where: where, offset: Number(page) * Number(limit), limit: Number(limit), - order: [['id', 'DESC']] + order: [['id', 'ASC']] }); ctx.status = 200 ctx.body = contractDetail; @@ -376,7 +376,7 @@ async function getInvoicingDetail(ctx) { where: where, offset: Number(page) * Number(limit), limit: Number(limit), - order: [['id', 'DESC']] + order: [['id', 'ASC']] }); ctx.status = 200 ctx.body = invoiceDetail; @@ -394,7 +394,7 @@ async function exportContractDetail(ctx) { try { const { models } = ctx.fs.dc; let exportData = await models.ContractDetail.findAll({ - order: [['id', 'DESC']] + order: [['id', 'ASC']] }); const { utils: { simpleExcelDown, contractDetailsColumnKeys } } = ctx.app.fs; let header = []; @@ -423,7 +423,7 @@ async function exportInvoicingDetail(ctx) { try { const { models } = ctx.fs.dc; let exportData = await models.InvoiceDetail.findAll({ - order: [['id', 'DESC']] + order: [['id', 'ASC']] }); const { utils: { simpleExcelDown, invoicingDetailsColumnKeys } } = ctx.app.fs; let header = []; diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index 460b1cf..ac36f7c 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -58,7 +58,7 @@ async function getSalersReport(ctx) { const salersRes = await clickHouse.hr.query(` SELECT * from sales_distribution as sales ${innerSelectQuery} - order by id desc + order by id asc ${!toExport && limit ? `LIMIT ${limit}` : ''} ${!toExport && limit && page ? 'OFFSET ' + parseInt(limit) * parseInt(page) : ''} `).toPromise()