Pre Merge pull request !239 from huppygo/dev

pull/239/MERGE
huppygo 2025-10-25 06:16:16 +00:00 committed by Gitee
commit 8de7c4626d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
17 changed files with 58 additions and 113 deletions

View File

@ -1,12 +1,9 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { getSimpleRuleSceneList } from '#/api/iot/rule/scene'; import { getSimpleRuleSceneList } from '#/api/iot/rule/scene';
import { getSimpleUserList } from '#/api/system/user'; import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
/** 新增/修改告警配置的表单 */ /** 新增/修改告警配置的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
@ -63,7 +60,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '关联场景联动规则', label: '关联场景联动规则',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleRuleSceneList, api: () => getSimpleRuleSceneList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
mode: 'multiple', mode: 'multiple',
@ -76,7 +73,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '接收的用户', label: '接收的用户',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleUserList, api: () => getSimpleUserList(),
labelField: 'nickname', labelField: 'nickname',
valueField: 'id', valueField: 'id',
mode: 'multiple', mode: 'multiple',
@ -124,10 +121,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -1,13 +1,10 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { getSimpleAlertConfigList } from '#/api/iot/alert/config'; import { getSimpleAlertConfigList } from '#/api/iot/alert/config';
import { getSimpleDeviceList } from '#/api/iot/device/device'; import { getSimpleDeviceList } from '#/api/iot/device/device';
import { getSimpleProductList } from '#/api/iot/product/product'; import { getSimpleProductList } from '#/api/iot/product/product';
import { getRangePickerDefaultProps } from '#/utils'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
/** 列表的搜索表单 */ /** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {
@ -17,7 +14,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '告警配置', label: '告警配置',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleAlertConfigList, api: () => getSimpleAlertConfigList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择告警配置', placeholder: '请选择告警配置',
@ -40,7 +37,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '产品', label: '产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -53,7 +50,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '设备', label: '设备',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleDeviceList, api: () => getSimpleDeviceList(),
labelField: 'deviceName', labelField: 'deviceName',
valueField: 'id', valueField: 'id',
placeholder: '请选择设备', placeholder: '请选择设备',
@ -75,10 +72,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -1,9 +1,6 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getSimpleDeviceList } from '#/api/iot/device/device'; import { getSimpleDeviceList } from '#/api/iot/device/device';
import { getSimpleDeviceGroupList } from '#/api/iot/device/group'; import { getSimpleDeviceGroupList } from '#/api/iot/device/group';
@ -11,6 +8,7 @@ import {
DeviceTypeEnum, DeviceTypeEnum,
getSimpleProductList, getSimpleProductList,
} from '#/api/iot/product/product'; } from '#/api/iot/product/product';
import { DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
@ -28,7 +26,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '产品', label: '产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -89,7 +87,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '设备分组', label: '设备分组',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleDeviceGroupList, api: () => getSimpleDeviceGroupList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
mode: 'multiple', mode: 'multiple',
@ -156,7 +154,7 @@ export function useGroupFormSchema(): VbenFormSchema[] {
label: '设备分组', label: '设备分组',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleDeviceGroupList, api: () => getSimpleDeviceGroupList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
mode: 'multiple', mode: 'multiple',
@ -199,7 +197,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '产品', label: '产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -249,7 +247,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '设备分组', label: '设备分组',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleDeviceGroupList, api: () => getSimpleDeviceGroupList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择设备分组', placeholder: '请选择设备分组',

View File

@ -34,7 +34,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '父级分组', label: '父级分组',
component: 'ApiTreeSelect', component: 'ApiTreeSelect',
componentProps: { componentProps: {
api: getSimpleDeviceGroupList, api: () => getSimpleDeviceGroupList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择父级分组', placeholder: '请选择父级分组',

View File

@ -29,7 +29,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '所属产品', label: '所属产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -85,7 +85,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '产品', label: '产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -96,10 +96,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -29,7 +29,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '所属产品', label: '所属产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -86,7 +86,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '产品', label: '产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -97,10 +97,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -2,10 +2,9 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { IoTOtaFirmwareApi } from '#/api/iot/ota/firmware'; import type { IoTOtaFirmwareApi } from '#/api/iot/ota/firmware';
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui'; import { Page, useVbenModal } from '@vben/common-ui';
import { IconifyIcon } from '@vben/icons'; import { IconifyIcon } from '@vben/icons';
import { useRouter } from 'vue-router';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
@ -40,6 +39,7 @@ function handleEdit(row: IoTOtaFirmwareApi.Firmware) {
formModalApi.setData({ type: 'update', id: row.id }).open(); formModalApi.setData({ type: 'update', id: row.id }).open();
} }
/** 删除固件 */ /** 删除固件 */
async function handleDelete(row: IoTOtaFirmwareApi.Firmware) { async function handleDelete(row: IoTOtaFirmwareApi.Firmware) {
const hideLoading = message.loading({ const hideLoading = message.loading({
@ -117,25 +117,19 @@ const [Grid, gridApi] = useVbenVxeGrid({
<!-- 固件文件列 --> <!-- 固件文件列 -->
<template #fileUrl="{ row }"> <template #fileUrl="{ row }">
<div <div v-if="row.fileUrl" class="inline-flex items-center gap-1.5 align-middle leading-none">
v-if="row.fileUrl" <IconifyIcon icon="ant-design:download-outlined" class="shrink-0 text-base align-middle text-primary" />
class="inline-flex items-center gap-1.5 align-middle leading-none" <a
> :href="row.fileUrl"
<IconifyIcon target="_blank"
icon="ant-design:download-outlined" download
class="text-primary shrink-0 align-middle text-base" class="text-primary cursor-pointer hover:underline align-middle"
/> >
<a 下载固件
:href="row.fileUrl" </a>
target="_blank" </div>
download <span v-else class="text-gray-400">无文件</span>
class="text-primary cursor-pointer align-middle hover:underline" </template>
>
下载固件
</a>
</div>
<span v-else class="text-gray-400">无文件</span>
</template>
<!-- 操作列 --> <!-- 操作列 -->
<template #actions="{ row }"> <template #actions="{ row }">

View File

@ -20,6 +20,8 @@ import {
} from 'ant-design-vue'; } from 'ant-design-vue';
import * as IoTOtaTaskApi from '#/api/iot/ota/task'; import * as IoTOtaTaskApi from '#/api/iot/ota/task';
import { DictTag } from '#/components/dict-tag';
import { DICT_TYPE } from '#/utils';
import { IoTOtaTaskStatusEnum } from '#/views/iot/utils/constants'; import { IoTOtaTaskStatusEnum } from '#/views/iot/utils/constants';
import OtaTaskDetail from './OtaTaskDetail.vue'; import OtaTaskDetail from './OtaTaskDetail.vue';
@ -220,11 +222,7 @@ onMounted(() => {
<!-- 任务状态 --> <!-- 任务状态 -->
<template v-else-if="column.key === 'status'"> <template v-else-if="column.key === 'status'">
<Tag v-if="record.status === 0" color="orange"></Tag> <DictTag :type="DICT_TYPE.IOT_OTA_TASK_STATUS" :value="record.status" />
<Tag v-else-if="record.status === 1" color="blue">执行中</Tag>
<Tag v-else-if="record.status === 2" color="green">已完成</Tag>
<Tag v-else-if="record.status === 3" color="red">已取消</Tag>
<Tag v-else>{{ record.status }}</Tag>
</template> </template>
<!-- 操作 --> <!-- 操作 -->

View File

@ -34,7 +34,7 @@ export function useFormSchema(): VbenFormSchema[] {
label: '父级分类', label: '父级分类',
component: 'ApiTreeSelect', component: 'ApiTreeSelect',
componentProps: { componentProps: {
api: getSimpleProductCategoryList, api: () => getSimpleProductCategoryList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择父级分类', placeholder: '请选择父级分类',

View File

@ -3,14 +3,12 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { h, ref } from 'vue'; import { h, ref } from 'vue';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { Button } from 'ant-design-vue'; import { Button } from 'ant-design-vue';
import { z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getSimpleProductCategoryList } from '#/api/iot/product/category'; import { getSimpleProductCategoryList } from '#/api/iot/product/category';
import { getProductPage } from '#/api/iot/product/product'; import { getProductPage } from '#/api/iot/product/product';
import { DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改产品的表单 */ /** 新增/修改产品的表单 */
export function useFormSchema(formApi?: any): VbenFormSchema[] { export function useFormSchema(formApi?: any): VbenFormSchema[] {
@ -93,7 +91,7 @@ export function useFormSchema(formApi?: any): VbenFormSchema[] {
label: '产品分类', label: '产品分类',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductCategoryList, api: () => getSimpleProductCategoryList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品分类', placeholder: '请选择产品分类',
@ -246,7 +244,7 @@ export function useBasicFormSchema(formApi?: any): VbenFormSchema[] {
label: '产品分类', label: '产品分类',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductCategoryList, api: () => getSimpleProductCategoryList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品分类', placeholder: '请选择产品分类',

View File

@ -1,11 +1,8 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { getSimpleProductList } from '#/api/iot/product/product'; import { getSimpleProductList } from '#/api/iot/product/product';
import { getRangePickerDefaultProps } from '#/utils'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
/** 列表的搜索表单 */ /** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {
@ -24,7 +21,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '产品', label: '产品',
component: 'ApiSelect', component: 'ApiSelect',
componentProps: { componentProps: {
api: getSimpleProductList, api: () => getSimpleProductList(),
labelField: 'name', labelField: 'name',
valueField: 'id', valueField: 'id',
placeholder: '请选择产品', placeholder: '请选择产品',
@ -45,10 +42,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -1,10 +1,7 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
import { getDictOptions } from '@vben/hooks';
import { getRangePickerDefaultProps } from '#/utils';
/** 列表的搜索表单 */ /** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {
@ -32,10 +29,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -1,10 +1,7 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
import { getDictOptions } from '@vben/hooks';
import { getRangePickerDefaultProps } from '#/utils';
/** 列表的搜索表单 */ /** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {
@ -42,10 +39,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -1,11 +1,10 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; import { CommonStatusEnum } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { z } from '#/adapter/form'; import { z } from '#/adapter/form';
import { getRangePickerDefaultProps } from '#/utils'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
@ -77,10 +76,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'createTime', fieldName: 'createTime',
label: '创建时间', label: '创建时间',
component: 'RangePicker', component: 'RangePicker',
componentProps: { componentProps: getRangePickerDefaultProps(),
...getRangePickerDefaultProps(),
allowClear: true,
},
}, },
]; ];
} }

View File

@ -234,9 +234,7 @@ async function handleSubmit() {
// //
if (!formRef.value) return; if (!formRef.value) return;
const valid = await formRef.value.validate(); const valid = await formRef.value.validate();
if (!valid) { if (!valid) return;
return;
}
// //
submitLoading.value = true; submitLoading.value = true;

View File

@ -1,8 +1,7 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants'; import { DICT_TYPE, getDictOptions } from '#/utils';
import { getDictOptions } from '@vben/hooks';
/** 列表的搜索表单 */ /** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {

View File

@ -7,13 +7,13 @@ import type { ThingModelData } from '#/api/iot/thingmodel';
import { inject, ref } from 'vue'; import { inject, ref } from 'vue';
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import { cloneDeep } from '@vben/utils';
import { Form, Input, message, Modal, Radio } from 'ant-design-vue'; import { Form, Input, message, Modal, Radio } from 'ant-design-vue';
import { DICT_TYPE, getDictOptions } from '#/utils';
import { import {
createThingModel, createThingModel,
getThingModel, getThingModel,