提交修改77\80
This commit is contained in:
parent
65b215c6a8
commit
5f1e6e3f11
|
@ -108,7 +108,7 @@ export function downFile(url,parameter){
|
|||
return axios({
|
||||
url: url,
|
||||
params: parameter,
|
||||
method:'get' ,
|
||||
method:'post' ,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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,12 +107,69 @@ 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对象
|
||||
}
|
||||
})
|
||||
},
|
||||
onOk(value) {
|
||||
|
|
|
@ -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
|
||||
// })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -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
|
||||
// })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user