Browse Source

导出限制导出时间范围——暂定3个月

LLL 1 year ago
parent
commit
9f9c4b72f7

+ 80 - 1
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory05List.vue

@@ -29,7 +29,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <a-button type="primary" icon="download" @click="handleExportXls('1立方温箱历史数据')">导出</a-button>
+      <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
       <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
       <!--        <a-button type="primary" icon="import">导入</a-button>-->
       <!--      </a-upload>-->
@@ -133,6 +133,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import ItdmWenxiangHistory05Modal from './modules/ItdmWenxiangHistory05Modal'
+  import { downFile } from '@/api/manage'
 
   export default {
     name: 'ItdmWenxiangHistory05List',
@@ -310,6 +311,84 @@
       },
     },
     methods: {
+      // 判断时间段是否在3个月内,在的话导出,超出的话提示
+      dc(fileName){
+        console.log(11111,this.queryParam)
+        //判断时间段是否在3个月内
+        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+
+        if(flag){
+          this.handleExportXls(fileName)
+        }else {
+          this.$message.error("时间跨度不得超过3个月!")
+        }
+      },
+
+      //导出xls
+      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("文件下载失败")
+            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); //释放掉blob对象
+          }
+        })
+      },
+
+      //判断时间段是否在3个月内,是的话返回true,否则返回false
+      completeDate (time1, time2, m) {
+        const year1 = time1.getFullYear()
+        const year2 = time2.getFullYear()
+        const month1 = time1.getMonth() + 1
+        const month2 = time2.getMonth() + 1
+        const day1 = time1.getDate()
+        const day2 = time2.getDate()
+        if (year2 === year1) { // 判断两个日期 是否是同年
+          if (month2 - month1 > m) { // 相差是否 在m个月中
+            return false
+          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+            if (day2 > day1) {
+              return false
+            }
+          }
+        } else { // 不同年
+          if (year2 - year1 > 1) {
+            return false
+          }
+          else if (year2 - year1 === 1) {
+            if (month2 > m || month1 + m - month2 < 12) {
+              return false
+            }
+            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+              if (day2 > day1) {
+                return false
+              }
+            }
+          }
+        }
+        return true
+      },
+
       initDictConfig(){
       },
       getSuperFieldList(){

+ 80 - 1
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory16List.vue

@@ -29,7 +29,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <a-button type="primary" icon="download" @click="handleExportXls('1立方温箱历史数据')">导出</a-button>
+      <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
       <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
       <!--        <a-button type="primary" icon="import">导入</a-button>-->
       <!--      </a-upload>-->
@@ -133,6 +133,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import ItdmWenxiangHistory16Modal from './modules/ItdmWenxiangHistory16Modal'
+  import { downFile } from '@/api/manage'
 
   export default {
     name: 'ItdmWenxiangHistory16List',
@@ -310,6 +311,84 @@
       },
     },
     methods: {
+      // 判断时间段是否在3个月内,在的话导出,超出的话提示
+      dc(fileName){
+        console.log(11111,this.queryParam)
+        //判断时间段是否在3个月内
+        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+
+        if(flag){
+          this.handleExportXls(fileName)
+        }else {
+          this.$message.error("时间跨度不得超过3个月!")
+        }
+      },
+
+      //导出xls
+      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("文件下载失败")
+            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); //释放掉blob对象
+          }
+        })
+      },
+
+      //判断时间段是否在3个月内,是的话返回true,否则返回false
+      completeDate (time1, time2, m) {
+        const year1 = time1.getFullYear()
+        const year2 = time2.getFullYear()
+        const month1 = time1.getMonth() + 1
+        const month2 = time2.getMonth() + 1
+        const day1 = time1.getDate()
+        const day2 = time2.getDate()
+        if (year2 === year1) { // 判断两个日期 是否是同年
+          if (month2 - month1 > m) { // 相差是否 在m个月中
+            return false
+          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+            if (day2 > day1) {
+              return false
+            }
+          }
+        } else { // 不同年
+          if (year2 - year1 > 1) {
+            return false
+          }
+          else if (year2 - year1 === 1) {
+            if (month2 > m || month1 + m - month2 < 12) {
+              return false
+            }
+            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+              if (day2 > day1) {
+                return false
+              }
+            }
+          }
+        }
+        return true
+      },
+
       initDictConfig(){
       },
       getSuperFieldList(){

+ 65 - 73
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory1List.vue

@@ -29,7 +29,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
 <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <a-button type="primary" icon="download" @click="daochu('1立方温箱历史数据')">导出</a-button>
+      <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
 <!--      <a-button type="primary" icon="download" @click="handleExportXls('1立方温箱历史数据')">导出</a-button>-->
 <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
 <!--        <a-button type="primary" icon="import">导入</a-button>-->
@@ -312,91 +312,83 @@
       },
     },
     methods: {
-      // 导出
-      daochu(fileName){
+
+      // 判断时间段是否在3个月内,在的话导出,超出的话提示
+      dc(fileName){
         console.log(11111,this.queryParam)
+        //判断时间段是否在3个月内
+        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
 
-        var time1 = new Date(this.queryParam.createTime_begin).getTime();
-        var time2 = new Date(this.queryParam.createTime_end).getTime();
-        var flag = true;
-        if(this.queryParam.createTime_begin==''){
-          alert("开始时间不能为空");
-          flag = false;
+        if(flag){
+          this.handleExportXls(fileName)
+        }else {
+          this.$message.error("时间跨度不得超过3个月!")
         }
-        if(this.queryParam.createTime_end==''){
-          alert("结束时间不能为空");
-          flag = false;
+      },
+
+      //导出xls
+      handleExportXls(fileName){
+        if(!fileName || typeof fileName != "string"){
+          fileName = "导出文件"
         }
-        if(time1 > time2){
-          alert("开始时间不能大于结束时间");
-          flag = false;
+        let param = this.getQueryParams();
+        if(this.selectedRowKeys && this.selectedRowKeys.length>0){
+          param['selections'] = this.selectedRowKeys.join(",")
         }
-
-        //判断时间跨度是否大于3个月
-        var arr1 = this.queryParam.createTime_begin.split('-');
-        var arr2 = this.queryParam.createTime_end.split('-');
-        arr1[1] = parseInt(arr1[1]);
-        arr1[2] = parseInt(arr1[2]);
-        arr2[1] = parseInt(arr2[1]);
-        arr2[2] = parseInt(arr2[2]);
-        if(arr1[0] == arr2[0]){//同年
-          if(arr2[1]-arr1[1] > 3){ //月间隔超过3个月
-            flag = false;
-          }else if(arr2[1]-arr1[1] == 3){ //月相隔3个月,比较日
-            if(arr2[2] > arr1[2]){ //结束日期的日大于开始日期的日
-              flag = false;
-            }
+        console.log("导出参数",param)
+        downFile(this.url.exportXlsUrl,param).then((data)=>{
+          if (!data) {
+            this.$message.warning("文件下载失败")
+            return
           }
-        }else{ //不同年
-          if(arr2[0] - arr1[0] > 1){
-            flag = false;
-          }else if(arr2[0] - arr1[0] == 1){
-            if(arr1[1] < 10){ //开始年的月份小于10时,不需要跨年
-              flag = false;
-            }else if(arr1[1]+3-arr2[1] < 12){ //月相隔大于3个月
-              flag = false;
-            }else if(arr1[1]+3-arr2[1] == 12){ //月相隔3个月,比较日
-              if(arr2[2] > arr1[2]){ //结束日期的日大于开始日期的日
-                flag = false;
-              }
-            }
+          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); //释放掉blob对象
           }
-        }
-
+        })
+      },
 
-        if(flag){
-          console.log("flag:",flag)
-          if(!fileName || typeof fileName != "string"){
-            fileName = "导出文件"
+      //判断时间段是否在3个月内,是的话返回true,否则返回false
+      completeDate (time1, time2, m) {
+        const year1 = time1.getFullYear()
+        const year2 = time2.getFullYear()
+        const month1 = time1.getMonth() + 1
+        const month2 = time2.getMonth() + 1
+        const day1 = time1.getDate()
+        const day2 = time2.getDate()
+        if (year2 === year1) { // 判断两个日期 是否是同年
+          if (month2 - month1 > m) { // 相差是否 在m个月中
+            return false
+          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+            if (day2 > day1) {
+              return false
+            }
           }
-          let param = this.getQueryParams();
-          if(this.selectedRowKeys && this.selectedRowKeys.length>0){
-            param['selections'] = this.selectedRowKeys.join(",")
+        } else { // 不同年
+          if (year2 - year1 > 1) {
+            return false
           }
-          console.log("导出参数",param)
-          downFile(this.url.exportXlsUrl,param).then((data)=>{
-            if (!data) {
-              this.$message.warning("文件下载失败")
-              return
+          else if (year2 - year1 === 1) {
+            if (month2 > m || month1 + m - month2 < 12) {
+              return false
             }
-            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); //释放掉blob对象
+            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+              if (day2 > day1) {
+                return false
+              }
             }
-          })
-        }else {
-          console.log("!flag:",!flag)
-          this.$message.error("时间跨度不得超过3个月!")
+          }
         }
+        return true
       },
 
       initDictConfig(){

+ 80 - 1
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory48List.vue

@@ -29,7 +29,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <a-button type="primary" icon="download" @click="handleExportXls('1立方温箱历史数据')">导出</a-button>
+      <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
       <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
       <!--        <a-button type="primary" icon="import">导入</a-button>-->
       <!--      </a-upload>-->
@@ -133,6 +133,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import ItdmWenxiangHistory48Modal from './modules/ItdmWenxiangHistory48Modal'
+  import { downFile } from '@/api/manage'
 
   export default {
     name: 'ItdmWenxiangHistory48List',
@@ -310,6 +311,84 @@
       },
     },
     methods: {
+      // 判断时间段是否在3个月内,在的话导出,超出的话提示
+      dc(fileName){
+        console.log(11111,this.queryParam)
+        //判断时间段是否在3个月内
+        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+
+        if(flag){
+          this.handleExportXls(fileName)
+        }else {
+          this.$message.error("时间跨度不得超过3个月!")
+        }
+      },
+
+      //导出xls
+      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("文件下载失败")
+            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); //释放掉blob对象
+          }
+        })
+      },
+
+      //判断时间段是否在3个月内,是的话返回true,否则返回false
+      completeDate (time1, time2, m) {
+        const year1 = time1.getFullYear()
+        const year2 = time2.getFullYear()
+        const month1 = time1.getMonth() + 1
+        const month2 = time2.getMonth() + 1
+        const day1 = time1.getDate()
+        const day2 = time2.getDate()
+        if (year2 === year1) { // 判断两个日期 是否是同年
+          if (month2 - month1 > m) { // 相差是否 在m个月中
+            return false
+          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+            if (day2 > day1) {
+              return false
+            }
+          }
+        } else { // 不同年
+          if (year2 - year1 > 1) {
+            return false
+          }
+          else if (year2 - year1 === 1) {
+            if (month2 > m || month1 + m - month2 < 12) {
+              return false
+            }
+            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+              if (day2 > day1) {
+                return false
+              }
+            }
+          }
+        }
+        return true
+      },
+
       initDictConfig(){
       },
       getSuperFieldList(){

+ 80 - 1
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistory8List.vue

@@ -29,7 +29,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <a-button type="primary" icon="download" @click="handleExportXls('1立方温箱历史数据')">导出</a-button>
+      <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
       <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
       <!--        <a-button type="primary" icon="import">导入</a-button>-->
       <!--      </a-upload>-->
@@ -133,6 +133,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import ItdmWenxiangHistory8Modal from './modules/ItdmWenxiangHistory8Modal'
+  import { downFile } from '@/api/manage'
 
   export default {
     name: 'ItdmWenxiangHistory8List',
@@ -310,6 +311,84 @@
       },
     },
     methods: {
+      // 判断时间段是否在3个月内,在的话导出,超出的话提示
+      dc(fileName){
+        console.log(11111,this.queryParam)
+        //判断时间段是否在3个月内
+        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+
+        if(flag){
+          this.handleExportXls(fileName)
+        }else {
+          this.$message.error("时间跨度不得超过3个月!")
+        }
+      },
+
+      //导出xls
+      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("文件下载失败")
+            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); //释放掉blob对象
+          }
+        })
+      },
+
+      //判断时间段是否在3个月内,是的话返回true,否则返回false
+      completeDate (time1, time2, m) {
+        const year1 = time1.getFullYear()
+        const year2 = time2.getFullYear()
+        const month1 = time1.getMonth() + 1
+        const month2 = time2.getMonth() + 1
+        const day1 = time1.getDate()
+        const day2 = time2.getDate()
+        if (year2 === year1) { // 判断两个日期 是否是同年
+          if (month2 - month1 > m) { // 相差是否 在m个月中
+            return false
+          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+            if (day2 > day1) {
+              return false
+            }
+          }
+        } else { // 不同年
+          if (year2 - year1 > 1) {
+            return false
+          }
+          else if (year2 - year1 === 1) {
+            if (month2 > m || month1 + m - month2 < 12) {
+              return false
+            }
+            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+              if (day2 > day1) {
+                return false
+              }
+            }
+          }
+        }
+        return true
+      },
+
       initDictConfig(){
       },
       getSuperFieldList(){

+ 80 - 1
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistoryMjList.vue

@@ -29,7 +29,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <a-button type="primary" icon="download" @click="handleExportXls('1立方温箱历史数据')">导出</a-button>
+      <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
       <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
       <!--        <a-button type="primary" icon="import">导入</a-button>-->
       <!--      </a-upload>-->
@@ -133,6 +133,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import ItdmWenxiangHistoryMjModal from './modules/ItdmWenxiangHistoryMjModal'
+  import { downFile } from '@/api/manage'
 
   export default {
     name: 'ItdmWenxiangHistoryMjList',
@@ -310,6 +311,84 @@
       },
     },
     methods: {
+      // 判断时间段是否在3个月内,在的话导出,超出的话提示
+      dc(fileName){
+        console.log(11111,this.queryParam)
+        //判断时间段是否在3个月内
+        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+
+        if(flag){
+          this.handleExportXls(fileName)
+        }else {
+          this.$message.error("时间跨度不得超过3个月!")
+        }
+      },
+
+      //导出xls
+      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("文件下载失败")
+            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); //释放掉blob对象
+          }
+        })
+      },
+
+      //判断时间段是否在3个月内,是的话返回true,否则返回false
+      completeDate (time1, time2, m) {
+        const year1 = time1.getFullYear()
+        const year2 = time2.getFullYear()
+        const month1 = time1.getMonth() + 1
+        const month2 = time2.getMonth() + 1
+        const day1 = time1.getDate()
+        const day2 = time2.getDate()
+        if (year2 === year1) { // 判断两个日期 是否是同年
+          if (month2 - month1 > m) { // 相差是否 在m个月中
+            return false
+          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+            if (day2 > day1) {
+              return false
+            }
+          }
+        } else { // 不同年
+          if (year2 - year1 > 1) {
+            return false
+          }
+          else if (year2 - year1 === 1) {
+            if (month2 > m || month1 + m - month2 < 12) {
+              return false
+            }
+            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+              if (day2 > day1) {
+                return false
+              }
+            }
+          }
+        }
+        return true
+      },
+
       initDictConfig(){
       },
       getSuperFieldList(){

+ 80 - 1
itdmWeb/src/views/module-iTDM/itdmWenxiangHistory/ItdmWenxiangHistorySzhList.vue

@@ -29,7 +29,7 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
-      <a-button type="primary" icon="download" @click="handleExportXls('1立方温箱历史数据')">导出</a-button>
+      <a-button type="primary" icon="download" @click="dc('1立方温箱历史数据')">导出</a-button>
       <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
       <!--        <a-button type="primary" icon="import">导入</a-button>-->
       <!--      </a-upload>-->
@@ -133,6 +133,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import ItdmWenxiangHistorySzhModal from './modules/ItdmWenxiangHistorySzhModal'
+  import { downFile } from '@/api/manage'
 
   export default {
     name: 'ItdmWenxiangHistorySzhList',
@@ -310,6 +311,84 @@
       },
     },
     methods: {
+      // 判断时间段是否在3个月内,在的话导出,超出的话提示
+      dc(fileName){
+        console.log(11111,this.queryParam)
+        //判断时间段是否在3个月内
+        let flag = this.completeDate(queryParam.createTime_begin,queryParam.createTime_end,3)
+
+        if(flag){
+          this.handleExportXls(fileName)
+        }else {
+          this.$message.error("时间跨度不得超过3个月!")
+        }
+      },
+
+      //导出xls
+      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("文件下载失败")
+            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); //释放掉blob对象
+          }
+        })
+      },
+
+      //判断时间段是否在3个月内,是的话返回true,否则返回false
+      completeDate (time1, time2, m) {
+        const year1 = time1.getFullYear()
+        const year2 = time2.getFullYear()
+        const month1 = time1.getMonth() + 1
+        const month2 = time2.getMonth() + 1
+        const day1 = time1.getDate()
+        const day2 = time2.getDate()
+        if (year2 === year1) { // 判断两个日期 是否是同年
+          if (month2 - month1 > m) { // 相差是否 在m个月中
+            return false
+          } else if (month2 - month1 === m) { // 如果正好为 m月 判断天数
+            if (day2 > day1) {
+              return false
+            }
+          }
+        } else { // 不同年
+          if (year2 - year1 > 1) {
+            return false
+          }
+          else if (year2 - year1 === 1) {
+            if (month2 > m || month1 + m - month2 < 12) {
+              return false
+            }
+            else if (month1 + m - month2 === 12) { // 正好为m月 判断天数
+              if (day2 > day1) {
+                return false
+              }
+            }
+          }
+        }
+        return true
+      },
+
       initDictConfig(){
       },
       getSuperFieldList(){