navigate.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 === "rdDailyReport") {
  69. uni.navigateTo({
  70. url: `/pages/ruiDu/edit?id=${data.businessId}&istime=${false}`,
  71. });
  72. } else if (data.type === "rdReportApproval") {
  73. uni.navigateTo({
  74. url: `/pages/ruiDu/approval?id=${data.businessId}`,
  75. });
  76. } else if (data.type === "rdReportDetail") {
  77. uni.navigateTo({
  78. url: `/pages/ruiDu/detail?id=${data.businessId}`,
  79. });
  80. } else if (data.type === "rhDailyReport") {
  81. uni.navigateTo({
  82. url: `/pages/ruihen/edit?id=${data.businessId}`,
  83. });
  84. } else if (data.type === "rhReportApproval") {
  85. uni.navigateTo({
  86. url: `/pages/ruihen/approval?id=${data.businessId}`,
  87. });
  88. } else if (data.type === "ryDailyReport") {
  89. uni.navigateTo({
  90. url: `/pages/ruiying/edit?id=${data.businessId}`,
  91. });
  92. } else if (data.type === "ryReportApproval") {
  93. uni.navigateTo({
  94. url: `/pages/ruiying/approval?id=${data.businessId}`,
  95. });
  96. } else if (data.type === "ryXjDailyReport") {
  97. uni.navigateTo({
  98. url: `/pages/ruiyingx/edit?id=${data.businessId}`,
  99. });
  100. } else if (data.type === "ryXjReportApproval") {
  101. uni.navigateTo({
  102. url: `/pages/ruiyingx/approval?id=${data.businessId}`,
  103. });
  104. }
  105. };