20 changed files with 314 additions and 75 deletions
-
9src/apis/home.ts
-
7src/assets/styles/element.scss
-
7src/components/common/FTButton/index.vue
-
171src/components/common/FTTable/index.vue
-
4src/components/home/SetTemperature/index.vue
-
6src/components/home/StartExperiment/index.vue
-
3src/components/home/Tube/index.vue
-
8src/hooks/useActivateDebug.ts
-
24src/layouts/default.vue
-
4src/router/index.ts
-
6src/router/routes.ts
-
4src/stores/systemStore.ts
-
1src/types/home.d.ts
-
2src/types/system.d.ts
-
26src/types/task.d.ts
-
4src/types/user.d.ts
-
3src/views/debug/index.vue
-
17src/views/home/index.vue
-
2src/views/point/index.vue
-
81src/views/taskLog/index.vue
@ -1,6 +1,11 @@ |
|||
import http from 'libs/http' |
|||
|
|||
const baseUrl = '/tasks/' |
|||
export const setTargetTemperature = (params: Home.SetTargetTemperatureParams): Promise<null> => http.post('/heat/target-temperature', params) |
|||
export const trayIn = (): Promise<null> => http.post('/tray/in') |
|||
export const trayOut = (): Promise<null> => http.post('/tray/out') |
|||
export const trayTube = (params: Home.TrayTubeParams): Promise<null> => http.post('/tray/out', params) |
|||
export const addTask = (params: Task.TaskAdd): Promise<null> => http.post(baseUrl, params) |
|||
export const stopTask = (): Promise<null> => http.post(`${baseUrl}stop`) |
|||
export const getTask = (id: number): Promise<Task.Task> => http.get(`${baseUrl}${id}`) |
|||
export const taskList = (params: Task.TaskQuery): Promise<Task.Task[]> => http.get(`${baseUrl}list`, { params }) |
|||
export const getTaskIng = (): Promise<null> => http.get(`${baseUrl}getIngTask`) |
|||
export const delTask = (params: string): Promise<null> => http.delete(`${baseUrl}${params}`) |
@ -0,0 +1,26 @@ |
|||
declare namespace Task { |
|||
|
|||
interface TaskAdd { |
|||
name: string |
|||
} |
|||
interface TaskQuery extends System.Page { |
|||
name: string |
|||
} |
|||
interface Task { |
|||
id: number |
|||
name: string |
|||
status: 1 | 2 |
|||
isDeleted: 0 | 1 |
|||
createTime: string |
|||
startTime: string |
|||
endTime: string |
|||
updateTime: string |
|||
steps: Step[] |
|||
} |
|||
interface Step { |
|||
id: number |
|||
taskId: number |
|||
stepDescription: string |
|||
createTime: string |
|||
} |
|||
} |
@ -0,0 +1,81 @@ |
|||
<script setup lang="ts"> |
|||
import { delTask, taskList } from 'apis/home' |
|||
import { ElMessageBox, ElTag } from 'element-plus' |
|||
import { FtMessage } from 'libs/message' |
|||
import { h, useTemplateRef } from 'vue' |
|||
|
|||
const searchList = [ |
|||
{ |
|||
title: '实验名称', |
|||
key: 'name', |
|||
}, |
|||
] |
|||
const btnList = [ |
|||
{ |
|||
name: '删除', |
|||
type: 'danger', |
|||
serverUrl: 'del', |
|||
serverCondition: 2, |
|||
}, |
|||
] |
|||
const columns = [ |
|||
{ |
|||
title: '实验名称', |
|||
type: 'selection', |
|||
}, |
|||
{ |
|||
title: '实验名称', |
|||
key: 'name', |
|||
}, |
|||
{ |
|||
title: '开始时间', |
|||
key: 'startTime', |
|||
}, |
|||
{ |
|||
title: '结束时间', |
|||
key: 'endTime', |
|||
}, |
|||
{ |
|||
title: '状态', |
|||
key: 'status', |
|||
width: 120, |
|||
render: (row: any) => { |
|||
return h( |
|||
ElTag, |
|||
{ |
|||
type: row.status === 1 ? 'primary' : 'success', |
|||
}, |
|||
{ default: () => row.status === 1 ? '执行中' : '执行完毕' }, |
|||
) |
|||
}, |
|||
}, |
|||
] |
|||
|
|||
const tableRef = useTemplateRef('tableRef') |
|||
|
|||
const del = async (selectedRows: any) => { |
|||
const ids = selectedRows.map((item: any) => item.id) |
|||
await ElMessageBox.confirm('确定删除当前选中的行?', '消息', { |
|||
confirmButtonText: '确认', |
|||
cancelButtonText: '取消', |
|||
type: 'warning', |
|||
}) |
|||
await delTask(ids) |
|||
FtMessage.success('删除成功') |
|||
tableRef.value?.initData() |
|||
} |
|||
|
|||
const rowClickHandle = (data: Task.Task) => { |
|||
console.log(data) |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<div> |
|||
<FtTable ref="tableRef" has-header has-page :columns="columns" :btn-list="btnList" :search-list="searchList" :get-data-fn="taskList" @del="del" @row-click="rowClickHandle" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue