ComputeJobList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <section class="content">
  3. <div class="box box-info">
  4. <div
  5. class="box-body"
  6. v-loading.body="loading"
  7. v-loading.fullscreen="loading"
  8. element-loading-text="请稍后..."
  9. >
  10. <!-- 表单 -->
  11. <el-form inline :model="formSearch">
  12. <el-form-item>
  13. <el-button
  14. size="small"
  15. type="primary"
  16. icon="el-icon-search"
  17. @click="handleSearchBtn"
  18. >
  19. 刷新
  20. </el-button>
  21. <el-button size="small" type="primary" @click="back">
  22. 返回
  23. </el-button>
  24. </el-form-item>
  25. </el-form>
  26. <div class="block-seperator"></div>
  27. <!-- 页面列表 -->
  28. <el-table
  29. :data="tableData"
  30. border
  31. resizable
  32. stripe
  33. style="width: 100%;"
  34. >
  35. <el-table-column width="50" label="ID">
  36. <span slot-scope="scope">{{ scope.row.id }}</span>
  37. </el-table-column>
  38. <el-table-column width="120" prop="statusName" label="状态">
  39. </el-table-column>
  40. <el-table-column width="180" prop="creationTime" label="任务生成时间">
  41. </el-table-column>
  42. <el-table-column width="180" prop="startTime" label="计算开始时间">
  43. </el-table-column>
  44. <el-table-column width="180" prop="endTime" label="计算结束时间">
  45. </el-table-column>
  46. <el-table-column prop="errorDesc" label="错误信息"> </el-table-column>
  47. <el-table-column :context="_self" label="操作" width="120">
  48. <div slot-scope="scope">
  49. <el-button
  50. size="mini"
  51. type="danger"
  52. plain
  53. :disabled="disStopJob(scope.row)"
  54. @click="stopJob(scope.row)"
  55. >
  56. 终止计算
  57. </el-button>
  58. </div>
  59. </el-table-column>
  60. </el-table>
  61. <div class="page pull-right">
  62. <el-pagination
  63. v-if="paginationShow"
  64. @current-change="handleCurrentChange"
  65. :current-page="currentPage"
  66. :page-size="pageSize"
  67. :page-sizes="[10, 20, 50, 100]"
  68. @size-change="handleSizeChange"
  69. layout="total, sizes, prev, pager, next, jumper"
  70. :total="total"
  71. />
  72. </div>
  73. </div>
  74. </div>
  75. </section>
  76. </template>
  77. <script>
  78. import { TASK_API } from "@/constants/constants.js";
  79. import { mapState } from "vuex";
  80. export default {
  81. name: "ComputeJobList",
  82. data() {
  83. return {
  84. loading: false,
  85. paginationShow: false,
  86. formSearch: {
  87. projectId: ""
  88. },
  89. tableData: [],
  90. currentPage: 1,
  91. pageSize: 10,
  92. total: 10,
  93. rules: {
  94. passScore: [
  95. { required: true, message: "请输入及格分数", trigger: "change" }
  96. ],
  97. totalScore: [
  98. { required: true, message: "请输入满分分数", trigger: "change" }
  99. ],
  100. partitionDetails: [
  101. {
  102. required: true,
  103. type: "array",
  104. message: "请设置分数段",
  105. trigger: "change"
  106. }
  107. ]
  108. }
  109. };
  110. },
  111. computed: {
  112. ...mapState({ user: state => state.user }),
  113. isSuperAdmin() {
  114. return this.user.roleList.some(role => role.roleCode == "SUPER_ADMIN");
  115. }
  116. },
  117. methods: {
  118. back() {
  119. this.$router.push({
  120. path: "/reports/overview"
  121. });
  122. },
  123. disStopJob(row) {
  124. if (row.status != "NONE" && row.status != "COMPUTING") {
  125. return true;
  126. } else {
  127. return false;
  128. }
  129. },
  130. stopJob(row) {
  131. this.loading = true;
  132. let url = TASK_API + "/reportsCompute/stopJob/" + row.id;
  133. this.$httpWithMsg
  134. .post(url)
  135. .then(() => {
  136. this.$notify({
  137. type: "success",
  138. message: "操作成功!"
  139. });
  140. this.searchForm();
  141. })
  142. .finally(() => (this.loading = false));
  143. },
  144. handleSearchBtn() {
  145. this.currentPage = 1;
  146. this.searchForm();
  147. },
  148. handleSizeChange(val) {
  149. this.pageSize = val;
  150. this.currentPage = 1;
  151. this.searchForm();
  152. },
  153. handleCurrentChange(val) {
  154. this.currentPage = val;
  155. this.searchForm();
  156. },
  157. //查询
  158. searchForm() {
  159. this.loading = true;
  160. var url =
  161. TASK_API +
  162. "/reportsCompute/page/" +
  163. this.formSearch.projectId +
  164. "/" +
  165. this.currentPage +
  166. "/" +
  167. this.pageSize;
  168. this.$httpWithMsg
  169. .get(url, { params: this.formSearch })
  170. .then(response => {
  171. this.tableData = response.data.list;
  172. this.total = response.data.total;
  173. this.loading = false;
  174. this.$nextTick(function() {
  175. this.paginationShow = true;
  176. });
  177. })
  178. .finally(() => (this.loading = false));
  179. },
  180. init() {
  181. this.searchForm();
  182. }
  183. },
  184. //初始化查询
  185. created() {
  186. this.formSearch.projectId = this.$route.params.projectId;
  187. this.init();
  188. }
  189. };
  190. </script>
  191. <style scoped>
  192. .page {
  193. margin-top: 10px;
  194. }
  195. .pull-length {
  196. width: 100px;
  197. }
  198. .details-length {
  199. width: 400px;
  200. }
  201. .pull-center {
  202. margin-top: 20px;
  203. }
  204. .editForm .el-form-item {
  205. margin-bottom: 12px;
  206. }
  207. .partition-main-left-div {
  208. width: 300px;
  209. padding: 5px;
  210. float: left;
  211. border: 1px solid #ddd;
  212. margin-left: 5px;
  213. }
  214. .partition-main-rigth-div {
  215. width: 200px;
  216. padding: 5px;
  217. float: right;
  218. border: 1px solid #ddd;
  219. margin-right: 5px;
  220. }
  221. .partition-detail-div {
  222. margin-top: 5px;
  223. }
  224. </style>