fix: iot && IconifyIcon

This commit is contained in:
xingyu4j
2025-10-13 10:41:08 +08:00
parent 4b69721a90
commit a4561b3dd8
22 changed files with 218 additions and 188 deletions

View File

@@ -1,9 +1,11 @@
<script setup lang="ts">
import type { VxeGridInstance } from '#/adapter/vxe-table';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ThingModelApi } from '#/api/iot/thingmodel';
import { Page } from '@vben/common-ui';
import { IconifyIcon } from '@vben/icons';
import { message } from 'ant-design-vue';
import { Button, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteThingModel, getThingModelPage } from '#/api/iot/thingmodel';
@@ -20,6 +22,8 @@ const props = defineProps<{
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions: {
columns: useGridColumns(),
height: 'auto',
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page, form }) => {
@@ -32,26 +36,30 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
},
},
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
search: true,
},
} as VxeTableGridOptions<ThingModelApi.ThingModel>,
formOptions: {
schema: useGridFormSchema(),
},
});
const xGrid = shallowRef<VxeGridInstance>();
const formRef = ref();
const tslRef = ref();
// 新增功能
const handleCreate = () => {
// TODO: 打开物模型表单
console.log('新增功能');
console.error('新增功能');
};
// 编辑功能
const handleEdit = (row: any) => {
// TODO: 打开物模型表单
console.log('编辑功能:', row);
console.error('编辑功能:', row);
};
// 删除功能
@@ -68,7 +76,7 @@ const handleDelete = async (row: any) => {
// 打开 TSL
const handleOpenTSL = () => {
// TODO: 打开 TSL 弹窗
console.log('打开 TSL');
console.error('打开 TSL');
};
// 获取数据类型标签
@@ -82,13 +90,13 @@ const getDataTypeLabel = (row: any) => {
description="管理产品的物模型定义,包括属性、服务和事件"
title="物模型管理"
>
<Grid ref="xGrid">
<Grid>
<template #toolbar-tools>
<VbenButton @click="handleCreate">
<Icon icon="ant-design:plus-outlined" class="mr-1" />
<Button @click="handleCreate">
<IconifyIcon icon="ant-design:plus-outlined" class="mr-1" />
添加功能
</VbenButton>
<VbenButton type="success" @click="handleOpenTSL"> TSL </VbenButton>
</Button>
<Button type="primary" @click="handleOpenTSL"> TSL </Button>
</template>
<!-- 数据类型列 -->
@@ -99,17 +107,15 @@ const getDataTypeLabel = (row: any) => {
<!-- 数据定义列 -->
<template #dataDefinition="{ row }">
<!-- TODO: 实现数据定义组件 -->
<span class="text-gray-400">-</span>
<span class="text-gray-400">{{ row }}</span>
</template>
<!-- 操作列 -->
<template #actions="{ row }">
<VbenButton size="small" type="primary" @click="handleEdit(row)">
<Button size="small" type="primary" @click="handleEdit(row)">
编辑
</VbenButton>
<VbenButton size="small" type="danger" @click="handleDelete(row)">
删除
</VbenButton>
</Button>
<Button size="small" danger @click="handleDelete(row)"> 删除 </Button>
</template>
</Grid>
</Page>