You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/IoT.Shared/Areas/Admin/Views/Command/_Script.cshtml

70 lines
3.1 KiB

<script>
$(function () {
$('#NodeId').change(function () {
var id = $(this).find(':selected').val();
update('@Url.Action("GetSceneJson", "Ajax")', id, "#SceneId");
update('@Url.Action("GetDeviceJson", "Ajax")', id, "#DeviceId");
update(null, null, "#ApiId");
$('#ajax').html('');
});
$('#DeviceId').change(function () {
var id = $(this).find(':selected').val();
update('@Url.Action("GetApiJson", "Ajax")', id, "#ApiId");
$('#ajax').html('');
});
$('#ApiId').change(function () {
var id = $(this).find(':selected').val();
$('#Url').parent().find('#ajax').html('');
var url = '@Url.Action("Api")?apiId=' + encodeURI(id) + '&deviceId=' + encodeURI($('#DeviceId').val());
$.get(url, function (html) {
$('#ajax').html(html);
reset();
});
});
$('body').on('change','.irKeyType',function () {
var id = $(this).find(':selected').val();
$('#ajax2').html('');
if (id) {
var url = '@Url.Action("Code")?type=' + encodeURI(id) + '&code=' + encodeURI($('#ircodeid').val())+ '&name=' + encodeURI($('#ajax2').attr('data-name'))+ '&deviceId=' + encodeURI($('#DeviceId').val());
$.get(url, function (html) {
$('#ajax2').html(html);
reset();
});
}
});
$('body').on('change', "input[type='range']", function (e) {
$(this).prev().find('span').html(parseInt(e.target.value) + 15);
});
});
function AirChange(e) {
var form = $('#ircodediv');
var list = {};
list['power'] = form.find("[name = 'power']:checked").val();
list['pattern'] = form.find("[name = 'pattern']:checked").val();
list['direction'] = form.find("[name = 'direction']:checked").val();
list['wind'] = form.find("[name = 'wind']:checked").val();
list['temperature'] = form.find("[name = 'temperature']").val();
list[event.target.name] = event.target.value;
code = 0;
for (var name in list) {
code += parseInt(list[name]);
}
$('#ircodeid').val(code);
}
function CodeChange(e) {
var form = $('#ircodediv');
var list = {};
list['power'] = form.find("[name = 'power']:checked").val();
list['pattern'] = form.find("[name = 'pattern']:checked").val();
list['direction'] = form.find("[name = 'direction']:checked").val();
list['wind'] = form.find("[name = 'wind']:checked").val();
list['temperature'] = form.find("[name = 'temperature']").val();
list[event.target.name] = event.target.value;
code = 0;
for (var name in list) {
code += parseInt(list[name]);
}
$('#ircodeid').val(code);
}
</script>