gaoshp
2024-06-20 2672eaeda5b32e17a00f2ff32c94207d6afeab98
src/views/mdc/components/TimeAlarm.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-18 21:52:18
 * @LastEditors: Sneed
 * @LastEditTime: 2024-04-22 22:32:05
 * @LastEditTime: 2024-06-20 23:20:15
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/TimeAlarm.vue
-->
<template>
@@ -113,10 +113,7 @@
            this.getTime({
                endDate: params.endDate,
                startDate: params.startDate,
            }).then(res => {
            })
        },
        getTime(data) {
            return Promise.all([
@@ -125,7 +122,8 @@
                    statisticalMethod: "DAY"
                }).then(res => {
                    if (res.code === 200) {
                        this.btnListDay = res.data.map(item => ({
                        this.btnListDay = res.data.map(item => {
                            return {
                            label: item.title,
                            value: item.id,
                            startDate: item.startDate,
@@ -133,7 +131,9 @@
                            week: moment(item.id).week(),
                            month: moment(item.id).month() + 1,
                            year: moment(item.id).year()
                        })).reverse()
                            }
                        }).reverse()
                    }
                    this.queryDay(this.btnListDay[0])
                }),
@@ -142,7 +142,8 @@
                    statisticalMethod: "WEEK"
                }).then(res => {
                    if (res.code === 200) {
                        this.btnListWeek = res.data.map(item => ({
                        this.btnListWeek = res.data.map(item => {
                            return {
                            label: item.title,
                            value: item.id,
                            startDate: item.startDate,
@@ -150,7 +151,9 @@
                            week: moment(item.startDate).week(),
                            month: moment(item.startDate).month() + 1,
                            year: moment(item.startDate).year()
                        })).reverse()
                            }
                        }).reverse()
                    }
                }),
@@ -159,15 +162,20 @@
                    statisticalMethod: "MONTH"
                }).then(res => {
                    if (res.code === 200) {
                        this.btnListMonth = res.data.map(item => ({
                        this.btnListMonth = res.data.map(item => {
                            let startDate = moment(item.id).startOf('month').format('YYYY-MM-DD')
                            let endDate = moment(item.id).endOf('month').format('YYYY-MM-DD')
                            return {
                            label: item.title,
                            value: item.id,
                            startDate: item.startDate,
                            endDate: item.endDate,
                                startDate,
                                endDate,
                            week: moment(item.id + '-1').week(),
                            month: moment(item.id + '-1').month() + 1,
                            year: moment(item.id + '-1').year()
                        })).reverse()
                            }
                        }).reverse()
                    }
                })
@@ -217,8 +225,10 @@
            })
        },
        query(data, flag) {
            console.log('--------')
            this.queryTableData(data, flag)
            if (this.isShowTable) {
                return this.queryTableData(data, flag)
            }
            return this.$HTTP.post(this.url, data, {}).then(res => {
                return this.setOptions(res.data.res)
            })