初始化CRICS
This commit is contained in:
127
WebSite/Scripts/room-control-index.js
Normal file
127
WebSite/Scripts/room-control-index.js
Normal file
@@ -0,0 +1,127 @@
|
||||
function addRoomControrl() {
|
||||
$("#dialog")
|
||||
.find('.dlg-content').panel({ height: 240, href: '/RoomControl/Edit/', queryParams: {} }).end()
|
||||
.find('.dlg-footer .dlg-btn-save').unbind('click').bind('click', saveRoomControrl).end()
|
||||
.dialog({
|
||||
title: lang.NewRoomControl,
|
||||
width: 360,
|
||||
height: 340
|
||||
})
|
||||
.dialog("open");
|
||||
}
|
||||
|
||||
function editRoomControrl(row) {
|
||||
var row = row || $('#dg').datagrid('getSelected');
|
||||
if (row) {
|
||||
$("#dialog")
|
||||
.find('.dlg-content').panel({ height: 240, href: '/RoomControl/Edit/', queryParams: { ID: row.ID} }).end()
|
||||
.find('.dlg-footer .dlg-btn-save').unbind('click').bind('click', saveRoomControrl).end()
|
||||
.dialog({
|
||||
title: lang.EditRoomControl,
|
||||
width: 360,
|
||||
height: 340
|
||||
})
|
||||
.dialog("open");
|
||||
} else {
|
||||
$.tools.alert(lang.PleaseSelectTheData);
|
||||
}
|
||||
}
|
||||
|
||||
function saveRoomControrl() {
|
||||
var form = $('#dialog').find('form');
|
||||
if (form.form('enableValidation').form('validate')) {
|
||||
var entry = form.serializeJson();
|
||||
if (entry.RoomTypeSceneID == 0) {
|
||||
$.tools.alert(lang.PleaseSelectScene);
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.RoomTypeID instanceof Array) {
|
||||
entry.RoomTypeID = entry.RoomTypeID[entry.RoomTypeID.length - 1];
|
||||
}
|
||||
if (entry.HostIDs instanceof Array) {
|
||||
entry.HostIDs = entry.HostIDs.join(",");
|
||||
}
|
||||
if (entry.TimingDay instanceof Array) {
|
||||
entry.TimingDay = entry.TimingDay.join(",");
|
||||
}
|
||||
if (entry.Timing instanceof Array) {
|
||||
entry.Timing = entry.Timing.join(",");
|
||||
}
|
||||
var param = { jsonData: JSON.stringify(entry) };
|
||||
|
||||
$.tools.post(param, '/RoomControl/SaveRoomControrl/', function () {
|
||||
$('#dg').datagrid('reload');
|
||||
$('#dialog').window('close');
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
//刪除
|
||||
function del() {
|
||||
var rows = $('#dg').datagrid('getSelections');
|
||||
if (!rows || rows.length == 0) {
|
||||
$.tools.alert(lang.PleaseSelectTheData);
|
||||
return;
|
||||
}
|
||||
var param;
|
||||
$.each(rows, function (i, n) {
|
||||
if (i == 0) {
|
||||
param = 'idList=' + n.ID;
|
||||
}
|
||||
else {
|
||||
param += '&idList=' + n.ID;
|
||||
}
|
||||
});
|
||||
$.tools.delPost(param, '/RoomControl/Delete/', function () {
|
||||
$('#dg').datagrid('clearSelections');
|
||||
$('#dg').datagrid('reload');
|
||||
}, this);
|
||||
}
|
||||
//启停设置
|
||||
function setActiveIndicator() {
|
||||
var rows = $('#dg').datagrid('getSelections');
|
||||
if (!rows || rows.length == 0) {
|
||||
$.tools.alert(lang.PleaseSelectTheData);
|
||||
return;
|
||||
}
|
||||
var param;
|
||||
$.each(rows, function (i, n) {
|
||||
if (i == 0) {
|
||||
param = 'idList=' + n.ID;
|
||||
}
|
||||
else {
|
||||
param += '&idList=' + n.ID;
|
||||
}
|
||||
});
|
||||
$.tools.post(param, '/RoomControl/SetActiveIndicator/', function () {
|
||||
$('#dg').datagrid('clearSelections');
|
||||
$('#dg').datagrid('reload');
|
||||
}, this);
|
||||
}
|
||||
//选择楼层加载房型、房号下拉选项
|
||||
function cbtFloorOnSelect(r) {
|
||||
/*var groupID = r.ID;
|
||||
if (groupID != 0) {
|
||||
$("#cbxRoomType").combobox("clear").combobox("reload", "/RoomControl/loadRoomType/?groupID=" + groupID);
|
||||
$("#cbxRoomNumber").combobox("clear").combobox("reload", "/RoomControl/loadRoomNumber/?groupID=" + groupID);
|
||||
}
|
||||
else {
|
||||
$("#cbxRoomType").combobox("clear").combobox("reload", "/RoomType/LoadDataForRoomTypeCombobox");
|
||||
$("#cbxRoomNumber").combobox("clear").combobox("reload", "/Host/LoadDataForRoomNumberCombobox");
|
||||
}*/
|
||||
}
|
||||
//选择房型改变场景、设备下拉选项
|
||||
function cbxRoomTypeOnSelect(r) {
|
||||
$('#cbxRoomNumber').combogrid({ url: '/RoomControl/LoadRoomNumberCombobox', queryParams: { roomTypeID: r.ID} });
|
||||
$("#cbxSceneName").combobox("clear").combobox("reload", "/RoomControl/LoadRoomTypeScene/?roomTypeID=" + r.ID);
|
||||
}
|
||||
//选择定时类型事件
|
||||
function cbxTimingTypeOnSelect(r) {
|
||||
var timeType = 0;
|
||||
if (r != undefined && r != null) {
|
||||
timeType = r.value;
|
||||
}
|
||||
$('#cbxTimeDay').combogrid({ url: '/RoomControl/LoadTimeDay', queryParams: { timeType: timeType} });
|
||||
}
|
||||
$(function () {
|
||||
});
|
||||
Reference in New Issue
Block a user