同步 -- 文件下载

prod
wj 2 years ago
parent bbbc0d379e
commit 2c39c94848

@ -59,4 +59,13 @@ export function infoByStatus(query) {
});
}
export function downloadFile(query) {
return axios({
url: "/sps/sync/download/info/file",
method: "get",
param: query,
responseType: 'blob'
});
}

@ -95,7 +95,8 @@ import {
deleteLog,
createSchedule,
findConfig,
updateConfig
updateConfig,
infoByStatus
} from "@/api/sync/spsSyncStatus";
import store from "@/store";

@ -33,98 +33,49 @@
</el-row>
</el-form>
<el-table
v-loading="loading"
:data="list"
style="width: 100%"
>
<el-table v-loading="loading" :data="list" style="width: 100%">
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column
label="任务ID"
prop="taskId"
width="140"
show-overflow-tooltip
></el-table-column>
<el-table-column label="任务ID" prop="taskId" width="140" show-overflow-tooltip></el-table-column>
<el-table-column
label="任务类型"
prop="type"
width="140"
show-overflow-tooltip
>
<el-table-column label="任务类型" prop="type" width="140" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{scope.row.type }}</span>
</template>
</el-table-column>
<el-table-column
label="状态"
prop="status"
width="140"
show-overflow-tooltip
>
<el-table-column label="状态" prop="status" width="140" show-overflow-tooltip>
<template slot-scope="scope">
<el-tag
:type="statusFilterType(scope.row.status)"
>{{ status[scope.row.status] }}
</el-tag
>
<el-tag :type="statusFilterType(scope.row.status)">{{ status[scope.row.status] }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="开始时间"
width="180"
prop="startTime"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="结束时间"
width="180"
prop="endTime"
show-overflow-tooltip
></el-table-column>
<el-table-column label="开始时间" width="180" prop="startTime" show-overflow-tooltip></el-table-column>
<el-table-column label="结束时间" width="180" prop="endTime" show-overflow-tooltip></el-table-column>
<el-table-column
label="同步信息"
prop="remark"
show-overflow-tooltip
></el-table-column>
<el-table-column label="同步信息" prop="remark" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" fixed="right" width="160">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.stop="detailDialog(scope.row.id)"
>详情
</el-button
>
<el-button
type="text"
size="small"
@click.native.stop="deleteDialog(scope.row.id)"
>删除
</el-button
>
<el-popconfirm @confirm="downFile(scope.row)" confirm-button-text='' cancel-button-text='' class="mr10"
icon="el-icon-info" icon-color="blck" title="是否确认要下载文件?" v-if="scope.row.cacheFilePath">
<el-button type="text" size="small" slot="reference">下载
</el-button>
</el-popconfirm>
<el-popconfirm @confirm="deleteData(scope.row.id)" confirm-button-text='' cancel-button-text=''
icon="el-icon-info" icon-color="red" title="是否确认要删除这条数据?">
<el-button type="text" size="small" slot="reference">删除
</el-button>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="filterQuery.limit"
@current-change="handleCurrentChange"
layout="prev, pager, next"
:total="total"
:current-page="filterQuery.page"
></el-pagination>
<el-pagination :page-size="filterQuery.limit" @current-change="handleCurrentChange" layout="prev, pager, next"
:total="total" :current-page="filterQuery.page"></el-pagination>
</el-card>
<el-dialog
title="同步信息"
width="25%"
:close-on-click-modal="false"
:close-on-press-escape="false"
:visible.sync="syncVisible"
>
<el-dialog title="同步信息" width="25%" :close-on-click-modal="false" :close-on-press-escape="false"
:visible.sync="syncVisible">
<span v-text="syncInfo" style="white-space:pre-line;" class="syncInfo"></span>
</el-dialog>
@ -132,10 +83,17 @@
</template>
<script>
import {filterLog, deleteLog, findConfig} from "@/api/sync/spsSyncDownload";
import {
filterLog,
deleteLog,
findConfig,
downloadFile
} from "@/api/sync/spsSyncDownload";
import store from "@/store";
import ShowText from "../sync/showText";
import {downloadNow} from "@/api/sync/spsSyncDownload";
import {
downloadNow
} from "@/api/sync/spsSyncDownload";
export default {
data() {
@ -244,13 +202,11 @@ export default {
if (val) {
this.getList();
}
}
,
},
handleCurrentChange(val) {
this.filterQuery.page = val;
this.getList();
}
,
},
createSchedule(type) {
let query = {
@ -298,8 +254,7 @@ export default {
this.loading = false;
});
})
.catch(() => {
});
.catch(() => {});
},
handleChange(response, files, fileList) {
console.log(response);
@ -329,7 +284,9 @@ export default {
},
downloadNow(type) {
//
let params = {type: type};
let params = {
type: type
};
downloadNow(params).then((res) => {
if (res.code === 20000) {
this.$message.success("同步任务创建成功,稍后请刷新查看下载日志!");
@ -339,12 +296,30 @@ export default {
}).catch((error) => {
this.$message.error(error.message);
})
}
},
mounted() {
downFile(rows) {
downloadFile({
'id': rows.id
}).then(res => {
let blob = new Blob([res])
let fileName = rows.cacheFilePath.substring(rows.cacheFilePath.lastIndexOf('/'))
let link = document.createElement("a")
link.href = window.URL.createObjectURL(blob)
link.download = fileName
link.style.display = 'none'
document.body.appendChild(link)
link.click()
window.URL.revokeObjectURL(link.href)
document.body.removeChild(link)
})
},
},
mounted() {},
components: {
ShowText
},
components: {ShowText},
created() {
this.headers = {
ADMIN_ID: store.getters.adminId,

Loading…
Cancel
Save