Former-commit-id: 17b94243f7f3c6afd2e872fa44a3e3835ec88ed5
TangShanKaiPing
wanggang 6 years ago
parent 990f71cd98
commit 75df4dab81

@ -197,8 +197,8 @@
<div class="row">
<div class="col-md-3" v-for="device in GetDevices('一路开关')">
<div class="row" style="background-color:#fff;border:1px solid #eee;border-radius:5px;text-align:center;padding:10px 0;margin:10px 0">
<img v-if="GetDataValue(device.Number,'状态')=='开'" v-on:click="CallApi(device.Number,'/Socket/Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'状态')=='关'" v-on:click="CallApi(device.Number,'/Socket/On')" src="/images/off.png" />
<img v-if="GetDataValue(device.Number,'状态')=='开'" @click="CallApi(device.Number,'/Socket/Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'状态')=='关'" @click="CallApi(device.Number,'/Socket/On')" src="/images/off.png" />
</div>
<div class="row" style="text-align:center;">
{{device.Name||device.DisplayName}}
@ -218,12 +218,12 @@
<div class="row">
<div class="col-md-3" v-for="device in GetDevices('三路开关')">
<div class="row" style="background-color:#fff;border:1px solid #eee;border-radius:5px;text-align:center;padding:10px 0;margin:10px 0">
<img v-if="GetDataValue(device.Number,'L1状态')=='开'" v-on:click="CallApi(device.Number,'/Switch3/L1Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'L1状态')=='关'" v-on:click="CallApi(device.Number,'/Switch3/L1On')" src="/images/off.png" />
<img v-if="GetDataValue(device.Number,'L2状态')=='开'" v-on:click="CallApi(device.Number,'/Switch3/L2Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'L2状态')=='关'" v-on:click="CallApi(device.Number,'/Switch3/L2On')" src="/images/off.png" />
<img v-if="GetDataValue(device.Number,'L3状态')=='开'" v-on:click="CallApi(device.Number,'/Switch3/L3Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'L3状态')=='关'" v-on:click="CallApi(device.Number,'/Switch3/L3On')" src="/images/off.png" />
<img v-if="GetDataValue(device.Number,'L1状态')=='开'" @click="CallApi(device.Number,'/Switch3/L1Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'L1状态')=='关'" @click="CallApi(device.Number,'/Switch3/L1On')" src="/images/off.png" />
<img v-if="GetDataValue(device.Number,'L2状态')=='开'" @click="CallApi(device.Number,'/Switch3/L2Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'L2状态')=='关'" @click="CallApi(device.Number,'/Switch3/L2On')" src="/images/off.png" />
<img v-if="GetDataValue(device.Number,'L3状态')=='开'" @click="CallApi(device.Number,'/Switch3/L3Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'L3状态')=='关'" @click="CallApi(device.Number,'/Switch3/L3On')" src="/images/off.png" />
</div>
<div class="row" style="text-align:center;">
{{device.Name||device.DisplayName}}
@ -242,8 +242,8 @@
<div class="row">
<div class="col-md-3" v-for="device in GetDevices('智能插座')">
<div class="row" style="background-color:#fff;border:1px solid #eee;border-radius:5px;text-align:center;padding:10px 0;margin:10px 0">
<img v-if="GetDataValue(device.Number,'状态')=='开'" v-on:click="CallApi(device.Number,'/Socket/Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'状态')=='关'" v-on:click="CallApi(device.Number,'/Socket/On')" src="/images/off.png" />
<img v-if="GetDataValue(device.Number,'状态')=='开'" @click="CallApi(device.Number,'/Socket/Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'状态')=='关'" @click="CallApi(device.Number,'/Socket/On')" src="/images/off.png" />
</div>
<div class="row" style="text-align:center;">
{{device.Name||device.DisplayName}}
@ -252,6 +252,51 @@
</div>
</div>
</div>
<div class="box box-solid btns">
<template v-for="device in GetDevices('调色灯')">
<div class="row" style="text-align:center;">
{{device.Name||device.DisplayName}}
</div>
<div class="row" style="background-color:#fff;border:1px solid #eee;border-radius:5px;text-align:center;padding:10px 0;margin:10px 0">
<img v-if="GetDataValue(device.Number,'状态')=='开'" @click="CallApi(device.Number,'/ColorLight/Off')" src="/images/on.png" />
<img v-if="GetDataValue(device.Number,'状态')=='关'" @click="CallApi(device.Number,'/ColorLight/On')" src="/images/off.png" />
</div>
<div class="row" style="background-color:#fff;border:1px solid #eee;border-radius:5px;text-align:center;padding:10px 0;margin:10px 0">
<form method="get" action="/App/Exec">
<input type="hidden" name="Number" :value="device.Number" />
<input type="hidden" name="Method" value="/ColorLight/SetBrightness" />
<div class="row">
<div class="col-md-3">
亮度:
</div>
<div class="col-md-9">
<input @change="AjaxSubmit($event)" type="range" min="0" step="1" max="255" name="Brightness" :value="GetDataValue(device.Number,'亮度')" />
</div>
</div>
</form>
</div>
<form method="get" action="/App/Exec">
<input type="hidden" name="Number" :value="device.Number" />
<input type="hidden" name="Method" value="/ColorLight/SetColor" />
<div class="row" style="background-color:#fff;border:1px solid #eee;border-radius:5px;text-align:center;padding:10px 0;margin:10px 0">
<div class="col-md-3">
色调:
</div>
<div class="col-md-9">
<input @change="AjaxSubmit($event)" type="range" min="0" step="1" max="255" name="Hue" :value="GetDataValue(device.Number,'色调')" />
</div>
</div>
<div class="row" style="background-color:#fff;border:1px solid #eee;border-radius:5px;text-align:center;padding:10px 0;margin:10px 0">
<div class="col-md-3">
饱和度:
</div>
<div class="col-md-9">
<input @change="AjaxSubmit($event)" type="range" min="0" step="1" max="255" name="Saturation" :value="GetDataValue(device.Number,'饱和度')" />
</div>
</div>
</form>
</template>
</div>
</div>
</div>
<script>
@ -598,7 +643,15 @@
return null;
},
CallApi(number, method) {
ajax('/App/Exec', { number: number, method: method }, 'post');
ajax('/App/Exec', { number: number, method: method, query: query }, 'post');
},
AjaxSubmit(event) {
var form = $(event.target).parents('form');
var url = form.attr('action') + '?' + form.serialize();
Vue.nextTick(function () {
ajax(url, null, 'get');
});
return false;
}
},
destroy() {

Loading…
Cancel
Save