Commit 6cefbeb7 authored by 张伯涛's avatar 张伯涛

网关日志模块导出

parent 2e82804a
......@@ -66,6 +66,16 @@
@click="resetQuery"
>{{ commonField.resetName }}</el-button>
</el-form-item>
<div style="text-align: end;">
<!-- //导出-->
<el-button
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.exportIcon"
:size="commonField.smallSize"
@click="handleExport"
>{{ commonField.exportName }}</el-button>
</div>
</el-form>
</div>
<div style="padding:5px 10px">
......@@ -201,7 +211,7 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="请求参数:" prop=requestData>
<el-form-item label="请求参数:" prop="requestData">
<el-input v-model="form.requestData" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入ip" />
</el-form-item>
</el-col>
......@@ -242,7 +252,7 @@
</template>
<script>
import {iaminstitutionListApi, openapilogDetailApi,iaminstitutionExportApi} from '@/api/openApi'
import { iaminstitutionListApi, openapilogDetailApi, iaminstitutionExportApi } from '@/api/openApi'
import commonField from '@/utils/commonField'
export default {
......@@ -333,6 +343,28 @@ export default {
this.queryParams.endTime = ''
}
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return iaminstitutionExportApi(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '网关日志' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg);
})
})
},
/** 表单重置*/
reset() {
this.form = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment