|
@@ -48,19 +48,19 @@
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
- v-if="scope.row.hasReportFile"
|
|
|
+ v-if="scope.row.reportFile"
|
|
|
class="btn-primary"
|
|
|
type="text"
|
|
|
:disabled="loading"
|
|
|
- @click="toDonwloadLog(scope.row)"
|
|
|
+ @click="toDonwload(scope.row.reportFile)"
|
|
|
>导出日志</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- v-if="!scope.row.resetCreatePdf"
|
|
|
+ v-if="scope.row.resultFile"
|
|
|
class="btn-primary"
|
|
|
type="text"
|
|
|
:disabled="loading"
|
|
|
- @click="toDonwloadFile(scope.row)"
|
|
|
+ @click="toDonwload(scope.row.resultFile)"
|
|
|
>下载文件</el-button
|
|
|
>
|
|
|
</template>
|
|
@@ -85,7 +85,6 @@
|
|
|
|
|
|
<script>
|
|
|
import { dataTaskList } from "../api";
|
|
|
-import { attachmentDownload } from "../../login/api";
|
|
|
import { downloadByUrl } from "@/plugins/download";
|
|
|
|
|
|
export default {
|
|
@@ -129,55 +128,25 @@ export default {
|
|
|
pageSize: this.size
|
|
|
};
|
|
|
const data = await dataTaskList(datas);
|
|
|
- this.dataList = data.records;
|
|
|
+ this.dataList = data.records.map(item => {
|
|
|
+ item.reportFile = item.txtFilePath;
|
|
|
+ item.resultFile = item.importFilePath || item.exportFilePath || "";
|
|
|
+ return item;
|
|
|
+ });
|
|
|
this.total = data.total;
|
|
|
},
|
|
|
toPage(page) {
|
|
|
this.current = page;
|
|
|
this.getList();
|
|
|
},
|
|
|
- async toDonwloadLog(row) {
|
|
|
- if (this.loading) return;
|
|
|
-
|
|
|
- this.loading = true;
|
|
|
- const res = await attachmentDownload({
|
|
|
- id: row.id,
|
|
|
- type: "TASK_REPORT"
|
|
|
- }).catch(() => {});
|
|
|
- this.loading = false;
|
|
|
-
|
|
|
- if (!res) {
|
|
|
- this.$message.error("文件下载失败,请重新尝试!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const url = res.url;
|
|
|
+ toDonwload(url) {
|
|
|
if (url.endsWith(".txt")) {
|
|
|
window.open(url);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
downloadByUrl(url);
|
|
|
- this.$message.success("文件下载成功!");
|
|
|
- },
|
|
|
- async toDonwloadFile(row) {
|
|
|
- if (this.loading) return;
|
|
|
-
|
|
|
- this.loading = true;
|
|
|
- const type = row.hasResultFile ? "RESULT" : "IMPORT_FILE";
|
|
|
- const res = await attachmentDownload({
|
|
|
- id: row.id,
|
|
|
- type
|
|
|
- }).catch(() => {});
|
|
|
- this.loading = false;
|
|
|
-
|
|
|
- if (!res) {
|
|
|
- this.$message.error("文件下载失败,请重新尝试!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- downloadByUrl(res.url);
|
|
|
- this.$message.success("文件下载成功!");
|
|
|
+ this.$message.success("文件开始成功!");
|
|
|
}
|
|
|
}
|
|
|
};
|