Browse Source

以id获取维修处理信息

master
巴林闲侠 2 years ago
parent
commit
0443001aca
  1. 26
      api/app/lib/controllers/patrolManage/patrolRecord.js
  2. 3
      api/app/lib/routes/patrolManage/patrolRecord.js
  3. 11
      weapp/package/troubleshooting/index.js
  4. 21
      weapp/package/troubleshooting/index.wxml

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

@ -238,6 +238,31 @@ async function getPatrolRecordIssueHandle (ctx) {
} }
} }
async function getPatrolRecordIssueHandleById (ctx) {
try {
const { models } = ctx.fs.dc;
const { id } = ctx.params
const res = await models.PatrolRecordIssueHandle.findOne({
where: {
},
include: [{
model: models.PatrolRecord
}]
})
ctx.status = 200;
ctx.body = res
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
// 新建维修处理计划成功 // 新建维修处理计划成功
function addPatrolRecordIssueHandle (opts) { function addPatrolRecordIssueHandle (opts) {
return async function (ctx, next) { return async function (ctx, next) {
@ -284,6 +309,7 @@ module.exports = {
findPatrolRecord, findPatrolRecord,
addPatrolRecord, addPatrolRecord,
getPatrolRecordIssueHandle, getPatrolRecordIssueHandle,
getPatrolRecordIssueHandleById,
addPatrolRecordIssueHandle, addPatrolRecordIssueHandle,
editPatrolRecordIssueHandle editPatrolRecordIssueHandle

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

@ -13,6 +13,9 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/patrolRecord/issue/handle'] = { content: '获取维修处理计划', visible: true }; app.fs.api.logAttr['GET/patrolRecord/issue/handle'] = { content: '获取维修处理计划', visible: true };
router.get('/patrolRecord/issue/handle', patrolRecord.getPatrolRecordIssueHandle) router.get('/patrolRecord/issue/handle', patrolRecord.getPatrolRecordIssueHandle)
app.fs.api.logAttr['GET/patrolRecord/issue/handle/:id'] = { content: '以id获取维修处理信息', visible: true };
router.get('/patrolRecord/issue/handle/:id', patrolRecord.getPatrolRecordIssueHandleById)
app.fs.api.logAttr['POST/patrolRecord/issue/handle'] = { content: '增加维修处理计划', visible: true }; app.fs.api.logAttr['POST/patrolRecord/issue/handle'] = { content: '增加维修处理计划', visible: true };
router.post('/patrolRecord/issue/handle', patrolRecord.addPatrolRecordIssueHandle(opts)) router.post('/patrolRecord/issue/handle', patrolRecord.addPatrolRecordIssueHandle(opts))

11
weapp/package/troubleshooting/index.js

@ -1,6 +1,7 @@
// package/bindTroubleshooting/index.js // package/bindTroubleshooting/index.js
import { getPatrolRecordIssueHandle } from "../../utils/getApiUrl"; import { getPatrolRecordIssueHandle } from "../../utils/getApiUrl";
import { Request } from "../../common"; import { Request } from "../../common";
const moment = require("../../utils/moment");
Page({ Page({
@ -8,7 +9,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
// hidden: true, dataList: [],
currentTab: '0', currentTab: '0',
// 筛选选择 // 筛选选择
structList: ['a', 'b', 'c'], structList: ['a', 'b', 'c'],
@ -45,6 +46,14 @@ Page({
...params, ...params,
}).then(res => { }).then(res => {
console.log(res); console.log(res);
this.setData({
dataList: res.map(r => {
return {
...r,
createTime: r.createTime ? moment(r.createTime).format('YYYY-MM-DD HH:mm:ss') : '--'
}
})
})
}) })
}, },

21
weapp/package/troubleshooting/index.wxml

@ -44,18 +44,27 @@
</view> </view>
<view style="height:100vh - 98rpx; padding-top:24rpx; overflow:auto"> <view style="height:100vh - 98rpx; padding-top:24rpx; overflow:auto">
<van-cell-group inset class="mission-card"> <van-cell-group inset class="mission-card">
<view wx:for="{{dataList}}">
<view class="mission-card-title"> <view class="mission-card-title">
<span>asd</span> <span>{{item.PatrolRecord.points.project.name}}</span>
<van-button type="info" round bind:tap="toShootingForm" data-shootingid="{{5}}"> <van-button type="info" round bind:tap="toShootingForm" data-shootingid="{{5}}">
按钮 {{
item.state == 1 ?'制定计划':
item.state == 2 ?'审批计划':
item.state == 3 ?'修改计划':
item.state == 4 ?'维修处理':
item.state == 5 ?'质检验收':
item.state == 6 ?'驳回重修':'查看详情'
}}
</van-button> </van-button>
</view> </view>
<van-field value="输入框已禁用" label="点位名称" readonly border="{{ false }}" /> <van-field value="{{item.PatrolRecord.points.itemData.name}}" label="点位名称" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="异常等级" readonly border="{{ false }}" /> <van-field value="{{item.PatrolRecord.points.itemData.name}}" label="异常等级" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="任务下发时间" readonly border="{{ false }}" /> <van-field value="{{ item.createTime}}" label="任务下发时间" readonly border="{{ false }}" />
</view>
</van-cell-group> </van-cell-group>
<!-- 暂无数据 --> <!-- 暂无数据 -->
<view hidden="{{hidden}}"> <view wx:if="{{!dataList.length}}">
<image class="noData" src="../../images/noData.png"></image> <image class="noData" src="../../images/noData.png"></image>
<view class="noTxt">暂无数据~</view> <view class="noTxt">暂无数据~</view>
</view> </view>

Loading…
Cancel
Save