From bd0d5396694b67e39ebaa44535b0df39895d5743 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 09 一月 2025 17:01:21 +0800
Subject: [PATCH] 设备日志导出

---
 src/views/mdc/base/modules/DeviceLog/LogList.vue |   44 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/src/views/mdc/base/modules/DeviceLog/LogList.vue b/src/views/mdc/base/modules/DeviceLog/LogList.vue
index 4888611..7fbc7be 100644
--- a/src/views/mdc/base/modules/DeviceLog/LogList.vue
+++ b/src/views/mdc/base/modules/DeviceLog/LogList.vue
@@ -20,7 +20,7 @@
   import JDictSelectTag from '@/components/dict/JDictSelectTag'
   import {
     requestPut,
-    deleteAction
+    deleteAction, downFile
   } from '@/api/manage'
 
   import JInput from '@/components/jeecg/JInput'
@@ -141,7 +141,10 @@
             align: 'center',
             dataIndex: 'sequenceNumber'
           }
-        ]
+        ],
+        url: {
+          exportXlsUrl: '/mdc/mdcEquipmentRunningSection/exportLogXls'
+        },
       }
     },
     methods: {
@@ -174,7 +177,42 @@
             }
           }
         }
-      }
+      },
+
+      handleExportXls(fileName){
+        if(!fileName || typeof fileName != "string"){
+          fileName = "瀵煎嚭鏂囦欢"
+        }
+        let param = this.getQueryParams();
+        if(this.selectedRowKeys && this.selectedRowKeys.length>0){
+          param['selections'] = this.selectedRowKeys.join(",")
+        }
+        console.log("瀵煎嚭鍙傛暟",param)
+        downFile(this.url.exportXlsUrl,param).then((data)=>{
+          if (!data) {
+            // this.$message.warning("鏂囦欢涓嬭浇澶辫触")
+            this.$notification.warning({
+              message:'娑堟伅',
+              description:"鏂囦欢涓嬭浇澶辫触"
+            });
+            return
+          }
+          if (typeof window.navigator.msSaveBlob !== 'undefined') {
+            window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
+          }else{
+            let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
+            let link = document.createElement('a')
+            link.style.display = 'none'
+            link.href = url
+            link.setAttribute('download', fileName+'.xls')
+            document.body.appendChild(link)
+            link.click()
+            document.body.removeChild(link); //涓嬭浇瀹屾垚绉婚櫎鍏冪礌
+            window.URL.revokeObjectURL(url); //閲婃斁鎺塨lob瀵硅薄
+          }
+        })
+      },
+
     },
     created() {
     }

--
Gitblit v1.9.3