Browse Source

feat:修改上报逻辑

master
zhaobing’ 2 years ago
parent
commit
093afea5fa
  1. 11
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 2
      weapp/package/polling/polling.js

11
api/app/lib/controllers/patrolManage/patrolRecord.js

@ -646,6 +646,7 @@ function getTemplate(opts){
function reportQuest(opts){ function reportQuest(opts){
return async function (ctx, next){ return async function (ctx, next){
try{ try{
const transaction = await ctx.fs.dc.orm.transaction();
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const data = ctx.request.body; const data = ctx.request.body;
let { patrolPlanId, inspectionTime, points, alarm, pointId, projectId } = data let { patrolPlanId, inspectionTime, points, alarm, pointId, projectId } = data
@ -665,10 +666,18 @@ function reportQuest(opts){
alarm, alarm,
pointId: pointId, pointId: pointId,
projectId projectId
} },{transaction}
); );
if (alarm) {
await models.PatrolRecordIssueHandle.create({
patrolRecordId: recordRes.id,
state: 1,
}, { transaction });
}
await transaction.commit();
ctx.status = 204; ctx.status = 204;
}catch(error){ }catch(error){
await transaction.rollback();
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400; ctx.status = 400;
ctx.body = { message: '上报问题失败' } ctx.body = { message: '上报问题失败' }

2
weapp/package/polling/polling.js

@ -49,7 +49,7 @@ Page({
recordHidden: true, recordHidden: true,
}, },
jumpToReport (options) { jumpToReport (options) {
const key='巡检录入' const key='主动上报'
wx.navigateTo({ wx.navigateTo({
url: `/package/report/report?key=${key}`, url: `/package/report/report?key=${key}`,
}) })

Loading…
Cancel
Save