Browse Source

历史优化:导出

wyh 5 months ago
parent
commit
48ae247060

+ 44 - 3
src/views/module_interLock/interlockHistoryData/InterlockHistory/InterlockHistoryList.vue

@@ -22,6 +22,13 @@
                 <a-select placeholder="请输入回路健康级别" v-model="queryParam.loopHealthLevel" allowClear :options="healthLevelOption"></a-select>
               </a-form-item>
             </a-col>
+            <a-col :xl="10" :lg="11" :md="12" :sm="24">
+              <a-form-item label="采集时间">
+                <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.beginTime"></j-date>
+                <span class="query-group-split-cust"></span>
+                <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.endTime"></j-date>
+              </a-form-item>
+            </a-col>
           </template>
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
@@ -130,7 +137,7 @@
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   // import InterlockSummaryModal from './modules/InterlockSummaryModal'
   import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
-  import { httpAction, getAction } from '@/api/manage'
+  import { httpAction, getAction, downFile } from '@/api/manage'
 
   export default {
     name: 'InterlockSummaryList',
@@ -215,6 +222,11 @@
             align:"center",
             dataIndex: 'bypass_dictText',
           },
+          {
+            title:'时间',
+            align:"center",
+            dataIndex: 'tagTime',
+          },
           // {
           //   title:'逻辑关系',
           //   align:"center",
@@ -240,7 +252,7 @@
             dataIndex: 'action',
             align:"center",
             fixed:"right",
-            width:147,
+            width:107,
             // scopedSlots: { customRender: 'action' },
             customRender: (text,record,index)=> {
               var childrenDetail = (<a onClick={() => {this.handleDetail(record)}}>详情</a>)
@@ -486,7 +498,36 @@
         fieldList.push({type:'string',value:'interlockOutValueTag',text:'联锁输出值点位',dictCode:''})
         fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
         this.superFieldList = fieldList
-      }
+      },
+      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对象
+          }
+        })
+      },
     }
   }
 </script>