5 changed files with 219 additions and 27 deletions
-
22src/src/main/java/com/my/graphiteDigesterBg/diframe/DiTestcaseManager.java
-
4src/web/src/pages/main/Page.vue
-
78src/web/src/pages/main/contents/Task.vue
-
98src/web/src/pages/main/contents/Test.vue
-
44src/web/src/pages/main/contents/TestActuatorExecute.vue
@ -0,0 +1,78 @@ |
|||
<template> |
|||
<div class="p-1"> |
|||
<a-table |
|||
:pagination="pagination" |
|||
:dataSource="dataSource" |
|||
:columns="columns" |
|||
@change="actionTableChange" |
|||
> |
|||
<template #bodyCell="{ column, record }"> |
|||
<template v-if="column.key === 'user'"> |
|||
{{ record.user.account }} |
|||
</template> |
|||
<template v-else-if="column.key === 'createdAt'"> |
|||
{{ formatTime(record.createdAt) }} |
|||
</template> |
|||
</template> |
|||
</a-table> |
|||
</div> |
|||
</template> |
|||
<script setup> |
|||
import ApiClient from '@/utils/ApiClient'; |
|||
import { onMounted, ref } from 'vue'; |
|||
/** @var {Array<Object>} */ |
|||
const columns = [ |
|||
{key:'user',dataIndex:'user',title:'用户',align:'left'}, |
|||
{key:'status',dataIndex:'status',title:'状态',align:'left'}, |
|||
{key:'name',dataIndex:'name',title:'名称',align:'left'}, |
|||
{key:'runtimeStatus',dataIndex:'runtimeStatus',title:'运行时状态',align:'left'}, |
|||
{key:'message',dataIndex:'message',title:'消息',align:'left'}, |
|||
{key:'createdAt',dataIndex: 'createdAt',title:'创建时间',align:'right'}, |
|||
]; |
|||
/** @var {Array<Object>} */ |
|||
const dataSource = ref([]); |
|||
/** @var {Object} */ |
|||
const pagination = ref({ |
|||
current: 1, |
|||
pageSize: 10, |
|||
total: 0, |
|||
showSizeChanger: false, |
|||
}); |
|||
// on mounted |
|||
onMounted(mounted); |
|||
|
|||
// on mounted |
|||
async function mounted() { |
|||
await refresh(); |
|||
} |
|||
|
|||
// format time |
|||
function formatTime(time) { |
|||
let date = new Date(time * 1000); |
|||
let year = date.getFullYear(); |
|||
let month = (date.getMonth()+1).toString().padStart(2,'0'); |
|||
let day = (date.getDate()).toString().padStart(2,'0'); |
|||
let hour = (date.getHours()).toString().padStart(2,'0'); |
|||
let minute = (date.getMinutes()).toString().padStart(2,'0'); |
|||
let second = (date.getSeconds()).toString().padStart(2,'0'); |
|||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`; |
|||
} |
|||
|
|||
// refresh |
|||
async function refresh() { |
|||
let client = ApiClient.getClient(); |
|||
let response = await client.call("task/list", { |
|||
offset : (pagination.value.current-1)*pagination.value.pageSize, |
|||
limit : pagination.value.pageSize, |
|||
}); |
|||
dataSource.value = response.list; |
|||
pagination.value.total = response.total; |
|||
} |
|||
|
|||
// action table change |
|||
async function actionTableChange(page) { |
|||
pagination.value.current = page.current; |
|||
pagination.value.pageSize = page.pageSize; |
|||
await refresh(); |
|||
} |
|||
</script> |
@ -1,33 +1,87 @@ |
|||
<template> |
|||
<div class="p-1"> |
|||
<a-table :dataSource="dataSource" :columns="columns"></a-table> |
|||
<a-table :dataSource="funcDataSource" :columns="funcColumns"> |
|||
<template #bodyCell="{ column, record }"> |
|||
<template v-if="column.key === 'action'"> |
|||
<a-popconfirm title="确定要运行吗?" ok-text="确定" cancel-text="取消" placement="left" @confirm="actionFunctionalTestExec(record)"> |
|||
<a-button size="small">运行</a-button> |
|||
</a-popconfirm> |
|||
</template> |
|||
</template> |
|||
</a-table> |
|||
|
|||
<!-- <a-tabs v-model:activeKey="activeKey" class="bg-white rounded-xl" type="card"> |
|||
<a-tab-pane key="functional" tab="功能测试"> |
|||
<a-table :dataSource="funcDataSource" :columns="funcColumns"> |
|||
<template #bodyCell="{ column, record }"> |
|||
<template v-if="column.key === 'action'"> |
|||
<a-popconfirm title="确定要运行吗?" ok-text="确定" cancel-text="取消" placement="left" @confirm="actionFunctionalTestExec(record)"> |
|||
<a-button size="small">运行</a-button> |
|||
</a-popconfirm> |
|||
</template> |
|||
</template> |
|||
</a-table> |
|||
</a-tab-pane> |
|||
<a-tab-pane key="unit" tab="单元测试" force-render> |
|||
<a-table :columns="actColumns" :dataSource="actDataSource"> |
|||
<template #bodyCell="{ column, record }"> |
|||
<template v-if="column.key === 'action'"> |
|||
<text-actuator-execute :type="record.type"/> |
|||
</template> |
|||
</template> |
|||
</a-table> |
|||
</a-tab-pane> |
|||
</a-tabs> --> |
|||
</div> |
|||
</template> |
|||
<script setup> |
|||
import { ref } from 'vue'; |
|||
import ApiClient from '@/utils/ApiClient'; |
|||
import TestAcutatorExecute from './TestActuatorExecute.vue'; |
|||
import { onMounted, ref } from 'vue'; |
|||
/** @var {Array<Object>} */ |
|||
const columns = [ |
|||
const funcColumns = [ |
|||
{key:'title',dataIndex:'title',title:'标题',align:'left'}, |
|||
{key:'description',dataIndex:'description',title:'描述',align:'left'}, |
|||
{key:'action',dataIndex:'action',title:'操作',align:'right'}, |
|||
]; |
|||
/** @var {Array<Object>} */ |
|||
const funcDataSource = ref([]); |
|||
/** @var {Array<Object>} */ |
|||
const actColumns = [ |
|||
{key:'name',dataIndex:'name',title:'名称',align:'left'}, |
|||
{key:'type',dataIndex:'type',title:'类型',align:'left'}, |
|||
{key:'action',dataIndex:'action',title:'操作',align:'right'}, |
|||
]; |
|||
/** @var {Array<Object>} */ |
|||
const dataSource = ref([ |
|||
{name:'加液机械臂',action:'复位 最小值 最大值'}, |
|||
{name:'蠕动泵01',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵02',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵03',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵04',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵05',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵06',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵07',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵08',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵09',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵10',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵11',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵12',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵13',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵14',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵15',action:'复位 加液 回抽'}, |
|||
{name:'蠕动泵16',action:'复位 加液 回抽'}, |
|||
]); |
|||
const actDataSource = ref([]); |
|||
// on mounted |
|||
onMounted(mounted); |
|||
|
|||
// on mounted |
|||
async function mounted() { |
|||
let client = ApiClient.getClient(); |
|||
let response = await client.call('test/list'); |
|||
funcDataSource.value = response.list; |
|||
response = await client.call('device/actuator-list'); |
|||
actDataSource.value = response.list; |
|||
} |
|||
|
|||
// actuactor exec |
|||
async function actuatorExec(key, action, params) { |
|||
let client = ApiClient.getClient(); |
|||
await client.call('test/actuator-execute', { |
|||
key, action, params, |
|||
}); |
|||
} |
|||
|
|||
// action functional test exec |
|||
async function actionFunctionalTestExec(record) { |
|||
console.log(record); |
|||
let client = ApiClient.getClient(); |
|||
await client.call('test/execute', { |
|||
name: record.name, |
|||
}); |
|||
} |
|||
|
|||
|
|||
</script> |
@ -0,0 +1,44 @@ |
|||
<template> |
|||
<div> |
|||
<template v-if="'Motor' === props.type"> |
|||
<a-popover title="移动"> |
|||
<template #content> |
|||
<a-input-number v-model:value="move.pos" size="small"/> |
|||
<a-button size="small" class="ml-1">执行</a-button> |
|||
</template> |
|||
<a-button size="small" class="ml-1">移动</a-button> |
|||
</a-popover> |
|||
|
|||
<a-button size="small" class="ml-1">旋转</a-button> |
|||
<a-button size="small" class="ml-1">复位</a-button> |
|||
</template> |
|||
|
|||
<template v-if="'Servo' === props.type"> |
|||
<a-button size="small" class="ml-1">移动</a-button> |
|||
</template> |
|||
|
|||
<template v-if="'PeristalticPump' === props.type"> |
|||
<a-button size="small" class="ml-1">旋转</a-button> |
|||
</template> |
|||
</div> |
|||
</template> |
|||
<script setup> |
|||
import ApiClient from '@/utils/ApiClient'; |
|||
/** @var {Object} */ |
|||
const props = defineProps({ |
|||
type : String, // type |
|||
}); |
|||
/** @var {Object} */ |
|||
const move = ref({pos:0}); |
|||
|
|||
async function actionExecuteMove() { |
|||
let client = ApiClient.getClient(); |
|||
client.call('device/actuator-execute', { |
|||
key: props.type, |
|||
action: 'move', |
|||
params: { |
|||
pos: move.value.pos, |
|||
}, |
|||
}) |
|||
} |
|||
</script> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue