epmet 工作端 小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.3 KiB

import {icEventOldList, userdemandList} from "../../../../utils/statisticsApi";
import {formatTime} from "../../../../utils/util";
Component({
properties: {
stayVal: {
type: String,
value: '1',
observer: function () {
this.getList();
}
}
},
data: {
list: []
},
ready() {
this.getList()
},
methods: {
getList() {
if (this.data.stayVal == '1') {
this.getEventList()
} else {
this.getDemandList()
}
},
getDemandList() {
userdemandList({
pageSize: "5",
pageNo: 1,
agencyId: "",
undoneStauts: "undone",
// orgId: "1704313950756757506",
// orgLevel: "agency"
}).then(res => {
res.data.list.forEach(item => {
item.reportTime = this.formatTime(item.reportTime)
})
this.setData({
list: res.data.list
})
})
},
formatTime(date) {
if (date) {
let _date = new Date(date)
let M = _date.getMonth() - 0 + 1 > 10 ? _date.getMonth() - 0 + 1 : '0' + (_date.getMonth() - 0 + 1)
let D = _date.getDate() > 10 ? _date.getDate() : '0' + _date.getDate()
return M + '-' +D
}
return ''
},
getEventList() {
icEventOldList({"pageSize": "5", "pageNo": 1, "agencyId": "", "status": "processing"}).then(res => {
res.data.list.forEach(item => {
item.happenTime = this.formatTime(item.happenTime)
})
this.setData({
list: res.data.list
})
})
},
gotopage(e) {
if (this.data.stayVal === '1') {
wx.navigateTo({
url: '/subpages/statistics/pages/event/detail/detail?id=' + e.currentTarget.dataset.id+'&is12345=2',
})
} else {
wx.navigateTo({
url: '/subpages/statistics/pages/demand/detail/detail?id=' + e.currentTarget.dataset.id+'&type=1',
})
}
}
}
});