From 7d1bcc53f9c4271044c4fd5c155f5f3db5ec7af8 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Wed, 16 Oct 2024 10:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9B=E7=8E=87=E5=85=A5=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/HotlineRates/HotlineRates.js | 128 ++++++++++++++++++ utils/config.js | 8 ++ 2 files changed, 136 insertions(+) create mode 100644 pages/statistics/modules/HotlineRates/HotlineRates.js diff --git a/pages/statistics/modules/HotlineRates/HotlineRates.js b/pages/statistics/modules/HotlineRates/HotlineRates.js new file mode 100644 index 0000000..0857c68 --- /dev/null +++ b/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', + }) + } + + } + } +}); diff --git a/utils/config.js b/utils/config.js index 78cc30d..86692a6 100644 --- a/utils/config.js +++ b/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,