navigate.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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=${
  64. data.orderStatus % 2 == 0 ? 1 : 0
  65. }&param=${json}&reloginUserId=${data.userId}`,
  66. });
  67. }
  68. };