|
@@ -29,7 +29,8 @@
|
|
|
<!-- 操作按钮区域 -->
|
|
|
<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="daochu('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>-->
|
|
|
<!-- </a-upload>-->
|
|
@@ -133,6 +134,7 @@
|
|
|
import { mixinDevice } from '@/utils/mixin'
|
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
|
import ItdmWenxiangHistory1Modal from './modules/ItdmWenxiangHistory1Modal'
|
|
|
+ import { downFile } from '@/api/manage'
|
|
|
|
|
|
export default {
|
|
|
name: 'ItdmWenxiangHistory1List',
|
|
@@ -310,6 +312,93 @@
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 导出
|
|
|
+ daochu(fileName){
|
|
|
+ console.log(11111,this.queryParam)
|
|
|
+
|
|
|
+ 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(this.queryParam.createTime_end==''){
|
|
|
+ alert("结束时间不能为空");
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ if(time1 > time2){
|
|
|
+ alert("开始时间不能大于结束时间");
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断时间跨度是否大于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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }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(flag){
|
|
|
+ console.log("flag:",flag)
|
|
|
+ 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对象
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ console.log("!flag:",!flag)
|
|
|
+ this.$message.error("时间跨度不得超过3个月!")
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
initDictConfig(){
|
|
|
},
|
|
|
getSuperFieldList(){
|