提交修改77\80

This commit is contained in:
RenCheng 2025-05-26 23:17:59 +08:00
parent 65b215c6a8
commit 5f1e6e3f11
5 changed files with 75 additions and 16 deletions

View File

@ -108,7 +108,7 @@ export function downFile(url,parameter){
return axios({
url: url,
params: parameter,
method:'get' ,
method:'post' ,
responseType: 'blob'
})
}

View File

@ -63,7 +63,7 @@
</template>
<script>
import { metaDataTypeTree, tableDataList,DmExportTool } from '@/api/metaData'
import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
import { getAction, deleteAction, putAction, postAction,downFile } from '@/api/manage'
import moment from 'moment';
import tablelist from './modules/tablelist'

View File

@ -31,7 +31,9 @@
<script>
import moment from "moment"
import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
import axios from 'axios'
import Vue from 'vue'
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
import { metaDataTypeTree } from '@/api/metaData'
export default {
@ -105,11 +107,68 @@ import { metaDataTypeTree } from '@/api/metaData'
this.$message.warning("至少选择一个需要导出的表");
return;
}
postAction("/dataManager/DmExportTable?schemaMass="+this.queryParam.schemaMass+"&tableNames="+this.selectedRowKeys+"&exportType="+exportType,{}).then(res => {
if (res.code == 200) {
this.$message.success(res.result);
}else{
this.$message.warning(res.message)
let apiBaseUrl = window._CONFIG['domianURL'] || "/jeecg-boot";
const service = axios.create({
baseURL: apiBaseUrl, // api base_url
timeout: 300000 //
})
service.interceptors.request.use(config => {
const token = Vue.ls.get(ACCESS_TOKEN)
if (token) {
config.headers[ 'X-Access-Token' ] = token // token
}
//update-begin-author:taoyan date:2020707 for:
let tenantid = Vue.ls.get(TENANT_ID)
if (!tenantid) {
tenantid = 0;
}
config.headers[ 'tenant_id' ] = tenantid
//update-end-author:taoyan date:2020707 for:
if(config.method=='get'){
if(config.url.indexOf("sys/dict/getDictItems")<0){
config.params = {
_t: Date.parse(new Date())/1000,
...config.params
}
}
}
return config
},(error) => {
return Promise.reject(error)
})
service({
url: "/dataManager/DmExportTable?schemaMass="+this.queryParam.schemaMass+"&tableNames="+this.selectedRowKeys+"&exportType="+exportType,
params: {},
method:'post' ,
responseType: 'blob'
}).then((data) => {
if (!data || data.size === 0) {
this.$message.warning('文件下载失败')
return
}
let filename = '1.zip'; //
console.log(data)
const disposition = data.headers['content-disposition'];
// UTF-8''%E6%96%87%E4%BB%B6.txt
const filenameRegex = /filename\*?=((UTF-8'')([\w%\-\.]+)|(['"]?)([^;\n]*)\4)/i;
const matches = disposition.match(filenameRegex);
if (matches) {
//
filename = matches[3] || matches[5];
filename = decodeURIComponent(filename); //
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data]), filename)
} else {
let url = window.URL.createObjectURL(new Blob([data]))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', filename)
document.body.appendChild(link)
link.click()
document.body.removeChild(link) //
window.URL.revokeObjectURL(url) //blob
}
})
},

View File

@ -191,10 +191,10 @@ export default {
this.dataSource = res.result.rows
this.pagination = pagination
} else {
this.$notification.error({
message: '系统提示',
description: res.message
})
// this.$notification.error({
// message: '',
// description: res.message
// })
}
})
},

View File

@ -191,10 +191,10 @@ export default {
this.dataSource = res.result.rows
this.pagination = pagination
} else {
this.$notification.error({
message: '系统提示',
description: res.message
})
// this.$notification.error({
// message: '',
// description: res.message
// })
}
})
},