From 31773e156f9ebca72588ddf4149179ce1592ed8b Mon Sep 17 00:00:00 2001 From: SelfRidicule Date: Wed, 14 Aug 2024 15:12:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=8F=E8=BF=B0:=E9=87=8D=E6=96=B0=E6=B4=BE?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/app.js | 32 ++-- .../pages/reportRepair/assign/again/again.js | 170 ++++++++++++++++-- .../reportRepair/assign/again/again.json | 5 +- .../reportRepair/assign/again/again.wxml | 22 ++- .../reportRepair/assign/detail/detail.js | 12 ++ .../reportRepair/assign/detail/detail.wxml | 4 +- 6 files changed, 209 insertions(+), 36 deletions(-) diff --git a/miniprogram/app.js b/miniprogram/app.js index 2cc93c6..76a0687 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -303,21 +303,33 @@ App({ }) }, // 消息提示 - vantNotify(Notify, msg, type) { - if (!type) { - type = 'primary' - } - Notify({ + vantNotify(Notify, msg, type, top) { + let data = { type, - message: msg - }); + message: msg, + } + if (!type) { + data.type = 'primary' + } + if (top) { + data.top = top + } + Notify(data); }, // 消息提示 vantNotifySuccess(Notify, msg) { - this.vantNotify(Notify , msg , 'primary') + this.vantNotify(Notify, msg, 'primary') }, // 消息提示 vantNotifyErr(Notify, msg) { - this.vantNotify(Notify , msg , 'danger') - }, + this.vantNotify(Notify, msg, 'danger') + }, + // 消息提示 + vantNotifySuccessTop(Notify, msg) { + this.vantNotify(Notify, msg, 'primary', 90) + }, + // 消息提示 + vantNotifyErrTop(Notify, msg) { + this.vantNotify(Notify, msg, 'danger', 90) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/assign/again/again.js b/miniprogram/pages/reportRepair/assign/again/again.js index 2b5806b..b0d231c 100644 --- a/miniprogram/pages/reportRepair/assign/again/again.js +++ b/miniprogram/pages/reportRepair/assign/again/again.js @@ -1,8 +1,13 @@ const app = getApp() +import Notify from '@vant/weapp/notify/notify'; + import { + deviceTypeListRq, + deviceListRq, getDetailRq, - getStatusName + getStatusName, + flowHandleRq } from "../../../../api/repair/repair.js" Page({ @@ -14,6 +19,21 @@ Page({ IMG_NAME: app.IMG_NAME, id: '', detail: {}, + currentLog: {}, + typeVisible: false, + typeColumns: [{ + values: [], + className: 'column1', + }, + { + values: [], + className: 'column2', + }, + ], + "typeId": null, //故障类型 + "typeName": "", //故障名称 + "deviceId": null, //设备 + "deviceName": "", //设备名称 }, /** @@ -26,9 +46,11 @@ Page({ ...options }) _this.getDetail(options.id) + // 查询设备类型 + _this.queryDeviceType() }, - back(){ + back() { wx.navigateBack() }, @@ -41,31 +63,147 @@ Page({ // 详情 let detail = res.repair detail.statusName = getStatusName(detail.status) - + + // 日志 + if (detail.logId) { + let firstLog = res.log.find(item => item.id == detail.logId) + if (firstLog) { + let preLog = res.log.find(item => item.id == firstLog.pid) + _this.setData({ + currentLog: preLog + }) + } + } + _this.setData({ detail, }) }) }, - - // 确认损坏 - jumpAffirm(){ - wx.navigateTo({ - url: '/pages/reportRepair/assign/affirm/affirm', + + showType() { + this.setData({ + typeVisible: true, }) }, - - // 提交反馈 - jumpFeedback(){ - wx.navigateTo({ - url: '/pages/reportRepair/assign/feedback/feedback', + hideType() { + this.setData({ + typeVisible: false, }) }, - // 无效 - invalid(){ - wx.navigateBack() + // 查询设备类型 + queryDeviceType() { + let _this = this + deviceTypeListRq().then(res => { + console.log('deviceTypeListRq', res); + let list = res.rows.map(item => { + return { + id: item.id, + text: item.name + } + }) + let typeColumns = _this.data.typeColumns + typeColumns[0].values = list + _this.setData({ + typeColumns + }) + // 查询设备 + _this.queryDevice(list[0].id) + }) + }, + + // 查询设备 + queryDevice(id) { + let _this = this + + deviceListRq({ + typeId: id + }).then(res => { + console.log('deviceListRq', res); + let list = res.rows.map(item => { + return { + id: item.id, + text: item.name + } + }) + let typeColumns = _this.data.typeColumns + typeColumns[1].values = list + _this.setData({ + typeColumns + }) + }) + }, + + // 选择设备类型 + typeColumnsChange(e) { + console.log('typeColumnsChange', e.detail); + let _this = this + const { + picker, + value, + index + } = e.detail; + if (index == 0) { // 选择类型 + let obj = value[index] + _this.queryDevice(obj.id) + + } else if (index == 1) { // 选择设备 + let obj = value[index] + } + }, + + // 确认设备 + typeColumnsConfirm(e) { + console.log('typeColumnsConfirm', e.detail); + let _this = this + const { + picker, + value, + index + } = e.detail; + + _this.setData({ + typeId: value[0].id, + typeName: value[0].text, + deviceId: value[1].id, + deviceName: value[1].text, + typeVisible: false + }) + }, + + submit() { + let _this = this + // 参数校验 + if (!_this.data.typeId) { + // 危险通知 + app.vantNotifyErrTop(Notify, '请选择故障类型!') + return + } + // 提交参数 + let data = { + "repair": { + id: _this.data.id, + typeId: _this.data.typeId, + typeName: _this.data.typeName, + deviceId: _this.data.deviceId, + deviceName: _this.data.deviceName, + }, + "content": '重新指派设备类型', + "operate": "NEXT" + } + flowHandleRq(data).then(res => { + console.log('flowHandleRq', res); + if (res.code == 0) { + app.vantNotifySuccessTop(Notify, res.msg) + wx.navigateBack({ + delta: 2 + }) + } else { + app.vantNotifyErrTop(Notify, res.msg) + } + }) }, /** diff --git a/miniprogram/pages/reportRepair/assign/again/again.json b/miniprogram/pages/reportRepair/assign/again/again.json index 02854d6..8b91fd3 100644 --- a/miniprogram/pages/reportRepair/assign/again/again.json +++ b/miniprogram/pages/reportRepair/assign/again/again.json @@ -1,6 +1,9 @@ { "navigationStyle": "custom", "usingComponents": { - "van-icon": "@vant/weapp/icon/index" + "van-icon": "@vant/weapp/icon/index", + "van-popup": "@vant/weapp/popup/index", + "van-notify": "@vant/weapp/notify/index", + "van-picker": "@vant/weapp/picker/index" } } \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/assign/again/again.wxml b/miniprogram/pages/reportRepair/assign/again/again.wxml index 067da2d..cac5a4e 100644 --- a/miniprogram/pages/reportRepair/assign/again/again.wxml +++ b/miniprogram/pages/reportRepair/assign/again/again.wxml @@ -22,28 +22,36 @@ - 反馈 + 派单反馈 反馈人员 - 王军 + {{currentLog.recUserName}} 反馈描述 - 类型不一致类型不一致类型不一致类型不一致类型不一致 + {{currentLog.content}} 故障类型 - - 请选择重新选择故障类型 + + {{ typeName ? typeName + '/' + deviceName : '请选择故障类型' }} - 提交 + 提交 + - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/assign/detail/detail.js b/miniprogram/pages/reportRepair/assign/detail/detail.js index 32dde06..e0c64d4 100644 --- a/miniprogram/pages/reportRepair/assign/detail/detail.js +++ b/miniprogram/pages/reportRepair/assign/detail/detail.js @@ -17,6 +17,7 @@ Page({ id: '', detail: {}, files: {}, + currentLog: {}, innerAudioContext: null, // 音频对象 innerAudioContextIsPlay: false, // 音频对象-是否播放 }, @@ -56,6 +57,17 @@ Page({ item.url = app.IMG_NAME + item.url return item }) + // 日志 + if (detail.logId) { + let firstLog = res.log.find(item => item.id == detail.logId) + if (firstLog) { + let preLog = res.log.find(item => item.id == firstLog.pid) + _this.setData({ + currentLog: preLog + }) + } + } + _this.setData({ detail, files diff --git a/miniprogram/pages/reportRepair/assign/detail/detail.wxml b/miniprogram/pages/reportRepair/assign/detail/detail.wxml index 64d41f0..d468054 100644 --- a/miniprogram/pages/reportRepair/assign/detail/detail.wxml +++ b/miniprogram/pages/reportRepair/assign/detail/detail.wxml @@ -84,11 +84,11 @@ 反馈人员 - 王军 + {{currentLog.recUserName}} 反馈描述 - 类型不一致类型不一致类型不一致类型不一致类型不一致 + {{currentLog.content}}