DataTaskDialog.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <el-dialog
  3. class="data-task-dialog page-dialog"
  4. :visible.sync="modalIsShow"
  5. title="数据任务进度"
  6. top="10vh"
  7. width="900px"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. @open="visibleChange"
  12. >
  13. <div class="part-box part-box-pad">
  14. <el-table ref="TableList" :data="dataList">
  15. <el-table-column
  16. type="index"
  17. label="序号"
  18. width="50"
  19. :index="indexMethod"
  20. ></el-table-column>
  21. <el-table-column prop="type" label="类别" width="140">
  22. <span slot-scope="scope">
  23. {{ scope.row.type | dataTaskTypeFilter }}
  24. </span>
  25. </el-table-column>
  26. <el-table-column prop="status" label="状态" width="100">
  27. <span slot-scope="scope">
  28. {{ scope.row.status | dataTaskStatusFilter }}
  29. </span>
  30. </el-table-column>
  31. <el-table-column prop="result" label="结果" width="80">
  32. <span slot-scope="scope">
  33. {{ scope.row.result | dataTaskResultFilter }}
  34. </span>
  35. </el-table-column>
  36. <el-table-column prop="createTime" label="创建时间" width="170">
  37. <span slot-scope="scope">{{
  38. scope.row.createTime | timestampFilter
  39. }}</span>
  40. </el-table-column>
  41. <el-table-column prop="createName" label="创建人"></el-table-column>
  42. <el-table-column
  43. class-name="action-column"
  44. label="操作"
  45. width="160px"
  46. align="center"
  47. fixed="right"
  48. >
  49. <template slot-scope="scope">
  50. <el-button
  51. v-if="scope.row.reportFile"
  52. class="btn-primary"
  53. type="text"
  54. :disabled="loading"
  55. @click="toDonwload(scope.row.reportFile)"
  56. >导出日志</el-button
  57. >
  58. <el-button
  59. v-if="scope.row.resultFile"
  60. class="btn-primary"
  61. type="text"
  62. :disabled="loading"
  63. @click="toDonwload(scope.row.resultFile)"
  64. >下载文件</el-button
  65. >
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <div class="part-page">
  70. <el-pagination
  71. background
  72. layout="total,prev, pager, next"
  73. :current-page="current"
  74. :total="total"
  75. :page-size="size"
  76. @current-change="toPage"
  77. >
  78. </el-pagination>
  79. </div>
  80. </div>
  81. <div slot="footer"></div>
  82. </el-dialog>
  83. </template>
  84. <script>
  85. import { dataTaskList } from "../api";
  86. import { downloadByUrl } from "@/plugins/download";
  87. export default {
  88. name: "data-task-dialog",
  89. props: {
  90. taskType: {
  91. type: String,
  92. default: ""
  93. }
  94. },
  95. data() {
  96. return {
  97. modalIsShow: false,
  98. filter: {
  99. type: "",
  100. status: "",
  101. result: ""
  102. },
  103. dataList: [],
  104. current: 1,
  105. size: this.GLOBAL.pageSize,
  106. total: 0,
  107. loading: false
  108. };
  109. },
  110. methods: {
  111. visibleChange() {
  112. this.filter.type = this.taskType;
  113. this.toPage(1);
  114. },
  115. cancel() {
  116. this.modalIsShow = false;
  117. },
  118. open() {
  119. this.modalIsShow = true;
  120. },
  121. async getList() {
  122. const datas = {
  123. ...this.filter,
  124. pageNumber: this.current,
  125. pageSize: this.size
  126. };
  127. const data = await dataTaskList(datas);
  128. this.dataList = data.records.map(item => {
  129. item.reportFile = item.txtFilePath;
  130. item.resultFile = item.importFilePath || item.exportFilePath || "";
  131. return item;
  132. });
  133. this.total = data.total;
  134. },
  135. toPage(page) {
  136. this.current = page;
  137. this.getList();
  138. },
  139. toDonwload(url) {
  140. if (url.endsWith(".txt")) {
  141. window.open(url);
  142. return;
  143. }
  144. downloadByUrl(url);
  145. this.$message.success("文件开始成功!");
  146. }
  147. }
  148. };
  149. </script>