This commit is contained in:
23688nl 2022-01-12 15:31:33 +08:00
parent 2d05e10f14
commit d9d52747b9
33 changed files with 290 additions and 116 deletions

View File

@ -8,7 +8,7 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="<%= BASE_URL %>cdn/iconfont/1.0.0/index.css"> <link rel="stylesheet" href="<%= BASE_URL %>cdn/iconfont/1.0.0/index.css">
<link rel="stylesheet" href="<%= BASE_URL %>cdn/iconfont/1.0.0/iconfont.css"> <link rel="stylesheet" href="<%= BASE_URL %>cdn/iconfont/1.0.0/iconfont.css">
<link rel="stylesheet" href="//at.alicdn.com/t/font_2506643_p77wcbhksgm.css"> <link rel="stylesheet" href="//at.alicdn.com/t/font_2506643_eumy2msqof4.css">
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=aabc97a5e095102787d405719847ecf0"></script> <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=aabc97a5e095102787d405719847ecf0"></script>

View File

@ -12,7 +12,7 @@ export function listProject(query) {
// 查询项目详细 // 查询项目详细
export function getProject(projectId) { export function getProject(projectId) {
return request({ return request({
url: "/tenant/project/" + projectId, url: "/iot/project/" + projectId,
method: "get" method: "get"
}); });
} }
@ -20,7 +20,7 @@ export function getProject(projectId) {
// 导出项目 // 导出项目
export function exportProject(query) { export function exportProject(query) {
return request({ return request({
url: "/tenant/project/export", url: "/iot/project/export",
method: "get", method: "get",
params: query params: query
}); });

View File

@ -85,7 +85,7 @@ export default {
}, },
// //
markerClick(e) { markerClick(e) {
console.log('地图点击标注点!!') // console.log('')
if (!this.infoWindow) { if (!this.infoWindow) {
this.createInfoWindowO(); this.createInfoWindowO();
} }

View File

@ -59,7 +59,7 @@ export default {
this.aMap.clearMap(); this.aMap.clearMap();
} }
this.createMarker(); this.createMarker();
console.log("map_projectList: ", list); // console.log("map_projectList: ", list);
// this.textFu(); // this.textFu();
}, },
deep: true deep: true
@ -94,7 +94,7 @@ export default {
}, },
// //
markerClick(e) { markerClick(e) {
console.log("地图点击标注点!!"); // console.log("");
if (!this.infoWindow) { if (!this.infoWindow) {
this.createInfoWindowO(); this.createInfoWindowO();
} }
@ -212,9 +212,6 @@ export default {
} }
return resultStr; return resultStr;
}, },
st(v) {
console.log('srccc:', v)
},
// //
createInfoWindow(content) { createInfoWindow(content) {
var info = document.createElement("div"); var info = document.createElement("div");

View File

@ -85,7 +85,7 @@ export default {
}, },
// //
markerClick(e) { markerClick(e) {
console.log('地图点击标注点!!') // console.log('')
if (!this.infoWindow) { if (!this.infoWindow) {
this.createInfoWindowO(); this.createInfoWindowO();
} }

View File

@ -97,7 +97,7 @@ export default {
this.valueLoop.start = 2 this.valueLoop.start = 2
this.valueLoop.interval = 1 this.valueLoop.interval = 1
this.parseProp(this.prop) this.parseProp(this.prop)
console.log(this.valueList) // console.log(this.valueList)
} }
} }
</script> </script>

View File

@ -35,7 +35,7 @@ export default {
if (typeof val !== 'string') return if (typeof val !== 'string') return
const themeCluster = this.getThemeCluster(val.replace('#', '')) const themeCluster = this.getThemeCluster(val.replace('#', ''))
const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
console.log(themeCluster, originalCluster) // console.log(themeCluster, originalCluster)
const $message = this.$message({ const $message = this.$message({
message: ' Compiling the theme', message: ' Compiling the theme',

View File

@ -71,7 +71,7 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
}, },
beforeAvatarUpload(file) { beforeAvatarUpload(file) {
console.log(file.type) // console.log(file.type)
const isJPG = this.fileType.indexOf(file.type) >= 0; const isJPG = this.fileType.indexOf(file.type) >= 0;
const isLt2M = file.size < this.fileSize; const isLt2M = file.size < this.fileSize;

View File

@ -5,6 +5,7 @@ var iotHost="192.168.18.139"; // 海创iot 平台 host
// iot.gkiiot.com 192.168.18.139 // iot.gkiiot.com 192.168.18.139
var flowIotUrl = ''; var flowIotUrl = '';
let iotWebSocketBaseUrl = '' let iotWebSocketBaseUrl = ''
let devLiveWebSocketBaseUrl = ''
let sysWebSocket = 'ws://' let sysWebSocket = 'ws://'
let prodApi = '/prod-api'; let prodApi = '/prod-api';
var hrefHost = window.location.host; var hrefHost = window.location.host;
@ -24,11 +25,13 @@ if (env.NODE_ENV == 'development') {
iotWebSocketAlarmBaseUrl = sysWebSocket + hrefHost + ':8899/ws/alarm/live' iotWebSocketAlarmBaseUrl = sysWebSocket + hrefHost + ':8899/ws/alarm/live'
sysWebSocket = sysWebSocket + hrefHost + prodApi; sysWebSocket = sysWebSocket + hrefHost + prodApi;
iotWebSocketBaseUrl = sysWebSocket + '/ws/dev/up/' iotWebSocketBaseUrl = sysWebSocket + '/ws/dev/up/'
devLiveWebSocketBaseUrl = sysWebSocket + '/ws/dev/live/'
iotPlatformUrl = 'http://' + iotHost + '/prod-api' iotPlatformUrl = 'http://' + iotHost + '/prod-api'
export { export {
iotPlatformUrl, iotPlatformUrl,
sysWebSocket, sysWebSocket,
iotWebSocketBaseUrl, iotWebSocketBaseUrl,
iotWebSocketAlarmBaseUrl iotWebSocketAlarmBaseUrl,
devLiveWebSocketBaseUrl
} }

View File

@ -3,7 +3,7 @@
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/> <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
<sidebar class="sidebar-container" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }" /> <sidebar class="sidebar-container" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }" />
<div :class="{hasTagsView:needTagsView}" class="main-container"> <div :class="{hasTagsView:needTagsView}" class="main-container">
<div :class="{'fixed-header':fixedHeader}"> <div :class="{'fixed-header':fixedHeader}" id="navbar-top" :style="navbarShow() ? 'display: none;' : ''">
<navbar /> <navbar />
<tags-view v-if="needTagsView" /> <tags-view v-if="needTagsView" />
</div> </div>
@ -56,6 +56,9 @@ export default {
} }
}, },
methods: { methods: {
navbarShow() {
return this.$route.path === '/index'
},
handleClickOutside() { handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
} }

View File

@ -64,6 +64,9 @@ export const constantRoutes = [
name: 'BigScreen', name: 'BigScreen',
meta: { meta: {
title: '数据总览', icon: 'dashboard', noCache: true, affix: true title: '数据总览', icon: 'dashboard', noCache: true, affix: true
},
params: {
showNav: false
} }
}, },
] ]

View File

@ -88,7 +88,7 @@ service.interceptors.response.use(res => {
} }
}, },
error => { error => {
console.log('err' + error) // console.log('err' + error)
let { message } = error; let { message } = error;
if (message == "Network Error") { if (message == "Network Error") {
message = "后端接口连接异常"; message = "后端接口连接异常";

View File

@ -85,7 +85,7 @@ export default {
watch: { watch: {
option(val, oldVal) { option(val, oldVal) {
this.chart = null this.chart = null
console.log(val) // console.log(val)
this.drawLine() this.drawLine()
} }
} }

View File

@ -105,7 +105,7 @@ export default {
} }
] ]
}; };
console.log('radar',this.option, this.chart) // console.log('radar',this.option, this.chart)
this.chart.setOption(option); this.chart.setOption(option);
} }
}, },

View File

@ -59,7 +59,7 @@ export default {
} }
if (list) { if (list) {
for(var i = 0; i < list.length; i++) { for(var i = 0; i < list.length; i++) {
console.log(list[i]['typeCode'].indexOf('a')) // console.log(list[i]['typeCode'].indexOf('a'))
if (list[i]['typeCode'].indexOf('a') === 0) { if (list[i]['typeCode'].indexOf('a') === 0) {
this.templist['alarm'].push({ value: list[i].alarmTotal, name: list[i].typeName }) this.templist['alarm'].push({ value: list[i].alarmTotal, name: list[i].typeName })
} else if (list[i]['typeCode'].indexOf('w') === 0) { } else if (list[i]['typeCode'].indexOf('w') === 0) {
@ -67,7 +67,7 @@ export default {
} }
} }
} }
console.log(this.templist) // console.log(this.templist)
this.updateEcharts() this.updateEcharts()
}, },
deep: true deep: true

View File

@ -107,7 +107,9 @@ export default {
this.thisScrollTopY = document.getElementById("con_lf_top_div").scrollTop; this.thisScrollTopY = document.getElementById("con_lf_top_div").scrollTop;
document.getElementById("con_lf_top_div").style.background = "#010a31"; document.getElementById("con_lf_top_div").style.background = "#010a31";
document.getElementById("con_lf_top_div").style.height = document.getElementById("con_lf_top_div").style.height =
"calc(100vh - 84px)"; "calc(100vh - 0px)";
document.getElementById("con_lf_top_div").style.minHeight =
"calc(100vh - 0px)";
document.getElementById("con_lf_top_div").style.overflow = "hidden"; document.getElementById("con_lf_top_div").style.overflow = "hidden";
document.getElementById("con_lf_top_div").scrollTop = 0; document.getElementById("con_lf_top_div").scrollTop = 0;
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
@ -181,7 +183,7 @@ export default {
if (this.fullscreen) { if (this.fullscreen) {
w_height = Number(document.documentElement.clientHeight / 1080); w_height = Number(document.documentElement.clientHeight / 1080);
} else { } else {
w_height = Number(document.documentElement.clientHeight / 1186); w_height = Number(document.documentElement.clientHeight / 1080);
} }
this.scalseNum = w_height; this.scalseNum = w_height;
}, },
@ -224,7 +226,7 @@ export default {
<style lang="scss"> <style lang="scss">
.big-v1-wrap { .big-v1-wrap {
width: 100%; width: 100%;
height: calc(100vh - 85px); height: calc(100vh - 0px);
display: flex; display: flex;
justify-content: center; justify-content: center;
background-image: url("../../../assets/images/big/bigpg_v2.jpg"); background-image: url("../../../assets/images/big/bigpg_v2.jpg");
@ -272,7 +274,7 @@ export default {
} }
.app-main { .app-main {
width: 100%; width: 100%;
height: calc(100vh - 100px); height: calc(100vh - 0);
// background: #021c80; // background: #021c80;
} }
.big-v1-wrap { .big-v1-wrap {

View File

@ -105,7 +105,7 @@ export default {
} }
] ]
}; };
console.log('radar',this.option, this.chart) // console.log('radar',this.option, this.chart)
this.chart.setOption(option); this.chart.setOption(option);
} }
}, },

View File

@ -60,7 +60,7 @@ export default {
} }
if (list) { if (list) {
for(var i = 0; i < list.length; i++) { for(var i = 0; i < list.length; i++) {
console.log(list[i]['typeCode'].indexOf('a')) // console.log(list[i]['typeCode'].indexOf('a'))
if (list[i]['typeCode'].indexOf('a') === 0) { if (list[i]['typeCode'].indexOf('a') === 0) {
this.templist['alarm'].push({ value: list[i].alarmTotal, name: list[i].typeName }) this.templist['alarm'].push({ value: list[i].alarmTotal, name: list[i].typeName })
} else if (list[i]['typeCode'].indexOf('w') === 0) { } else if (list[i]['typeCode'].indexOf('w') === 0) {

View File

@ -20,6 +20,7 @@
:sourceId="deviceId" :sourceId="deviceId"
:deviceInfo="infoData" :deviceInfo="infoData"
:prodId="infoData.prodKey" :prodId="infoData.prodKey"
:wsUrl="iotWebSocketBaseUrl"
></device-run-starts-wrap> ></device-run-starts-wrap>
</div> </div>
</el-tab-pane> </el-tab-pane>
@ -54,6 +55,7 @@ import { getDevice } from "@/api/iot/device";
import InfoWrap from "./info"; import InfoWrap from "./info";
import ChildDevice from "./childDevice"; import ChildDevice from "./childDevice";
import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index"; import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index";
import { iotWebSocketBaseUrl } from "@/config/env";
import TriggerWrap from "@/views/profile/DeviceTrigger/index"; import TriggerWrap from "@/views/profile/DeviceTrigger/index";
export default { export default {
name: "DetailsWrap", name: "DetailsWrap",
@ -67,6 +69,7 @@ export default {
data() { data() {
return { return {
infoData: {}, infoData: {},
iotWebSocketBaseUrl,
activeName: "runingState", activeName: "runingState",
breadcrumbList: [], breadcrumbList: [],
tempType: "bs", tempType: "bs",

View File

@ -168,6 +168,14 @@
<el-input v-model="form.modelName" placeholder="请输入型号名称" /> <el-input v-model="form.modelName" placeholder="请输入型号名称" />
</el-form-item> </el-form-item>
<el-form-item label="产品json" prop="prodJson" v-if="form.protocolType === 'OFFICIAL'">
<el-input v-model="form.prodJson" type="textarea" :rows="5" placeholder="请输入产品json" />
</el-form-item>
<el-form-item label="分组json" prop="remark" v-if="form.protocolType === 'OFFICIAL'">
<el-input v-model="form.remark" type="textarea" :rows="5" placeholder="请输入分组json" />
</el-form-item>
<el-form-item label="设备类型:" prop="deviceType"> <el-form-item label="设备类型:" prop="deviceType">
<el-select <el-select
@ -610,7 +618,8 @@ export default {
prodKey: "", prodKey: "",
deviceType: "", deviceType: "",
paramList: [], paramList: [],
protocolType: 'IOTOS' protocolType: 'IOTOS',
prodJson: ''
}; };
this.resetForm("form"); this.resetForm("form");
}, },

View File

@ -862,8 +862,6 @@ export default {
if (this.temp.model) { if (this.temp.model) {
this.temp.modelName = this.temp.model.modelName this.temp.modelName = this.temp.model.modelName
this.getcomdlist(this.temp.model.modelId); this.getcomdlist(this.temp.model.modelId);
} else {
console.log('型号参数错误!')
} }
}) })
.catch(err => { .catch(err => {

View File

@ -200,7 +200,7 @@ export default {
rouetParams["tempType"] && rouetParams["tempType"] !== "list" rouetParams["tempType"] && rouetParams["tempType"] !== "list"
? "DetailsWrap" ? "DetailsWrap"
: ""; : "";
console.log(rouetParams); // console.log(rouetParams);
}, },
sortChange(column) { sortChange(column) {
const sort = { const sort = {

View File

@ -20,6 +20,7 @@
:sourceId="deviceId" :sourceId="deviceId"
:deviceInfo="infoData" :deviceInfo="infoData"
:prodId="infoData.prodKey" :prodId="infoData.prodKey"
:wsUrl="iotWebSocketBaseUrl"
></device-run-starts-wrap> ></device-run-starts-wrap>
</div> </div>
</el-tab-pane> </el-tab-pane>
@ -49,6 +50,7 @@ import { getDevice } from "@/api/personal/device";
import InfoWrap from "./info"; import InfoWrap from "./info";
import ChildDevice from "./childDevice"; import ChildDevice from "./childDevice";
import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index"; import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index";
import { iotWebSocketBaseUrl } from "@/config/env";
export default { export default {
name: "DetailsWrap", name: "DetailsWrap",
props: ["sourceId"], props: ["sourceId"],
@ -60,6 +62,7 @@ export default {
data() { data() {
return { return {
infoData: {}, infoData: {},
iotWebSocketBaseUrl,
activeName: "runingState", activeName: "runingState",
breadcrumbList: [], breadcrumbList: [],
tempType: "bs", tempType: "bs",

View File

@ -468,7 +468,7 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
}, },
handelDelFile(file) { handelDelFile(file) {
console.log(file); // console.log(file);
this.pictures.splice(this.pictures.indexOf(file), 1); this.pictures.splice(this.pictures.indexOf(file), 1);
}, },
uploud(file) { uploud(file) {

View File

@ -9,34 +9,41 @@
" "
> >
<div class="nav-p-dev"> <div class="nav-p-dev">
<!-- <el-radio
v-model="checkobxDeviceId"
style="margin-right: 10px"
:label="deviceInfo.deviceId"
>
{{
deviceInfo.deviceId === checkobxDeviceId ? "已选择" : "未选择"
}}</el-radio
> -->
<div <div
style=" style="
height: 25px; height: 25px;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
padding-right: 10px;
padding-top: 5px;
" "
> >
<div style="width: 60px; display: flex; justify-content: center" v-if="deviceInfo.stype === 'LAN'">
<i
class="iconfont iconkuandai"
style="color: black; font-size: 20px"
></i>
</div>
<div style="width: 60px; display: flex; justify-content: center" v-else>
<i
class="iconfont iconwifi"
style="color: black; font-size: 20px"
v-if="deviceInfo.stype === 'WIFI'"
></i>
<i
:class="signalType(deviceInfo.stype)"
style="color: black; font-size: 20px"
v-else
></i>
<signal-intensity
:intensityNumber="deviceInfo.signal"
></signal-intensity>
</div>
<i <i
v-if="deviceInfo.deviceId === checkobxDeviceId" v-if="deviceInfo.deviceId === checkobxDeviceId"
class="el-icon-success" class="el-icon-success"
style=" style="font-size: 25px; color: #1890ff"
font-size: 25px;
color: #1890ff;
position: relative;
top: 5px;
z-index: 100;
right: 8px;
"
></i> ></i>
</div> </div>
<div class="dev-info"> <div class="dev-info">
@ -84,55 +91,48 @@
:key="item.deviceId" :key="item.deviceId"
> >
<div class="nav-c-dev"> <div class="nav-c-dev">
<!-- <el-radio
v-model="checkobxDeviceId"
:label="item.deviceId"
style="margin-right: 10px"
>
{{ item.deviceId === checkobxDeviceId ? "已选择" : "未选择" }}
</el-radio> -->
<div <div
style=" style="
height: 25px; height: 25px;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
padding-right: 10px;
padding-top: 5px;
" "
> >
<!-- <div style="
width: 60px;
display: flex;
justify-content: center;
">
<i :class="signalType(item.stype)" style="color: black; font-size: 20px;" ></i>
<signal-intensity :intensityNumber="item.signal" ></signal-intensity>
</div> -->
<i <i
v-if="item.deviceId === checkobxDeviceId" v-if="item.deviceId === checkobxDeviceId"
class="el-icon-success" class="el-icon-success"
style=" style="font-size: 25px; color: #1890ff"
font-size: 25px;
color: #1890ff;
position: relative;
top: 5px;
z-index: 100;
right: 8px;
"
></i> ></i>
</div> </div>
<div class="dev-info"> <div class="dev-info">
<span class="dev-info-title" :title="item.deviceName">{{ <span class="dev-info-title" :title="item.deviceName">{{
item.deviceName item.deviceName
}}</span> }}</span>
<div class="dev-info-state" v-show="item.deviceId !== checkobxDeviceId"> <div
class="dev-info-state"
v-show="item.deviceId !== checkobxDeviceId"
>
<el-tag type="success" v-if="item.deviceState === 'ONLINE'" <el-tag type="success" v-if="item.deviceState === 'ONLINE'"
>在线</el-tag >在线</el-tag
> >
<el-tag <el-tag type="danger" v-else-if="item.deviceState === 'OFFLINE'"
type="danger"
v-else-if="item.deviceState === 'OFFLINE'"
>离线</el-tag >离线</el-tag
> >
<el-tag <el-tag type="danger" v-else-if="item.deviceState === 'OUTLINE'"
type="danger"
v-else-if="item.deviceState === 'OUTLINE'"
>脱线</el-tag >脱线</el-tag
> >
<el-tag <el-tag type="info" v-else-if="item.deviceState === 'UNACTIVE'"
type="info"
v-else-if="item.deviceState === 'UNACTIVE'"
>未激活</el-tag >未激活</el-tag
> >
<el-button <el-button
@ -142,7 +142,10 @@
>查看</el-button >查看</el-button
> >
</div> </div>
<div class="dev-info-state" v-show="item.deviceId === checkobxDeviceId"> <div
class="dev-info-state"
v-show="item.deviceId === checkobxDeviceId"
>
<el-switch <el-switch
size="mini" size="mini"
v-model="item.switch" v-model="item.switch"
@ -188,9 +191,13 @@
<script> <script>
import { listDevice, setSwitchControl } from "@/api/iot/device"; import { listDevice, setSwitchControl } from "@/api/iot/device";
import { iotWebSocketBaseUrl } from "@/config/env"; import { iotWebSocketBaseUrl, devLiveWebSocketBaseUrl } from "@/config/env";
import SignalIntensity from "./signalIntensity";
export default { export default {
name: "DeviceSelectNav", name: "DeviceSelectNav",
components: {
SignalIntensity,
},
props: { props: {
deviceInfo: { deviceInfo: {
type: Object, type: Object,
@ -212,6 +219,7 @@ export default {
stompClient: null, stompClient: null,
socket_flag: true, socket_flag: true,
setTimeOut_flag: null, setTimeOut_flag: null,
timingPingWs_flag: null,
// wsDeviceInfo: null? // wsDeviceInfo: null?
}; };
}, },
@ -221,16 +229,24 @@ export default {
watch: { watch: {
wsDeviceInfo: { wsDeviceInfo: {
handler: function () { handler: function () {
this.timingPingWs(this.wsDeviceInfo);
if (this.deviceInfo.deviceId !== this.wsDeviceInfo.deviceId) { if (this.deviceInfo.deviceId !== this.wsDeviceInfo.deviceId) {
for(let i =0; i < this.childDeviceList.length; i++) { for (let i = 0; i < this.childDeviceList.length; i++) {
if (this.childDeviceList[i]['deviceId'] === this.wsDeviceInfo['deviceId']) { if (
this.childDeviceList[i]['switch'] = this.wsDeviceInfo['switch'].toString(); this.childDeviceList[i]["deviceId"] ===
this.$forceUpdate() this.wsDeviceInfo["deviceId"]
) {
this.childDeviceList[i]["switch"] =
this.wsDeviceInfoswitch?.switch.toString();
this.$forceUpdate();
break; break;
} }
} }
// this.timingPingWs(this.wsDeviceInfo);
// ws // ws
this.connection(); this.connection();
} else {
this.connection();
} }
}, },
deep: true, deep: true,
@ -244,6 +260,20 @@ export default {
}, },
}, },
methods: { methods: {
signalType(val) {
switch (val) {
case "5G":
return "iconfont icona-5G";
case "4G":
return "iconfont icon4g";
case "3G":
return "iconfont icon3g";
case "2G":
return "iconfont icong";
default:
return "iconfont icong";
}
},
// ws // ws
connection() { connection() {
if (this.stompClient) { if (this.stompClient) {
@ -252,7 +282,7 @@ export default {
if (!this.wsDeviceInfo) { if (!this.wsDeviceInfo) {
return; return;
} }
if (!iotWebSocketBaseUrl) { if (!devLiveWebSocketBaseUrl) {
return; return;
} }
let headers = { let headers = {
@ -260,9 +290,9 @@ export default {
username: this.wsDeviceInfo.wsUsername, username: this.wsDeviceInfo.wsUsername,
sign: this.wsDeviceInfo.wsSign, sign: this.wsDeviceInfo.wsSign,
}; };
console.log("connection:--"); // console.log("connection:--");
this.stompClient = new WebSocket( this.stompClient = new WebSocket(
`${iotWebSocketBaseUrl}${headers.clientid}/${headers.username}/${headers.sign}` `${devLiveWebSocketBaseUrl}${headers.clientid}/${headers.username}/${headers.sign}`
); );
this.socket_flag = true; this.socket_flag = true;
this.stompClient.onopen = this.socket_open; this.stompClient.onopen = this.socket_open;
@ -273,20 +303,26 @@ export default {
console.log("ws-open:", evt); console.log("ws-open:", evt);
}, },
socket_onmsg(evt) { socket_onmsg(evt) {
this.handlerWsMsgData(JSON.parse(evt.data)) this.handlerWsMsgData(JSON.parse(evt.data));
}, },
handlerWsMsgData(evt) { handlerWsMsgData(evt) {
console.log('msg:', evt) // console.log("msg:", evt);
for(let i =0; i < this.childDeviceList.length; i++) { this.$emit("wsRealTImeMsg", JSON.stringify(evt))
if (this.childDeviceList[i]['deviceKey'] === evt['devId']) { if (this.deviceInfo.deviceId !== this.wsDeviceInfo.deviceId) {
this.childDeviceList[i]['switch'] = evt['params']['switch'].toString(); for (let i = 0; i < this.childDeviceList.length; i++) {
this.$forceUpdate() if (this.childDeviceList[i]["deviceKey"] === evt["devId"]) {
break; this.childDeviceList[i]["switch"] = evt["params"]["switch"] ? evt["params"]["switch"].toString() : '0';
this.$forceUpdate();
break;
}
} }
} else {
this.deviceInfo["stype"] = evt["params"]["stype"] ? evt["params"]["stype"].toString() : '0';
this.deviceInfo["signal"] = evt["params"]["signal"] ? evt["params"]["signal"].toString() : '0';
} }
}, },
socket_onclose(e) { socket_onclose(e) {
console.log("socket_onclose:--", e, this.stompClient); // console.log("socket_onclose:--", e, this.stompClient);
this.stompClient = null; this.stompClient = null;
if (this.socket_flag) { if (this.socket_flag) {
this.socket_flag = false; this.socket_flag = false;
@ -299,26 +335,52 @@ export default {
}, },
// //
closeWebscoket() { closeWebscoket() {
console.log(this.stompClient) // console.log(this.stompClient);
this.socket_flag = false; this.socket_flag = false;
if (this.stompClient) { if (this.stompClient) {
console.log('we-close---') console.log("we-close---");
this.stompClient.close(); this.stompClient.close();
} }
this.stompClient = null; this.stompClient = null;
clearInterval(this.timingPingWs_flag);
clearTimeout(this.setTimeOut_flag); clearTimeout(this.setTimeOut_flag);
}, },
// ping ws
timingPingWs(row) {
this.extenSubmit(row)
const _this = this;
this.timingPingWs_flag = setInterval(function () {
_this.extenSubmit(row)
}, 5000);
},
extenSubmit(row) {
let params = {
data: {
cmd: "set_live_time",
params: {
ltime: 10,
dtime: 1200,
},
},
deviceId: row.deviceId,
};
setSwitchControl(params).then((res) => {
console.log(res)
// this.msgSuccess("");
});
},
// 线 // 线
submitChildStatus(type, row) { submitChildStatus(type, row) {
this.$prompt("请输入登录密码", "提示", { this.$prompt("请输入登录密码", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
inputPattern: /^[a-z A-z 0-9 $.]+/, inputPattern: /^[a-z A-z 0-9 $.]+/,
inputType: 'password', inputType: "password",
inputErrorMessage: "登录密码不能为空", inputErrorMessage: "登录密码不能为空",
}).then(({ value }) => { }).then(({ value }) => {
let params = { let params = {
data: { data: {
cmd: "set_switch",
params: { params: {
switch: type === "true" ? 1 : 0, switch: type === "true" ? 1 : 0,
}, },
@ -326,9 +388,9 @@ export default {
deviceId: row.deviceId, deviceId: row.deviceId,
verifyKey: value, verifyKey: value,
}; };
console.log(params);
setSwitchControl(params).then((res) => { setSwitchControl(params).then((res) => {
console.log(res); // console.log(res);
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
}); });
@ -339,15 +401,6 @@ export default {
this.checkobxDeviceId = id; this.checkobxDeviceId = id;
// ws // ws
this.closeWebscoket(); this.closeWebscoket();
if (this.deviceInfo.deviceId !== id) {
// ws
// this.connection()
// let resArr = this.childDeviceList.filter((item) => {
// return item.deviceId === id
// })
// this.wsDeviceInfo = resArr.shift()
// this.connection()
}
this.$emit("changeEvent", { val: id }); this.$emit("changeEvent", { val: id });
} }
}, },
@ -360,6 +413,9 @@ export default {
}); });
}, },
}, },
destroyed() {
this.closeWebscoket()
},
}; };
</script> </script>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="iot-circuit-breaker-details-warp"> <div class="iot-circuit-breaker-details-warp">
<device-select v-if="pInfo" :deviceInfo="pInfo" :wsDeviceInfo="infoData" @changeEvent="viewDeviceChange($event)"></device-select> <device-select @wsRealTImeMsg="wsRealTImeMsg($event)" v-if="pInfo" :deviceInfo="pInfo" :wsDeviceInfo="infoData" @changeEvent="viewDeviceChange($event)"></device-select>
<div class="info-tabs-circuit"> <div class="info-tabs-circuit">
<div class="breadcrumb-wrap" v-show="breadcrumbList.length > 1"> <div class="breadcrumb-wrap" v-show="breadcrumbList.length > 1">
<el-breadcrumb separator-class="el-icon-arrow-right"> <el-breadcrumb separator-class="el-icon-arrow-right">
@ -19,6 +19,7 @@
<state-management <state-management
v-if="devudeRunState" v-if="devudeRunState"
:deviceInfo="infoData" :deviceInfo="infoData"
:realTimeData="realTimeData"
></state-management> ></state-management>
</div> </div>
</el-tab-pane> </el-tab-pane>
@ -41,7 +42,6 @@
import { getDevice } from "@/api/iot/device"; import { getDevice } from "@/api/iot/device";
import InfoWrap from "./info"; import InfoWrap from "./info";
import StateManagement from "./stateManagement"; import StateManagement from "./stateManagement";
import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index";
import TriggerWrap from "@/views/profile/DeviceTrigger/index"; import TriggerWrap from "@/views/profile/DeviceTrigger/index";
import DeviceSelect from './deviceSelectNav' import DeviceSelect from './deviceSelectNav'
export default { export default {
@ -50,7 +50,6 @@ export default {
components: { components: {
InfoWrap, InfoWrap,
StateManagement, StateManagement,
DeviceRunStartsWrap,
TriggerWrap, TriggerWrap,
DeviceSelect DeviceSelect
}, },
@ -62,7 +61,8 @@ export default {
breadcrumbList: [], breadcrumbList: [],
tempType: "bs", tempType: "bs",
deviceId: "", deviceId: "",
devudeRunState: false devudeRunState: false,
realTimeData: null
}; };
}, },
created() { created() {
@ -70,6 +70,9 @@ export default {
this.deviceInfo(); this.deviceInfo();
}, },
methods: { methods: {
wsRealTImeMsg(data) {
this.realTimeData = Object.assign(data)
},
viewDeviceChange(row) { viewDeviceChange(row) {
this.deviceId = row.val; this.deviceId = row.val;
this.deviceInfo(row.val === this.pInfo.deviceId ? null : 'children') this.deviceInfo(row.val === this.pInfo.deviceId ? null : 'children')

View File

@ -0,0 +1,75 @@
<template>
<div class="signal-intensity-view">
<div class="box">
<span class="wifi-icon strength-no strength-3">
<span v-for="idx in list" :key="idx" :style="signalIntensity(idx) ? 'background: #07eb58': ''"></span>
</span>
</div>
</div>
</template>
<script>
export default {
name: "SignalIntensity",
props: {
intensityNumber: {
type: [String,Number],
default: '0'
}
},
data() {
return {
list: 5
}
},
methods: {
signalIntensity(idx){
return Number(this.intensityNumber) ? Number(this.intensityNumber) >= idx : false
}
}
};
</script>
<style lang="scss">
.signal-intensity-view {
width: 23px;
align-content: baseline;
align-items: flex-end;
display: flex;
height: 21px;
.box {
width: 100%;
> span {
display: flex;
align-items: flex-end;
justify-content: space-between;
color: rgba(0, 0, 0, 0.5);
height: 15px;
>span {
width: 3px;
border-radius: 5px;
background: rgba(0, 0, 0, 0.5);
}
span:nth-child(1) {
height: 20%;
left: 0px;
}
span:nth-child(2) {
height: 40%;
left: 10px;
}
span:nth-child(3) {
height: 60%;
left: 20px;
}
span:nth-child(4) {
height: 80%;
left: 30px;
}
span:nth-child(5) {
height: 100%;
left: 40px;
}
}
}
}
</style>

View File

@ -5,12 +5,15 @@
:sourceId="deviceInfo.deviceId" :sourceId="deviceInfo.deviceId"
:deviceInfo="deviceInfo" :deviceInfo="deviceInfo"
:prodId="deviceInfo.prodKey" :prodId="deviceInfo.prodKey"
:wsUrl="iotWebSocketBaseUrl"
:realTimeData="realTimeData"
></device-run-starts-wrap> ></device-run-starts-wrap>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index"; import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index";
import { iotWebSocketBaseUrl } from "@/config/env";
import DeviceSelect from './deviceSelectNav' import DeviceSelect from './deviceSelectNav'
export default { export default {
name: "StateManagement", name: "StateManagement",
@ -24,10 +27,17 @@ export default {
default: () => { default: () => {
return {}; return {};
}, },
},
realTimeData: {
type: String,
default: () => {
return "{}";
},
} }
}, },
data() { data() {
return { return {
iotWebSocketBaseUrl,
}; };
}, },
created() { created() {

View File

@ -71,7 +71,7 @@ import { iotWebSocketBaseUrl } from "@/config/env";
import RunStateTable from "./table"; import RunStateTable from "./table";
export default { export default {
name: "RunStartsWrap", name: "RunStartsWrap",
props: ["prodId", "sourceId", "deviceInfo"], props: ["prodId", "sourceId", "deviceInfo", 'wsUrl', 'realTimeData'],
components: { components: {
RunStateTable, RunStateTable,
}, },
@ -109,7 +109,7 @@ export default {
if (this.stompClient) { if (this.stompClient) {
return; return;
} }
if (!iotWebSocketBaseUrl) { if (!this.wsUrl) {
return; return;
} }
// let locahostUrl = 'ws://192.168.18.138/device/ws/dev/send/' // let locahostUrl = 'ws://192.168.18.138/device/ws/dev/send/'
@ -119,7 +119,7 @@ export default {
sign: this.deviceInfo.wsSign, sign: this.deviceInfo.wsSign,
}; };
this.stompClient = new WebSocket( this.stompClient = new WebSocket(
`${iotWebSocketBaseUrl}${headers.clientid}/${headers.username}/${headers.sign}` `${this.wsUrl}${headers.clientid}/${headers.username}/${headers.sign}`
); );
this.stompClient.onmessage = this.socket_onmsg; this.stompClient.onmessage = this.socket_onmsg;
this.stompClient.onclose = this.socket_onclose; this.stompClient.onclose = this.socket_onclose;
@ -232,6 +232,12 @@ export default {
// this.connection() // this.connection()
} }
}, },
realTimeData: {
handler: function () {
this.setListData(this.realTimeData)
},
deep: true,
}
}, },
}; };
</script>- </script>-

View File

@ -203,7 +203,7 @@ export default {
reultEventFu() { reultEventFu() {
this.form.guid = this.tempIndex; this.form.guid = this.tempIndex;
this.returnIsSumbit(); this.returnIsSumbit();
console.log(this.form); // console.log(this.form);
this.$emit("resultEvent", { result: this.form, index: this.tempIndex }); this.$emit("resultEvent", { result: this.form, index: this.tempIndex });
}, },
returnIsSumbit() { returnIsSumbit() {

View File

@ -619,7 +619,7 @@ export default {
// //
submitFileForm() { submitFileForm() {
// //
console.log(this.otherOption["inputType"], ":", this.childIds); // console.log(this.otherOption["inputType"], ":", this.childIds);
} /** 修改按钮操作 */, } /** 修改按钮操作 */,
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
@ -661,7 +661,7 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
console.log(row); // console.log(row);
const tenantIds = row.tenantId || this.ids; const tenantIds = row.tenantId || this.ids;
this.$confirm( this.$confirm(
// '"' + tenantIds + '"?', // '"' + tenantIds + '"?',

View File

@ -20,6 +20,7 @@
:sourceId="deviceId" :sourceId="deviceId"
:deviceInfo="infoData" :deviceInfo="infoData"
:prodId="infoData.prodKey" :prodId="infoData.prodKey"
:wsUrl="iotWebSocketBaseUrl"
></device-run-starts-wrap> ></device-run-starts-wrap>
</div> </div>
</el-tab-pane> </el-tab-pane>
@ -54,6 +55,7 @@ import { getDevice } from "@/api/tenant/device";
import InfoWrap from "./info"; import InfoWrap from "./info";
import ChildDevice from "./childDevice"; import ChildDevice from "./childDevice";
import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index"; import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index";
import { iotWebSocketBaseUrl } from "@/config/env";
import TriggerWrap from "@/views/profile/DeviceTrigger/index"; import TriggerWrap from "@/views/profile/DeviceTrigger/index";
export default { export default {
name: "DetailsWrap", name: "DetailsWrap",
@ -71,7 +73,8 @@ export default {
breadcrumbList: [], breadcrumbList: [],
tempType: "bs", tempType: "bs",
deviceId: "", deviceId: "",
devudeRunState: false devudeRunState: false,
iotWebSocketBaseUrl
}; };
}, },
created() { created() {

View File

@ -40,7 +40,7 @@ export default {
}, },
/** 查询空间设备列表 */ /** 查询空间设备列表 */
getList() { getList() {
console.log(this.sourceId) // console.log(this.sourceId)
this.loading = true; this.loading = true;
listDeviceByProjectId(this.sourceId).then(response => { listDeviceByProjectId(this.sourceId).then(response => {
this.list = response.data; this.list = response.data;