471615499@qq.com b4417bee7b 20240825代码提交
windows下部分内容与mac不一致,全量提交;
功能改动:
- 去掉“我的报修”页面的“报修名称”、“故障等级”、“故障时间”三个字段
- 派单员页面添加“故障等级”字段,故障等级由派单员选择设置
- “我的报修”页面,“门牌号”修改为“门牌号(地点)”
- 维修人员不允许评价
- 首页加入请求“我的报修”,可以直接点击进入
- 去掉语音输入,必填描述
- 派单列表页调整
- 维修人员退回工单需要必填理由
2024-08-25 18:17:00 +08:00

272 lines
4.8 KiB
JavaScript

const app = getApp()
import Notify from '@vant/weapp/notify/notify';
import {
selfFormatTimeYMDHMS,
} from "../../../../utils/util.js"
import {
getDetailRq,
getStatusName,
flowHandleRq,
selectWorkerIdByTypeIdRq
} from "../../../../api/repair/repair.js"
Page({
/**
* 页面的初始数据
*/
data: {
IMG_NAME: app.IMG_NAME,
id: '',
detail: {},
form: {
repairUserId: null,
repairUserName: null,
preDate: '',
repairLevel: '',
},
levelVisible: false,
levelColumns: [{
values: ['一级', '二级', '三级'],
className: 'column1',
}],
preDateVisible: false,
preDateTime: new Date().getTime(),
userVisible: false,
userColumns: [{
values: [],
className: 'column1',
}],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('onLoad', options);
let _this = this
_this.setData({
...options
})
_this.getDetail(options.id)
},
back() {
wx.navigateBack()
},
getDetail(id) {
let _this = this
getDetailRq({
id
}).then(res => {
console.log("getDetailRq", res);
// 详情
let detail = res.repair
detail.statusName = getStatusName(detail.status)
//
_this.setData({
detail,
})
// 查询维修员
_this.queryWorkUser(detail.typeId)
})
},
showLevel() {
this.setData({
levelVisible: true,
})
},
hideLevel() {
this.setData({
levelVisible: false,
})
},
// 确认-故障等级
levelConfirm(e) {
console.log('levelConfirm', e);
let _this = this;
const {
picker,
value,
index
} = e.detail;
let form = _this.data.form
form.repairLevel = value[0]
_this.setData({
form,
levelVisible: false
})
},
// 显示-完成时间
showPreDate() {
let _this = this;
_this.setData({
preDateVisible: true
})
},
// 关闭-完成时间
hidePreDate() {
let _this = this;
_this.setData({
preDateVisible: false
})
},
// 确认-完成时间
confirmPreDate(e) {
console.log('confirmPreDate', e);
let _this = this;
let form = _this.data.form;
form.preDate = selfFormatTimeYMDHMS(e.detail);
_this.setData({
preDateVisible: false,
preDateTime: e.detail,
form
})
},
// 查询维修员
queryWorkUser(id) {
let _this = this
selectWorkerIdByTypeIdRq(id).then(res => {
console.log('selectWorkerIdByTypeIdRq', res);
let list = res.rows.map(item => {
return {
id: item.userId,
userName: item.userName,
text: item.userPhone + '-' + item.userName
}
})
let userColumns = _this.data.userColumns
userColumns[0].values = list
_this.setData({
userColumns
})
})
},
showUser() {
this.setData({
userVisible: true,
})
},
hideUser() {
this.setData({
userVisible: false,
})
},
// 确认用户
userColumnsConfirm(e) {
console.log('userColumnsConfirm', e.detail);
let _this = this
const {
picker,
value,
index
} = e.detail;
let form = _this.data.form
form.repairUserId = value[0].id
form.repairUserName = value[0].text
_this.setData({
form,
userVisible: false
})
},
submit() {
let _this = this
// 参数校验
if (!_this.data.form.repairLevel) {
// 危险通知
app.vantNotifyErrTop(Notify, '请选择故障等级!')
return
}
if (!_this.data.form.repairUserId) {
// 危险通知
app.vantNotifyErrTop(Notify, '请选择维修人员!')
return
}
// if (!_this.data.form.preDate) {
// // 危险通知
// app.vantNotifyErrTop(Notify, '请选择预计完成时间!')
// return
// }
// 提交参数
let data = {
"repair": {
id: _this.data.id,
..._this.data.form
},
"content": '指派维修员',
"operate": "NEXT"
}
flowHandleRq(data).then(res => {
console.log('flowHandleRq', res);
if (res.code == 0) {
app.vantNotifySuccessTop(Notify, res.msg)
app.selfBackPage(2)
} else {
app.vantNotifyErrTop(Notify, res.msg)
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})