巴林闲侠 2 years ago
parent
commit
3ff726e2b7
  1. 26
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 1
      api/app/lib/middlewares/authenticator.js
  3. 4
      api/app/lib/routes/patrolManage/patrolRecord.js
  4. 3
      weapp/app.json
  5. 1
      weapp/images/inspection-report.svg
  6. 66
      weapp/package/inspectionReport/inspectionReport.js
  7. 3
      weapp/package/inspectionReport/inspectionReport.json
  8. 2
      weapp/package/inspectionReport/inspectionReport.wxml
  9. 1
      weapp/package/inspectionReport/inspectionReport.wxss
  10. 6
      weapp/pages/overview/overview.js
  11. 6
      weapp/pages/overview/overview.wxml
  12. 2
      web/client/src/sections/issueHandle/containers/patrolRecord.js
  13. 3
      web/client/src/sections/issueHandle/nav-item.js

26
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) { async function addPatrolRecord (ctx, next) {
let error = { name: 'addError', message: '新增巡检记录失败' }; let error = { name: 'addError', message: '新增巡检记录失败' };
const transaction = await ctx.fs.dc.orm.transaction(); const transaction = await ctx.fs.dc.orm.transaction();
@ -307,10 +331,10 @@ function editPatrolRecordIssueHandle (opts) {
module.exports = { module.exports = {
findPatrolRecord, findPatrolRecord,
findPatrolRecordUnlicensed,
addPatrolRecord, addPatrolRecord,
getPatrolRecordIssueHandle, getPatrolRecordIssueHandle,
getPatrolRecordIssueHandleById, getPatrolRecordIssueHandleById,
addPatrolRecordIssueHandle, addPatrolRecordIssueHandle,
editPatrolRecordIssueHandle editPatrolRecordIssueHandle
} }

1
api/app/lib/middlewares/authenticator.js

@ -59,6 +59,7 @@ let isPathExcluded = function (opts, path, method) {
let excludeOpts = opts.exclude || []; let excludeOpts = opts.exclude || [];
excludeOpts.push({ p: '/login', o: 'POST' }); excludeOpts.push({ p: '/login', o: 'POST' });
excludeOpts.push({ p: '/logout', o: 'PUT' }); excludeOpts.push({ p: '/logout', o: 'PUT' });
excludeOpts.push({ p: '/patrolRecord/unlicensed', o: 'GET' });
excludes = new ExcludesUrls(excludeOpts); excludes = new ExcludesUrls(excludeOpts);
} }
let excluded = excludeAll || excludes.isExcluded(path, method); let excluded = excludeAll || excludes.isExcluded(path, method);

4
api/app/lib/routes/patrolManage/patrolRecord.js

@ -7,6 +7,10 @@ module.exports = function (app, router, opts) {
// 小程序端查点位最新一条数据:startTime、endTime、alarm不传 // 小程序端查点位最新一条数据:startTime、endTime、alarm不传
router.get('/patrolRecord/:patrolPlanId/:startTime/:endTime/:alarm/:pointId', patrolRecord.findPatrolRecord); 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 } app.fs.api.logAttr['POST/patrolRecord/add'] = { content: '新增巡检记录', visible: true }
router.post('/patrolRecord/add', patrolRecord.addPatrolRecord); router.post('/patrolRecord/add', patrolRecord.addPatrolRecord);

3
weapp/app.json

@ -15,7 +15,8 @@
"startInspection/startInspection", "startInspection/startInspection",
"inspectionInput/inspectionInput", "inspectionInput/inspectionInput",
"troubleshooting/index", "troubleshooting/index",
"troubleshooting/shootingForm/index" "troubleshooting/shootingForm/index",
"inspectionReport/inspectionReport"
] ]
} }
], ],

1
weapp/images/inspection-report.svg

@ -0,0 +1 @@
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1742" height="128" width="128"><path d="M947.330443 280.886557L740.015166 73.57128c-13.659654-13.659654-35.779673-13.648391-49.42704 0L71.584942 692.57344c-13.648391 13.648391-13.659654 35.767386 0 49.42704l207.315277 207.315277c13.659654 13.659654 35.779673 13.648391 49.42704 0l619.00216-619.00216c13.649415-13.647367 13.661702-35.767386 0.001024-49.42704zM303.614763 875.175196L145.726527 717.28696l39.749276-39.749276 27.055146 27.055146c13.659654 13.659654 35.779673 13.648391 49.42704 0 13.648391-13.648391 13.659654-35.767386 0-49.427041l-27.055146-27.055145 39.749276-39.749276 27.055146 27.055145c13.659654 13.659654 35.779673 13.648391 49.42704 0 13.648391-13.648391 13.659654-35.767386 0-49.428064l-27.055146-27.055146 39.749276-39.749276 27.055146 27.055146c13.659654 13.659654 35.779673 13.648391 49.42704 0 13.648391-13.648391 13.660678-35.767386 0-49.428064l-27.055146-27.055146 39.749276-39.749276 27.055146 27.055146c13.659654 13.659654 35.779673 13.648391 49.42704 0 13.648391-13.648391 13.660678-35.767386 0-49.428064l-27.055145-27.055146 39.749276-39.749276 27.055146 27.055146c13.659654 13.659654 35.779673 13.648391 49.42704 0 13.648391-13.648391 13.659654-35.767386 0-49.42704l-27.055146-27.055146 39.738013-39.738013 27.055146 27.055145c13.659654 13.660678 35.779673 13.648391 49.42704 0 13.648391-13.648391 13.659654-35.767386 0-49.42704l-27.055146-27.055146 34.52439-34.524389 157.888236 157.888237-569.571024 569.574095z" fill="#3E3A39" p-id="1743"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

66
weapp/package/inspectionReport/inspectionReport.js

@ -0,0 +1,66 @@
// package/inspectionReport/inspectionReport.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
weapp/package/inspectionReport/inspectionReport.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
weapp/package/inspectionReport/inspectionReport.wxml

@ -0,0 +1,2 @@
<!--package/inspectionReport/inspectionReport.wxml-->
<text>package/inspectionReport/inspectionReport.wxml</text>

1
weapp/package/inspectionReport/inspectionReport.wxss

@ -0,0 +1 @@
/* package/inspectionReport/inspectionReport.wxss */

6
weapp/pages/overview/overview.js

@ -21,6 +21,12 @@ Page({
}) })
}, },
bindInspectionReport() {
wx.navigateTo({
url: '/package/inspectionReport/inspectionReport',
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */

6
weapp/pages/overview/overview.wxml

@ -10,9 +10,9 @@
<view class="txt">问题处理</view> <view class="txt">问题处理</view>
<image class="right" src="/images/right.svg"></image> <image class="right" src="/images/right.svg"></image>
</view> </view>
<!-- <view class="box"> <view class="box" bindtap="bindInspectionReport">
<image class="logo" src="/images/tabBar/icon_menu.png"></image> <image class="logo" src="/images/inspection-report.svg"></image>
<view class="txt">巡检报告</view> <view class="txt">巡检报告</view>
<image class="right" src="/images/right.svg"></image> <image class="right" src="/images/right.svg"></image>
</view> --> </view>
</view> </view>

2
web/client/src/sections/issueHandle/containers/patrolRecord.js

@ -165,7 +165,7 @@ const PatrolRecord = (props) => {
onFinish={onFinish} />) 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(<IssueHandleModal options.push(<IssueHandleModal
structsUsers={structsUsers} structsUsers={structsUsers}
editData={record} editData={record}

3
web/client/src/sections/issueHandle/nav-item.js

@ -10,8 +10,7 @@ export function getNavItem(user, dispatch) {
// return null // return null
// } // }
return ( return (
(Func.isAuthorized("XIUGAIJIUHA") (Func.isAuthorized("SHENHE")
|| Func.isAuthorized("SHENHE")
|| Func.isAuthorized("ZHIDINGJIHUA") || Func.isAuthorized("ZHIDINGJIHUA")
|| Func.isAuthorized("CHAKANXIANGQING")) && || Func.isAuthorized("CHAKANXIANGQING")) &&
<Menu.Item icon={<SettingOutlined />} key="issueHandle"> <Menu.Item icon={<SettingOutlined />} key="issueHandle">

Loading…
Cancel
Save