设备接口调试

master
zhaowei 3 years ago
parent ec2636e62e
commit b7a38912de

@ -0,0 +1,9 @@
import request from '@/utils/request'
// 查询设备数据
export function listDevice(query) {
return request({
url: '/system/device/list',
method: 'get',
params: query
})
}

@ -7,17 +7,16 @@
<el-button size="mini" type="primary" icon="el-icon-plus" @click="editDevice"></el-button> <el-button size="mini" type="primary" icon="el-icon-plus" @click="editDevice"></el-button>
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteDevice"></el-button> <el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteDevice"></el-button>
</div> </div>
<div id="deviceBox"> <div id="deviceBox">
<div class="deviceMsg" v-for="i in 150" :key="i"> <div class="deviceMsg" v-for="(item, index) in deviceData" :key="index">
<el-popover placement="right" width="250" trigger="click"> <el-popover placement="right" width="270" trigger="click">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<div class="iconBox"> <div class="iconBox">
<img src="../../../assets/images/位置.png" class="iconImg" alt /> <img src="../../../assets/images/位置.png" class="iconImg" alt />
</div> </div>
<span class="span1 span2">位置</span> <span class="span1 span2">位置</span>
<span class="span1 span3">001</span> <span class="span1 span3">{{item.location}}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -26,7 +25,7 @@
<img src="../../../assets/images/网络.png" class="iconImg" alt /> <img src="../../../assets/images/网络.png" class="iconImg" alt />
</div> </div>
<span class="span1 span4">IP地址</span> <span class="span1 span4">IP地址</span>
<span class="span1 span5">192.168.88.88</span> <span class="span1 span5">{{item.deviceIp}}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -35,7 +34,7 @@
<img src="../../../assets/images/音符.png" class="iconImg" alt /> <img src="../../../assets/images/音符.png" class="iconImg" alt />
</div> </div>
<span class="span1 span2">音符</span> <span class="span1 span2">音符</span>
<span class="span1 span3">1</span> <span class="span1 span3">{{item.note}}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -44,7 +43,7 @@
<img src="../../../assets/images/音量.png" class="iconImg" alt /> <img src="../../../assets/images/音量.png" class="iconImg" alt />
</div> </div>
<span class="span1 span2">音量</span> <span class="span1 span2">音量</span>
<span class="span1 span3">50%</span> <span class="span1 span3">{{item.volume}}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -53,7 +52,11 @@
<img src="../../../assets/images/设置.png" class="iconImg" alt /> <img src="../../../assets/images/设置.png" class="iconImg" alt />
</div> </div>
<span class="span1">设备状态</span> <span class="span1">设备状态</span>
<span class="span1">正常</span> <span class="span1">{{item.status==0?'正常':'异常'}}</span>
<!-- <template slot-scope="scope">
<span class="span1" v-if="scope.row.stasus == '1'"></span>
<span class="span1" v-else-if="scope.row.status == '0'">正常</span>
</template>-->
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -62,7 +65,7 @@
<img src="../../../assets/images/时间.png" class="iconImg" alt /> <img src="../../../assets/images/时间.png" class="iconImg" alt />
</div> </div>
<span class="span1">创建时间</span> <span class="span1">创建时间</span>
<span class="span1">2022.02.22</span> <span class="span1">{{item.createTime}}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -71,37 +74,121 @@
<img src="../../../assets/images/创建人.png" class="iconImg" alt /> <img src="../../../assets/images/创建人.png" class="iconImg" alt />
</div> </div>
<span class="span1 span6">创建人</span> <span class="span1 span6">创建人</span>
<span class="span1 span7">张大大</span> <span class="span1 span7">{{item.createBy}}</span>
</el-col> </el-col>
</el-row> </el-row>
<div class="shadows" slot="reference"></div> <div :class="item.status==0?'shadows':'active'" slot="reference"></div>
</el-popover> </el-popover>
<div class="deleteIcon" @click="removeItem(index,deviceData)">
<div class="deleteIcon">
<img src="../../../assets/images/删除.png" class="deleteImg" alt /> <img src="../../../assets/images/删除.png" class="deleteImg" alt />
</div> </div>
<span class="deviceStatus">正常</span> <span class="deviceStatus">{{item.status==0?'正常':'异常'}}</span>
<span class="deviceNumber">{{i}}</span> <span class="deviceNumber">{{item.deviceId}}</span>
<img src="../../../assets/images/喇叭.png" class="deviceImg" alt /> <img src="../../../assets/images/喇叭.png" class="deviceImg" alt />
</div> </div>
</div> </div>
<!-- 新增设备对话框-->
<el-dialog title :visible.sync="addDevice" width="20%" style="top:20vh" center>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="位置" prop="location">
<el-input placeholder="请输入位置" v-model="form.location"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="IP地址" prop="address">
<el-input placeholder="请输入IP地址" v-model="form.address"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="音符" prop="note">
<el-input placeholder="请输入音符" v-model="form.note"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="音量" prop="volume">
<el-input placeholder="请输入音量" v-model="form.volume"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="addDevice = false"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</span>
</el-dialog>
<div class="panel-footer"></div> <div class="panel-footer"></div>
</div> </div>
</template> </template>
<script> <script>
import flexible from "@/layout/flexible.js"; import flexible from "@/layout/flexible.js";
import { listDevice } from "@/api/Device";
export default { export default {
data() { data() {
return {}; return {
//
queryParams: {
pageNum: 1
},
address: null,
note: null,
volume: null,
location: null,
addDevice: false,
form: {},
forms: {},
rules: {},
deviceData: []
};
},
created() {
this.getList();
}, },
methods: { methods: {
//
getList() {
this.loading = true;
listDevice(this.queryParams).then(result => {
this.deviceData = result.rows;
this.loading = false;
});
},
// //
editDevice() {}, editDevice() {
this.addDevice = true;
},
//
submitForm() {
this.addDevice = false;
},
// //
deleteDevice() {} deleteDevice() {},
//
removeItem(index, deviceData) {
this.$modal
.confirm("确认要删除吗")
.then(function() {
deviceData.splice(index, 1);
})
.then(() => {
this.$modal.msgSuccess("删除成功");
})
.catch(() => {
});
}
} }
}; };
</script> </script>
@ -181,6 +268,7 @@ export default {
border-radius: 0; border-radius: 0;
background: none; background: none;
} }
/* 设备正常时的遮罩层 */
.shadows { .shadows {
position: absolute; position: absolute;
top: 0px; top: 0px;
@ -188,9 +276,20 @@ export default {
width: 79px; width: 79px;
height: 90px; height: 90px;
cursor: pointer; cursor: pointer;
/* background:grey; /* background:red;
opacity: 0.4; */ opacity: 0.4; */
} }
/* 设备异常时的遮罩层 */
.active {
position: absolute;
top: 0px;
left: 0px;
width: 79px;
height: 90px;
cursor: pointer;
background: red;
opacity: 0.4;
}
.deviceStatus { .deviceStatus {
color: white; color: white;
font-size: 12px; font-size: 12px;
@ -215,6 +314,7 @@ export default {
} }
.deleteIcon { .deleteIcon {
width: 8px; width: 8px;
height: 5px;
position: absolute; position: absolute;
top: 2px; top: 2px;
right: 5px; right: 5px;

@ -2,12 +2,7 @@
<div class="panel bar1"> <div class="panel bar1">
<div class="titleBg"> <div class="titleBg">
<h2> <h2>
<el-form <el-form :inline="true" :model="queryParams" ref="queryForm" label-width="1.7rem">
:inline="true"
:model="queryParams"
ref="queryForm"
label-width="1.7rem"
>
<el-form-item label prop="musicManage"> <el-form-item label prop="musicManage">
<el-select <el-select
class="selectNav" class="selectNav"
@ -57,13 +52,52 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<!-- 编辑音乐管理对话框 -->
<el-dialog title :visible.sync="musicHandle" width="20%" style="top:20vh" center>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="位置" prop="location">
<el-input placeholder="请输入位置" v-model="form.location" class="el-input1"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="IP地址" prop="address">
<el-input placeholder="请输入IP地址" v-model="form.address" class="el-input1"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="音符" prop="note">
<el-input placeholder="请输入音符" v-model="form.note" class="el-input1"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="音量" prop="volume">
<el-input placeholder="请输入音量" v-model="form.volume" class="el-input1"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="musicHandle = false"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</span>
</el-dialog>
<!-- 用户管理 --> <!-- 用户管理 -->
<div class="userManagement" v-show="userShow"> <div class="userManagement" v-show="userShow">
<user />
</div> </div>
<div class="panel-footer"></div> <div class="panel-footer"></div>
<!-- <pagination <!-- <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -75,9 +109,14 @@
</template> </template>
<script> <script>
import User from "@/layout/components/User";
import flexible from "@/layout/flexible.js"; import flexible from "@/layout/flexible.js";
export default { export default {
components: {
User
},
data() { data() {
return { return {
musicManagementList: [ musicManagementList: [
@ -111,12 +150,10 @@ export default {
], ],
musicManageArr: [ musicManageArr: [
{ {
value: 1, value: 1,
label: "音乐管理" label: "音乐管理"
}, },
{ {
value: 2, value: 2,
label: "用户管理" label: "用户管理"
} }
@ -125,25 +162,29 @@ export default {
musicShow: true, musicShow: true,
// //
userShow: false, userShow: false,
//
musicHandle: false,
form:{},
rules:{},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 7, pageSize: 7,
musicManage: undefined, musicManage: undefined
} }
}; };
}, },
created() {},
methods: { methods: {
// //
pageShow(e) { pageShow(e) {
console.log(e,8888888888888) console.log(e, 8888888888888);
if (e == 2) { if (e == 2) {
this.musicShow = false; this.musicShow = false;
this.userShow = true; this.userShow = true;
} } else {
else{
this.musicShow = true; this.musicShow = true;
this.userShow = false; this.userShow = false;
} }
@ -153,7 +194,9 @@ export default {
this.open = false; this.open = false;
}, },
// //
submitForm() {}, submitForm() {
this.musicHandle=false;
},
// //
deleteMusic(index, musicManagementList) { deleteMusic(index, musicManagementList) {
@ -161,11 +204,16 @@ export default {
.confirm("确认要删除吗") .confirm("确认要删除吗")
.then(function() { .then(function() {
musicManagementList.splice(index, 1); musicManagementList.splice(index, 1);
}) })
.then(() => { .then(() => {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}) })
.catch(() => {}); .catch(() => {});
},
//
edit() {
this.musicHandle = true;
} }
} }
}; };
@ -174,10 +222,17 @@ export default {
.userManagement { .userManagement {
margin: 0.125rem 0 0.125rem; margin: 0.125rem 0 0.125rem;
border: 1px solid rgba(25, 186, 139, 0.17); border: 1px solid rgba(25, 186, 139, 0.17);
height: 3rem;
} }
::v-deep .el-input { ::v-deep .el-input {
margin-left: 6px !important; margin-left: 6px !important;
line-height: 0px!important;
}
::v-deep .el-form-item__label{
color:white!important;
}
::v-deep .el-input1 {
background: cornflowerblue!important;
} }
::v-deep .el-input__suffix { ::v-deep .el-input__suffix {
right: 0.8rem !important; right: 0.8rem !important;
@ -193,7 +248,22 @@ export default {
text-align: center !important; text-align: center !important;
letter-spacing: 4px !important; letter-spacing: 4px !important;
} }
/* ::v-deep .el-input1 .el-input__inner {
border:1px solid rgba(25, 186, 139, 0.17) !important;
border-radius: 4px!important;
} */
::v-deep input::-webkit-input-placeholder { ::v-deep input::-webkit-input-placeholder {
color: white !important ; color: white !important ;
} }
::v-deep .el-input1::-webkit-input-placeholder {
color: gray !important ;
}
::v-deep .el-dialog {
background: #111658 !important;
border:1px solid gray;
}
::v-deep .el-dialog__body {
color: white !important;
}
</style> </style>

@ -0,0 +1,74 @@
<template>
<div class="userBox">
<el-form
:inline="true"
:model="queryParams"
ref="queryForm"
class="demo-form-inline"
label-width="68px"
>
<el-form-item label prop="roleType">
<el-select
class="input2"
v-model="queryParams.roleType"
placeholder="角色类型"
clearable
size="small"
style="width: 150px"
>
<el-option
v-for="dict in roleTypeArr"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form>
</div>
</template>
<style scoped>
.userBox {
width: 100%;
height: 100%;
}
::v-deep .el-input__inner {
background: #111658 !important;
border: 1px solid rgba(25, 186, 139, 0.17) !important;
color: white !important;
text-align: center !important;
letter-spacing: 4px !important;
}
::v-deep .el-input--small {
font-size:14px !important;
color: white !important;
}
</style>
<script>
import flexible from "@/layout/flexible.js";
export default {
data() {
return {
//
queryParams:{
roleType:null,
},
roleTypeArr:[
{
value: 1,
label: "管理员"
},
{
value: 2,
label: "操作员"
},
]
};
},
methods: {}
};
</script>

@ -27,7 +27,8 @@ import {
CarMsg, CarMsg,
TrackManagement, TrackManagement,
MusicManage, MusicManage,
Device Device,
} from "./components"; } from "./components";
import flexible from "@/layout/flexible.js"; import flexible from "@/layout/flexible.js";
export default { export default {
@ -37,7 +38,8 @@ export default {
CarMsg, CarMsg,
TrackManagement, TrackManagement,
MusicManage, MusicManage,
Device Device,
}, },
methods: {}, methods: {},
data() { data() {

@ -35,7 +35,7 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://192.168.31.99:8080`, target: `http://192.168.31.27:8080`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save