import { TimeUtil } from '../../utils/TimeUtil' Component({ /** * 组件的属性列表 */ properties: { //0=待维修 1=维修中 2=已完成 itemData: null }, /** * 组件的初始数据 */ data: { status: 0, statusText: "", faultTime: '', myItemData: null, }, lifetimes: { attached: function () { // 在组件实例被从页面节点树添加时执行 let text = ""; switch (Number(this.properties.itemData.processType)) { case 0: text = "待维修"; break; case 1: text = "维修中"; break; case 2: text = "已完成"; break; } this.setData({ status: this.properties.itemData.processType, statusText: text, faultTime: TimeUtil.dateFormat(parseInt(this.properties.itemData.reportTime), "yyyy-MM-dd HH:mm"), myItemData: this.properties.itemData }) console.log("myItemData:", this.data.myItemData) }, detached: function () { // 在组件实例被从页面节点树移除时执行 }, }, /** * 组件的方法列表 */ methods: { toFaultInfoPage: function () { console.log("去故障详情界面:", this.data.itemData.id) wx.navigateTo({ url: '../../faultInfo/faultInfo?faultId=' + this.data.itemData.id, }) } } })