-
-
-
-
- {{ task.id }}
-
- {{ task.name }}
-
-
-
- {{ getDictLabel(DICT_TYPE.IOT_OTA_TASK_DEVICE_SCOPE, task.deviceScope) }}
-
-
-
-
- {{ getDictLabel(DICT_TYPE.IOT_OTA_TASK_STATUS, task.status) }}
-
-
-
- {{
- task.createTime
- ? formatDate(task.createTime, 'YYYY-MM-DD HH:mm:ss')
- : '-'
- }}
-
-
- {{ task.description }}
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/apps/web-antd/src/views/iot/ota/task/modules/form.vue b/apps/web-antd/src/views/iot/ota/task/modules/form.vue
index 532cca453..4d93f26b4 100644
--- a/apps/web-antd/src/views/iot/ota/task/modules/form.vue
+++ b/apps/web-antd/src/views/iot/ota/task/modules/form.vue
@@ -12,6 +12,7 @@ import { $t } from '#/locales';
import { useFormSchema } from '../data';
+// TODO @AI:是不是defineOptions、升级任务表单 注释需要?
/** IoT OTA 升级任务表单 */
defineOptions({ name: 'IoTOtaTaskForm' });
@@ -28,6 +29,7 @@ const [Form, formApi] = useVbenForm({
showDefaultActions: false,
});
+// TODO @AI:注释风格,需要对齐其他 form;
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
const { valid } = await formApi.validate();
diff --git a/apps/web-antd/src/views/iot/ota/task/modules/info.vue b/apps/web-antd/src/views/iot/ota/task/modules/info.vue
new file mode 100644
index 000000000..8086daa95
--- /dev/null
+++ b/apps/web-antd/src/views/iot/ota/task/modules/info.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/iot/ota/task/modules/list.vue b/apps/web-antd/src/views/iot/ota/task/modules/list.vue
index e45a5ab9a..364c6a41a 100644
--- a/apps/web-antd/src/views/iot/ota/task/modules/list.vue
+++ b/apps/web-antd/src/views/iot/ota/task/modules/list.vue
@@ -2,21 +2,19 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { IoTOtaTaskApi } from '#/api/iot/ota/task';
+import { ref } from 'vue';
+
import { useVbenModal } from '@vben/common-ui';
-import { message } from 'ant-design-vue';
+import { Input, message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { cancelOtaTask, getOtaTaskPage } from '#/api/iot/ota/task';
import { IoTOtaTaskStatusEnum } from '#/views/iot/utils/constants';
+import { useGridColumns } from '../data';
import OtaTaskDetail from './detail.vue';
import OtaTaskForm from './form.vue';
-import { useGridColumns, useGridFormSchema } from '../data';
-
-/** IoT OTA 任务列表 */
-// TODO @AI:defineOptions 还需要么?
-defineOptions({ name: 'IoTOtaTaskList' });
const props = defineProps<{
firmwareId: number;
@@ -25,6 +23,8 @@ const props = defineProps<{
const emit = defineEmits(['success']);
+const searchName = ref('');
+
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: OtaTaskForm,
destroyOnClose: true,
@@ -41,6 +41,11 @@ async function handleRefresh() {
emit('success');
}
+/** 按任务名搜索(嵌入页面里,单字段搜索做成 toolbar 内联输入框,回车 / 清空触发查询) */
+async function handleSearch() {
+ await gridApi.query();
+}
+
/** 新增任务 */
function handleCreate() {
formModalApi
@@ -61,21 +66,18 @@ async function handleCancel(row: IoTOtaTaskApi.Task) {
}
const [Grid, gridApi] = useVbenVxeGrid({
- formOptions: {
- schema: useGridFormSchema(),
- },
gridOptions: {
columns: useGridColumns(),
- height: 'auto',
+ maxHeight: 500,
keepSource: true,
proxyConfig: {
ajax: {
- query: async ({ page }, formValues) => {
+ query: async ({ page }) => {
return await getOtaTaskPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
firmwareId: props.firmwareId,
- ...formValues,
+ name: searchName.value || undefined,
});
},
},
@@ -86,31 +88,44 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
toolbarConfig: {
refresh: true,
- search: true,
},
} as VxeTableGridOptions
,
});
-
-
-
+
+
!e.target.value && handleSearch()"
+ />
+
+
+// TODO @AI:是不是改成 statistics.vue 简化掉?
import { computed } from 'vue';
+import { DICT_TYPE } from '@vben/constants';
+import { getDictLabel } from '@vben/hooks';
+
import { Card, Col, Row } from 'ant-design-vue';
import { IoTOtaTaskRecordStatusEnum } from '#/views/iot/utils/constants';
-/** OTA 升级设备统计卡片 */
-// TODO @AI:是不是去掉 defineOptions
-defineOptions({ name: 'IoTOtaUpgradeStatistics' });
-
const props = defineProps<{
loading?: boolean;
statistics: Record;
}>();
+/** 取字典标签(同步) */
+function dictLabel(value: number) {
+ return getDictLabel(DICT_TYPE.IOT_OTA_TASK_RECORD_STATUS, value);
+}
+
/** 统计项配置 */
const items = computed(() => [
{
@@ -25,39 +30,38 @@ const items = computed(() => [
0,
),
},
- // TODO @AI:label 名字,是不是通过字典获取名字?包括 vue3 + ep 也是;
{
- label: '待推送',
+ label: dictLabel(IoTOtaTaskRecordStatusEnum.PENDING.value),
span: 3,
color: 'text-gray-400',
value: props.statistics[IoTOtaTaskRecordStatusEnum.PENDING.value] || 0,
},
{
- label: '已推送',
+ label: dictLabel(IoTOtaTaskRecordStatusEnum.PUSHED.value),
span: 3,
color: 'text-blue-400',
value: props.statistics[IoTOtaTaskRecordStatusEnum.PUSHED.value] || 0,
},
{
- label: '正在升级',
+ label: dictLabel(IoTOtaTaskRecordStatusEnum.UPGRADING.value),
span: 3,
color: 'text-yellow-500',
value: props.statistics[IoTOtaTaskRecordStatusEnum.UPGRADING.value] || 0,
},
{
- label: '升级成功',
+ label: dictLabel(IoTOtaTaskRecordStatusEnum.SUCCESS.value),
span: 3,
color: 'text-green-500',
value: props.statistics[IoTOtaTaskRecordStatusEnum.SUCCESS.value] || 0,
},
{
- label: '升级失败',
+ label: dictLabel(IoTOtaTaskRecordStatusEnum.FAILURE.value),
span: 3,
color: 'text-red-500',
value: props.statistics[IoTOtaTaskRecordStatusEnum.FAILURE.value] || 0,
},
{
- label: '升级取消',
+ label: dictLabel(IoTOtaTaskRecordStatusEnum.CANCELED.value),
span: 3,
color: 'text-gray-400',
value: props.statistics[IoTOtaTaskRecordStatusEnum.CANCELED.value] || 0,
@@ -66,7 +70,7 @@ const items = computed(() => [
-
+
`${row.progress || 0}%`,
+ },
+ {
+ field: 'description',
+ title: '状态描述',
+ minWidth: 150,
+ align: 'center',
+ showOverflow: 'tooltip',
+ },
+ {
+ field: 'updateTime',
+ title: '更新时间',
+ width: 180,
+ align: 'center',
+ formatter: 'formatDateTime',
+ },
+ {
+ title: '操作',
+ width: 80,
+ fixed: 'right',
+ align: 'center',
+ slots: { default: 'actions' },
+ },
+ ];
+}
diff --git a/apps/web-antd/src/views/iot/ota/task/record/modules/list.vue b/apps/web-antd/src/views/iot/ota/task/record/modules/list.vue
new file mode 100644
index 000000000..6a8f7aff8
--- /dev/null
+++ b/apps/web-antd/src/views/iot/ota/task/record/modules/list.vue
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+