faultItem.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // component/faultItem/faultItem.ts
  2. import { TimeUtil } from '../../utils/TimeUtil'
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. //0=待维修 1=维修中 2=已完成
  9. faultStatus: {
  10. type: Number,
  11. value: 0
  12. },
  13. faultRepairNo: {
  14. type: String,
  15. value: ''
  16. },
  17. faultReportTime: {
  18. type: String,
  19. value: ''
  20. },
  21. faultProvinceCity: {
  22. type: String,
  23. value: ''
  24. },
  25. faultSchoolName: {
  26. type: String,
  27. value: ''
  28. },
  29. faultClassName: {
  30. type: String,
  31. value: ''
  32. }
  33. },
  34. /**
  35. * 组件的初始数据
  36. */
  37. data: {
  38. status: 0,
  39. statusText: "",
  40. faultTime: '',
  41. },
  42. lifetimes: {
  43. attached: function () {
  44. // 在组件实例被从页面节点树添加时执行
  45. let text = "";
  46. switch (Number(this.properties.faultStatus)) {
  47. case 0:
  48. text = "待维修";
  49. break;
  50. case 1:
  51. text = "维修中";
  52. break;
  53. case 2:
  54. text = "已完成";
  55. break;
  56. }
  57. this.setData({
  58. status: this.properties.faultStatus,
  59. statusText: text,
  60. faultTime: TimeUtil.dateFormat(parseInt(this.properties.faultReportTime), "yyyy-MM-dd HH:mm")
  61. })
  62. console.log("status:", this.data.status)
  63. console.log("propertiesstatus:", this.properties.faultStatus)
  64. },
  65. detached: function () {
  66. // 在组件实例被从页面节点树移除时执行
  67. },
  68. },
  69. /**
  70. * 组件的方法列表
  71. */
  72. methods: {
  73. }
  74. })