|
@@ -14,7 +14,7 @@
|
|
|
<a-col :span="20">
|
|
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="getSearch">查询</a-button>
|
|
|
<a-button preIcon="ant-design:sync-outlined" style="margin: 0px 15px" @click="getReset">重置</a-button>
|
|
|
- <a-button type="primary" preIcon="ant-design:download-outlined">导出</a-button>
|
|
|
+ <!-- <a-button type="primary" preIcon="ant-design:download-outlined" @click="downLoadFx">导出</a-button> -->
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</div>
|
|
@@ -90,6 +90,10 @@
|
|
|
<div :style="contentStyle">{{ text[2] }}</div>
|
|
|
</template>
|
|
|
</template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <a class="table-action-link" @click="downLoadFx(record)">导出</a>
|
|
|
+
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
<div class="echart-area">
|
|
@@ -114,7 +118,8 @@ import customHeader from '/@/components/vent/customHeader.vue';
|
|
|
import echartBox from './components/echartBox.vue'
|
|
|
import dayjs from 'dayjs';
|
|
|
import { columns, pagination, } from './gasAnalysis.data'
|
|
|
-import { gasReportLogList } from './gasAnalysis.api'
|
|
|
+import { gasReportLogList,exportGasInsFx } from './gasAnalysis.api'
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
|
|
|
|
|
|
let searchTime = ref(dayjs().format('YYYY-MM-DD'))//dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
@@ -204,6 +209,35 @@ let getReset = () => {
|
|
|
searchTime.value = dayjs().format('YYYY-MM-DD')
|
|
|
gasReportLogLists()
|
|
|
}
|
|
|
+//导出
|
|
|
+async function downLoadFx(record){
|
|
|
+ let res=await exportGasInsFx({id:record.id})
|
|
|
+ if (res) {
|
|
|
+ let filename = `${new Date().getTime()}.xlsx`;
|
|
|
+ downFilePublic(res, filename);
|
|
|
+ message.success('导出成功')
|
|
|
+ }
|
|
|
+}
|
|
|
+// 下载公用方法
|
|
|
+function downFilePublic(content, fileName) {
|
|
|
+ const blob = new Blob([content], { type: 'application/xlsx;charset=UTF-8' }); // 构造一个blob对象来处理数据
|
|
|
+ // 对于<a>标签,只有 Firefox 和 Chrome(内核) 支持 download 属性
|
|
|
+ // IE10以上支持blob但是依然不支持download
|
|
|
+ if ('download' in document.createElement('a')) {
|
|
|
+ // 支持a标签download的浏览器
|
|
|
+ const link = document.createElement('a'); // 创建a标签
|
|
|
+ link.download = fileName; // a标签添加属性
|
|
|
+ link.style.display = 'none';
|
|
|
+ link.href = URL.createObjectURL(blob);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click(); // 执行下载
|
|
|
+ URL.revokeObjectURL(link.href); // 释放url
|
|
|
+ document.body.removeChild(link); // 释放标签
|
|
|
+ } else {
|
|
|
+ // 其他浏览器
|
|
|
+ navigator.msSaveBlob(blob, fileName);
|
|
|
+ }
|
|
|
+}
|
|
|
onMounted(() => {
|
|
|
gasReportLogLists()
|
|
|
})
|