2025-06-19 17:33:18 +08:00

123 lines
2.5 KiB
TypeScript

// pages/vehicleMaintenance/maintainSend/maintainSend.ts
Page({
/**
* 页面的初始数据
*/
data: {
message: {} as any, // 展示的信息
userInfo: {} as any // 用户信息
},
// 前往下一状态的维修单
goRepair() {
let url = '../UpkeepPlanInfo/UpkeepPlanInfo';
wx.setStorageSync('info', {
info: this.data.message
});
wx.reLaunch({
url: url,
fail: e => {
console.log(e);
}
});
},
// 返回首页
backHome() {
if (this.data.userInfo.type == '1') {
wx.reLaunch({
url: '/pages/index/index'
});
} else if (this.data.userInfo.type == '2') {
wx.reLaunch({
url: '/pages/manufacturerIndex/manufacturerIndex'
});
} else if (this.data.userInfo.type == '3') {
wx.reLaunch({
url: '/pages/projectIndex/projectIndex'
});
} else if (this.data.userInfo.type == '4') {
wx.reLaunch({
url: '/pages/maintenanceIndex/maintenanceIndex'
});
} else {
wx.reLaunch({
url: '/pages/login/login'
});
}
},
getInf() {
// 获取信息
let info = wx.getStorageSync('message');
wx.removeStorage({ key: 'message' });
this.setData({
message: info
});
this.changeTitle(info);
},
// 获取用户信息
getUserInfo() {
let userInfo = wx.getStorageSync('userInfo');
this.setData({
userInfo: userInfo
});
},
// 修改页眉
changeTitle(info: any) {
let title = '操作成功';
switch (info.auditStatus) {
case 1:
title = '已提交';
break;
case 2:
title = '已审批';
break;
}
wx.setNavigationBarTitle({
title: title
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.getInf();
this.getUserInfo();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 不放onReady 是因为有可能切出去然后状态改了得跳转到别的页面
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});