From 9f66786502ca7c8e7812c9ac112a7ff7288bb098 Mon Sep 17 00:00:00 2001 From: JoolsoftAdmin Date: Tue, 8 Oct 2024 10:10:43 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3?= =?UTF-8?q?=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 76 +++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index bd97889..7514029 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -1066,7 +1066,17 @@ export class ReportController extends Controller { salaryRef: v.templateDoc, })), }) - .then(async res => {}) + .then(async res => { + const lists = await this.personalRepository.find({ + where: { probation_status: 8, personal_id: In(body.refIds.map(x => x.refId)) }, + }) + await Promise.all( + lists.map(async list => { + list.probation_status = 9 + await this.personalRepository.save(list) + }) + ) + }) .catch(() => {}) return new HttpSuccess() } @@ -1081,6 +1091,32 @@ export class ReportController extends Controller { const lists = await this.personalRepository.find({ where: { probation_status: 2, personal_id: In(body.refIds) }, }) + await Promise.all( + lists.map(async list => { + list.probation_status = 8 + await this.personalRepository.save(list) + }) + ) + + return new HttpSuccess() + } + @Post("command11/officer/report/delete") + public async command11Delete( + @Request() req: RequestWithUser, + @Body() + body: { + refIds: string[] + } + ) { + const lists = await this.personalRepository.find({ + where: { probation_status: 8, personal_id: In(body.refIds) }, + }) + await Promise.all( + lists.map(async list => { + list.probation_status = 2 + await this.personalRepository.save(list) + }) + ) return new HttpSuccess() } @@ -1111,7 +1147,17 @@ export class ReportController extends Controller { salaryRef: v.templateDoc, })), }) - .then(async res => {}) + .then(async res => { + const lists = await this.personalRepository.find({ + where: { probation_status: 8, personal_id: In(body.refIds.map(x => x.refId)) }, + }) + await Promise.all( + lists.map(async list => { + list.probation_status = 9 + await this.personalRepository.save(list) + }) + ) + }) .catch(() => {}) return new HttpSuccess() } @@ -1126,7 +1172,31 @@ export class ReportController extends Controller { const lists = await this.personalRepository.find({ where: { probation_status: 3, personal_id: In(body.refIds) }, }) - + await Promise.all( + lists.map(async list => { + list.probation_status = 8 + await this.personalRepository.save(list) + }) + ) + return new HttpSuccess() + } + @Post("command12/officer/report/delete") + public async command12Delete( + @Request() req: RequestWithUser, + @Body() + body: { + refIds: string[] + } + ) { + const lists = await this.personalRepository.find({ + where: { probation_status: 8, personal_id: In(body.refIds) }, + }) + await Promise.all( + lists.map(async list => { + list.probation_status = 3 + await this.personalRepository.save(list) + }) + ) return new HttpSuccess() } }