This commit is contained in:
SelfRidicule 2024-08-07 11:02:13 +08:00
parent b14dd4ac89
commit d8cc6e9a79
4 changed files with 354 additions and 107 deletions

View File

@ -0,0 +1,38 @@
import {
request
} from '../selfRequest';
// 查询故障分类列表
export function deviceTypeListRq() {
return request({
url: '/repair/deviceTypeList',
method: "get",
});
}
// 根据故障分类查询故障设备列表
export function deviceListRq(data) {
return request({
url: '/repair/deviceList',
method: "get",
data
});
}
// 查询地区
export function selectAddressListRq() {
return request({
url: '/repair/selectAddressList',
method: "get",
});
}
// 查询楼层
export function selectRoomListRq(data) {
return request({
url: '/repair/selectRoomList',
method: "get",
data
});
}

View File

@ -7,10 +7,11 @@ import {
} from "../../../utils/util.js" } from "../../../utils/util.js"
import { import {
visitorPersonRq, deviceTypeListRq,
selectVisitorRecordByIdRq, deviceListRq,
updateVisitorPersonStatusRq selectAddressListRq,
} from "../../../api/meeting/visitorIinvitation.js" selectRoomListRq,
} from "../../../api/repair/repair.js"
Page({ Page({
@ -27,33 +28,54 @@ Page({
voiceObj: {}, // 录音文件对象 voiceObj: {}, // 录音文件对象
innerAudioContext: null, // 音频对象 innerAudioContext: null, // 音频对象
innerAudioContextIsPlay: false, // 音频对象-是否播放 innerAudioContextIsPlay: false, // 音频对象-是否播放
idcardTypeShow: false, faultLevelShow: false,
idcardTypeList: [{ faultLevelList: [{
name: '居民身份证', name: '一级',
}, {
name: '二级',
}, {
name: '三级',
}, ], }, ],
visitTimeShow: false, // 到访时间show failureDateShow: false, // 故障时间show
visitTimeDate: new Date().getTime(), // 到访时间-当前 failureDate: new Date().getTime(), // 故障时间-当前
visitTimeMinDate: new Date().getTime(), // 到访时间-最小 failureMinDate: new Date().getTime(), // 故障时间-最小
leaveTimeShow: false, // 离开时间show typeVisible: false,
leaveTimeDate: new Date().getTime(), // 离开时间-当前 typeName: '',
typeColumns: [{
values: [],
className: 'column1',
},
{
values: [],
className: 'column2',
},
],
addressVisible: false,
addressName: '',
addressColumns: [{
values: [],
className: 'column1',
},
{
values: [],
className: 'column2',
},
],
fileList: [], // 上传文件 fileList: [], // 上传文件
detail: { detail: {
customerId: null, //企业id "repairName": "", //维修名称
customerName: null, //企业名称 "repairLevel": "", //维修等级
userId: null, // 被访人id "failureDate": null, //故障时间
userName: null, //被访人姓名 "typeId" : null , //故障类型
userMobile: null, //被访人手机号 "repairDevice": null, //维修设备
intervieweeId: null, // 访客id "name": "", //用户名
name: null, // 访客姓名 "phone": "", //手机号码
phone: null, // 访客手机号 "addressId" : null ,// 地点id
cardType: '居民身份证', // 证件类型 "roomId" : null ,// 楼层id
cardNo: null, // 证件号 "area": "", // 门牌号
visitTime: null, // 到访时间 "content" : "", // 描述
leaveTime: null, // 离开时间 "repairVoice" : "", // 语音文件
visitContent: null, // 来访事由 "repairImages" : '', //故障图片
photo: null, // 头像-相对路径
url: null, // 人脸设备图片-全路径
voiceUrl: null, // 语音
}, },
}, },
@ -78,91 +100,257 @@ Page({
// 初始化录音 // 初始化录音
_this.initRecording() _this.initRecording()
// 查询设备类型
_this.queryDeviceType()
// 查询地点
_this.queryAddress()
}, },
// 显示-身份证类型
showIdcardType() {
// 显示-故障等级
showFaultLevel() {
let _this = this; let _this = this;
_this.setData({ _this.setData({
idcardTypeShow: true faultLevelShow: true
}) })
}, },
// 选择-身份证类型 // 选择-故障等级
selectIdcardType(e) { selectFaultLevel(e) {
console.log('selectIdcardType', e); console.log('selectFaultLevel', e);
let _this = this; let _this = this;
let detail = _this.data.detail; let detail = _this.data.detail;
detail.cardType = e.detail.name; detail.repairLevel = e.detail.name;
_this.setData({ _this.setData({
idcardTypeShow: false, faultLevelShow: false,
detail detail
}) })
}, },
// 关闭-身份证类型 // 关闭-故障等级
closeIdcardType() { closeFaultLevel() {
let _this = this; let _this = this;
_this.setData({ _this.setData({
idcardTypeShow: false faultLevelShow: false
}) })
}, },
// 显示-到访时间 // 显示-故障时间
showVisitTime() { showFailureDate() {
let _this = this; let _this = this;
_this.setData({ _this.setData({
visitTimeShow: true failureDateShow: true
}) })
}, },
// 关闭-到访时间 // 关闭-故障时间
closeVisitTime() { hideFailureDate() {
let _this = this; let _this = this;
_this.setData({ _this.setData({
visitTimeShow: false failureDateShow: false
}) })
}, },
// 确认-到访时间 // 确认-故障时间
confirmVisitTime(e) { confirmFailureDate(e) {
console.log('confirmVisitTime', e); console.log('confirmFailureDate', e);
let _this = this; let _this = this;
let detail = _this.data.detail; let detail = _this.data.detail;
detail.visitTime = selfFormatTimeYMDHMS(e.detail); detail.failureDate = selfFormatTimeYMDHMS(e.detail);
_this.setData({ _this.setData({
visitTimeShow: false, failureDateShow: false,
visitTimeDate: e.detail, failureDate: e.detail,
detail detail
}) })
}, },
// 显示-离开时间 showType() {
showLeaveTime() { this.setData({
let _this = this; typeVisible: true,
_this.setData({
leaveTimeShow: true
}) })
}, },
// 关闭-离开时间 hideType() {
closeLeaveTime() { this.setData({
let _this = this; typeVisible: false,
_this.setData({
leaveTimeShow: false
}) })
}, },
// 确认-离开时间 // 查询设备类型
confirmLeaveTime(e) { queryDeviceType() {
console.log('confirmLeaveTime111', e); let _this = this
let _this = this; deviceTypeListRq().then(res => {
let detail = _this.data.detail; console.log('deviceTypeListRq', res);
detail.leaveTime = selfFormatTimeYMDHMS(e.detail); 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;
let detail = _this.data.detail
detail.typeId = value[0].id
detail.repairDevice = value[1].id
let typeName = value[0].text + '/' + value[1].text
_this.setData({ _this.setData({
leaveTimeShow: false, detail,
leaveTimeDate: e.detail, typeName,
detail typeVisible : false
})
},
showAddress() {
this.setData({
addressVisible: true,
})
},
hideAddress() {
this.setData({
addressVisible: false,
})
},
// 查询地点
queryAddress(){
let _this = this
selectAddressListRq().then(res=>{
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
})
// 查询楼层
_this.queryRoom(list[0].id)
})
},
// 查询楼层
queryRoom(id){
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
})
})
},
// 选择地点
addressColumnsChange(e) {
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]
}
},
// 确认地点
addressColumnsConfirm(e){
console.log('addressColumnsConfirm' , e.detail);
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
_this.setData({
detail,
addressName,
addressVisible : false
}) })
}, },
@ -174,6 +362,7 @@ Page({
}) })
recorderManager.onStop((res) => { recorderManager.onStop((res) => {
console.log('recorder stop', res) console.log('recorder stop', res)
res.duration = parseInt(parseInt(res.duration) / 10) / 100
_this.setData({ _this.setData({
voiceObj: res, voiceObj: res,
innerAudioContext: null, // 音频对象 innerAudioContext: null, // 音频对象
@ -211,7 +400,9 @@ Page({
let innerAudioContextIsPlay = _this.data.innerAudioContextIsPlay let innerAudioContextIsPlay = _this.data.innerAudioContextIsPlay
if (!innerAudioContext) { if (!innerAudioContext) {
// 全局设置播放声音 // 全局设置播放声音
wx.setInnerAudioOption({ obeyMuteSwitch: false }); wx.setInnerAudioOption({
obeyMuteSwitch: false
});
innerAudioContext = wx.createInnerAudioContext() innerAudioContext = wx.createInnerAudioContext()
// 设置音频文件的路径 // 设置音频文件的路径
innerAudioContext.src = _this.data.voiceObj.tempFilePath innerAudioContext.src = _this.data.voiceObj.tempFilePath
@ -241,6 +432,15 @@ Page({
_this.data.innerAudioContext.stop() _this.data.innerAudioContext.stop()
}, },
// 清楚语音
clearAudio(){
this.setData({
innerAudioContext: null, // 音频对象
innerAudioContextIsPlay: false, // 音频对象-是否播放
voiceObj: {}, // 录音文件对象
})
},
// 图片-上传前校验 // 图片-上传前校验
beforeRead(event) { beforeRead(event) {
// const { // const {
@ -253,7 +453,7 @@ Page({
// 文件-上传后 // 文件-上传后
fileAfterRead(event) { fileAfterRead(event) {
let _this = this; let _this = this;
console.log('fileAfterRead' ,event); console.log('fileAfterRead', event);
const { const {
file file
} = event.detail; } = event.detail;
@ -312,24 +512,26 @@ Page({
let _this = this; let _this = this;
// 上传文件列表 // 上传文件列表
let fileList = _this.data.fileList; let fileList = _this.data.fileList;
// 音频
let voiceObj = _this.data.voiceObj;
// 数据 // 数据
let detail = _this.data.detail; let detail = _this.data.detail;
// //
// 校验数据 // 校验数据
// //
// 被访单位 // 报修名称
if (!detail.customerId) { if (!detail.repairName) {
_this.showErrMsg('请选择被访单位!') _this.showErrMsg('输入报修名称!')
return; return;
} }
// 被访人姓名 // 故障等级
if (!detail.userName) { if (!detail.repairLevel) {
_this.showErrMsg('请输入被访人姓名!') _this.showErrMsg('请选择故障等级!')
return; return;
} }
// 被访人电话 // 故障时间
if (!detail.userMobile) { if (!detail.failureDate) {
_this.showErrMsg('请输入被访人电话!') _this.showErrMsg('请选择故障时间!')
return; return;
} }
// 访客姓名 // 访客姓名

View File

@ -8,6 +8,7 @@
"van-notify": "@vant/weapp/notify/index", "van-notify": "@vant/weapp/notify/index",
"van-action-sheet": "@vant/weapp/action-sheet/index", "van-action-sheet": "@vant/weapp/action-sheet/index",
"van-dialog": "@vant/weapp/dialog/index", "van-dialog": "@vant/weapp/dialog/index",
"van-icon": "@vant/weapp/icon/index" "van-icon": "@vant/weapp/icon/index",
"van-picker": "@vant/weapp/picker/index"
} }
} }

View File

@ -2,40 +2,40 @@
<view class="contentView"> <view class="contentView">
<view class="rowView"> <view class="rowView">
<view class="label must">报修名称</view> <view class="label must">报修名称</view>
<van-field value="{{ detail.reportName }}" bind:input="fieldInput" data-name="reportName" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" /> <van-field value="{{ detail.repairName }}" bind:input="fieldInput" data-name="repairName" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" />
</view> </view>
<view class="rowView"> <view class="rowView">
<view class="label must">故障等级</view> <view class="label must">故障等级</view>
<van-field value="{{ detail.cardType }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" border="{{ false }}" input-align="right" bind:tap="showIdcardType" /> <van-field value="{{ detail.repairLevel }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" border="{{ false }}" input-align="right" bind:tap="showFaultLevel" />
</view> </view>
<view class="rowView" bind:tap="showVisitTime"> <view class="rowView" bind:tap="showFailureDate">
<view class="label must">故障时间</view> <view class="label must">故障时间</view>
<van-field value="{{ detail.visitTime }}" input-class="input" is-link readonly placeholder="请选择" border="{{ false }}" arrow-direction="down" input-align="right" /> <van-field value="{{ detail.failureDate }}" input-class="input" is-link readonly placeholder="请选择" border="{{ false }}" arrow-direction="down" input-align="right" />
</view> </view>
<view class="rowView"> <view class="rowView">
<view class="label must">故障类型</view> <view class="label must">故障类型</view>
<van-field value="{{ detail.cardType }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" border="{{ false }}" input-align="right" bind:tap="showIdcardType" /> <van-field value="{{ typeName }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" border="{{ false }}" input-align="right" bind:tap="showType" />
</view> </view>
<view class="rowView"> <view class="rowView">
<view class="label must">联系电话</view> <view class="label ">联系电话</view>
<van-field value="{{ detail.userMobile }}" bind:input="fieldInput" data-name="userMobile" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" /> <van-field value="{{ detail.phone }}" bind:input="fieldInput" data-name="phone" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" />
</view> </view>
<view class="rowView"> <view class="rowView">
<view class="label must">报修人姓名</view> <view class="label ">报修人姓名</view>
<van-field value="{{ detail.name }}" bind:input="fieldInput" data-name="name" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" /> <van-field value="{{ detail.name }}" bind:input="fieldInput" data-name="name" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" />
</view> </view>
<view class="rowView"> <view class="rowView">
<view class="label must">故障地点</view> <view class="label must">故障地点</view>
<van-field value="{{ detail.cardType }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" border="{{ false }}" input-align="right" bind:tap="showIdcardType" /> <van-field value="{{ addressName }}" input-class="input" is-link readonly placeholder="请选择" arrow-direction="down" border="{{ false }}" input-align="right" bind:tap="showAddress" />
</view> </view>
<view class="rowView"> <view class="rowView">
<view class="label must">门牌号</view> <view class="label must">门牌号</view>
<van-field value="{{ detail.reportName }}" bind:input="fieldInput" data-name="reportName" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" /> <van-field value="{{ detail.area }}" bind:input="fieldInput" data-name="area" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" />
</view> </view>
<view class="rowColumnView"> <view class="rowColumnView">
<view class="label must">故障描述</view> <view class="label must">故障描述</view>
<view class="contentView"> <view class="contentView">
<van-field model:value="{{ value }}" type="textarea" placeholder="请输入用户名" maxlength="{{100}}" show-word-limit border="{{false}}" autosize input-class="selfTextarea" /> <van-field model:value="{{ detail.content }}" bind:input="fieldInput" data-name="content" type="textarea" placeholder="请输入" maxlength="{{100}}" show-word-limit border="{{false}}" autosize input-class="selfTextarea" />
<view class="voiceView1" bind:touchstart="startRecording" bind:touchend="stopRecording"> <view class="voiceView1" bind:touchstart="startRecording" bind:touchend="stopRecording">
<view class="voiceView2"> <view class="voiceView2">
<view class="voiceImg" style="background: no-repeat center/cover url({{IMG_NAME + '/profile/static/repair/index/voice.png'}});"></view> <view class="voiceImg" style="background: no-repeat center/cover url({{IMG_NAME + '/profile/static/repair/index/voice.png'}});"></view>
@ -44,15 +44,15 @@
</view> </view>
</view> </view>
<view class="rowView self"> <view class="rowView self">
<view class="label must">语音</view> <view class="label">语音</view>
<view class="voiceBtnView" wx:if="{{voiceObj.tempFilePath}}" bind:tap="startAudio"> <view class="voiceBtnView" wx:if="{{voiceObj.tempFilePath}}">
<van-icon name="volume-o" color="black" size="40rpx" /> <van-icon name="volume-o" color="black" size="40rpx" bind:tap="startAudio"/>
<view class="voiceTimeView">{{voiceObj.duration}}ms</view> <view class="voiceTimeView" bind:tap="startAudio">{{voiceObj.duration}} s</view>
<van-icon name="close" size="34rpx"/> <van-icon name="close" size="34rpx" bind:tap="clearAudio"/>
</view> </view>
</view> </view>
<view class="rowColumnView"> <view class="rowColumnView">
<view class="label must">故障图片</view> <view class="label">故障图片</view>
<view class="imgContentView"> <view class="imgContentView">
<van-uploader file-list="{{ fileList }}" upload-text="点击上传图片" bind:after-read="fileAfterRead" deletable="{{ true }}" bind:delete="deleteImg" max-count="6" accept="media" multiple/> <van-uploader file-list="{{ fileList }}" upload-text="点击上传图片" bind:after-read="fileAfterRead" deletable="{{ true }}" bind:delete="deleteImg" max-count="6" accept="media" multiple/>
</view> </view>
@ -67,15 +67,21 @@
<!-- 消息通知 --> <!-- 消息通知 -->
<van-notify id="van-notify" /> <van-notify id="van-notify" />
<!-- 选择-身份证类型 --> <!-- 选择-故障等级 -->
<van-action-sheet description="请选择身份证类型" close-on-click-overlay="{{true}}" show="{{ idcardTypeShow }}" actions="{{ idcardTypeList }}" bind:select="selectIdcardType" bind:close="closeIdcardType" /> <van-action-sheet description="请选择故障等级" close-on-click-overlay="{{true}}" show="{{ faultLevelShow }}" actions="{{ faultLevelList }}" bind:select="selectFaultLevel" bind:close="closeFaultLevel" />
<!-- 选择-到访时间 --> <!-- 选择-故障时间 -->
<van-popup show="{{ visitTimeShow }}" position="bottom" custom-style="height: 50vh;" bind:close="closeVisitTime"> <van-popup show="{{ failureDateShow }}" position="bottom" custom-style="height: 50vh;" bind:close="hideFailureDate">
<van-datetime-picker type="datetime" value="{{ visitTimeDate }}" min-date="{{ visitTimeMinDate }}" bind:confirm="confirmVisitTime" bind:cancel="closeVisitTime" /> <van-datetime-picker type="datetime" value="{{ failureDate }}" min-date="{{ failureMinDate }}" bind:confirm="confirmFailureDate" bind:cancel="hideFailureDate" />
</van-popup> </van-popup>
<!-- 选择-离开时间 --> <!-- 故障类型 -->
<van-popup show="{{ leaveTimeShow }}" position="bottom" custom-style="height: 50vh;" bind:close="closeLeaveTime"> <van-popup show="{{ typeVisible }}" position="bottom" custom-style="height: 50vh;" bind:close="hideType">
<van-datetime-picker type="datetime" value="{{ leaveTimeDate }}" min-date="{{ visitTimeDate }}" bind:confirm="confirmLeaveTime" bind:cancel="closeLeaveTime" /> <van-picker show-toolbar columns="{{ typeColumns }}" bind:change="typeColumnsChange" bind:confirm="typeColumnsConfirm" bind:cancel="hideType"/>
</van-popup>
<!-- 故障地点 -->
<van-popup show="{{ addressVisible }}" position="bottom" custom-style="height: 50vh;" bind:close="hideAddress">
<van-picker show-toolbar columns="{{ addressColumns }}" bind:change="addressColumnsChange" bind:confirm="addressColumnsConfirm" bind:cancel="hideAddress"/>
</van-popup> </van-popup>