From f95bd530f635ab9bad73fba9de3bc7eeb902c54d Mon Sep 17 00:00:00 2001
From: hyingbo <1363390067@qq.com>
Date: 星期三, 04 六月 2025 18:07:09 +0800
Subject: [PATCH] 我的消息添加状态筛选

---
 src/views/mdc/base/modules/efficiencyReport/EfficiencyList.vue |   78 +++++++++++++++++++++++++++++++-------
 1 files changed, 63 insertions(+), 15 deletions(-)

diff --git a/src/views/mdc/base/modules/efficiencyReport/EfficiencyList.vue b/src/views/mdc/base/modules/efficiencyReport/EfficiencyList.vue
index 8acbf86..7b3fa34 100644
--- a/src/views/mdc/base/modules/efficiencyReport/EfficiencyList.vue
+++ b/src/views/mdc/base/modules/efficiencyReport/EfficiencyList.vue
@@ -38,7 +38,9 @@
           </a-col>
           <a-col :md="6" :sm="6">
             <a-form-item label="鏃堕棿">
-              <a-range-picker @change="dateParamChange" :disabledDate="disabledDate" format="YYYYMMDD"
+              <a-range-picker @change="dateParamChange" :disabledDate="disabledDate"
+                              @calendarChange="handleCalendarChange" @openChange="handleCalendarOpenChange"
+                              format="YYYYMMDD"
                               v-model="dates" :allowClear="false"/>
             </a-form-item>
           </a-col>
@@ -95,8 +97,13 @@
                 <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>
                 <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button>
                 <a-button type="primary" @click="exportExcel" icon="download">瀵煎嚭</a-button>
-                <!--<a-button type="primary" @click="exportOneYearExcel('璁惧TEEP')" icon="download">澶ф暟鎹鍑�</a-button>-->
-                <a-button type="primary" @click="handleShowFeedbackModal" icon="plus" v-has="'efficiency:feedback'">寮傚父鍙嶉</a-button>
+                <a-button type="primary" @click="exportLongTimeExcel('璁惧TEEP')" icon="download"
+                          :loading="longTimeExportButtonLoading">
+                  澶ф暟鎹鍑�
+                </a-button>
+                <a-button type="primary" @click="handleShowFeedbackModal" icon="plus" v-has="'efficiency:feedback'">
+                  寮傚父鍙嶉
+                </a-button>
                 <a-button type="primary" icon="printer" v-print="'#Efficiency'"
                           v-has="'efficiency:print'">鎵撳嵃
                 </a-button>
@@ -275,7 +282,7 @@
           list: '/mdc/efficiencyReport/efficiencyList',
           listByType: '/mdc/MdcUtilizationRate/getByType',
           queryEquipmentType: '/mdc/mdcEquipmentType/queryEquipmentType',
-          exportOneYearXlsUrl: ''
+          exportLongTimeXlsUrl: '/mdc/efficiencyReport/exportEfficiencyXls'
         },
         tableHeads: [],
         utilizationRateRowAverage: '',
@@ -289,7 +296,9 @@
         requestAllDataSize: 8,// 鎬诲叡璇锋眰鐨勫垪琛ㄩ」鏁扮洰(榛樿鍊间负榛樿鏃ユ湡鐨勫樊鍊�+1)
         everyRequestDataSize: 15,// 姣忔璇锋眰鐨勫垪琛ㄩ」鏁扮洰
         toggleSearchStatus: false,
-        modalVisible: false// 寮傚父鍙嶉寮圭獥鏄惁寮瑰嚭
+        modalVisible: false,// 寮傚父鍙嶉寮圭獥鏄惁寮瑰嚭
+        preSelectFirstDate: null,
+        longTimeExportButtonLoading: false
       }
     },
     props: { nodeTree: '', Type: '', nodePeople: '' },
@@ -469,10 +478,42 @@
         }
         return list
       },
-      disabledDate(current) {
-        //Can not slect days before today and today
-        return current && current > moment().subtract('days', 1)
+
+      dateParamChange(v1, v2) {
+        this.queryParam.startTime = v2[0]
+        this.queryParam.endTime = v2[1]
       },
+
+      /**
+       * 鏃堕棿閫夋嫨鍣ㄩ潰鏉夸笂鐨勫�煎彂鐢熸敼鍙樻椂瑙﹀彂
+       * @param dates 闈㈡澘涓婄殑涓や釜鍊肩粍鎴愮殑鏁扮粍
+       */
+      handleCalendarChange(dates) {
+        if (dates.length === 1) this.preSelectFirstDate = dates[0]
+      },
+
+      /**
+       * 鎺у埗鏃堕棿閫夋嫨鍣ㄩ潰鏉垮紑鍚笌鍏抽棴
+       * @param status 寮�鍚姸鎬�
+       */
+      handleCalendarOpenChange(status) {
+        if (status) this.preSelectFirstDate = null
+      },
+
+      /**
+       * 闈㈡澘涓婄姝㈤�夋嫨鐨勬棩鏈�
+       * @param current 绂佹鐨勬椂闂磋寖鍥�
+       */
+      disabledDate(current) {
+        if (!this.preSelectFirstDate) {
+          return current > moment().startOf('days')
+        } else {
+          return current < moment(this.preSelectFirstDate).subtract(365, 'days').startOf('days')
+            || current > moment().startOf('days')
+            || current > moment(this.preSelectFirstDate).add(365, 'days').endOf('days')
+        }
+      },
+
       exportExcel() {
         $('#Efficiency').table2excel({
           exclude: '.noExl',
@@ -484,10 +525,15 @@
           exclude_inputs: false
         })
       },
-      exportOneYearExcel(fileName) {
+      exportLongTimeExcel(fileName) {
         // let param = this.getQueryParams()
         // console.log('瀵煎嚭鍙傛暟', param)
-        downFile(this.url.exportOneYearXlsUrl)
+        const param = {
+          startTime: moment(this.dates[0]).format('YYYYMMDD'),
+          endTime: moment(this.dates[1]).format('YYYYMMDD')
+        }
+        this.longTimeExportButtonLoading = true
+        downFile(this.url.exportLongTimeXlsUrl, param)
           .then((data) => {
             if (!data) {
               this.$notification.warning({
@@ -510,6 +556,13 @@
               window.URL.revokeObjectURL(url) //閲婃斁鎺塨lob瀵硅薄
             }
           })
+          .finally(() => {
+            let timer = setTimeout(() => {
+              this.longTimeExportButtonLoading = false
+              clearTimeout(timer)
+              timer = null
+            }, 1000)
+          })
       },
       showIdentifying() {
         getAction(this.url.listByType, { type: 'lyl' }).then(res => {
@@ -517,11 +570,6 @@
             this.identifying = res.result
           }
         })
-      },
-      dateParamChange(v1, v2) {
-        this.queryParam.startTime = v2[0]
-        this.queryParam.endTime = v2[1]
-        this.dates = [v1[0], v1[1]]
       },
       efficiencyOptionsOnChange(checkedList) {
         this.checkedList = checkedList

--
Gitblit v1.9.3