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-col>
<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-select
v-model="formModel.isOnline"
@ -222,6 +232,7 @@
name: '',
status: '',
isOnline: '',
productName: '',
};
};
@ -252,6 +263,10 @@
title: '名称',
dataIndex: 'name',
},
{
title: '所属产品',
dataIndex: 'productName',
},
{
title: '状态',
dataIndex: 'state',
@ -281,6 +296,14 @@
value: 'false',
},
]);
const productOptions = computed(() => {
return [
{
label: '全部',
value: '',
},
];
});
//
const fetchData = async (params = { size: 10, current: 1 }) => {

View File

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

View File

@ -30,6 +30,16 @@
</a-form-item>
</a-col>
<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-select
v-model="formModel.isOnline"
@ -78,7 +88,7 @@
:loading="loading"
:id="item.id"
:title="item.name"
:createBy="item.createBy"
:productName="item.productName"
:createTime="item.createTime"
open-txt="详情"
>
@ -94,25 +104,6 @@
</CardWrap>
</a-col>
<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>
</div>
<a-pagination
@ -166,6 +157,15 @@
value: 'false',
},
]);
const productOptions = computed(() => {
return [
{
label: '全部',
value: '',
},
];
});
//
const fetchData = async (params = { size: 10, current: 1 }) => {
@ -207,26 +207,6 @@
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(() => {
search();
});