|
|
@@ -4,54 +4,87 @@
|
|
|
<div class="left-row">
|
|
|
<div>
|
|
|
<div>状态:</div>
|
|
|
- <el-tag size="large" :effect="focusTaskStatus.includes('all') ? 'dark' : ''" type="primary"
|
|
|
- @click="changeTaskStatus()">
|
|
|
+ <el-tag
|
|
|
+ size="large"
|
|
|
+ :effect="focusTaskStatus.includes('all') ? 'dark' : ''"
|
|
|
+ type="primary"
|
|
|
+ @click="changeTaskStatus()"
|
|
|
+ >
|
|
|
全部
|
|
|
</el-tag>
|
|
|
<template v-for="status in taskStatus" :key="status.index">
|
|
|
- <el-tag size="large" :effect="focusTaskStatus.includes(status.index) ? 'dark' : ''" type="primary"
|
|
|
- @click="changeTaskStatus(status)">
|
|
|
+ <el-tag
|
|
|
+ size="large"
|
|
|
+ :effect="focusTaskStatus.includes(status.index) ? 'dark' : ''"
|
|
|
+ type="primary"
|
|
|
+ @click="changeTaskStatus(status)"
|
|
|
+ >
|
|
|
{{ status.name }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div>类别:</div>
|
|
|
- <el-tag size="large" :effect="focusTaskType.includes('all') ? 'dark' : ''" type="primary"
|
|
|
- @click="changeTaskType()">
|
|
|
+ <el-tag
|
|
|
+ size="large"
|
|
|
+ :effect="focusTaskType.includes('all') ? 'dark' : ''"
|
|
|
+ type="primary"
|
|
|
+ @click="changeTaskType()"
|
|
|
+ >
|
|
|
全部
|
|
|
</el-tag>
|
|
|
<template v-for="type in taskType" :key="type.index">
|
|
|
- <el-tag size="large" :effect="focusTaskType.includes(type.index) ? 'dark' : ''" type="primary"
|
|
|
- @click="changeTaskType(type)">
|
|
|
+ <el-tag
|
|
|
+ size="large"
|
|
|
+ :effect="focusTaskType.includes(type.index) ? 'dark' : ''"
|
|
|
+ type="primary"
|
|
|
+ @click="changeTaskType(type)"
|
|
|
+ >
|
|
|
{{ type.name }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="row">
|
|
|
- <el-input class="searcher" v-model="searcher" placeholder="请输入任务名称相关关键字" />
|
|
|
+ <el-input
|
|
|
+ class="searcher"
|
|
|
+ v-model="searcher"
|
|
|
+ placeholder="请输入任务名称相关关键字"
|
|
|
+ />
|
|
|
<el-button type="primary" @click="pullTaskData(1)">搜索</el-button>
|
|
|
<el-button type="primary" @click="reset(), pullTaskData(1)">重置</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="lighter-container">
|
|
|
- 查询到{{ taskNum }}条任务
|
|
|
- <el-table table-layout="fixed" row-key="main_id" :data="taskData" class="table">
|
|
|
+ <div class="task-count">查询到{{ taskNum }}条任务</div>
|
|
|
+ <el-table
|
|
|
+ table-layout="fixed"
|
|
|
+ row-key="main_id"
|
|
|
+ :data="taskData"
|
|
|
+ class="table"
|
|
|
+ :height="tableHeight"
|
|
|
+ >
|
|
|
<el-table-column prop="main_c_name" label="名称" />
|
|
|
<el-table-column prop="main_c_user_name" label="用户" />
|
|
|
<el-table-column prop="main_c_state" label="类型">
|
|
|
<template #default="scope">
|
|
|
- <el-tag effect="dark" v-show="getType(scope.row.main_c_type) != null" disable-transitions>{{
|
|
|
- getType(scope.row.main_c_type)?.name ?? "" }}
|
|
|
+ <el-tag
|
|
|
+ effect="dark"
|
|
|
+ v-show="getType(scope.row.main_c_type) != null"
|
|
|
+ disable-transitions
|
|
|
+ >{{ getType(scope.row.main_c_type)?.name ?? "" }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="main_c_state" label="状态">
|
|
|
<template #default="scope">
|
|
|
- <el-tag effect="dark" v-show="getStatus(scope.row.main_c_state) != null"
|
|
|
- :type="statusStaticInfo[scope.row.main_c_state]?.tagType ?? ''" disable-transitions>{{
|
|
|
- getStatus(scope.row.main_c_state)?.name ?? "" }}</el-tag>
|
|
|
+ <el-tag
|
|
|
+ effect="dark"
|
|
|
+ v-show="getStatus(scope.row.main_c_state) != null"
|
|
|
+ :type="statusStaticInfo[scope.row.main_c_state]?.tagType ?? ''"
|
|
|
+ disable-transitions
|
|
|
+ >{{ getStatus(scope.row.main_c_state)?.name ?? "" }}</el-tag
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="main_c_start_time" label="任务开始时间">
|
|
|
@@ -66,26 +99,44 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="main_c_file_name" label="结果">
|
|
|
<template #default="scope">
|
|
|
- <span class="link" v-if="scope.row.main_c_file != null && scope.row.main_c_file_name != null"
|
|
|
- @click="downloadWithBlob(scope.row.main_c_file, scope.row.main_c_file_name)">
|
|
|
+ <span
|
|
|
+ class="link"
|
|
|
+ v-if="scope.row.main_c_file != null && scope.row.main_c_file_name != null"
|
|
|
+ @click="downloadWithBlob(scope.row.main_c_file, scope.row.main_c_file_name)"
|
|
|
+ >
|
|
|
{{ scope.row.main_c_file_name }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="360">
|
|
|
+ <el-table-column label="操作" width="420">
|
|
|
<template #default="scope">
|
|
|
- <el-button type="primary" @click="
|
|
|
- () => {
|
|
|
- dialog = true;
|
|
|
- focusTask = scope.row;
|
|
|
- }
|
|
|
- ">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="
|
|
|
+ () => {
|
|
|
+ dialog = true;
|
|
|
+ focusTask = scope.row;
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
查看详情
|
|
|
</el-button>
|
|
|
- <template v-if="scope.row.main_c_file != null && scope.row.main_c_file_name != null">
|
|
|
- <el-button type="primary" @click="
|
|
|
- downloadWithBlob(scope.row.main_c_file, scope.row.main_c_file_name)
|
|
|
- ">
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.main_c_state == 0"
|
|
|
+ type="success"
|
|
|
+ @click="runTask(scope.row.main_id)"
|
|
|
+ >
|
|
|
+ 运行
|
|
|
+ </el-button>
|
|
|
+ <template
|
|
|
+ v-if="scope.row.main_c_file != null && scope.row.main_c_file_name != null"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="
|
|
|
+ downloadWithBlob(scope.row.main_c_file, scope.row.main_c_file_name)
|
|
|
+ "
|
|
|
+ >
|
|
|
下载结果
|
|
|
</el-button>
|
|
|
<el-button type="primary" @click="preView(scope.row.main_c_file)">
|
|
|
@@ -95,9 +146,13 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <div class="between-row">
|
|
|
+ <div class="between-row pagination-container">
|
|
|
<div><!--empty div--></div>
|
|
|
- <el-pagination layout="prev, pager, next" :total="taskNum" @change="(page) => pullTaskData(page)" />
|
|
|
+ <el-pagination
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="taskNum"
|
|
|
+ @change="(page) => pullTaskData(page)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-dialog v-model="dialog" :show-close="true" width="750">
|
|
|
@@ -114,8 +169,11 @@
|
|
|
{{ focusTask.main_c_comment }}
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="任务类型">
|
|
|
- <el-tag effect="dark" v-show="getType(focusTask.main_c_type) != null" disable-transitions>{{
|
|
|
- getType(focusTask.main_c_type)?.name ?? "" }}
|
|
|
+ <el-tag
|
|
|
+ effect="dark"
|
|
|
+ v-show="getType(focusTask.main_c_type) != null"
|
|
|
+ disable-transitions
|
|
|
+ >{{ getType(focusTask.main_c_type)?.name ?? "" }}
|
|
|
</el-tag>
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="用户名">
|
|
|
@@ -125,8 +183,11 @@
|
|
|
{{ focusTask.main_c_user_id }}
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="状态">
|
|
|
- <el-tag effect="dark" :type="statusStaticInfo[focusTask.main_c_state]?.tagType ?? ''" disable-transitions>{{
|
|
|
- getStatus(focusTask.main_c_state)?.name ?? "" }}
|
|
|
+ <el-tag
|
|
|
+ effect="dark"
|
|
|
+ :type="statusStaticInfo[focusTask.main_c_state]?.tagType ?? ''"
|
|
|
+ disable-transitions
|
|
|
+ >{{ getStatus(focusTask.main_c_state)?.name ?? "" }}
|
|
|
</el-tag>
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="任务开始时间">
|
|
|
@@ -138,21 +199,32 @@
|
|
|
<el-descriptions-item label="结果文件">
|
|
|
{{ focusTask.main_c_file_name }}
|
|
|
|
|
|
- <template v-if="focusTask.main_c_file != null && focusTask.main_c_file_name != null">
|
|
|
- <el-button type="primary" size="small"
|
|
|
- @click="downloadWithBlob(focusTask.main_c_file, focusTask.main_c_file_name)">
|
|
|
+ <template
|
|
|
+ v-if="focusTask.main_c_file != null && focusTask.main_c_file_name != null"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="downloadWithBlob(focusTask.main_c_file, focusTask.main_c_file_name)"
|
|
|
+ >
|
|
|
下载结果
|
|
|
</el-button>
|
|
|
- <el-button type="primary" size="small" @click="preView(focusTask.main_c_file)">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="preView(focusTask.main_c_file)"
|
|
|
+ >
|
|
|
预览结果
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="原始数据">
|
|
|
- <template v-if="
|
|
|
- focusTask.main_c_source_file_name != null &&
|
|
|
- focusTask.main_c_source_file != null
|
|
|
- ">
|
|
|
+ <template
|
|
|
+ v-if="
|
|
|
+ focusTask.main_c_source_file_name != null &&
|
|
|
+ focusTask.main_c_source_file != null
|
|
|
+ "
|
|
|
+ >
|
|
|
{{ focusTask.main_c_source_file_name }}
|
|
|
<br />
|
|
|
</template>
|
|
|
@@ -168,7 +240,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getTasks, getCName } from "@/api/rwgl";
|
|
|
+import { getTasks, getCName, executeTask } from "@/api/rwgl";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -197,12 +269,18 @@ export default {
|
|
|
focusTask: {},
|
|
|
dialog: false,
|
|
|
page: 1,
|
|
|
+ tableHeight: 0,
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
this.pullTaskStatus();
|
|
|
this.pullTaskType();
|
|
|
this.pullTaskData(1);
|
|
|
+ this.calculateTableHeight();
|
|
|
+ window.addEventListener("resize", this.calculateTableHeight);
|
|
|
+ },
|
|
|
+ beforeUnmount() {
|
|
|
+ window.removeEventListener("resize", this.calculateTableHeight);
|
|
|
},
|
|
|
methods: {
|
|
|
async pullTaskStatus() {
|
|
|
@@ -211,8 +289,8 @@ export default {
|
|
|
for (const key of Object.keys(oData)) {
|
|
|
newData.push({
|
|
|
index: Number(key),
|
|
|
- name: oData[key]
|
|
|
- })
|
|
|
+ name: oData[key],
|
|
|
+ });
|
|
|
}
|
|
|
this.taskStatus = newData.sort((a, b) => a.index - b.index);
|
|
|
},
|
|
|
@@ -255,8 +333,8 @@ export default {
|
|
|
for (const key of Object.keys(oData)) {
|
|
|
newData.push({
|
|
|
index: Number(key),
|
|
|
- name: oData[key]
|
|
|
- })
|
|
|
+ name: oData[key],
|
|
|
+ });
|
|
|
}
|
|
|
let taskType = newData.sort((a, b) => a.index - b.index);
|
|
|
for (let i = 0; i < taskType.length; i++) {
|
|
|
@@ -267,7 +345,7 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- this.taskType = taskType
|
|
|
+ this.taskType = taskType;
|
|
|
},
|
|
|
changeTaskType(types) {
|
|
|
if (types == null) {
|
|
|
@@ -341,12 +419,62 @@ export default {
|
|
|
preView(url) {
|
|
|
window.open("fileView?url=" + systemConfig.dmsDataProxy + url, "_blank");
|
|
|
},
|
|
|
+ async runTask(taskId) {
|
|
|
+ try {
|
|
|
+ const res = await executeTask(taskId);
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: res.content || "任务已提交,正在后台执行",
|
|
|
+ });
|
|
|
+ // 先禁用按钮,防止重复点击
|
|
|
+ this.$refs.runTaskBtn.disabled = true;
|
|
|
+ // 刷新任务列表
|
|
|
+ setTimeout(() => {
|
|
|
+ // 执行成功后,刷新任务列表
|
|
|
+ this.pullTaskData(this.page);
|
|
|
+ }, 300);
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: res.message || "执行任务失败",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("执行任务失败:", error);
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: "执行任务失败,请稍后重试",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
truncateText(text, maxLength = 40) {
|
|
|
if (typeof text !== "string" || text.length <= maxLength) {
|
|
|
return text;
|
|
|
}
|
|
|
return text.substring(0, maxLength) + "…";
|
|
|
},
|
|
|
+ calculateTableHeight() {
|
|
|
+ // 计算表格高度:窗口高度 - header高度 - footer高度 - 页面padding - 其他元素高度
|
|
|
+ const windowHeight = window.innerHeight;
|
|
|
+ const headerHeight = 70; // Header组件高度
|
|
|
+ const footerHeight = 50; // Footer组件高度
|
|
|
+ const pagePadding = 40 * 2; // 页面上下padding
|
|
|
+ const filterAreaHeight = 120; // 筛选条件区域高度
|
|
|
+ const taskCountHeight = 30; // 任务数量文字高度
|
|
|
+ const paginationHeight = 50; // 分页区域高度
|
|
|
+ const containerMargin = 15 * 2; // 容器上下margin
|
|
|
+
|
|
|
+ this.tableHeight =
|
|
|
+ windowHeight -
|
|
|
+ headerHeight -
|
|
|
+ footerHeight -
|
|
|
+ pagePadding -
|
|
|
+ filterAreaHeight -
|
|
|
+ taskCountHeight -
|
|
|
+ paginationHeight -
|
|
|
+ containerMargin;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -413,7 +541,7 @@ link {
|
|
|
margin-left: 0;
|
|
|
padding-left: 90px;
|
|
|
padding-right: 90px;
|
|
|
- min-height: 80vh
|
|
|
+ min-height: 80vh;
|
|
|
}
|
|
|
|
|
|
.darkblue-background {
|
|
|
@@ -427,6 +555,7 @@ link {
|
|
|
.blue-background,
|
|
|
body {
|
|
|
background: #0f3460;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.bluedark-background {
|
|
|
@@ -447,6 +576,15 @@ body {
|
|
|
border-radius: 3%;
|
|
|
}
|
|
|
|
|
|
+.task-count {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ color: #fff;
|
|
|
+}
|
|
|
+
|
|
|
+.pagination-container {
|
|
|
+ margin-top: 15px;
|
|
|
+}
|
|
|
+
|
|
|
.lightblue-container {
|
|
|
border-radius: 3%;
|
|
|
padding: 10px;
|
|
|
@@ -490,7 +628,7 @@ body {
|
|
|
justify-content: flex-start;
|
|
|
}
|
|
|
|
|
|
-.left-row>* {
|
|
|
+.left-row > * {
|
|
|
margin-right: 15px;
|
|
|
}
|
|
|
|
|
|
@@ -512,8 +650,8 @@ body {
|
|
|
flex-direction: column-reverse;
|
|
|
}
|
|
|
|
|
|
-.dense-col>*,
|
|
|
-.start-reverse-col>* {
|
|
|
+.dense-col > *,
|
|
|
+.start-reverse-col > * {
|
|
|
margin: 10px;
|
|
|
}
|
|
|
|