navigate.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { getInspectOrderGet } from '@/api/inspection';
  2. import { getRepairDetail } from '@/api/repair';
  3. /**
  4. * 根据不同类型的消息跳转目标页面
  5. * @param data
  6. */
  7. export const messageNavigate = async data => {
  8. if (!data.userId) {
  9. data.userId = '';
  10. }
  11. if (data.type === 'generateInspect') {
  12. // 巡检工单填写页面
  13. const detail = (await getInspectOrderGet({ id: data.id })).data;
  14. if (detail.status === 'finished') {
  15. uni.navigateTo({
  16. url: `/pages/inspection/detail?id=${data.id}&reloginUserId=${data.userId}`,
  17. });
  18. } else {
  19. uni.navigateTo({
  20. url: `/pages/inspection/edit?id=${data.id}&reloginUserId=${data.userId}`,
  21. });
  22. }
  23. } else if (data.type === 'failureReport') {
  24. // 故障上报审批页面
  25. uni.navigateTo({
  26. url: `/pages/message/detail/index?processInstanceId=${data.id}&reloginUserId=${data.userId}`,
  27. });
  28. } else if (data.type === 'generateMaintain') {
  29. // 维修工单填写页面
  30. const detail = (await getRepairDetail({ id: data.id })).data;
  31. if (detail.status !== 'tx') {
  32. uni.navigateTo({
  33. url: `/pages/repair/detail?id=${data.id}&reloginUserId=${data.userId}`,
  34. });
  35. } else {
  36. uni.navigateTo({
  37. url: `/pages/repair/edit?id=${data.id}&reloginUserId=${data.userId}`,
  38. });
  39. }
  40. } else if (data.type === 'maintainOut') {
  41. // 维修工单委外流程审批页面
  42. uni.navigateTo({
  43. url: `/pages/message/detail/index?processInstanceId=${data.id}&reloginUserId=${data.userId}`,
  44. });
  45. } else if (data.type === 'generateMaintenance') {
  46. // 保养工单填写页面
  47. uni.navigateTo({
  48. url: `/pages/maintenance/edit?id=${data.id}&reloginUserId=${data.userId}`,
  49. });
  50. } else if (data.type === 'generateOperation') {
  51. // 运行记录填写页面
  52. const json = JSON.stringify({
  53. deptId: data.deptId,
  54. userId: data.userId,
  55. createTime: data.createTime,
  56. orderId: data.id,
  57. orderStatus: data.orderStatus,
  58. orderName: data.orderName,
  59. userName: data.userName,
  60. });
  61. // {0: '待填写', 1: '已完成', 2: '填写中', 3: '忽略'}
  62. uni.navigateTo({
  63. url: `/pages/recordFilling/detail?view=${data.orderStatus % 2 == 0 ? 1 : 0}&param=${json}&reloginUserId=${
  64. data.userId
  65. }`,
  66. });
  67. } else if (data.type === 'rdReportApproval') {
  68. uni.navigateTo({
  69. url: `/pages/ruiDu/approval?id=${data.businessId}`,
  70. });
  71. }
  72. };