task.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="page-box">
  3. <div class="search-box">
  4. <el-input placeholder="任务Id"></el-input>&nbsp;&nbsp;
  5. <el-button type="primary" icon="el-icon-search">搜索</el-button>
  6. </div>
  7. <div>
  8. <vxe-table
  9. show-overflow
  10. height="200"
  11. row-id="id"
  12. :loading="loading1"
  13. :data="tableData1"
  14. >
  15. <vxe-column field="jobId" title="job Id" width="80"></vxe-column>
  16. <vxe-column
  17. field="requestTime"
  18. title="request Time"
  19. sortable
  20. ></vxe-column>
  21. <vxe-column field="createTime" title="create Time"></vxe-column>
  22. <vxe-column field="completeTime" title="complete Time"></vxe-column>
  23. <vxe-column field="deleteTime" title="delete Time"></vxe-column>
  24. <vxe-column field="status" title="Status" width="120">
  25. <template #default="{ row }">
  26. <el-tag :type="getTag(row)">{{ row.status }}</el-tag>
  27. </template>
  28. </vxe-column>
  29. <vxe-column field="Details" title="Details" width="80">
  30. <template #default="{ row }">
  31. <div style="text-align: center">
  32. <i @click="showDetail(row)" class="el-icon-search" style="cursor: pointer;"></i>
  33. </div>
  34. </template>
  35. </vxe-column>
  36. </vxe-table>
  37. <vxe-pager
  38. :loading="loading1"
  39. :current-page="tablePage1.currentPage"
  40. :page-size="tablePage1.pageSize"
  41. :total="tablePage1.totalResult"
  42. :layouts="[
  43. 'PrevPage',
  44. 'JumpNumber',
  45. 'NextPage',
  46. 'FullJump',
  47. 'Sizes',
  48. 'Total',
  49. ]"
  50. @page-change="handlePageChange1"
  51. >
  52. </vxe-pager>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import axios from "axios";
  58. import { hotTags, getClicks, getBlogs } from "@/api";
  59. export default {
  60. name: "task",
  61. data() {
  62. return {
  63. loading1: false,
  64. tableData1: [],
  65. tablePage1: {
  66. currentPage: 1,
  67. pageSize: 10,
  68. totalResult: 0,
  69. },
  70. };
  71. },
  72. created() {
  73. this.findList1();
  74. },
  75. methods: {
  76. findList1() {
  77. this.loading1 = true;
  78. setTimeout(() => {
  79. const list = [
  80. {
  81. completeTime: "not completed",
  82. createTime: "not created",
  83. jobId: 795,
  84. key: 795,
  85. requestTime: "2023-04-04 21:09:27",
  86. deleteTime: "2023-04-04 21:09:27",
  87. status: "waiting",
  88. },
  89. {
  90. completeTime: "not completed",
  91. createTime: "not created",
  92. jobId: 795,
  93. key: 795,
  94. requestTime: "2023-04-04 21:09:27",
  95. deleteTime: "2023-04-04 21:09:27",
  96. status: "success",
  97. },
  98. {
  99. completeTime: "not completed",
  100. createTime: "not created",
  101. jobId: 795,
  102. key: 795,
  103. requestTime: "2023-04-04 21:09:27",
  104. deleteTime: "2023-04-04 21:09:27",
  105. status: "failed",
  106. },
  107. ];
  108. this.loading1 = false;
  109. this.tablePage1.totalResult = list.length;
  110. this.tableData1 = list.slice(
  111. (this.tablePage1.currentPage - 1) * this.tablePage1.pageSize,
  112. this.tablePage1.currentPage * this.tablePage1.pageSize
  113. );
  114. console.log(this.tableData1);
  115. }, 300);
  116. },
  117. handlePageChange1({ currentPage, pageSize }) {
  118. this.tablePage1.currentPage = currentPage;
  119. this.tablePage1.pageSize = pageSize;
  120. this.findList1();
  121. },
  122. print(row) {
  123. console.log(row);
  124. },
  125. getTag(row) {
  126. if (row.status === "success") {
  127. return "success";
  128. }
  129. if (row.status === "waiting") {
  130. return "info";
  131. }
  132. return "danger";
  133. },
  134. showDetail(row) {
  135. this.$router.push({
  136. path: '/result',
  137. query: {
  138. jobId: row.jobId
  139. }
  140. })
  141. }
  142. },
  143. };
  144. </script>
  145. <style lang="less" scoped>
  146. .page-box {
  147. padding: 0 24px;
  148. margin-top: 67px;
  149. height: calc(100vh - 68px);
  150. .search-box {
  151. display: flex;
  152. margin-top: 24px;
  153. padding-top: 24px;
  154. margin-bottom: 24px;
  155. }
  156. .list-box {
  157. //margin-top: 24px;
  158. // box-sizing: border-box;
  159. // height: 300px;
  160. // width: 100%;
  161. }
  162. }
  163. </style>