123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <section class="content">
- <div class="box box-info">
- <div
- class="box-body"
- v-loading.body="loading"
- v-loading.fullscreen="loading"
- element-loading-text="请稍后..."
- >
- <!-- 表单 -->
- <el-form inline :model="formSearch">
- <el-form-item>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-search"
- @click="handleSearchBtn"
- >
- 刷新
- </el-button>
- <el-button size="small" type="primary" @click="back">
- 返回
- </el-button>
- </el-form-item>
- </el-form>
- <div class="block-seperator"></div>
- <!-- 页面列表 -->
- <el-table
- :data="tableData"
- border
- resizable
- stripe
- style="width: 100%;"
- >
- <el-table-column width="50" label="ID">
- <span slot-scope="scope">{{ scope.row.id }}</span>
- </el-table-column>
- <el-table-column width="120" prop="statusName" label="状态">
- </el-table-column>
- <el-table-column width="180" prop="creationTime" label="任务生成时间">
- </el-table-column>
- <el-table-column width="180" prop="startTime" label="计算开始时间">
- </el-table-column>
- <el-table-column width="180" prop="endTime" label="计算结束时间">
- </el-table-column>
- <el-table-column prop="errorDesc" label="错误信息"> </el-table-column>
- <el-table-column :context="_self" label="操作" width="120">
- <div slot-scope="scope">
- <el-button
- size="mini"
- type="danger"
- plain
- :disabled="disStopJob(scope.row)"
- @click="stopJob(scope.row)"
- >
- 终止计算
- </el-button>
- </div>
- </el-table-column>
- </el-table>
- <div class="page pull-right">
- <el-pagination
- v-if="paginationShow"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="pageSize"
- :page-sizes="[10, 20, 50, 100]"
- @size-change="handleSizeChange"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- />
- </div>
- </div>
- </div>
- </section>
- </template>
- <script>
- import { TASK_API } from "@/constants/constants.js";
- import { mapState } from "vuex";
- export default {
- name: "ComputeJobList",
- data() {
- return {
- loading: false,
- paginationShow: false,
- formSearch: {
- projectId: ""
- },
- tableData: [],
- currentPage: 1,
- pageSize: 10,
- total: 10,
- rules: {
- passScore: [
- { required: true, message: "请输入及格分数", trigger: "change" }
- ],
- totalScore: [
- { required: true, message: "请输入满分分数", trigger: "change" }
- ],
- partitionDetails: [
- {
- required: true,
- type: "array",
- message: "请设置分数段",
- trigger: "change"
- }
- ]
- }
- };
- },
- computed: {
- ...mapState({ user: state => state.user }),
- isSuperAdmin() {
- return this.user.roleList.some(role => role.roleCode == "SUPER_ADMIN");
- }
- },
- methods: {
- back() {
- this.$router.push({
- path: "/reports/overview"
- });
- },
- disStopJob(row) {
- if (row.status != "NONE" && row.status != "COMPUTING") {
- return true;
- } else {
- return false;
- }
- },
- stopJob(row) {
- this.loading = true;
- let url = TASK_API + "/reportsCompute/stopJob/" + row.id;
- this.$httpWithMsg
- .post(url)
- .then(() => {
- this.$notify({
- type: "success",
- message: "操作成功!"
- });
- this.searchForm();
- })
- .finally(() => (this.loading = false));
- },
- handleSearchBtn() {
- this.currentPage = 1;
- this.searchForm();
- },
- handleSizeChange(val) {
- this.pageSize = val;
- this.currentPage = 1;
- this.searchForm();
- },
- handleCurrentChange(val) {
- this.currentPage = val;
- this.searchForm();
- },
- //查询
- searchForm() {
- this.loading = true;
- var url =
- TASK_API +
- "/reportsCompute/page/" +
- this.formSearch.projectId +
- "/" +
- this.currentPage +
- "/" +
- this.pageSize;
- this.$httpWithMsg
- .get(url, { params: this.formSearch })
- .then(response => {
- this.tableData = response.data.list;
- this.total = response.data.total;
- this.loading = false;
- this.$nextTick(function() {
- this.paginationShow = true;
- });
- })
- .finally(() => (this.loading = false));
- },
- init() {
- this.searchForm();
- }
- },
- //初始化查询
- created() {
- this.formSearch.projectId = this.$route.params.projectId;
- this.init();
- }
- };
- </script>
- <style scoped>
- .page {
- margin-top: 10px;
- }
- .pull-length {
- width: 100px;
- }
- .details-length {
- width: 400px;
- }
- .pull-center {
- margin-top: 20px;
- }
- .editForm .el-form-item {
- margin-bottom: 12px;
- }
- .partition-main-left-div {
- width: 300px;
- padding: 5px;
- float: left;
- border: 1px solid #ddd;
- margin-left: 5px;
- }
- .partition-main-rigth-div {
- width: 200px;
- padding: 5px;
- float: right;
- border: 1px solid #ddd;
- margin-right: 5px;
- }
- .partition-detail-div {
- margin-top: 5px;
- }
- </style>
|