下载
This commit is contained in:
parent
2a8996130c
commit
2c68c12fe2
29
web/src/views/testdata/testtask/index.vue
vendored
29
web/src/views/testdata/testtask/index.vue
vendored
@ -43,6 +43,7 @@ const queryParams: any = ref({
|
|||||||
endDate: ''
|
endDate: ''
|
||||||
});
|
});
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
|
//导入
|
||||||
const importDialog = ref(false)
|
const importDialog = ref(false)
|
||||||
const importForm: any = ref({})
|
const importForm: any = ref({})
|
||||||
const importRules: any = ref({
|
const importRules: any = ref({
|
||||||
@ -51,6 +52,8 @@ const importRules: any = ref({
|
|||||||
})
|
})
|
||||||
const fileList = ref([])
|
const fileList = ref([])
|
||||||
const importFormRef = ref()
|
const importFormRef = ref()
|
||||||
|
// 是否单机
|
||||||
|
const standAlone = ref(true)
|
||||||
//转化时间格式
|
//转化时间格式
|
||||||
function zhuandata(dateString: any) {
|
function zhuandata(dateString: any) {
|
||||||
// 创建Date对象
|
// 创建Date对象
|
||||||
@ -158,6 +161,11 @@ function addproject() {
|
|||||||
localStorageId: '',
|
localStorageId: '',
|
||||||
backupStorageId: ''
|
backupStorageId: ''
|
||||||
}
|
}
|
||||||
|
if(standAlone){
|
||||||
|
projectForme.value.localStorageId = 1
|
||||||
|
projectForme.value.backupStorageId = -1
|
||||||
|
}
|
||||||
|
console.log(projectForme.value)
|
||||||
// formitemarr.value.length = 0
|
// formitemarr.value.length = 0
|
||||||
shidou.value = true
|
shidou.value = true
|
||||||
}
|
}
|
||||||
@ -223,26 +231,15 @@ function expproject(row: any) {
|
|||||||
console.log(res)
|
console.log(res)
|
||||||
console.log('响应头:', res.headers);
|
console.log('响应头:', res.headers);
|
||||||
if (res) {
|
if (res) {
|
||||||
// 正确访问响应头
|
const fileName = `${row.taskCode}_exportdata.zip`; // 或从响应头中获取文件名
|
||||||
//const disposition = res.headers['Content-Disposition'];
|
|
||||||
|
|
||||||
const fileName = `${row.id}_data.sql.zip`; // 或从响应头中获取文件名
|
|
||||||
|
|
||||||
// if (disposition) {
|
|
||||||
// const filenameMatch = disposition.match(/filename="?([^"]+)"?/);
|
|
||||||
// if (filenameMatch && filenameMatch[1]) {
|
|
||||||
// fileName = decodeURIComponent(filenameMatch[1]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 处理响应数据
|
// 处理响应数据
|
||||||
const blob = new Blob([res.data], { type: 'application/zip' });
|
const blob = new Blob([res], { type: 'application/zip' });
|
||||||
|
|
||||||
// 创建临时链接并触发下载
|
// 创建临时链接并触发下载
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = `${row.id}_data.sql.zip`;
|
link.download = fileName;
|
||||||
link.style.display = 'none';
|
link.style.display = 'none';
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
@ -487,6 +484,7 @@ function fileChange(uploadFile, uploadFiles) {
|
|||||||
fileList.value = [uploadFile.raw]
|
fileList.value = [uploadFile.raw]
|
||||||
console.log(fileList.value, 999)
|
console.log(fileList.value, 999)
|
||||||
}
|
}
|
||||||
|
const isconnect = ref(false)
|
||||||
function importSubmit(formEl: any) {
|
function importSubmit(formEl: any) {
|
||||||
if (!formEl) return
|
if (!formEl) return
|
||||||
formEl.validate((valid: any, fields: any) => {
|
formEl.validate((valid: any, fields: any) => {
|
||||||
@ -705,7 +703,7 @@ function importClose() {
|
|||||||
<el-button type="primary" @click="dellable(index)">删除</el-button>
|
<el-button type="primary" @click="dellable(index)">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
|
<div v-if="!standAlone" style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
|
||||||
<el-form-item label="本地存储空间" prop="localStorageId" style="width: 50%;">
|
<el-form-item label="本地存储空间" prop="localStorageId" style="width: 50%;">
|
||||||
<el-select v-model="projectForme.localStorageId" clearable placeholder=" "
|
<el-select v-model="projectForme.localStorageId" clearable placeholder=" "
|
||||||
:disabled="!shidou">
|
:disabled="!shidou">
|
||||||
@ -721,7 +719,6 @@ function importClose() {
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user