This commit is contained in:
SelfRidicule 2024-08-14 16:27:51 +08:00
parent 31773e156f
commit e45c024d2f
5 changed files with 186 additions and 36 deletions

View File

@ -79,6 +79,14 @@ export function flowHandleRq(data) {
});
}
// 根据设备类型查询维修人员
export function selectWorkerIdByTypeIdRq(id) {
return request({
url: `/repairDeviceApi/selectWorkerIdByTypeId?typeId=${id}`,
method: "get",
});
}
// 返回订单状态
// 状态:1 待派单,3 重新派单,5 已派单,7 处理中, 9已完成 待评价, 11 已关闭 13 已评价

View File

@ -1,5 +1,18 @@
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({
/**
@ -7,50 +20,167 @@ Page({
*/
data: {
IMG_NAME: app.IMG_NAME,
timeShow : true,
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(){
back() {
wx.navigateBack()
},
// 提交反馈
jumpFeedback(){
wx.navigateTo({
url: '/pages/reportRepair/assign/feedback/feedback',
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)
})
},
// 无效
invalid(){
wx.navigateBack()
},
// 跳转人员列表
jumpPersonList(){
wx.navigateTo({
url: '/pages/reportRepair/assign/personList/personList',
// 显示-完成时间
showPreDate() {
let _this = this;
_this.setData({
preDateVisible: true
})
},
// 显示时间
showTime(){
// 关闭-完成时间
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({
timeShow : true,
userVisible: true,
})
},
// 关闭时间
closeTime(){
hideUser() {
this.setData({
timeShow : false,
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)
wx.navigateBack({
delta: 2
})
} else {
app.vantNotifyErrTop(Notify, res.msg)
}
})
},

View File

@ -2,7 +2,9 @@
"navigationStyle": "custom",
"usingComponents": {
"van-icon": "@vant/weapp/icon/index",
"van-popup": "@vant/weapp/popup/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-action-sheet": "@vant/weapp/action-sheet/index"
"van-notify": "@vant/weapp/notify/index",
"van-picker": "@vant/weapp/picker/index"
}
}

View File

@ -16,29 +16,39 @@
<view class="mainView">
<view class="statusView">
<view class="label">YG123081273812</view>
<view class="time">空调</view>
<view class="tag">待派单</view>
<view class="label">{{detail.sn}}</view>
<view class="time">{{detail.typeName + '/' + detail.deviceName}}</view>
<view class="tag">{{detail.statusName}}</view>
</view>
<view class="reportView">
<view class="topTitle">派单</view>
<view class="selfLine"></view>
<view class="itemView" bind:tap="jumpPersonList">
<view class="label">请选择维修人员</view>
<view class="itemView" bind:tap="showUser">
<view class="label">{{form.repairUserName ? form.repairUserName : '请选择维修人员'}}</view>
<van-icon name="arrow" size="36rpx" color="gray" />
</view>
<view class="itemView" bind:tap="showTime">
<view class="label">请选择预计完成时间</view>
<view class="itemView" bind:tap="showPreDate">
<view class="label">{{form.preDate ? form.preDate : '请选择预计完成时间'}}</view>
<van-icon name="arrow" size="36rpx" color="gray" />
</view>
</view>
</view>
<van-action-sheet show="{{ timeShow }}" bind:close="closeTime" close-on-click-overlay>
<van-datetime-picker type="datetime" value="{{ currentDate }}" min-date="{{ minDate }}" bind:input="onInput" />
</van-action-sheet>
<view class="submitBtn" bind:tap="submit">提交</view>
<view class="submitBtn">提交</view>
</view>
</view>
<!-- 完成时间 -->
<van-popup show="{{ preDateVisible }}" position="bottom" custom-style="height: 50vh;" bind:close="hidePreDate">
<van-datetime-picker type="datetime" value="{{ preDateTime }}" bind:confirm="confirmPreDate" bind:cancel="hidePreDate" />
</van-popup>
<!-- 维修人员 -->
<van-popup show="{{ userVisible }}" position="bottom" custom-style="height: 50vh;" bind:close="hideUser">
<van-picker show-toolbar columns="{{ userColumns }}" bind:confirm="userColumnsConfirm" bind:cancel="hideUser"/>
</van-popup>
<!-- 消息通知 -->
<van-notify id="van-notify" />

View File

@ -147,5 +147,5 @@
.mainView .reportView .itemView .label {
flex-shrink: 0;
font-size: 30rpx;
color: gray;
color: black;
}