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}`, })