navigate.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. console.log('data :>> ', data);
  9. if (!data.userId) {
  10. data.userId = '';
  11. }
  12. if (data.type === 'generateInspect') {
  13. // 巡检工单填写页面
  14. const detail = (await getInspectOrderGet({ id: data.id })).data;
  15. if (detail.status === 'finished') {
  16. uni.navigateTo({
  17. url: `/pages/inspection/detail?id=${data.id}&reloginUserId=${data.userId}`,
  18. });
  19. } else {
  20. uni.navigateTo({
  21. url: `/pages/inspection/edit?id=${data.id}&reloginUserId=${data.userId}`,
  22. });
  23. }
  24. } else if (data.type === 'failureReport') {
  25. // 故障上报审批页面
  26. uni.navigateTo({
  27. url: `/pages/message/detail/index?processInstanceId=${data.id}&reloginUserId=${data.userId}`,
  28. });
  29. } else if (data.type === 'generateMaintain') {
  30. // 维修工单填写页面
  31. const detail = (await getRepairDetail({ id: data.id })).data;
  32. if (detail.status !== 'tx') {
  33. uni.navigateTo({
  34. url: `/pages/repair/detail?id=${data.id}&reloginUserId=${data.userId}`,
  35. });
  36. } else {
  37. uni.navigateTo({
  38. url: `/pages/repair/edit?id=${data.id}&reloginUserId=${data.userId}`,
  39. });
  40. }
  41. } else if (data.type === 'maintainOut') {
  42. // 维修工单委外流程审批页面
  43. uni.navigateTo({
  44. url: `/pages/message/detail/index?processInstanceId=${data.id}&reloginUserId=${data.userId}`,
  45. });
  46. } else if (data.type === 'generateMaintenance') {
  47. // 保养工单填写页面
  48. uni.navigateTo({
  49. url: `/pages/maintenance/edit?id=${data.id}&reloginUserId=${data.userId}`,
  50. });
  51. } else if (data.type === 'generateOperation') {
  52. // 运行记录填写页面
  53. const json = JSON.stringify({
  54. deptId: data.deptId,
  55. userId: data.userId,
  56. createTime: data.createTime,
  57. orderId: data.id,
  58. orderStatus: data.orderStatus,
  59. orderName: data.orderName,
  60. userName: data.userName,
  61. });
  62. // {0: '待填写', 1: '已完成', 2: '填写中', 3: '忽略'}
  63. uni.navigateTo({
  64. url: `/pages/recordFilling/detail?view=${data.orderStatus % 2 == 0 ? 1 : 0}&param=${json}&reloginUserId=${
  65. data.userId
  66. }`,
  67. });
  68. } else if (data.type === 'rdReportApproval') {
  69. uni.navigateTo({
  70. url: `/pages/ruiDu/approval?id=${data.businessId}`,
  71. });
  72. } else if (data.type === 'rhDailyReport') {
  73. uni.navigateTo({
  74. url: `/pages/ruihen/edit?id=${data.businessId}`,
  75. });
  76. } else if (data.type === 'rhReportApproval') {
  77. uni.navigateTo({
  78. url: `/pages/ruihen/approval?id=${data.businessId}`,
  79. });
  80. }
  81. };