2024-07-26 17:28:44 +08:00
|
|
|
let app = getApp();
|
|
|
|
|
|
|
|
import Notify from '@vant/weapp/notify/notify';
|
|
|
|
|
|
|
|
import {
|
|
|
|
selfFormatTimeYMDHMS
|
|
|
|
} from "../../../utils/util.js"
|
|
|
|
|
|
|
|
import {
|
2024-08-07 11:02:13 +08:00
|
|
|
deviceTypeListRq,
|
|
|
|
deviceListRq,
|
|
|
|
selectAddressListRq,
|
|
|
|
selectRoomListRq,
|
2024-08-07 14:06:17 +08:00
|
|
|
repairSaveRq,
|
2024-08-07 11:02:13 +08:00
|
|
|
} from "../../../api/repair/repair.js"
|
2024-07-26 17:28:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
IMG_NAME: app.IMG_NAME,
|
|
|
|
id: null,
|
|
|
|
title: null,
|
|
|
|
userDetail: {},
|
2024-08-06 17:32:38 +08:00
|
|
|
recorderManager: null, // 录音对象
|
|
|
|
voiceObj: {}, // 录音文件对象
|
|
|
|
innerAudioContext: null, // 音频对象
|
|
|
|
innerAudioContextIsPlay: false, // 音频对象-是否播放
|
2024-08-07 11:02:13 +08:00
|
|
|
faultLevelShow: false,
|
|
|
|
faultLevelList: [{
|
|
|
|
name: '一级',
|
|
|
|
}, {
|
|
|
|
name: '二级',
|
|
|
|
}, {
|
|
|
|
name: '三级',
|
2024-07-26 17:28:44 +08:00
|
|
|
}, ],
|
2024-08-07 11:02:13 +08:00
|
|
|
failureDateShow: false, // 故障时间show
|
|
|
|
failureDate: new Date().getTime(), // 故障时间-当前
|
|
|
|
failureMinDate: new Date().getTime(), // 故障时间-最小
|
|
|
|
typeVisible: false,
|
|
|
|
typeName: '',
|
|
|
|
typeColumns: [{
|
|
|
|
values: [],
|
|
|
|
className: 'column1',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
values: [],
|
|
|
|
className: 'column2',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
addressVisible: false,
|
|
|
|
addressName: '',
|
|
|
|
addressColumns: [{
|
|
|
|
values: [],
|
|
|
|
className: 'column1',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
values: [],
|
|
|
|
className: 'column2',
|
|
|
|
},
|
|
|
|
],
|
2024-07-26 17:28:44 +08:00
|
|
|
fileList: [], // 上传文件
|
|
|
|
detail: {
|
2024-08-07 11:02:13 +08:00
|
|
|
"repairName": "", //维修名称
|
|
|
|
"repairLevel": "", //维修等级
|
|
|
|
"failureDate": null, //故障时间
|
2024-08-07 14:06:17 +08:00
|
|
|
"typeId": null, //故障类型
|
2024-08-07 11:02:13 +08:00
|
|
|
"repairDevice": null, //维修设备
|
|
|
|
"name": "", //用户名
|
|
|
|
"phone": "", //手机号码
|
2024-08-07 14:06:17 +08:00
|
|
|
"addressId": null, // 地点id
|
|
|
|
"roomId": null, // 楼层id
|
2024-08-07 11:02:13 +08:00
|
|
|
"area": "", // 门牌号
|
2024-08-07 14:06:17 +08:00
|
|
|
"content": "", // 描述
|
|
|
|
"repairVoice": "", // 语音文件
|
|
|
|
"repairImages": "", //故障图片
|
2024-07-26 17:28:44 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
console.log('onLoad', options)
|
|
|
|
let _this = this;
|
|
|
|
let userDetail = wx.getStorageSync('user')
|
|
|
|
//
|
|
|
|
let detail = _this.data.detail;
|
2024-08-08 09:28:05 +08:00
|
|
|
detail.phone = userDetail.mobile
|
2024-07-26 17:28:44 +08:00
|
|
|
_this.setData({
|
|
|
|
...options,
|
|
|
|
userDetail,
|
|
|
|
detail
|
|
|
|
})
|
|
|
|
// 页面初始化 options为页面跳转所带来的参数
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
|
title: options.title
|
|
|
|
})
|
|
|
|
|
2024-08-06 17:32:38 +08:00
|
|
|
// 初始化录音
|
|
|
|
_this.initRecording()
|
2024-08-07 11:02:13 +08:00
|
|
|
|
|
|
|
// 查询设备类型
|
|
|
|
_this.queryDeviceType()
|
|
|
|
|
|
|
|
// 查询地点
|
|
|
|
_this.queryAddress()
|
2024-07-26 17:28:44 +08:00
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
// 显示-故障等级
|
|
|
|
showFaultLevel() {
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
faultLevelShow: true
|
2024-07-26 17:28:44 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
// 选择-故障等级
|
|
|
|
selectFaultLevel(e) {
|
|
|
|
console.log('selectFaultLevel', e);
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
|
|
|
let detail = _this.data.detail;
|
2024-08-07 11:02:13 +08:00
|
|
|
detail.repairLevel = e.detail.name;
|
2024-07-26 17:28:44 +08:00
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
faultLevelShow: false,
|
2024-07-26 17:28:44 +08:00
|
|
|
detail
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
// 关闭-故障等级
|
|
|
|
closeFaultLevel() {
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
faultLevelShow: false
|
2024-07-26 17:28:44 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
// 显示-故障时间
|
|
|
|
showFailureDate() {
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
failureDateShow: true
|
2024-07-26 17:28:44 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
// 关闭-故障时间
|
|
|
|
hideFailureDate() {
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
failureDateShow: false
|
2024-07-26 17:28:44 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
// 确认-故障时间
|
|
|
|
confirmFailureDate(e) {
|
|
|
|
console.log('confirmFailureDate', e);
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
|
|
|
let detail = _this.data.detail;
|
2024-08-07 11:02:13 +08:00
|
|
|
detail.failureDate = selfFormatTimeYMDHMS(e.detail);
|
2024-07-26 17:28:44 +08:00
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
failureDateShow: false,
|
|
|
|
failureDate: e.detail,
|
2024-07-26 17:28:44 +08:00
|
|
|
detail
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
showType() {
|
|
|
|
this.setData({
|
|
|
|
typeVisible: true,
|
2024-07-26 17:28:44 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
hideType() {
|
|
|
|
this.setData({
|
|
|
|
typeVisible: false,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 查询设备类型
|
|
|
|
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
|
|
|
|
})
|
2024-08-07 14:06:17 +08:00
|
|
|
// 查询设备
|
|
|
|
_this.queryDevice(list[0].id)
|
2024-08-07 11:02:13 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 查询设备
|
|
|
|
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]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// 确认设备
|
2024-08-07 14:06:17 +08:00
|
|
|
typeColumnsConfirm(e) {
|
|
|
|
console.log('typeColumnsConfirm', e.detail);
|
2024-08-07 11:02:13 +08:00
|
|
|
let _this = this
|
|
|
|
const {
|
|
|
|
picker,
|
|
|
|
value,
|
|
|
|
index
|
|
|
|
} = e.detail;
|
|
|
|
let detail = _this.data.detail
|
|
|
|
detail.typeId = value[0].id
|
|
|
|
detail.repairDevice = value[1].id
|
|
|
|
let typeName = value[0].text + '/' + value[1].text
|
2024-07-26 17:28:44 +08:00
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
detail,
|
|
|
|
typeName,
|
2024-08-07 14:06:17 +08:00
|
|
|
typeVisible: false
|
2024-07-26 17:28:44 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
|
|
|
|
showAddress() {
|
|
|
|
this.setData({
|
|
|
|
addressVisible: true,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
hideAddress() {
|
|
|
|
this.setData({
|
|
|
|
addressVisible: false,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 查询地点
|
2024-08-07 14:06:17 +08:00
|
|
|
queryAddress() {
|
2024-08-07 11:02:13 +08:00
|
|
|
let _this = this
|
2024-08-07 14:06:17 +08:00
|
|
|
selectAddressListRq().then(res => {
|
2024-08-07 11:02:13 +08:00
|
|
|
console.log('selectAddressListRq', res);
|
|
|
|
let list = res.rows.map(item => {
|
|
|
|
return {
|
|
|
|
id: item.id,
|
|
|
|
text: item.name
|
|
|
|
}
|
|
|
|
})
|
|
|
|
let addressColumns = _this.data.addressColumns
|
|
|
|
addressColumns[0].values = list
|
|
|
|
_this.setData({
|
|
|
|
addressColumns
|
|
|
|
})
|
2024-08-07 14:06:17 +08:00
|
|
|
// 查询楼层
|
|
|
|
_this.queryRoom(list[0].id)
|
2024-08-07 11:02:13 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 查询楼层
|
2024-08-07 14:06:17 +08:00
|
|
|
queryRoom(id) {
|
2024-08-07 11:02:13 +08:00
|
|
|
let _this = this
|
|
|
|
|
|
|
|
selectRoomListRq({
|
|
|
|
addressId: id
|
|
|
|
}).then(res => {
|
|
|
|
console.log('selectRoomListRq', res);
|
|
|
|
let list = res.rows.map(item => {
|
|
|
|
return {
|
|
|
|
id: item.id,
|
|
|
|
text: item.name
|
|
|
|
}
|
|
|
|
})
|
|
|
|
let addressColumns = _this.data.addressColumns
|
|
|
|
addressColumns[1].values = list
|
|
|
|
_this.setData({
|
|
|
|
addressColumns
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-07 14:06:17 +08:00
|
|
|
// 选择地点
|
|
|
|
addressColumnsChange(e) {
|
2024-08-07 11:02:13 +08:00
|
|
|
console.log('addressColumnsChange', e.detail);
|
|
|
|
let _this = this
|
|
|
|
const {
|
|
|
|
picker,
|
|
|
|
value,
|
|
|
|
index
|
|
|
|
} = e.detail;
|
|
|
|
if (index == 0) { // 选择地点
|
|
|
|
let obj = value[index]
|
|
|
|
_this.queryRoom(obj.id)
|
|
|
|
|
|
|
|
} else if (index == 1) { // 选择楼层
|
|
|
|
let obj = value[index]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2024-08-07 14:06:17 +08:00
|
|
|
// 确认地点
|
|
|
|
addressColumnsConfirm(e) {
|
|
|
|
console.log('addressColumnsConfirm', e.detail);
|
2024-08-07 11:02:13 +08:00
|
|
|
let _this = this
|
|
|
|
const {
|
|
|
|
picker,
|
|
|
|
value,
|
|
|
|
index
|
|
|
|
} = e.detail;
|
|
|
|
let detail = _this.data.detail
|
|
|
|
detail.addressId = value[0].id
|
|
|
|
detail.roomId = value[1].id
|
|
|
|
let addressName = value[0].text + '/' + value[1].text
|
2024-07-26 17:28:44 +08:00
|
|
|
_this.setData({
|
2024-08-07 11:02:13 +08:00
|
|
|
detail,
|
|
|
|
addressName,
|
2024-08-07 14:06:17 +08:00
|
|
|
addressVisible: false
|
2024-07-26 17:28:44 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-08-06 17:32:38 +08:00
|
|
|
initRecording() {
|
|
|
|
let _this = this
|
|
|
|
let recorderManager = wx.getRecorderManager()
|
|
|
|
recorderManager.onStart(() => {
|
|
|
|
console.log('recorder start')
|
|
|
|
})
|
|
|
|
recorderManager.onStop((res) => {
|
|
|
|
console.log('recorder stop', res)
|
2024-08-07 11:02:13 +08:00
|
|
|
res.duration = parseInt(parseInt(res.duration) / 10) / 100
|
2024-08-06 17:32:38 +08:00
|
|
|
_this.setData({
|
|
|
|
voiceObj: res,
|
|
|
|
innerAudioContext: null, // 音频对象
|
|
|
|
innerAudioContextIsPlay: false, // 音频对象-是否播放
|
|
|
|
})
|
|
|
|
})
|
|
|
|
_this.setData({
|
|
|
|
recorderManager
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 开始录音
|
|
|
|
startRecording() {
|
|
|
|
this.data.recorderManager.start({
|
|
|
|
duration: 60000,
|
|
|
|
sampleRate: 16000, //采样率,有效值 8000/16000/44100
|
|
|
|
numberOfChannels: 1, //录音通道数,有效值 1/2
|
|
|
|
encodeBitRate: 96000, //编码码率
|
|
|
|
format: 'mp3', //音频格式,有效值 aac/mp3
|
|
|
|
frameSize: 50, //指定帧大小
|
|
|
|
// audioSource: 'auto' //指定录音的音频输入源,可通过 wx.getAvailableAudioSources() 获取
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 停止录音
|
|
|
|
stopRecording() {
|
|
|
|
this.data.recorderManager.stop()
|
|
|
|
},
|
|
|
|
|
|
|
|
// 播放语音
|
|
|
|
startAudio() {
|
|
|
|
console.log('startAudio');
|
|
|
|
let _this = this
|
|
|
|
// 获取innerAudioContext实例
|
|
|
|
let innerAudioContext = _this.data.innerAudioContext
|
|
|
|
let innerAudioContextIsPlay = _this.data.innerAudioContextIsPlay
|
|
|
|
if (!innerAudioContext) {
|
|
|
|
// 全局设置播放声音
|
2024-08-07 11:02:13 +08:00
|
|
|
wx.setInnerAudioOption({
|
|
|
|
obeyMuteSwitch: false
|
|
|
|
});
|
2024-08-06 17:32:38 +08:00
|
|
|
innerAudioContext = wx.createInnerAudioContext()
|
|
|
|
// 设置音频文件的路径
|
|
|
|
innerAudioContext.src = _this.data.voiceObj.tempFilePath
|
|
|
|
innerAudioContextIsPlay = false
|
|
|
|
innerAudioContext.onEnded(() => {
|
|
|
|
_this.setData({
|
|
|
|
innerAudioContextIsPlay: false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (innerAudioContextIsPlay) { // 播放中
|
|
|
|
innerAudioContext.stop()
|
|
|
|
innerAudioContextIsPlay = false
|
|
|
|
} else { // 未播放
|
|
|
|
innerAudioContext.play()
|
|
|
|
innerAudioContextIsPlay = true
|
|
|
|
}
|
|
|
|
//
|
|
|
|
_this.setData({
|
|
|
|
innerAudioContext,
|
|
|
|
innerAudioContextIsPlay
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 停止语音
|
|
|
|
stopAudio() {
|
|
|
|
_this.data.innerAudioContext.stop()
|
|
|
|
},
|
2024-07-26 17:28:44 +08:00
|
|
|
|
2024-08-07 11:02:13 +08:00
|
|
|
// 清楚语音
|
2024-08-07 14:06:17 +08:00
|
|
|
clearAudio() {
|
2024-08-07 11:02:13 +08:00
|
|
|
this.setData({
|
|
|
|
innerAudioContext: null, // 音频对象
|
|
|
|
innerAudioContextIsPlay: false, // 音频对象-是否播放
|
|
|
|
voiceObj: {}, // 录音文件对象
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2024-07-26 17:28:44 +08:00
|
|
|
// 图片-上传前校验
|
|
|
|
beforeRead(event) {
|
2024-08-06 17:32:38 +08:00
|
|
|
// const {
|
|
|
|
// file,
|
|
|
|
// callback
|
|
|
|
// } = event.detail;
|
|
|
|
// callback(file.type === 'image');
|
2024-07-26 17:28:44 +08:00
|
|
|
},
|
|
|
|
|
2024-08-06 17:32:38 +08:00
|
|
|
// 文件-上传后
|
|
|
|
fileAfterRead(event) {
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
2024-08-07 11:02:13 +08:00
|
|
|
console.log('fileAfterRead', event);
|
2024-07-26 17:28:44 +08:00
|
|
|
const {
|
|
|
|
file
|
|
|
|
} = event.detail;
|
|
|
|
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
2024-08-06 17:32:38 +08:00
|
|
|
for (let i = 0; i < file.length; i++) {
|
|
|
|
let url = file[i].url;
|
|
|
|
wx.uploadFile({
|
|
|
|
url: app.DOMAIN_NAME + '/api/dfs/upload',
|
|
|
|
filePath: url,
|
|
|
|
name: 'file',
|
|
|
|
formData: {},
|
|
|
|
success(res) {
|
|
|
|
console.log('upload file ', res);
|
|
|
|
let fileData = JSON.parse(res.data)
|
|
|
|
// 上传完成需要更新 fileList
|
|
|
|
let fileList = _this.data.fileList;
|
|
|
|
fileList.push({
|
|
|
|
relativeUrl: fileData.fileName,
|
|
|
|
url: app.IMG_NAME + fileData.fileName,
|
|
|
|
name: fileData.fileName,
|
|
|
|
deletable: true,
|
|
|
|
})
|
|
|
|
_this.setData({
|
|
|
|
fileList
|
|
|
|
})
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2024-07-26 17:28:44 +08:00
|
|
|
},
|
|
|
|
|
2024-08-06 17:32:38 +08:00
|
|
|
|
2024-07-26 17:28:44 +08:00
|
|
|
// 删除图片
|
|
|
|
deleteImg(event) {
|
|
|
|
console.log('deleteImg', event);
|
|
|
|
let _this = this;
|
|
|
|
let fileList = _this.data.fileList;
|
|
|
|
fileList.splice(event.detail.index, 1);
|
|
|
|
_this.setData({
|
|
|
|
fileList
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// input输入内容监听
|
|
|
|
fieldInput(e) {
|
|
|
|
console.log('fieldInput', e);
|
|
|
|
let _this = this;
|
|
|
|
let detail = _this.data.detail;
|
|
|
|
detail[e.currentTarget.dataset.name] = e.detail
|
|
|
|
_this.setData({
|
|
|
|
detail
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
// 提交数据
|
2024-08-07 14:06:17 +08:00
|
|
|
async submitData() {
|
2024-07-26 17:28:44 +08:00
|
|
|
let _this = this;
|
|
|
|
// 上传文件列表
|
|
|
|
let fileList = _this.data.fileList;
|
2024-08-07 14:06:17 +08:00
|
|
|
// 音频
|
|
|
|
let voiceObj = _this.data.voiceObj;
|
2024-07-26 17:28:44 +08:00
|
|
|
// 数据
|
|
|
|
let detail = _this.data.detail;
|
|
|
|
//
|
|
|
|
// 校验数据
|
|
|
|
//
|
2024-08-07 11:02:13 +08:00
|
|
|
// 报修名称
|
|
|
|
if (!detail.repairName) {
|
|
|
|
_this.showErrMsg('输入报修名称!')
|
2024-07-26 17:28:44 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-08-07 11:02:13 +08:00
|
|
|
// 故障等级
|
|
|
|
if (!detail.repairLevel) {
|
|
|
|
_this.showErrMsg('请选择故障等级!')
|
2024-07-26 17:28:44 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-08-07 11:02:13 +08:00
|
|
|
// 故障时间
|
|
|
|
if (!detail.failureDate) {
|
|
|
|
_this.showErrMsg('请选择故障时间!')
|
2024-07-26 17:28:44 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-08-07 14:06:17 +08:00
|
|
|
// 故障类型
|
|
|
|
if (!detail.typeId) {
|
|
|
|
_this.showErrMsg('请选择故障类型!')
|
2024-07-26 17:28:44 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-08-07 14:06:17 +08:00
|
|
|
// 故障地点
|
|
|
|
if (!detail.addressId) {
|
|
|
|
_this.showErrMsg('请选择故障地点!')
|
2024-07-26 17:28:44 +08:00
|
|
|
return;
|
|
|
|
}
|
2024-08-07 14:06:17 +08:00
|
|
|
// 门牌号
|
|
|
|
if (!detail.area) {
|
|
|
|
_this.showErrMsg('请输入门牌号!')
|
2024-07-26 17:28:44 +08:00
|
|
|
return;
|
2024-08-08 09:16:37 +08:00
|
|
|
}
|
|
|
|
// 联系电话
|
|
|
|
if (!detail.phone) {
|
|
|
|
_this.showErrMsg('请输入联系电话!')
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// 报修人姓名
|
|
|
|
if (!detail.name) {
|
|
|
|
_this.showErrMsg('请输入报修人姓名!')
|
|
|
|
return;
|
2024-07-26 17:28:44 +08:00
|
|
|
}
|
2024-08-07 14:06:17 +08:00
|
|
|
// 故障描述
|
|
|
|
if (!detail.content) {
|
|
|
|
_this.showErrMsg('请输入故障描述!')
|
2024-07-26 17:28:44 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// 图片上传
|
|
|
|
if (fileList && fileList.length > 0) {
|
2024-08-07 14:06:17 +08:00
|
|
|
detail.repairImages = JSON.stringify(fileList.map(item => {
|
|
|
|
return {
|
|
|
|
name: item.relativeUrl,
|
|
|
|
url: item.relativeUrl,
|
|
|
|
uid: item.relativeUrl,
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
// 音频
|
|
|
|
if (voiceObj && voiceObj.tempFilePath) {
|
|
|
|
await app.selfUploadFile(voiceObj.tempFilePath).then(res => {
|
|
|
|
console.log('selfUploadFile', res);
|
|
|
|
detail.repairVoice = JSON.stringify({
|
|
|
|
url: res.fileName,
|
|
|
|
time: voiceObj.duration
|
|
|
|
})
|
|
|
|
})
|
2024-07-26 17:28:44 +08:00
|
|
|
}
|
|
|
|
//
|
|
|
|
// 添加数据
|
2024-08-07 14:06:17 +08:00
|
|
|
repairSaveRq(detail).then(res => {
|
2024-07-26 17:28:44 +08:00
|
|
|
console.log('visitorPersonRq', res);
|
2024-08-07 14:06:17 +08:00
|
|
|
//
|
2024-07-26 17:28:44 +08:00
|
|
|
if (res.code == 0) {
|
|
|
|
wx.navigateBack()
|
|
|
|
} else {
|
|
|
|
_this.showErrMsg(res.msg)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 显示错误消息
|
|
|
|
showErrMsg(msg) {
|
|
|
|
Notify({
|
|
|
|
type: 'danger',
|
|
|
|
message: msg
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|