From 7ef5817eb490f83cc37ee4a41e5822ddab35f31e Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Thu, 2 Mar 2023 09:43:02 +0800 Subject: [PATCH 1/3] =?UTF-8?q?(+)=20=E5=85=8Dtoken=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/patrolManage/patrolRecord.js | 26 ++++++++++++++++++- api/app/lib/middlewares/authenticator.js | 1 + .../lib/routes/patrolManage/patrolRecord.js | 4 +++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/api/app/lib/controllers/patrolManage/patrolRecord.js b/api/app/lib/controllers/patrolManage/patrolRecord.js index 6112c66..cf5a36a 100644 --- a/api/app/lib/controllers/patrolManage/patrolRecord.js +++ b/api/app/lib/controllers/patrolManage/patrolRecord.js @@ -136,6 +136,30 @@ async function findPatrolRecord (ctx, next) { } } +async function findPatrolRecordUnlicensed(ctx, next) { + let rslt = []; + let error = { name: 'FindError', message: '获取巡检记录失败' }; + try { + const models = ctx.fs.dc.models; + const { startTime, endTime } = ctx.query; + const options = { + where: {} + } + if (startTime && endTime) { + options.where.inspectionTime = { $between: [startTime, endTime] }; + } + rslt = await models.PatrolRecord.findAll(options); + ctx.status = 200; + ctx.body = rslt; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "获取巡检记录失败" + } + } +} + async function addPatrolRecord (ctx, next) { let error = { name: 'addError', message: '新增巡检记录失败' }; const transaction = await ctx.fs.dc.orm.transaction(); @@ -307,10 +331,10 @@ function editPatrolRecordIssueHandle (opts) { module.exports = { findPatrolRecord, + findPatrolRecordUnlicensed, addPatrolRecord, getPatrolRecordIssueHandle, getPatrolRecordIssueHandleById, addPatrolRecordIssueHandle, editPatrolRecordIssueHandle - } \ No newline at end of file diff --git a/api/app/lib/middlewares/authenticator.js b/api/app/lib/middlewares/authenticator.js index 447690d..b1c283e 100644 --- a/api/app/lib/middlewares/authenticator.js +++ b/api/app/lib/middlewares/authenticator.js @@ -59,6 +59,7 @@ let isPathExcluded = function (opts, path, method) { let excludeOpts = opts.exclude || []; excludeOpts.push({ p: '/login', o: 'POST' }); excludeOpts.push({ p: '/logout', o: 'PUT' }); + excludeOpts.push({ p: '/patrolRecord/unlicensed', o: 'GET' }); excludes = new ExcludesUrls(excludeOpts); } let excluded = excludeAll || excludes.isExcluded(path, method); diff --git a/api/app/lib/routes/patrolManage/patrolRecord.js b/api/app/lib/routes/patrolManage/patrolRecord.js index 2c21e7a..1535b07 100644 --- a/api/app/lib/routes/patrolManage/patrolRecord.js +++ b/api/app/lib/routes/patrolManage/patrolRecord.js @@ -7,6 +7,10 @@ module.exports = function (app, router, opts) { // 小程序端查点位最新一条数据:startTime、endTime、alarm不传 router.get('/patrolRecord/:patrolPlanId/:startTime/:endTime/:alarm/:pointId', patrolRecord.findPatrolRecord); + app.fs.api.logAttr['GET/patrolRecord/unlicensed'] = { content: '获取巡检记录', visible: true }; + // 获取巡检记录,免token,用与生成巡检报告 + router.get('/patrolRecord/unlicensed', patrolRecord.findPatrolRecordUnlicensed); + app.fs.api.logAttr['POST/patrolRecord/add'] = { content: '新增巡检记录', visible: true } router.post('/patrolRecord/add', patrolRecord.addPatrolRecord); From 49c231d1c89604ba9acf0ab9765d40d19d46a588 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Thu, 2 Mar 2023 10:01:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?(+)=20=E5=B7=A1=E6=A3=80=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/app.json | 3 +- weapp/images/inspection-report.svg | 1 + .../inspectionReport/inspectionReport.js | 66 +++++++++++++++++++ .../inspectionReport/inspectionReport.json | 3 + .../inspectionReport/inspectionReport.wxml | 2 + .../inspectionReport/inspectionReport.wxss | 1 + weapp/pages/overview/overview.js | 6 ++ weapp/pages/overview/overview.wxml | 6 +- 8 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 weapp/images/inspection-report.svg create mode 100644 weapp/package/inspectionReport/inspectionReport.js create mode 100644 weapp/package/inspectionReport/inspectionReport.json create mode 100644 weapp/package/inspectionReport/inspectionReport.wxml create mode 100644 weapp/package/inspectionReport/inspectionReport.wxss diff --git a/weapp/app.json b/weapp/app.json index 48ca4ea..c143865 100644 --- a/weapp/app.json +++ b/weapp/app.json @@ -15,7 +15,8 @@ "startInspection/startInspection", "inspectionInput/inspectionInput", "troubleshooting/index", - "troubleshooting/shootingForm/index" + "troubleshooting/shootingForm/index", + "inspectionReport/inspectionReport" ] } ], diff --git a/weapp/images/inspection-report.svg b/weapp/images/inspection-report.svg new file mode 100644 index 0000000..49ddb80 --- /dev/null +++ b/weapp/images/inspection-report.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/weapp/package/inspectionReport/inspectionReport.js b/weapp/package/inspectionReport/inspectionReport.js new file mode 100644 index 0000000..0fccf18 --- /dev/null +++ b/weapp/package/inspectionReport/inspectionReport.js @@ -0,0 +1,66 @@ +// package/inspectionReport/inspectionReport.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/weapp/package/inspectionReport/inspectionReport.json b/weapp/package/inspectionReport/inspectionReport.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/weapp/package/inspectionReport/inspectionReport.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/weapp/package/inspectionReport/inspectionReport.wxml b/weapp/package/inspectionReport/inspectionReport.wxml new file mode 100644 index 0000000..90de8ed --- /dev/null +++ b/weapp/package/inspectionReport/inspectionReport.wxml @@ -0,0 +1,2 @@ + +package/inspectionReport/inspectionReport.wxml diff --git a/weapp/package/inspectionReport/inspectionReport.wxss b/weapp/package/inspectionReport/inspectionReport.wxss new file mode 100644 index 0000000..b130672 --- /dev/null +++ b/weapp/package/inspectionReport/inspectionReport.wxss @@ -0,0 +1 @@ +/* package/inspectionReport/inspectionReport.wxss */ \ No newline at end of file diff --git a/weapp/pages/overview/overview.js b/weapp/pages/overview/overview.js index ca01b03..1bbd590 100644 --- a/weapp/pages/overview/overview.js +++ b/weapp/pages/overview/overview.js @@ -21,6 +21,12 @@ Page({ }) }, + bindInspectionReport() { + wx.navigateTo({ + url: '/package/inspectionReport/inspectionReport', + }) + }, + /** * 生命周期函数--监听页面加载 */ diff --git a/weapp/pages/overview/overview.wxml b/weapp/pages/overview/overview.wxml index f95e500..98ce914 100644 --- a/weapp/pages/overview/overview.wxml +++ b/weapp/pages/overview/overview.wxml @@ -10,9 +10,9 @@ 问题处理 - + \ No newline at end of file From 8ce3bea610e978a06d6771472f5ac3ac7c7b07ef Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Thu, 2 Mar 2023 13:35:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/issueHandle/containers/patrolRecord.js | 2 +- web/client/src/sections/issueHandle/nav-item.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/web/client/src/sections/issueHandle/containers/patrolRecord.js b/web/client/src/sections/issueHandle/containers/patrolRecord.js index ab3ed67..fe33a80 100644 --- a/web/client/src/sections/issueHandle/containers/patrolRecord.js +++ b/web/client/src/sections/issueHandle/containers/patrolRecord.js @@ -165,7 +165,7 @@ const PatrolRecord = (props) => { onFinish={onFinish} />) } - if (Func.isAuthorized('XIUGAIJIUHA') && (record?.patrolRecordIssueHandles[0]?.state == 3 || record?.patrolRecordIssueHandles[0]?.state == 2)) { + if (Func.isAuthorized('ZHIDINGJIHUA') && (record?.patrolRecordIssueHandles[0]?.state == 3 || record?.patrolRecordIssueHandles[0]?.state == 2)) { options.push(} key="issueHandle">