Former-commit-id: 4d6947105bcd056c2f3c9d6184854458c8cb05c6
TangShanKaiPing
zhengpengju 5 years ago
parent 4dc7e6dc56
commit 043605dbeb

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1588125515273" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2038" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="1024"><defs><style type="text/css"></style></defs><path d="M43.119152 804.252027c0 121.372427 98.375546 219.747973 219.747972 219.747973s219.747973-98.375546 219.747973-219.747973c0-35.134124-8.304429-69.629445-24.274486-100.930754-14.692452-28.746101-36.411728-54.298191-62.60262-74.101061V129.676856C395.099189 58.131004 336.968185 0 265.422333 0H260.311915C188.127261 0 129.996257 58.131004 129.996257 129.676856v499.543356c-26.190892 19.80287-47.910168 45.354959-62.60262 74.101061C51.423581 734.622583 43.119152 769.117904 43.119152 804.252027z m146.924516-143.091703V129.676856c0-38.328135 31.30131-70.268247 70.268247-70.268247h5.74922c38.328135 0 70.268247 31.30131 70.268247 70.268247v531.483468l13.414848 8.943232c45.993762 29.384903 73.462258 79.850281 73.462258 134.148471 0 88.15471-71.545852 159.700561-159.700562 159.700562s-159.700561-71.545852-159.700561-159.700562c0-54.298191 27.468497-104.763568 73.462258-134.148471l12.776045-8.943232z" fill="#ffffff" p-id="2039"></path><path d="M362.520274 810.001248c0-55.575795-44.716157-100.291953-100.291952-100.291953s-100.291953 44.716157-100.291953 100.291953 44.716157 100.291953 100.291953 100.291952 100.291953-44.716157 100.291952-100.291952z" fill="#ffffff" p-id="2040"></path><path d="M225.816594 728.23456c0 20.441672 16.608858 37.05053 37.05053 37.05053 20.441672 0 37.05053-16.608858 37.05053-37.05053V327.705552c0-20.441672-16.608858-37.05053-37.05053-37.05053-20.441672 0-37.05053 16.608858-37.05053 37.05053V728.23456zM477.504679 111.151591h205.055521c13.414847 0 24.274485 10.859638 24.274485 24.274485s-10.859638 24.274485-24.274485 24.274485H477.504679c-13.414847 0-24.274485-10.859638-24.274486-24.274485 0.638802-13.414847 11.49844-24.274485 24.274486-24.274485zM477.504679 188.446663h173.754211c13.414847 0 24.274485 10.859638 24.274485 24.274485 0 13.414847-10.859638 24.274485-24.274485 24.274485H477.504679c-13.414847 0-24.274485-10.859638-24.274486-24.274485 0.638802-13.414847 11.49844-24.274485 24.274486-24.274485zM477.504679 265.102932h205.055521c13.414847 0 24.274485 10.859638 24.274485 24.274485s-10.859638 24.274485-24.274485 24.274486H477.504679c-13.414847 0-24.274485-10.859638-24.274486-24.274486 0.638802-13.414847 11.49844-24.274485 24.274486-24.274485zM477.504679 342.398004h173.754211c13.414847 0 24.274485 10.859638 24.274485 24.274485s-10.859638 24.274485-24.274485 24.274485H477.504679c-13.414847 0-24.274485-10.859638-24.274486-24.274485 0.638802-13.414847 11.49844-24.274485 24.274486-24.274485zM477.504679 419.693075h205.055521c13.414847 0 24.274485 10.859638 24.274485 24.274486 0 13.414847-10.859638 24.274485-24.274485 24.274485H477.504679c-13.414847 0-24.274485-10.859638-24.274486-24.274485 0.638802-13.414847 11.49844-24.274485 24.274486-24.274486z" fill="#ffffff" p-id="2041"></path><path d="M727.276357 534.67748c-45.993762 145.00811-139.25889 205.694323-139.25889 282.989395 0 77.295072 62.60262 139.25889 139.25889 139.258889s139.25889-62.60262 139.258889-139.258889c0-77.295072-124.566438-279.795384-139.258889-282.989395z m252.326887 83.044292c-7.026825-31.940112-77.295072-106.041173-83.044292-106.041173-6.388022 64.519027-40.244541 98.375546-33.217717 130.315658 7.026825 31.940112 38.328135 53.020586 70.907049 45.993762 31.30131-6.388022 51.742982-38.328135 45.35496-70.268247z" fill="#ffffff" p-id="2042"></path></svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1588124700762" class="icon" viewBox="0 0 1053 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2249" xmlns:xlink="http://www.w3.org/1999/xlink" width="1053" height="1024"><defs><style type="text/css"></style></defs><path d="M1021.28 456.8a32 32 0 0 0-32 32A471.68 471.68 0 0 1 518.08 960a32 32 0 0 0 0 64 535.84 535.84 0 0 0 535.2-535.2 32 32 0 0 0-32-32z" fill="#ffffff" p-id="2250"></path><path d="M518.08 802.08a32 32 0 0 0 0 64 375.84 375.84 0 0 0 375.2-375.36 32 32 0 0 0-64 0 311.68 311.68 0 0 1-311.2 311.36z" fill="#ffffff" p-id="2251"></path><path d="M734.56 480.96A245.76 245.76 0 1 0 488.8 724.8a245.6 245.6 0 0 0 245.76-243.84z m-427.52 0A181.76 181.76 0 1 1 488.8 660.8a181.12 181.12 0 0 1-181.76-179.84zM700.16 297.28a32 32 0 0 0 22.4-9.12l102.88-101.28a32 32 0 1 0-44.8-45.6l-103.04 101.28a32 32 0 0 0 22.56 54.72zM247.04 288.96a32 32 0 1 0 44.8-45.6l-102.88-101.12A32 32 0 1 0 144 187.84zM475.52 206.4a32 32 0 0 0 32-32V32a32 32 0 0 0-64 0v142.4a32 32 0 0 0 32 32zM214.08 660.16l-103.04 101.12a32 32 0 0 0 44.96 45.76l102.88-101.12a32 32 0 0 0-44.8-45.76z" fill="#ffffff" p-id="2252"></path><path d="M208 467.68a32 32 0 0 0-32-32H32a32 32 0 0 0 0 64h144a32 32 0 0 0 32-32z" fill="#ffffff" p-id="2253"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1588139977802" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2725" xmlns:xlink="http://www.w3.org/1999/xlink" width="1024" height="1024"><defs><style type="text/css"></style></defs><path d="M233.344 393.536c7.54-7.056 19.6-6.592 27.244 1.052 7.648 7.644 8.112 19.708 1.052 27.248-51.884 51.888-49.908 138.296 4.4 192.604 7.416 7.876 7.5 19.936 0.192 27.24-7.304 7.308-19.364 7.224-27.24-0.188-69.92-69.92-72.46-181.148-5.648-247.956z" fill="#ffffff" p-id="2726"></path><path d="M175.124 337.436c5.06-5.06 12.556-6.908 19.668-4.852a21.808 21.808 0 0 1 14.816 14.816c2.056 7.116 0.208 14.612-4.848 19.668-81.976 81.976-78.856 218.472 6.956 304.28a21.448 21.448 0 0 1 6.328 14.628 19.56 19.56 0 0 1-5.688 14.348 19.56 19.56 0 0 1-14.34 5.672 21.448 21.448 0 0 1-14.616-6.328C81.24 597.52 77.544 435.016 175.12 337.436zM789.984 393.536c-7.54-7.056-19.6-6.592-27.248 1.052-7.64 7.644-8.108 19.708-1.048 27.248 51.884 51.888 49.908 138.296-4.4 192.604-7.416 7.876-7.5 19.936-0.196 27.24 7.308 7.308 19.368 7.224 27.24-0.188 69.924-69.92 72.46-181.148 5.652-247.956z" fill="#ffffff" p-id="2727"></path><path d="M848.2 337.436c-5.056-5.06-12.552-6.908-19.664-4.852a21.808 21.808 0 0 0-14.82 14.816c-2.056 7.116-0.204 14.612 4.852 19.668 81.976 81.976 78.856 218.472-6.956 304.28a21.448 21.448 0 0 0-6.328 14.628 19.56 19.56 0 0 0 5.688 14.348 19.56 19.56 0 0 0 14.34 5.672 21.448 21.448 0 0 0 14.616-6.328c102.16-102.144 105.856-264.652 8.276-362.232zM521.52 318.756c-84.1 0-152.272-71.36-152.272-159.38S437.42 0 521.52 0s152.268 71.356 152.268 159.376c0 88.024-68.172 159.38-152.268 159.38z m0-63.752c50.452 0 91.36-42.812 91.36-95.628 0-52.812-40.908-95.624-91.36-95.624-50.46 0-91.364 42.812-91.364 95.624 0 52.816 40.904 95.628 91.36 95.628z" fill="#ffffff" p-id="2728"></path><path d="M548.16 934.8v-196.828l45.556-12.42c3.312-0.904 6.08-2.024 9.856-4 7.72-4.024 13.52-9.616 18-17.332 6.16-10.628 9-21.58 11.764-56.3l16.64-208.984c0.12-1.54 0.184-3.088 0.184-4.632 0-30.808-23.86-55.784-53.296-55.784H445.388c-1.476 0-2.952 0.064-4.424 0.196-29.332 2.56-51.128 29.52-48.684 60.22l16.64 208.984c2.76 34.72 5.6 45.672 11.76 56.3 4.48 7.716 10.284 13.308 18.004 17.336 3.892 2.032 6.728 3.168 10.212 4.088l45.972 12.172V934.8c0 9.46 1.144 14.784 2.972 18.364 0.96 1.88 2 2.968 3.796 3.972 3.42 1.916 8.504 3.108 17.544 3.108h4.672c9.04 0 14.128-1.192 17.548-3.108 1.792-1 2.836-2.096 3.792-3.972 1.828-3.58 2.972-8.904 2.972-18.364z m60.912 0c0 19.972-3.536 35.448-10.172 48.432-6.632 12.988-16.372 23.18-28.776 30.124-12.408 6.944-27.192 10.644-46.272 10.644h-4.672c-19.08 0-33.86-3.7-46.268-10.64-12.408-6.948-22.144-17.14-28.78-30.128-6.636-12.984-10.168-28.46-10.168-48.428v-147.352c-8.552-2.264-15.512-5.22-22.46-8.844-18.008-9.4-32.44-23.3-42.88-41.3-10.444-18.004-16.612-36.48-20.4-84.092l-16.64-208.984c-5.24-65.792 41.468-123.568 104.32-129.048 3.156-0.276 6.32-0.412 9.484-0.412h151.48c63.068 0 114.2 53.516 114.2 119.532 0 3.312-0.132 6.624-0.4 9.928l-16.636 208.984c-3.792 47.616-9.96 66.088-20.4 84.092-10.44 18-24.876 31.9-42.88 41.3-6.736 3.512-13.484 6.4-21.68 8.636v147.56z" fill="#ffffff" p-id="2729"></path></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -15,14 +15,14 @@
},
mounted: function () {
weui.tab('#tab', { defaultIndex: 1 });
console.log('setUser>>>>>>>>');
var url = this.url;
axios.get(url).then(function (response) {
store.commit('setUser', response.data);
}).catch(function (error) {
//error
})
console.log('载入消息2>>>>>>>>');
// 从存储载入消息
if(!isLoadedMSG) {
loadMessage(function(msgs){

@ -0,0 +1,97 @@
<div class="page js_show" v-if="node">
<div class="weui-header">
<router-link to="/pages/iot/nodes" class="weui-header-left">
<i class="ion ion-ios-arrow-back"></i>
</router-link>
<h1 class="weui-header-title">{{node.name}}</h1>
</div>
<div class="main">
<!--场景-->
<div class="row" v-if="scenes.length">
<div class="col col-md-12">
<div class="card" style="margin-top: 10px;">
<div class="card-header">场景</div>
<div class="card-body">
<div class="row">
<div class="col-md-2 col-sm-4 col-6 p-3" v-for="scene in scenes" v-on:click="execScene(scene.id)">
<div class="weui-grid__icon">
<img class="weui-tabbar__icon" :src="scene.image.replace('.png', '.svg')" style="width:48px;margin: auto auto" />
</div>
<p class="weui-grid__label" style="text-align: center;">{{scene.name}}</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!--环境-->
<!--<div class="col col-md-12 my-2 px-3">环境</div>-->
<div class="row">
<!--光强检测器-->
<div v-for="device in getDevices('光强检测器')" class="col" style="min-width:320px;">
<iot-light v-bind:device="device"></iot-light>
</div>
<!--温湿度传感器-->
<div v-for="device in getDevices('温湿度传感器')" class="col" style="min-width:320px;">
<iot-humiture v-bind:device="device"></iot-humiture>
</div>
<!--烟雾报警器-->
<div v-for="device in getDevices('烟雾报警器')" class="col" style="min-width:320px;">
<iot-smoke v-bind:device="device"></iot-smoke>
</div>
<!--人体感应器-->
<div v-for="device in getDevices('人体感应器')" class="col" style="min-width:320px;">
<iot-person v-bind:device="device"></iot-person>
</div>
<!--</div>
<div class="col col-md-12 my-2 px-3">用电</div>
<div class="row">-->
<!--调色灯-->
<div v-for="device in getDevices('调色灯')" class="col" style="min-width:320px;">
<iot-color-light v-bind:device="device"></iot-color-light>
</div>
<!--窗帘电机-->
<div v-for="device in getDevices('窗帘电机')" class="col" style="min-width:320px;">
<iot-curtain v-bind:device="device"></iot-curtain>
</div>
<!--一路开关-->
<div v-for="device in getDevices('一路开关')" class="col" style="min-width:320px;">
<iot-switch v-bind:device="device"></iot-switch>
</div>
<!--三路开关-->
<div v-for="device in getDevices('三路开关')" class="col" style="min-width:320px;">
<iot-switch3 v-bind:device="device"></iot-switch3>
</div>
<!--智能插座-->
<div v-for="device in getDevices('智能插座')" class="col" style="min-width:320px;">
<iot-socket v-bind:device="device"></iot-socket>
</div>
</div>
<!--<div class="col col-md-12 my-2 px-3">遥控器</div>-->
<div class="row">
<!--摄像头-->
<div v-for="device in getDevices('摄像头')" class="col" style="min-width:320px;">
<iot-camera v-bind:device="device"></iot-camera>
</div>
<!--红外转发器-->
<div v-for="device in getDevices('红外转发器')" class="col" style="min-width:320px;">
<iot-ir v-bind:device="device"></iot-ir>
</div>
<!--串口控制器-->
<div v-if="getShowFlag('串口控制器')" v-for="device in getDevices('串口控制器')" class="col" style="min-width:320px;">
<iot-serial-port v-bind:device="device"></iot-serial-port>
</div>
</div>
<!--test-->
<!--<hr />
<div class="row" v-if="node">
<div v-for="device in node.devices" class="col-lg-3 col col-md-4 col-sm-6">
<div class="weui-grid__icon">
<img :src="'/IoTCenter'+device.product.image" />
</div>
<p class="weui-grid__label">{{device.displayName}}</p>
</div>
</div>-->
</div>
</div>

@ -30,10 +30,12 @@
},
// 实例生命周期钩子 (销毁完毕)
destroyed: function () {
console.log('destroyed:');
store.commit('setDevice', null);
},
methods: {
updateChart: function () {
console.log('updateChart:');
var dataList = Enumerable.from(this.device.data).where(function (o) {
return o.type === 10 || o.type === 20;
}).toArray();
@ -42,6 +44,7 @@
}
},
changeTime: function (key, time,title) {
console.log('changeTime:');
var vm = this;
var t = (new Date()).valueOf();
var url = '/IoTCenter/api/v1/Device/GetChartData?t=' + t;
@ -54,12 +57,14 @@
.then(function (response) {
var data = response.data;
vm.UpdateChartInternal(key, data,title);
console.log('折线图更新成功');
})
.catch(function (error) {
console.log(error);
});
},
UpdateChartInternal(key, data, title) {
console.log('UpdateChartInternal:');
var canvas = document.getElementById(this.device.number + '-' + key);
var chart;
Chart.helpers.each(Chart.instances, function (instance) {
@ -67,6 +72,7 @@
chart = instance;
}
});
console.log('chart:', chart);
if (chart === '') {
chart.data = data;
@ -74,7 +80,8 @@
}
else {
var ctx = canvas.getContext('2d');
// ctx.canvas.height = 150;
console.log('canvas.getContext:', ctx);
var options = {
responsive: true,
legend: {
@ -117,8 +124,11 @@
},
computed: {
// 计算属性的 getter
device: function () {
device: function () {
console.log('++++++++++++++++debug++++++++++++++++');
console.log(store.state.device);
return store.state.device;
},
hasChart: function () {
// `this` 指向 app 实例
@ -131,9 +141,18 @@
}),
onMessage: function (event, model, to, from) {
// event : execApiResponse | dataEntityUpdated
console.log('@@@@ device.js @@@@')
console.log(event)
console.log('@@@@ device.js @@@@')
if(event === 'dataEntityUpdated'){
console.log('%%%%%%%%')
console.log(event)
console.log(model)
console.log(to)
console.log(from)
store.dispatch('update', {event, model, to, from});
}
}
//alert(event)
}
}
}

@ -123,20 +123,25 @@
this.flvPlayer.muted = this.muted;
var vm = this;
this.timer = setInterval(function () {
console.log('.');
if (vm.flvPlayer.statisticsInfo.speed === 0) {
console.log('reload1');
clearInterval(vm.timer);
vm.playByFlvJs();
}
else if (vm.decodedFrames && vm.flvPlayer.statisticsInfo.decodedFrames <= decodedFrames) {
console.log('reload2');
clearInterval(vm.timer);
vm.playByFlvJs();
}
else if (vm.flvPlayer.buffered.length > 0 && vm.flvPlayer.buffered.end(0) - vm.flvPlayer.currentTime > 2) {
console.log('reset currentTime');
vm.flvPlayer.currentTime = vm.flvPlayer.buffered.end(0) - 0.001;
}
vm.decodedFrames = vm.flvPlayer.statisticsInfo.decodedFrames;
}, 30 * 1000);
} catch (e) {
console.log('error:');
console.log(e);
}
}

@ -56,6 +56,7 @@
color: function () {
var h = Math.round(parseInt(this.hue || 128) * 360 / 255);
var result = 'hsl(' + h + ',100%,50%)';
console.log('color:'+result);
return result;
},
hsl: function () {
@ -63,6 +64,7 @@
var s = Math.round(parseInt(this.saturation || 128) * 100 / 254);
var l = Math.round(parseInt(this.brightness || 128) * 100 / 254);
var result = 'hsl(' + h + ',' + s + '%,' + l + '%);';
console.log('hsl:'+result);
return result;
}
}

@ -27,9 +27,11 @@
props: ['device'],
computed: {
electricity: function () {
console.log('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-electricity');
return parseFloat(getDeviceDataValue(this.device, '电量')||0).toFixed(2);
},
power: function (){
console.log('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$-power');
return parseFloat(getDeviceDataValue(this.device, '功率')||0).toFixed(2);
}
}

@ -25,47 +25,164 @@
</div>
</div>
<!--环境-->
<!--<div class="col col-md-12 my-2 px-3">环境</div>-->
<div class="row">
<div class="row" style="background-color: #35A9FE">
<!--光强检测器-->
<div v-for="device in getDevices('光强检测器')" class="col" style="min-width:320px;">
<iot-light v-bind:device="device"></iot-light>
<div v-for="device in getDevices('光强检测器')" class="col-3" style="padding:5px">
<template>
<div class="light align-self-center" style="box-sizing:border-box;">
<div class="row" style="height:100%;margin: 0 auto;padding:0px;">
<div class="col-12 align-self-center " style="text-align:center; padding-bottom:15px;">
<img class="mh-100" src="/images/white-light.svg" style="width:24px;" />
</div>
<div class="col-12 align-self-center" style="line-height:14px;text-align:center;font-size:12px;padding:5px;color: #ffffff;">
<span style="display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; word-break: break-all;">{{getDeviceData(device,'光照度')}}</span>
</div>
</div>
</div>
</template>
<script>
({
props: ['device']
});
</script>
</div>
<!--温湿度传感器-->
<div v-for="device in getDevices('温湿度传感器')" class="col" style="min-width:320px;">
<iot-humiture v-bind:device="device"></iot-humiture>
<div v-for="device in getDevices('温湿度传感器')" class="col-3" style="padding:5px">
<template>
<div class="light align-self-center" style="box-sizing:border-box;">
<div class="row" style="height:100%;margin: 0 auto; padding:0px;">
<div class="col-12 align-self-center " style="text-align:center; padding-bottom:15px;">
<img class="mh-100" src="/images/white-humiture.svg" style="width:24px" />
</div>
<div class="col-12 align-self-center" style="line-height:14px;text-align:center;font-size:12px;padding:5px;color: #ffffff;">
<span>
{{getDeviceData(device,'温度')}}
</span>
<span>
{{getDeviceData(device,'湿度')}}
</span>
</span>
</div>
</div>
</div>
</template>
<script>
({
props: ['device']
});
</script>
</div>
<!--烟雾报警器-->
<div v-for="device in getDevices('烟雾报警器')" class="col" style="min-width:320px;">
<!--<div v-for="device in getDevices('烟雾报警器')" class="col" style="min-width:320px;">
<iot-smoke v-bind:device="device"></iot-smoke>
</div>
</div>-->
<!--人体感应器-->
<div v-for="device in getDevices('人体感应器')" class="col" style="min-width:320px;">
<iot-person v-bind:device="device"></iot-person>
<div v-for="device in getDevices('人体感应器')" class="col-3" style="padding:5px">
<template>
<div class="light align-self-center" style="box-sizing:border-box;">
<div class="row" style="height:100%;margin: 0 auto;padding:0px;">
<div class="col-12 align-self-center " style="text-align:center; padding-bottom:15px;">
<img src="/images/white-person.svg" class="mh-100" style="width:24px;" />
</div>
<div class="col-12 align-self-center" style="line-height:14px;text-align:center;font-size:12px;padding:5px;color: #ffffff;">
<span>
<span v-if="getDeviceDataValue(device,'状态')==='正常'">
{{getDeviceDataValue(device,'状态')}}
</span>
<span v-else>
{{getDeviceDataValue(device,'状态')}}
</span>
</span>
</div>
</div>
</div>
</template>
<script>
({
props: ['device']
});
</script>
</div>
<!--</div>
<div class="col col-md-12 my-2 px-3">用电</div>
<div class="row">-->
</div>
<!--控制-->
<div class="row">
<!--调色灯-->
<div v-for="device in getDevices('调色灯')" class="col" style="min-width:320px;">
<div v-for="device in getDevices('调色灯')" class="col" style="padding:5px">
<iot-color-light v-bind:device="device"></iot-color-light>
</div>
<!--窗帘电机-->
<div v-for="device in getDevices('窗帘电机')" class="col" style="min-width:320px;">
<div v-for="device in getDevices('窗帘电机')" class="col" style="padding:5px">
<iot-curtain v-bind:device="device"></iot-curtain>
</div>
<!--一路开关-->
<div v-for="device in getDevices('一路开关')" class="col" style="min-width:320px;">
<iot-switch v-bind:device="device"></iot-switch>
<div v-for="device in getDevices('一路开关')" class="col-6" style="padding:5px">
<template>
<div class="card switch" style="box-sizing:border-box;height:130px;">
<div class="card-header" style="background-color: #fff;border-bottom-color: #fff; font-size: 14px;padding:10px 15px;">
{{device.displayName}}
<span class="float-right text-success" v-if="device.isOnline"><i class="ion ion-ios-wifi"></i></span>
<span class="float-right text-danger" v-else><i class="ion ion-ios-wifi"></i></span>
</div>
<div class="card-body" style="padding:0px">
<div class="row" style="height:100%;margin: 0 auto;">
<div class="col-7 align-self-center">
<img class="mh-100" src="/images/switch1.svg" style="width:32px;" />
</div>
<div class="col-5 align-self-center">
<div class="row" style="line-height:28px; text-align: right;">
<img style="height:32px;width:32px;padding:5px;border:solid #cccccc 1px;border-radius:50%;margin-left: 10px;" v-if="getDeviceDataValue(device,'状态')=='开'" v-on:click="execApi(device.number,'/Switch/Off')" src="/images/on.svg" />
<img style="height:32px;width:32px;padding:5px;border:solid #cccccc 1px;border-radius:50%;margin-left: 10px;" v-if="getDeviceDataValue(device,'状态')=='关'" v-on:click="execApi(device.number,'/Switch/On')" src="/images/off.svg" />
</div>
</div>
</div>
</div>
</div>
</template>
<script>
({
props: ['device']
});
</script>
</div>
<!--三路开关-->
<div v-for="device in getDevices('三路开关')" class="col" style="min-width:320px;">
<div v-for="device in getDevices('三路开关')" class="col" style="padding:5px">
<iot-switch3 v-bind:device="device"></iot-switch3>
</div>
<!--智能插座-->
<div v-for="device in getDevices('智能插座')" class="col" style="min-width:320px;">
<iot-socket v-bind:device="device"></iot-socket>
<div v-for="device in getDevices('智能插座')" class="col-6" style="padding:5px">
<template>
<div class="card socket" style="box-sizing:border-box;height:130px;">
<div class="card-header" style="background-color: #fff;border-bottom-color: #fff; font-size: 14px;padding:10px 15px;">
{{device.displayName}}
<span class="float-right text-success" v-if="device.isOnline"><i class="ion ion-ios-wifi"></i></span>
<span class="float-right text-danger" v-else><i class="ion ion-ios-wifi"></i></span>
</div>
<div class="card-body"style="padding:0px">
<div class="row" style="height:50%;margin: 0 auto;">
<div class="col-7 align-self-center">
<img class="mh-100" src="/images/socket.svg" style="width:32px;" />
</div>
<div class="col-5 align-self-center">
<div class="row" style="line-height:28px;">
<img style="height:32px;width:32px;padding:5px;border:solid #cccccc 1px;border-radius:50%;margin-left: 10px;" v-if="getDeviceDataValue(device,'状态')==='开'" v-on:click="execApi(device.number,'/Socket/Off')" :src="config.apigateway+'/IoTCenter/images/on.png'" />
<img style="height:32px;width:32px;padding:5px;border:solid #cccccc 1px;border-radius:50%;margin-left: 10px;" v-else="getDeviceDataValue(device,'状态')==='关'" v-on:click="execApi(device.number,'/Socket/On')" :src="config.apigateway+'/IoTCenter/images/off.png'" />
</div>
</div>
</div>
<div class="row" style="margin: 0 auto;">
<span class="badge badge-info" style="line-height:14px;margin: 10px 0px 5px 15px;color: #666;background-color: #f5f5f5;font-weight: normal;" v-if="getDeviceDataValue(device, '电量')">{{parseFloat(getDeviceDataValue(device, '电量')||0).toFixed(2)}} kW‧h</span>
<span class="badge badge-info" style="line-height:14px;margin: 10px 0px 5px 15px;color: #666;background-color: #f5f5f5;font-weight: normal;" >{{parseFloat(getDeviceDataValue(device, '功率')||0).toFixed(2)}} W</span>
</div>
</div>
</div>
</template>
<script>
({
props: ['device'],
});
</script>
</div>
</div>
<!--<div class="col col-md-12 my-2 px-3">遥控器</div>-->

@ -30,6 +30,8 @@
},
getShowFlag:function (name){
arr = Enumerable.from(this.node.devices).where(function (o) { return o.name === name; }).toArray();
console.log('arrarrarrarr', arr)
console.log('arrarrarrarr', JSON.parse(arr[0].data[0].value)[0].name)
return JSON.parse(arr[0].data[0].value)[0].name !== '测试' ? true : false;
},
getDeviceDataAttr: function (number, name, attr) {
@ -57,9 +59,18 @@
}),
onMessage: function (event, model, to, from) {
// event : execApiResponse | dataEntityUpdated
console.log('@@@@ node.js @@@@')
console.log(event)
console.log('@@@@ node.js @@@@')
if(event === 'dataEntityUpdated'){
console.log('%%%%%%%%')
console.log(event)
console.log(model)
console.log(to)
console.log(from)
store.dispatch('update', {event, model, to, from});
}
//alert(event)
}
}
}

@ -36,10 +36,18 @@
}),
onMessage: function (event, model, to, from) {
// event : deviceEntityDeleted | productEntityInserted
console.log('@@@@')
console.log(event)
// 当当前为产品设备列表页面时,刷新产品设备列表 (由于每次进入页面都触发数据刷新,非当前页面则不做数据更新处理)
var number = getUrlKey('number');
if(event === 'productEntityInserted'){
console.log('%%%%%%%%')
console.log(event)
console.log(model)
console.log(to)
console.log(from)
store.dispatch('getProducts', {event, model, to, from});
// 向产品设备列表中新增
store.dispatch('getProduct', {number:number});

@ -33,9 +33,17 @@ function pages_iot_products() {
}),
onMessage: function (event, model, to, from) {
// event : execApiResponse | dataEntityUpdated
console.log('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
console.log(event)
if(event === 'productEntityInserted'){
console.log('%%%%%%%%')
console.log(event)
console.log(model)
console.log(to)
console.log(from)
store.dispatch('getProducts', {event, model, to, from});
}
//alert(event)
}
}
}

@ -11,9 +11,11 @@
};
},
mounted: function () {
console.log('mounted:login');
weui.form.checkIfBlur('#form', this.regexp);
// 绑定enter事件
this.enterKeyup();
console.log('mounted:enterKeyup');
},
computed: {
regexp: function () {

Loading…
Cancel
Save