faultItem.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { TimeUtil } from '../../utils/TimeUtil'
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. //0=待维修 1=维修中 2=已完成
  8. itemData: null
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. status: 0,
  15. statusText: "",
  16. faultTime: '',
  17. myItemData: null,
  18. },
  19. lifetimes: {
  20. attached: function () {
  21. // 在组件实例被从页面节点树添加时执行
  22. let text = "";
  23. switch (Number(this.properties.itemData.processType)) {
  24. case 0:
  25. text = "待维修";
  26. break;
  27. case 1:
  28. text = "维修中";
  29. break;
  30. case 2:
  31. text = "已完成";
  32. break;
  33. }
  34. this.setData({
  35. status: this.properties.itemData.processType,
  36. statusText: text,
  37. faultTime: TimeUtil.dateFormat(parseInt(this.properties.itemData.reportTime), "yyyy-MM-dd HH:mm"),
  38. myItemData: this.properties.itemData
  39. })
  40. console.log("myItemData:", this.data.myItemData)
  41. },
  42. detached: function () {
  43. // 在组件实例被从页面节点树移除时执行
  44. },
  45. },
  46. /**
  47. * 组件的方法列表
  48. */
  49. methods: {
  50. toFaultInfoPage: function () {
  51. console.log("去故障详情界面:", this.data.itemData.id)
  52. wx.navigateTo({
  53. url: '../../faultInfo/faultInfo?faultId=' + this.data.itemData.id,
  54. })
  55. }
  56. }
  57. })