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

View File

@ -8,6 +8,7 @@
"van-notify": "@vant/weapp/notify/index",
"van-action-sheet": "@vant/weapp/action-sheet/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="rowView">
<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 class="rowView">
<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 class="rowView" bind:tap="showVisitTime">
<view class="rowView" bind:tap="showFailureDate">
<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 class="rowView">
<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 class="rowView">
<view class="label must">联系电话</view>
<van-field value="{{ detail.userMobile }}" bind:input="fieldInput" data-name="userMobile" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" />
<view class="label ">联系电话</view>
<van-field value="{{ detail.phone }}" bind:input="fieldInput" data-name="phone" input-class="input" placeholder="请输入" border="{{ false }}" input-align="right" />
</view>
<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" />
</view>
<view class="rowView">
<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 class="rowView">
<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 class="rowColumnView">
<view class="label must">故障描述</view>
<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="voiceView2">
<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 class="rowView self">
<view class="label must">语音</view>
<view class="voiceBtnView" wx:if="{{voiceObj.tempFilePath}}" bind:tap="startAudio">
<van-icon name="volume-o" color="black" size="40rpx" />
<view class="voiceTimeView">{{voiceObj.duration}}ms</view>
<van-icon name="close" size="34rpx"/>
<view class="label">语音</view>
<view class="voiceBtnView" wx:if="{{voiceObj.tempFilePath}}">
<van-icon name="volume-o" color="black" size="40rpx" bind:tap="startAudio"/>
<view class="voiceTimeView" bind:tap="startAudio">{{voiceObj.duration}} s</view>
<van-icon name="close" size="34rpx" bind:tap="clearAudio"/>
</view>
</view>
<view class="rowColumnView">
<view class="label must">故障图片</view>
<view class="label">故障图片</view>
<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/>
</view>
@ -67,15 +67,21 @@
<!-- 消息通知 -->
<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-datetime-picker type="datetime" value="{{ visitTimeDate }}" min-date="{{ visitTimeMinDate }}" bind:confirm="confirmVisitTime" bind:cancel="closeVisitTime" />
<!-- 选择-故障时间 -->
<van-popup show="{{ failureDateShow }}" position="bottom" custom-style="height: 50vh;" bind:close="hideFailureDate">
<van-datetime-picker type="datetime" value="{{ failureDate }}" min-date="{{ failureMinDate }}" bind:confirm="confirmFailureDate" bind:cancel="hideFailureDate" />
</van-popup>
<!-- 选择-离开时间 -->
<van-popup show="{{ leaveTimeShow }}" position="bottom" custom-style="height: 50vh;" bind:close="closeLeaveTime">
<van-datetime-picker type="datetime" value="{{ leaveTimeDate }}" min-date="{{ visitTimeDate }}" bind:confirm="confirmLeaveTime" bind:cancel="closeLeaveTime" />
<!-- 故障类型 -->
<van-popup show="{{ typeVisible }}" position="bottom" custom-style="height: 50vh;" bind:close="hideType">
<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>