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){
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: '上报问题失败' }

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

Loading…
Cancel
Save