From d2be196da480346d1f111ca1f02b9852694aa2ca Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Fri, 02 Feb 2024 18:49:47 +0800
Subject: [PATCH] 1

---
 src/views/publicSecurity/ninePlaceManage/hiddenDangerStatistics.vue |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/views/publicSecurity/ninePlaceManage/hiddenDangerStatistics.vue b/src/views/publicSecurity/ninePlaceManage/hiddenDangerStatistics.vue
index 55684cd..ffc3542 100644
--- a/src/views/publicSecurity/ninePlaceManage/hiddenDangerStatistics.vue
+++ b/src/views/publicSecurity/ninePlaceManage/hiddenDangerStatistics.vue
@@ -5,6 +5,10 @@
             @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" @search-change="searchChange"
             @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
             @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
+            <template slot="menuLeft">
+                <el-button type="warning" size="small" plain icon="el-icon-download" @click="handleExport">导出
+                </el-button>
+            </template>
         </avue-crud>
     </basic-container>
 </template>
@@ -173,7 +177,31 @@
         },
 
     },
+
     methods: {
+        getLastMouth (str = '-') {
+            let today = new Date()
+            let lastMouth = new Date()
+            let nowTime = today.getTime()
+            let ms = 24 * 3600 * 1000 * -30
+            today.setTime(parseInt(nowTime))
+            lastMouth.setTime(parseInt(nowTime + ms))
+            let oYear = today.getFullYear()
+            let oMoth = (today.getMonth() + 1).toString()
+            if (oMoth.length <= 1) oMoth = "0" + oMoth
+            let oDay = today.getDate().toString()
+            if (oDay.length <= 1) oDay = "0" + oDay
+            let mYear = lastMouth.getFullYear()
+            let mMoth = (lastMouth.getMonth() + 1).toString()
+            if (mMoth.length <= 1) mMoth = "0" + mMoth
+            let mDay = lastMouth.getDate().toString()
+            if (mDay.length <= 1) mDay = "0" + mDay
+            let todayDate = oYear + str + oMoth + str + oDay
+            let lastMouthDate = mYear + str + mMoth + str + mDay
+            console.log('[todayDate, lastMouthDate]', [todayDate, lastMouthDate])
+            return [todayDate, lastMouthDate]
+        },
+
         summaryMethod ({ columns, data }) {
             const sums = []
             if (columns.length > 0) {
@@ -362,6 +390,12 @@
 
         onLoad (page, params = {}) {
             this.loading = true
+            if (!this.query.startTime) {
+                this.query = {
+                    startTime: this.getLastMouth[1],
+                    endTime: this.getLastMouth[0],
+                }
+            }
             getYHTJList(page.currentPage, page.pageSize, this.query).then(res => {
                 console.log('getZGQKList', res.data.data)
                 const data = res.data.data

--
Gitblit v1.9.3