From 2531e0bfc90679b56e851089e9138d4d81a43d2f Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Sat, 21 Oct 2023 17:17:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86=E5=B7=A1?= =?UTF-8?q?=E6=A3=80=E8=AE=B0=E5=BD=95=E5=B1=95=E7=A4=BA=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../troubleshooting/shootingForm/index.js | 63 ++++++++++--------- .../troubleshooting/shootingForm/index.wxml | 41 ++++++------ 2 files changed, 57 insertions(+), 47 deletions(-) diff --git a/weapp/package/troubleshooting/shootingForm/index.js b/weapp/package/troubleshooting/shootingForm/index.js index b737d0a..c40e7c2 100644 --- a/weapp/package/troubleshooting/shootingForm/index.js +++ b/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() { } }) \ No newline at end of file diff --git a/weapp/package/troubleshooting/shootingForm/index.wxml b/weapp/package/troubleshooting/shootingForm/index.wxml index 5a872b9..c62ac73 100644 --- a/weapp/package/troubleshooting/shootingForm/index.wxml +++ b/weapp/package/troubleshooting/shootingForm/index.wxml @@ -15,26 +15,29 @@ - - - - - - - - - - - 现场照片 - - - - + + + + + + + + + + + + + 现场照片 + + + + + - - - - + + + +