设备分组筛选和细节优化

This commit is contained in:
kerwincui
2022-06-15 15:27:24 +08:00
parent 146d84dcab
commit b87a1dc6f0
5 changed files with 50 additions and 12 deletions

View File

@@ -24,7 +24,7 @@
<div style="display:table;margin-bottom:10px;"> <div style="display:table;margin-bottom:10px;">
<div style="width:70px;font-weight: bold;display:table-cell;">官方网站</div> <div style="width:70px;font-weight: bold;display:table-cell;">官方网站</div>
<div style="display:table-cell;"> <div style="display:table-cell;">
<span>www.wumei.live</span> <el-link target="_blank" href="https://wumei.live/">www.wumei.live</el-link>
</div> </div>
</div> </div>
<div style="display:table;margin-bottom:10px;"> <div style="display:table;margin-bottom:10px;">
@@ -557,7 +557,7 @@ export default {
}; };
option = { option = {
title: { title: {
text: '设备分布和状态(数量 ' + this.deviceCount + '', text: '设备分布和状态',
subtext: 'wumei-smart open source living iot platform', subtext: 'wumei-smart open source living iot platform',
sublink: 'https://iot.wumei.live', sublink: 'https://iot.wumei.live',
target: "_blank", target: "_blank",

View File

@@ -3,19 +3,24 @@
<el-card style="margin-bottom:6px;"> <el-card style="margin-bottom:6px;">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="75px" style="margin-bottom:-20px;"> <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="75px" style="margin-bottom:-20px;">
<el-form-item label="设备名称" prop="deviceName"> <el-form-item label="设备名称" prop="deviceName">
<el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable size="small" @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable size="small" @keyup.enter.native="handleQuery" style="width:150px;" />
</el-form-item> </el-form-item>
<el-form-item label="产品名称" prop="productName"> <el-form-item label="产品名称" prop="productName">
<el-input v-model="queryParams.productName" placeholder="请输入产品名称" clearable size="small" @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.productName" placeholder="请输入产品名称" clearable size="small" @keyup.enter.native="handleQuery" style="width:150px;" />
</el-form-item> </el-form-item>
<el-form-item label="设备状态" prop="status"> <el-form-item label="设备状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择设备状态" clearable size="small"> <el-select v-model="queryParams.status" placeholder="请选择设备状态" clearable size="small" style="width:150px;">
<el-option v-for="dict in dict.type.iot_device_status" :key="dict.value" :label="dict.label" :value="dict.value" /> <el-option v-for="dict in dict.type.iot_device_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="激活时间"> <el-form-item label="我的分组">
<el-date-picker v-model="daterangeActiveTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> <el-select v-model="queryParams.groupId" placeholder="请选择我的分组" clearable size="small" style="width:150px;">
<el-option v-for="group in myGroupList" :key="group.groupId" :label="group.groupName" :value="group.groupId" />
</el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item label="激活时间">
<el-date-picker v-model="daterangeActiveTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item> -->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -144,7 +149,7 @@
</el-row> </el-row>
<el-empty description="暂无数据,请添加设备" v-if="total==0"></el-empty> <el-empty description="暂无数据,请添加设备" v-if="total==0"></el-empty>
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" :pageSizes="[12, 24, 36, 60]" @pagination="getList" />
<!-- 查看监测数据 --> <!-- 查看监测数据 -->
<el-dialog title="实时监测" :visible.sync="open" width="800px"> <el-dialog title="实时监测" :visible.sync="open" width="800px">
@@ -195,6 +200,9 @@ import {
import { import {
cacheJsonThingsModel cacheJsonThingsModel
} from "@/api/iot/model"; } from "@/api/iot/model";
import {
listGroup
} from "@/api/iot/group";
export default { export default {
name: "Device", name: "Device",
@@ -230,6 +238,8 @@ export default {
total: 0, total: 0,
// 设备列表数据 // 设备列表数据
deviceList: [], deviceList: [],
// 我的分组列表数据
myGroupList:[],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
@@ -272,7 +282,7 @@ export default {
this.queryParams.productId = null; this.queryParams.productId = null;
} }
this.getList(); this.getList();
this.getGroupList();
}, },
activated() { activated() {
const time = this.$route.query.t; const time = this.$route.query.t;
@@ -296,6 +306,18 @@ export default {
} }
}, },
methods: { methods: {
/** 查询设备分组列表 */
getGroupList() {
this.loading = true;
let queryParams ={
pageSize:30,
pageNum:1,
userId:this.$store.state.user.userId
}
listGroup(queryParams).then(response => {
this.myGroupList = response.rows;
});
},
/** 发布物模型 类型(1=属性2=功能) */ /** 发布物模型 类型(1=属性2=功能) */
publishThingsModel(device, model) { publishThingsModel(device, model) {
// 获取缓存的Json物模型 // 获取缓存的Json物模型

View File

@@ -5,6 +5,9 @@
<el-form-item label="分组名称" prop="groupName"> <el-form-item label="分组名称" prop="groupName">
<el-input v-model="queryParams.groupName" placeholder="请输入分组名称" clearable size="small" @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.groupName" placeholder="请输入分组名称" clearable size="small" @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="我的分组" v-if="isAdmin" style="margin:0 20px;">
<el-switch v-model="myGroup" @change="myGroupChange"></el-switch>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -85,6 +88,10 @@ export default {
}, },
data() { data() {
return { return {
// 是否管理员
isAdmin:false,
// 我的分组
myGroup:false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
@@ -110,7 +117,7 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
groupName: null, groupName: null,
userName: null, userId: null,
}, },
// 设备分组 // 设备分组
group: {}, group: {},
@@ -134,8 +141,18 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.init();
}, },
methods: { methods: {
init() {
if (this.$store.state.user.roles.indexOf("tenant") === -1 && this.$store.state.user.roles.indexOf("general") === -1) {
this.isAdmin = true
}
},
// 我的分组改变事件
myGroupChange(){
this.queryParams.userId=this.myGroup?this.$store.state.user.userId:null;
},
/** 查看设备按钮操作 */ /** 查看设备按钮操作 */
handleViewDevice(groupId) { handleViewDevice(groupId) {
this.$router.push({ this.$router.push({

View File

@@ -78,7 +78,7 @@
</el-row> </el-row>
<el-empty description="暂无数据,请添加产品" v-if="total==0"></el-empty> <el-empty description="暂无数据,请添加产品" v-if="total==0"></el-empty>
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" :pageSizes="[12, 24, 36, 60]" @pagination="getList" />
<!-- 下载SDK --> <!-- 下载SDK -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>

View File

@@ -47,7 +47,6 @@
<dict-tag :options="dict.type.iot_auth_status" :value="scope.row.status" /> <dict-tag :options="dict.type.iot_auth_status" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="设备ID" width="75" align="center" prop="deviceId" />
<el-table-column label="设备编号" width="150" align="center" prop="serialNumber" /> <el-table-column label="设备编号" width="150" align="center" prop="serialNumber" />
<el-table-column label="授权时间" align="center" prop="updateTime" width="180"> <el-table-column label="授权时间" align="center" prop="updateTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">