mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-22 00:49:37 +08:00
233 lines
4.9 KiB
JavaScript
233 lines
4.9 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: '',
|
|
},
|
|
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)
|
|
})
|
|
},
|
|
|
|
// 显示-完成时间
|
|
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.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() {
|
|
|
|
}
|
|
}) |