From 0b687faa2d0b24c47314b30327a21cf53108e887 Mon Sep 17 00:00:00 2001 From: zhanghan Date: Thu, 28 Dec 2023 17:22:43 +0800 Subject: [PATCH] Interface data related to the docking task list --- atune/server/controller/task.go | 2 +- atune/web/index.html | 2 +- atune/web/src/api/atune.ts | 11 ++- atune/web/src/components/atuneTemplete.vue | 13 ++-- atune/web/src/components/table.vue | 87 +++------------------- atune/web/src/types/atune.d.ts | 5 ++ atune/web/src/views/Home.vue | 26 ++----- atune/web/src/views/taskList.vue | 48 +++--------- 8 files changed, 54 insertions(+), 140 deletions(-) diff --git a/atune/server/controller/task.go b/atune/server/controller/task.go index 17d7b1e0..f8a6cb4e 100644 --- a/atune/server/controller/task.go +++ b/atune/server/controller/task.go @@ -36,7 +36,7 @@ func DeleteTask(c *gin.Context) { response.Fail(c, nil, err.Error()) return } - response.Success(c, nil, "已删除调优对象模板") + response.Success(c, nil, "已删除任务") } func SearchTask(c *gin.Context) { diff --git a/atune/web/index.html b/atune/web/index.html index 9437bd9e..13d0e329 100644 --- a/atune/web/index.html +++ b/atune/web/index.html @@ -4,7 +4,7 @@ - + 智能调优 diff --git a/atune/web/src/api/atune.ts b/atune/web/src/api/atune.ts index 0ea89bfb..546fff1c 100644 --- a/atune/web/src/api/atune.ts +++ b/atune/web/src/api/atune.ts @@ -9,6 +9,15 @@ export function getTaskLists(data: Object) { }); } +// 高级搜索任务列表分页 +export function searchTask(data: object) { + return request({ + url: "/plugin/atune/task_search", + method: "get", + params: data, + }); +} + // 新增任务 export function addTask(data: object) { return request({ @@ -21,7 +30,7 @@ export function addTask(data: object) { // 删除任务 export function deleteTask(data: object) { return request({ - url: "/plugin/atune/delete", + url: "/plugin/atune/task_delete", method: "delete", data, }); diff --git a/atune/web/src/components/atuneTemplete.vue b/atune/web/src/components/atuneTemplete.vue index f1937d04..5cb87d3b 100644 --- a/atune/web/src/components/atuneTemplete.vue +++ b/atune/web/src/components/atuneTemplete.vue @@ -4,6 +4,9 @@ + + + @@ -17,12 +20,7 @@ - + @@ -36,7 +34,7 @@ import { ElMessage } from "element-plus"; import { reactive, watchEffect, ref } from "vue"; import { getAtuneInfo, saveTune, updateTune } from "@/api/atune"; -import { Atune } from "@/types/atune"; +import { Atune, Task } from "@/types/atune"; import MyButton from "@/components/myButton.vue"; let props = defineProps({ @@ -54,6 +52,7 @@ const isEdit = ref(false); const form = reactive({ id: 0, tuneName: "", + description: "", workDir: "", prepare: "", tune: "", diff --git a/atune/web/src/components/table.vue b/atune/web/src/components/table.vue index 629cd42e..6cb24f02 100644 --- a/atune/web/src/components/table.vue +++ b/atune/web/src/components/table.vue @@ -8,13 +8,8 @@
- +
@@ -23,14 +18,8 @@
- + @@ -103,53 +84,7 @@ onMounted(async () => { // 获取表格数据 const getTableData = () => { - // loading.value = true; - tableData.value = [ - { - id: 2, - task_name: "准备调优环境", - command: "ls", - task_status: "已完成", - create_time: "2023-12-25 11:23:18", - update_time: "2023-12-25 11:23:18", - results: [ - { - id: 2, - task_id: 2, - machine_uuid: "13ff60a7-0f7d-49d6-b7fc-b766cc347ba8", - machine_ip: "192.168.160.20", - command: "ls", - retcode: 0, - stdout: - "app\nconfig_agent.yaml\nconfig_agent.yaml.templete\nconfig_server.yaml\nconfig_server.yaml.templete\ndbmanager\nglobal\ngo.mod\ngo.sum\nuser.xlsx.templete\nutils\nvendor", - stderr: "", - is_update: true, - }, - ], - }, - { - id: 1, - task_name: "执行中", - command: "ls", - task_status: "执行中", - create_time: "2023-12-25 10:08:15", - update_time: "", - results: [ - { - id: 1, - task_id: 1, - machine_uuid: "13ff60a7-0f7d-49d6-b7fc-b766cc347ba8", - machine_ip: "192.168.160.20", - command: "ls", - retcode: 0, - stdout: - "app\nconfig_agent.yaml\nconfig_agent.yaml.templete\nconfig_server.yaml\nconfig_server.yaml.templete\ndbmanager\nglobal\ngo.mod\ngo.sum\nuser.xlsx.templete\nutils\nvendor", - stderr: "", - is_update: false, - }, - ], - }, - ]; + loading.value = true; props.getData!({ page: page.currentPage, size: page.pageSize }).then( (res: { data: ReaultData }) => { let result: ReaultData = res.data; @@ -174,7 +109,7 @@ const handleSearch = () => { .searchFunc({ page: page.currentPage, size: page.pageSize, - name: keyWord, + search: keyWord.value, }) .then((res: any) => { loading.value = false; @@ -256,6 +191,7 @@ defineExpose({ justify-content: space-evenly; width: 100%; height: 100%; + &_header { width: 100%; height: 44px; @@ -265,6 +201,7 @@ defineExpose({ display: flex; align-items: center; justify-content: space-between; + &_title { font-size: 16px; } diff --git a/atune/web/src/types/atune.d.ts b/atune/web/src/types/atune.d.ts index 349d456a..d2f093ab 100644 --- a/atune/web/src/types/atune.d.ts +++ b/atune/web/src/types/atune.d.ts @@ -6,10 +6,15 @@ export interface Task { create_time: string; update_time: string; results: Array; + tune_id: int; + tune: Atune } export interface Atune { id: number; + description: string; + create_time: string; + update_time: string tuneName: string; workDir: string; prepare: string; diff --git a/atune/web/src/views/Home.vue b/atune/web/src/views/Home.vue index 6f51d4c7..2b2db216 100644 --- a/atune/web/src/views/Home.vue +++ b/atune/web/src/views/Home.vue @@ -2,21 +2,14 @@
- +
- 执行任务列表 + 执行任务列表 任务详情
@@ -25,12 +18,8 @@ - + @@ -65,11 +54,11 @@ const returnHome = () => { }; // 新增 -const handleCreat = () => {}; +const handleCreat = () => { }; // 查看模板详情 const handleAtuneDetail = (taskRow: Task | Atune) => { - selectedEditRow.value = taskRow; + selectedEditRow.value = taskRow.tune; showDialog.value = true; }; @@ -98,6 +87,7 @@ const handleDataUpdated = () => { margin: 0 auto; height: 100%; } + &-nav { width: 96%; margin: 0 auto; diff --git a/atune/web/src/views/taskList.vue b/atune/web/src/views/taskList.vue index e283e858..a6568d48 100644 --- a/atune/web/src/views/taskList.vue +++ b/atune/web/src/views/taskList.vue @@ -1,12 +1,7 @@