From 093afea5fae3d61a9adbaccc468112e81da56c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Mon, 23 Oct 2023 14:38:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/patrolManage/patrolRecord.js | 11 ++++++++++- weapp/package/polling/polling.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/patrolManage/patrolRecord.js b/api/app/lib/controllers/patrolManage/patrolRecord.js index 5f5e6c0..3129d0f 100644 --- a/api/app/lib/controllers/patrolManage/patrolRecord.js +++ b/api/app/lib/controllers/patrolManage/patrolRecord.js @@ -646,6 +646,7 @@ function getTemplate(opts){ function reportQuest(opts){ return async function (ctx, next){ try{ + const transaction = await ctx.fs.dc.orm.transaction(); const models = ctx.fs.dc.models; const data = ctx.request.body; let { patrolPlanId, inspectionTime, points, alarm, pointId, projectId } = data @@ -665,10 +666,18 @@ function reportQuest(opts){ alarm, pointId: pointId, projectId - } + },{transaction} ); + if (alarm) { + await models.PatrolRecordIssueHandle.create({ + patrolRecordId: recordRes.id, + state: 1, + }, { transaction }); + } + await transaction.commit(); ctx.status = 204; }catch(error){ + await transaction.rollback(); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: '上报问题失败' } diff --git a/weapp/package/polling/polling.js b/weapp/package/polling/polling.js index 207f511..4977e55 100644 --- a/weapp/package/polling/polling.js +++ b/weapp/package/polling/polling.js @@ -49,7 +49,7 @@ Page({ recordHidden: true, }, jumpToReport (options) { - const key='巡检录入' + const key='主动上报' wx.navigateTo({ url: `/package/report/report?key=${key}`, })