修改为响应式布局

This commit is contained in:
kerwincui
2022-04-16 16:42:56 +08:00
parent 63c3f0b6a2
commit a0a3987209
7 changed files with 75 additions and 79 deletions

View File

@@ -1,13 +1,13 @@
<template> <template>
<div class="app-container home"> <div class="app-container home">
<el-row :gutter="40"> <el-row :gutter="40" style="margin-bottom:80px;">
<el-col :span="14"> <el-col :xs="24" :sm="24" :md="24" :lg="14" :xl="14">
<el-card style="margin:-10px;" shadow="hover" body-style="background-color:#F8F8F8;"> <el-card style="margin:-10px;" shadow="hover" body-style="background-color:#F8F8F8;">
<div ref="map" style="height:650px;margin:-10px;margin-top:-5px;"></div> <div ref="map" style="height:650px;margin:-10px;margin-top:-5px;"></div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="10"> <el-col :xs="24" :sm="24" :md="24" :lg="10" :xl="10">
<el-card style="margin:-10px;" shadow="hover"> <el-card style="margin:-10px;" shadow="hover">
<h3 style="font-weight:bold">Mqtt 统计指标</h3> <h3 style="font-weight:bold">Mqtt 统计指标</h3>
<el-row :gutter="40" class="panel-group"> <el-row :gutter="40" class="panel-group">
@@ -98,14 +98,10 @@
</el-row> </el-row>
<div v-if="isAdmin"> <div v-if="isAdmin">
<el-row :gutter="40" style="margin-top:80px;"> <h2><i class="el-icon-s-data"> 服务器状态</i></h2>
<el-col :span="1"> <el-row :gutter="40">
<el-card style="margin:-10px;height:218px;margin-right:-31px;padding-top:35px;text-align:center;font-weight:bold;" shadow="none"> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="6">
<br /><br /><br /><br /> <el-card style="margin:-10px;height:218px;margin-bottom:30px;" shadow="hover">
</el-card>
</el-col>
<el-col :span="5">
<el-card style="margin:-10px;height:218px;" shadow="hover">
<el-descriptions :column="1"> <el-descriptions :column="1">
<el-descriptions-item label="服务器名称"><strong>{{server.sys.computerName}}</strong></el-descriptions-item> <el-descriptions-item label="服务器名称"><strong>{{server.sys.computerName}}</strong></el-descriptions-item>
<el-descriptions-item label="服务器IP"><strong>{{server.sys.computerIp}}</strong></el-descriptions-item> <el-descriptions-item label="服务器IP"><strong>{{server.sys.computerIp}}</strong></el-descriptions-item>
@@ -116,23 +112,23 @@
</el-descriptions> </el-descriptions>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="4"> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="4">
<el-card style="margin:-10px;" shadow="hover"> <el-card style="margin:-10px;height:218px;margin-bottom:30px;" shadow="hover">
<div ref="pieCpu" style="height:200px;margin-bottom:-20px;"></div> <div ref="pieCpu" style="height:200px;margin-bottom:-20px;"></div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="4"> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="4">
<el-card style="margin:-10px;" shadow="hover"> <el-card style="margin:-10px;height:218px;margin-bottom:30px;" shadow="hover">
<div ref="pieMemery" style="height:200px;margin-bottom:-20px;"></div> <div ref="pieMemery" style="height:200px;margin-bottom:-20px;"></div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="4"> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="4">
<el-card style="margin:-10px;" shadow="hover"> <el-card style="margin:-10px;height:218px;margin-bottom:30px;" shadow="hover">
<div ref="pieDisk" style="height:200px;margin-bottom:-20px;"></div> <div ref="pieDisk" style="height:200px;margin-bottom:-20px;"></div>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="6"> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="6">
<el-card style="margin:-10px;height:218px;" shadow="hover"> <el-card style="margin:-10px;height:218px;margin-bottom:30px;" shadow="hover">
<el-descriptions :column="1"> <el-descriptions :column="1">
<el-descriptions-item label="Java名称"><strong>{{server.jvm.name}}</strong></el-descriptions-item> <el-descriptions-item label="Java名称"><strong>{{server.jvm.name}}</strong></el-descriptions-item>
<el-descriptions-item label="启动时间"><strong>{{ server.jvm.startTime }}</strong></el-descriptions-item> <el-descriptions-item label="启动时间"><strong>{{ server.jvm.startTime }}</strong></el-descriptions-item>
@@ -186,14 +182,14 @@ export default {
data() { data() {
return { return {
// 控制是否显示服务器状态栏 // 控制是否显示服务器状态栏
isAdmin:true, isAdmin: true,
queryParams:{ queryParams: {
userName: '' userName: ''
}, },
// 设备列表 // 设备列表
deviceList: [], deviceList: [],
// 设备总数 // 设备总数
deviceCount:0, deviceCount: 0,
// emqx状态数据 // emqx状态数据
stats: {}, stats: {},
// emqx统计信息 // emqx统计信息
@@ -233,10 +229,10 @@ export default {
this.statisticMqtt(); this.statisticMqtt();
}, },
methods: { methods: {
init(){ init() {
// 设置用户的角色 用以区分自己创建的设备 // 设置用户的角色 用以区分自己创建的设备
// 由于admin可以看所有数据所以判断 // 由于admin可以看所有数据所以判断
if (this.$store.state.user.roles.indexOf("admin") === -1){ if (this.$store.state.user.roles.indexOf("admin") === -1) {
this.isAdmin = false this.isAdmin = false
this.queryParams.userName = this.$store.state.user.name this.queryParams.userName = this.$store.state.user.name
} }
@@ -245,7 +241,7 @@ export default {
getAllDevice() { getAllDevice() {
listAllDeviceShort2(this.queryParams).then(response => { listAllDeviceShort2(this.queryParams).then(response => {
this.deviceList = response.rows; this.deviceList = response.rows;
this.deviceCount=response.total; this.deviceCount = response.total;
this.$nextTick(() => { this.$nextTick(() => {
loadBMap().then(() => { loadBMap().then(() => {
this.getmap(); this.getmap();
@@ -306,7 +302,7 @@ export default {
}; };
option = { option = {
title: { title: {
text: '设备分布和状态(数量 '+this.deviceCount+'', text: '设备分布和状态(数量 ' + this.deviceCount + '',
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

@@ -5,7 +5,7 @@
<span slot="label"> * 基本信息</span> <span slot="label"> * 基本信息</span>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="100"> <el-row :gutter="100">
<el-col :span="7"> <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<el-form-item label="设备名称" prop="deviceName"> <el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" /> <el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item> </el-form-item>
@@ -39,10 +39,10 @@
</el-switch> </el-switch>
</el-form-item> </el-form-item>
<el-form-item label="备注信息" prop="remark"> <el-form-item label="备注信息" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" rows="4" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" rows="3" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<!-- <!--
<el-form-item label="设备图片" prop="imageUrl"> <el-form-item label="设备图片" prop="imageUrl">
<el-image style="height:225px;border:1px solid #dee4ed;border-radius:5px;padding:5px;" :src="imageUrl" :preview-src-list="[imageUrl]" fit="cover"></el-image> <el-image style="height:225px;border:1px solid #dee4ed;border-radius:5px;padding:5px;" :src="imageUrl" :preview-src-list="[imageUrl]" fit="cover"></el-image>
@@ -80,7 +80,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="8">
<div style="border:1px solid #dfe4ed;border-radius:5px;padding:5px;text-align:center;line-height:400px;"> <div style="border:1px solid #dfe4ed;border-radius:5px;padding:5px;text-align:center;line-height:400px;">
<div id="map" style="height:435px;width:100%;">地图展示区域新增后显示</div> <div id="map" style="height:435px;width:100%;">地图展示区域新增后显示</div>
</div> </div>

View File

@@ -28,7 +28,7 @@
<el-card style="padding-bottom:100px;"> <el-card style="padding-bottom:100px;">
<el-row :gutter="30" v-loading="loading"> <el-row :gutter="30" v-loading="loading">
<el-col :span="6" v-for="(item,index) in deviceList" :key="index" style="margin-bottom:30px;text-align:center;"> <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="6" v-for="(item,index) in deviceList" :key="index" style="margin-bottom:30px;text-align:center;">
<el-card :body-style="{ padding: '20px'}" shadow="always"> <el-card :body-style="{ padding: '20px'}" shadow="always">
<el-row type="flex" :gutter="10" justify="space-between"> <el-row type="flex" :gutter="10" justify="space-between">
<el-col :span="20" style="text-align:left;"> <el-col :span="20" style="text-align:left;">

View File

@@ -53,8 +53,8 @@ export default {
connectTimeout: 60000 connectTimeout: 60000
} }
// 配置Mqtt地址 // 配置Mqtt地址
// let url = "wss://iot.wumei.live/mqtt" let url = "wss://iot.wumei.live/mqtt"
let url = "ws://" + window.location.hostname + ":8083/mqtt"; // let url = "ws://" + window.location.hostname + ":8083/mqtt";
console.log("mqtt地址", url); console.log("mqtt地址", url);
this.client = mqtt.connect(url, options); this.client = mqtt.connect(url, options);
this.client.on("connect", (e) => { this.client.on("connect", (e) => {

View File

@@ -1,7 +1,7 @@
<template> <template>
<div style="padding-left:20px;"> <div style="padding-left:20px;">
<el-row :gutter="80"> <el-row :gutter="80">
<el-col :span="9"> <el-col :xs="24" :sm="24" :md="24" :lg="10" :xl="10">
<el-descriptions :column="1" border :title="title"> <el-descriptions :column="1" border :title="title">
<!-- 设备升级--> <!-- 设备升级-->
<el-descriptions-item :labelStyle="statusColor"> <el-descriptions-item :labelStyle="statusColor">
@@ -155,9 +155,9 @@
<mqtt-client ref="mqttClient" :publish="publish" :subscribes="subscribes" @callbackEvent="mqttCallback($event)" /> <mqtt-client ref="mqttClient" :publish="publish" :subscribes="subscribes" @callbackEvent="mqttCallback($event)" />
</el-col> </el-col>
<el-col :span="14" :offset="1"> <el-col :xs="24" :sm="24" :md="24" :lg="14" :xl="14">
<el-row :gutter="20" style="background-color:#F5F7FA;padding:20px;padding-left:10px;"> <el-row :gutter="20" style="background-color:#F5F7FA;padding:20px;padding-left:10px;">
<el-col :span="8" v-for="(item,index) in deviceInfo.readOnlyList" :key="index" style="margin-bottom:20px;"> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="8" v-for="(item,index) in deviceInfo.readOnlyList" :key="index" style="margin-bottom:20px;">
<el-card shadow="hover" style="border-radius:30px;"> <el-card shadow="hover" style="border-radius:30px;">
<div ref="map" style="height:230px;width:180px;margin:0 auto;margin-top:-10px;"></div> <div ref="map" style="height:230px;width:180px;margin:0 auto;margin-top:-10px;"></div>
</el-card> </el-card>

View File

@@ -24,7 +24,7 @@
</el-card> </el-card>
<el-card style="padding-bottom:100px;"> <el-card style="padding-bottom:100px;">
<el-row :gutter="30" v-loading="loading" > <el-row :gutter="30" v-loading="loading" >
<el-col :span="6" v-for="(item,index) in productList" :key="index" style="margin-bottom:30px;text-align:center;"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="6" v-for="(item,index) in productList" :key="index" style="margin-bottom:30px;text-align:center;">
<el-card :body-style="{ padding: '20px'}" shadow="always"> <el-card :body-style="{ padding: '20px'}" shadow="always">
<el-row type="flex" :gutter="10" justify="space-between"> <el-row type="flex" :gutter="10" justify="space-between">
<el-col :span="20" style="text-align:left;"> <el-col :span="20" style="text-align:left;">

View File

@@ -5,7 +5,7 @@
<span slot="label"> * 基本信息</span> <span slot="label"> * 基本信息</span>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="100"> <el-row :gutter="100">
<el-col :span="7"> <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<el-form-item label="产品名称" prop="productName"> <el-form-item label="产品名称" prop="productName">
<el-input v-model="form.productName" placeholder="请输入产品名称" /> <el-input v-model="form.productName" placeholder="请输入产品名称" />
</el-form-item> </el-form-item>
@@ -23,10 +23,10 @@
<el-switch v-model="form.isAuthorize" @change="changeIsAuthorize(form.isAuthorize)" :active-value="1" :inactive-value="0" /> <el-switch v-model="form.isAuthorize" @change="changeIsAuthorize(form.isAuthorize)" :active-value="1" :inactive-value="0" />
</el-form-item> </el-form-item>
<el-form-item label="备注信息" prop="remark"> <el-form-item label="备注信息" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" rows="7" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" rows="3" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<el-form-item label="设备类型" prop="deviceType"> <el-form-item label="设备类型" prop="deviceType">
<el-select v-model="form.deviceType" placeholder="请选择设备类型" disabled style="width:100%"> <el-select v-model="form.deviceType" placeholder="请选择设备类型" disabled style="width:100%">
<el-option v-for="dict in dict.type.iot_device_type" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option> <el-option v-for="dict in dict.type.iot_device_type" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
@@ -56,7 +56,7 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<el-form-item label="产品图片"> <el-form-item label="产品图片">
<imageUpload ref="image-upload" :value="form.imgUrl" :limit="1" :fileSize="1" @input="getImagePath($event)"></imageUpload> <imageUpload ref="image-upload" :value="form.imgUrl" :limit="1" :fileSize="1" @input="getImagePath($event)"></imageUpload>
</el-form-item> </el-form-item>