Browse Source

问题处理巡检记录展示设备信息

master
liujiangyong 1 year ago
parent
commit
2531e0bfc9
  1. 63
      weapp/package/troubleshooting/shootingForm/index.js
  2. 41
      weapp/package/troubleshooting/shootingForm/index.wxml

63
weapp/package/troubleshooting/shootingForm/index.js

@ -47,7 +47,7 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
onLoad(options) {
const { shootingid, tabIndex } = options
if (shootingid) {
this.setData({
@ -69,14 +69,20 @@ Page({
points: {
...issue.PatrolRecord.points,
inspectContent: (() => {
let inspectContent = []
for (let k in issue.PatrolRecord.points.inspectContent) {
inspectContent.push({
...issue.PatrolRecord.points.inspectContent[k],
itemName: k
})
// 1.1 版本(2023-10-18)之前 dataList.points.inspectContent 为 Object, 1.1版本因增加点位关联设备改为 Array
const priorToV1_1 = moment(issue.PatrolRecord.inspectionTime).isBefore(moment('2023-10-18'))
if (priorToV1_1) {
let inspectContent = []
for (let k in issue.PatrolRecord.points.inspectContent) {
inspectContent.push({
...issue.PatrolRecord.points.inspectContent[k],
name: k,
})
}
return [{ checkItems: inspectContent }]
} else {
return issue.PatrolRecord.points.inspectContent
}
return inspectContent
})()
}
}
@ -88,6 +94,7 @@ Page({
isRepair: tabIndex == 0 && (issue.state == 4 || issue.state == 7),
isCheck: tabIndex == 0 && issue.state == 5,
})
console.log(nextData, 'nextData')
this.setData({
strucFocusUser: {
...strucUser,
@ -135,13 +142,13 @@ Page({
}
},
onPointItemCollapseActiveChange (event) {
onPointItemCollapseActiveChange(event) {
this.setData({
pointItemCollapseActiveNames: event.detail,
});
},
onMaintenancePersonPopupChange (e) {
onMaintenancePersonPopupChange(e) {
if (e.target.dataset.type == 'zhijian') {
this.setData({
qualityPersonIndex: e.detail.value
@ -155,13 +162,13 @@ Page({
}
},
showPlanStartTimePopup () {
showPlanStartTimePopup() {
if (this.data.isPlanState) {
this.setData({ planStartTimePopupShow: true })
}
},
closePlanStartTimePopup (e) {
closePlanStartTimePopup(e) {
this.setData({ planStartTimePopupShow: false })
if (e.target.dataset.option == 'cancel') {
// this.setData({ planStartTime: '' })
@ -172,19 +179,19 @@ Page({
}
},
onPlanStartTimeChange (event) {
onPlanStartTimeChange(event) {
this.setData({
planStartTime: event.detail,
})
},
showPlanEndTimePopup () {
showPlanEndTimePopup() {
if (this.data.isPlanState) {
this.setData({ planEndTimePopupShow: true })
}
},
closePlanEndTimePopup (e) {
closePlanEndTimePopup(e) {
this.setData({ planEndTimePopupShow: false })
if (e.target.dataset.option == 'confirmed') {
this.setData({
@ -193,13 +200,13 @@ Page({
}
},
onPlanEndTimeChange (event) {
onPlanEndTimeChange(event) {
this.setData({
planEndTime: event.detail,
})
},
onInputChange (e) {
onInputChange(e) {
let value = e.detail.value
if (e.target.dataset.type === 'cost' && !/^(\d?)+(\.\d{0,2})?$/.test(e.detail.value)) {
wx.showToast({
@ -215,8 +222,8 @@ Page({
// 预览图片
previewImg: function (e) {
const { index, itemindex, type } = e.currentTarget.dataset
const imgs = type == 'point' ? this.data.data.PatrolRecord.points.inspectContent[itemindex].imgs : this.data[type];
const { index, itemindex, deviceidx, type } = e.currentTarget.dataset
const imgs = type == 'point' ? this.data.data.PatrolRecord.points.inspectContent[deviceidx].checkItems[itemindex].imgs : this.data[type];
const newImgs = imgs.map(i => this.data.imgServer + i);
wx.previewImage({
current: newImgs[index],
@ -324,7 +331,7 @@ Page({
});
},
async confirm (e) {
async confirm(e) {
const { approve } = e.target.dataset
const { state } = this.data.data
const {
@ -465,7 +472,7 @@ Page({
})
},
mustInput (field) {
mustInput(field) {
let fieldMap = {
repairPerson: '维修人',
checkPerson: '质检人',
@ -488,49 +495,49 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady () {
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide () {
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload () {
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () {
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom () {
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage () {
onShareAppMessage() {
}
})

41
weapp/package/troubleshooting/shootingForm/index.wxml

@ -15,26 +15,29 @@
</view>
<van-field value="{{data.PatrolRecord.points.itemData.name}}" label="点位" readonly accordion />
<van-collapse wx:if="{{data.PatrolRecord.points.inspectContent}}" value="{{ pointItemCollapseActiveNames }}" bind:change="onPointItemCollapseActiveChange" border="{{false}}">
<block wx:for="{{data.PatrolRecord.points.inspectContent}}" wx:key="index">
<van-collapse-item wx:if="{{!item.isNormal}}" name="{{item.itemName}}" border="{{false}}">
<view slot="title">
<van-field value="{{item.itemName}}" label="检查项" readonly />
</view>
<view slot="">
<van-field value="{{item.level}}" label="异常等级" readonly />
<van-field value="{{item.msgInp||''}}" label="问题描述" readonly />
<van-cell border="{{false}}">
<view style="display:flex">
<view class="fs-cell-title" style="">现场照片</view>
<view class="fs-cell-content" style="">
<block wx:for="{{item.imgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex">
<image style="height:160rpx;width:160rpx;padding-right:12rpx;" src="{{imgServer+imgUrl}}" data-img="{{imgServer+imgUrl}}" data-index="{{imgIndex}}" data-key="{{imgIndex}}" data-itemindex="{{index}}" mode="aspectFill" bindtap="previewImg" data-type="point"></image>
</block>
<block wx:for="{{data.PatrolRecord.points.inspectContent}}" wx:key="index" wx:for-item="device" wx:for-index="deviceidx">
<van-field wx:if="{{device.deviceName && device.alarm}}" value="{{device.deviceName}}" label="设备" readonly accordion />
<block wx:for="{{device.checkItems}}">
<van-collapse-item wx:if="{{!item.isNormal}}" name="{{item.id}}" border="{{false}}">
<view slot="title">
<van-field value="{{item.name}}" label="检查项" readonly />
</view>
<view slot="">
<van-field value="{{item.level}}" label="异常等级" readonly />
<van-field value="{{item.msgInp||''}}" label="问题描述" readonly />
<van-cell border="{{false}}">
<view style="display:flex">
<view class="fs-cell-title" style="">现场照片</view>
<view class="fs-cell-content" style="">
<block wx:for="{{item.imgs}}" wx:for-index="imgIndex" wx:for-item="imgUrl" wx:key="imgIndex">
<image style="height:160rpx;width:160rpx;padding-right:12rpx;" src="{{imgServer+imgUrl}}" data-img="{{imgServer+imgUrl}}" data-index="{{imgIndex}}" data-key="{{imgIndex}}" data-itemindex="{{index}}" data-deviceidx="{{deviceidx}}" mode="aspectFill" bindtap="previewImg" data-type="point"></image>
</block>
</view>
</view>
</view>
</van-cell>
</view>
</van-collapse-item>
</van-cell>
</view>
</van-collapse-item>
</block>
</block>
</van-collapse>
<view class="mission-card-title mission-center-card-title">

Loading…
Cancel
Save