feat(iot): 设备列表增加所属产品筛选功能

- 在设备列表页面和设备卡片页面添加所属产品筛选条件
- 更新设备列表数据结构,增加所属产品字段- 修改设备卡片组件,显示所属产品信息
This commit is contained in:
Kven 2025-02-21 21:48:34 +08:00
parent b3e4a11a7b
commit 67e58660ff
3 changed files with 46 additions and 43 deletions

View File

@ -30,6 +30,16 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="9"> <a-col :span="9">
<a-form-item field="status" label="所属产品">
<a-select
v-model="formModel.productName"
style="width: 360px"
placeholder="请选择所属产品"
:options="productOptions"
/>
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item field="isOnline" label="在线"> <a-form-item field="isOnline" label="在线">
<a-select <a-select
v-model="formModel.isOnline" v-model="formModel.isOnline"
@ -222,6 +232,7 @@
name: '', name: '',
status: '', status: '',
isOnline: '', isOnline: '',
productName: '',
}; };
}; };
@ -252,6 +263,10 @@
title: '名称', title: '名称',
dataIndex: 'name', dataIndex: 'name',
}, },
{
title: '所属产品',
dataIndex: 'productName',
},
{ {
title: '状态', title: '状态',
dataIndex: 'state', dataIndex: 'state',
@ -281,6 +296,14 @@
value: 'false', value: 'false',
}, },
]); ]);
const productOptions = computed(() => {
return [
{
label: '全部',
value: '',
},
];
});
// //
const fetchData = async (params = { size: 10, current: 1 }) => { const fetchData = async (params = { size: 10, current: 1 }) => {

View File

@ -14,8 +14,8 @@
</template> </template>
<template #description> <template #description>
<a-descriptions :column="1"> <a-descriptions :column="1">
<a-descriptions-item label="创建人"> <a-descriptions-item label="所属产品">
{{ createBy }} {{ productName }}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="创建时间"> <a-descriptions-item label="创建时间">
{{ dayjs(createTime).format('YYYY-MM-DD HH:mm:ss') }} {{ dayjs(createTime).format('YYYY-MM-DD HH:mm:ss') }}
@ -68,7 +68,7 @@
type: Number, type: Number,
default: -1, default: -1,
}, },
createBy: { productName: {
type: String, type: String,
default: '', default: '',
}, },

View File

@ -30,6 +30,16 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="9"> <a-col :span="9">
<a-form-item field="status" label="所属产品">
<a-select
v-model="formModel.productName"
style="width: 360px"
placeholder="请选择所属产品"
:options="productOptions"
/>
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item field="isOnline" label="在线"> <a-form-item field="isOnline" label="在线">
<a-select <a-select
v-model="formModel.isOnline" v-model="formModel.isOnline"
@ -78,7 +88,7 @@
:loading="loading" :loading="loading"
:id="item.id" :id="item.id"
:title="item.name" :title="item.name"
:createBy="item.createBy" :productName="item.productName"
:createTime="item.createTime" :createTime="item.createTime"
open-txt="详情" open-txt="详情"
> >
@ -94,25 +104,6 @@
</CardWrap> </CardWrap>
</a-col> </a-col>
<DeviceEdit ref="createUserRef" :is-create="true" /> <DeviceEdit ref="createUserRef" :is-create="true" />
<!-- <a-col-->
<!-- :xs="12"-->
<!-- :sm="12"-->
<!-- :md="12"-->
<!-- :lg="6"-->
<!-- :xl="6"-->
<!-- :xxl="6"-->
<!-- class="list-col"-->
<!-- >-->
<!-- <div class="card-wrap empty-wrap">-->
<!-- <a-card :bordered="false" hoverable>-->
<!-- <a-result :status="null" title="点击创建设备">-->
<!-- <template #icon>-->
<!-- <icon-plus style="font-size: 20px" />-->
<!-- </template>-->
<!-- </a-result>-->
<!-- </a-card>-->
<!-- </div>-->
<!-- </a-col>-->
</a-row> </a-row>
</div> </div>
<a-pagination <a-pagination
@ -166,6 +157,15 @@
value: 'false', value: 'false',
}, },
]); ]);
const productOptions = computed(() => {
return [
{
label: '全部',
value: '',
},
];
});
// //
const fetchData = async (params = { size: 10, current: 1 }) => { const fetchData = async (params = { size: 10, current: 1 }) => {
@ -207,26 +207,6 @@
formModel.value = generateFormModel(); formModel.value = generateFormModel();
}; };
// //
// function openDetail(id:number): void{
// const url = router.resolve({
// name: 'deviceDetail',
// params: {id}
// }).href;
// router.push(url);
// }
// //
// const handleDelete = async (id: number) => {
// const res = await deleteDevice(id);
// if (res.status === 200) {
// Message.success({
// content: '',
// duration: 5 * 1000,
// });
// search();
// }
// };
onMounted(() => { onMounted(() => {
search(); search();
}); });