Browse Source

四率入参

taidong
mk 10 months ago
parent
commit
7d1bcc53f9
  1. 128
      pages/statistics/modules/HotlineRates/HotlineRates.js
  2. 8
      utils/config.js

128
pages/statistics/modules/HotlineRates/HotlineRates.js

@ -0,0 +1,128 @@
import {event12345Rates} from "../../../../utils/statisticsApi";
import {formatTime} from "../../../../utils/util";
const formatDay2 = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDay()
return [year, month, day].map(formatNumber).join('-')
}
const formatDay = date => {
const year = date.getFullYear()
const month = date.getMonth()
const day = date.getDay()
return [year, month, day].map(formatNumber).join('-')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
Component({
properties: {
curVal: {
type: String,
value: '1',
observer: function () {
this.getList();
}
}
},
data: {
list: [],
day: '',
day2: '',
showitem: 3,
},
ready() {
this.setData({
day: formatDay(new Date()),
})
this.setData({
day2: formatDay2(new Date())
})
this.getList()
},
methods: {
onChange(e) {
this.setData({
day: e.detail.value
})
},
onChange2(e) {
this.setData({
day2: e.detail.value
})
},
onSearch(){
if(this.data.day>this.data.day2){
wx.showToast({
title: '起止日期错误',
icon: 'error',
duration: 2000
})
return false
}
this.getList()
},
showall(){
if(this.data.showitem==99999){
this.setData({
showitem: 3
})
}else{
this.setData({
showitem: 99999
})
}
},
getList() {
if (this.data.curVal == '1') {
this.getEventList(false)
} else {
this.getEventList(false)
}
},
getEventList(deptFlag) {
event12345Rates({
startDate: this.data.day.toString() + ' ' + '00:00:00',
endDate: this.data.day2.toString() + ' ' + '23:59:59',
usableFlag: true,
// deptFlag: deptFlag,
recountFlag:1
}).then(res => {
console.log('++++++++++++',res.data)
// res.data.list.forEach(item => {
// item.reportTime = this.formatTime(item.reportTime)
// })
this.setData({
list: res.data
})
})
},
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 ''
},
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',
})
}
}
}
});

8
utils/config.js

@ -1,3 +1,11 @@
/*
* @Author: mk 2403457699@qq.com
* @Date: 2024-10-11 09:22:38
* @LastEditors: mk 2403457699@qq.com
* @LastEditTime: 2024-10-14 17:48:57
* @FilePath: \epmet-work-mp\utils\config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
module.exports = {
BASEURL: BASEURL,
Token: getToken,

Loading…
Cancel
Save