/// (function () { $.fn.combotree.defaults.editable = true; $.extend($.fn.combotree.defaults.keyHandler, { up: function () { console.log('up'); }, down: function () { console.log('down'); }, enter: function () { console.log('enter'); }, query: function (q) { var t = $(this).combotree('tree'); var nodes = t.tree('getChildren'); for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; if (node.text.indexOf(q) >= 0) { $(node.target).show(); } else { $(node.target).hide(); } } var opts = $(this).combotree('options'); if (!opts.hasSetEvents) { opts.hasSetEvents = true; var onShowPanel = opts.onShowPanel; opts.onShowPanel = function () { var nodes = t.tree('getChildren'); for (var i = 0; i < nodes.length; i++) { $(nodes[i].target).show(); } onShowPanel.call(this); }; $(this).combo('options').onShowPanel = opts.onShowPanel; } } }); })(jQuery); jQuery.ajaxSetup({ complete: function (data) { //对返回的数据data做判断, //session过期的话,就location到一个页面 if (data.responseText == 'TimeOut') { alert("登录超时,请重新登录!"); top.location.href = '../Default.aspx'; } } }); //function initAddKey() { // $("#hid_UserType").val("add"); // $('#txtEquipmentNo').val(""); // //$('#cbLockKeyTypeNo').val(""); // $('#TextRegionGroupsNo').combotree('setValue', $('#Hid_treeValue').val()); // $('#TextUserNo').val(""); // $('#TextKeyName').val(""); // $('#winSetKeyInfo').window('open'); //} function initEditKey(row) { $("#hid_UserType").val("modify"); $("#hid_KeyBoxNo").val(row.KeyBoxNo); $('#txtKeyBoxName').val(row.KeyBoxName); $('#txtBoxEquipNum').val(row.BoxEquipNum); $('#txtPosition').val(row.Position); $('#txtRegionGroupName').combotree('setValue', row.RegionGroupNo); $('#winSetKeyBoxInfo').window('open'); } function submit() { // if (!$('#txtBoxEquipNum').val()) { // $.messager.alert('提醒', '设备号不能为空', 'error'); // return; // } //// if (!$('#TextUserNo').val()) { //// $.messager.alert('提醒', '保管人不能为空', 'error'); //// return; //// } var type = ""; if ($("#hid_UserType").val() === "modify") { type = "modify"; } console.log(type); $.post("../EquipmentAjax/KeyBoxEditAjax.aspx", { Type: type, KeyBoxNo: $("#hid_KeyBoxNo").val(), KeyBoxName: $('#txtKeyBoxName').val(), BoxEquipNum: $('#txtBoxEquipNum').val(), Position: $('#txtPosition').val(), RegionNo: $('#txtRegionGroupName').combotree('getValue') }, function(msg) { if (msg === "true") { $.messager.alert('提示', '操作成功!'); window.flashTable(); $('#winSetKeyBoxInfo').window('close'); } else { $.messager.alert('提示', msg, 'error'); } }); console.log(2); } function ShowKeyBoxKey(row) { $('#boxKeyBoxName').val(row.KeyBoxName); $('#boxBoxEquipNum').val(row.BoxEquipNum); $('#boxPosition').val(row.Position); $('#boxRegionGroupName').val(row.RegionGroupName); $('#dgKey').datagrid({ url: '../EquipmentAjax/KeyInBoxListAjax.aspx?BoxEquipNum=' + escape(row.BoxEquipNum), singleSelect: true, method: 'post', multiSort: false, toolbar: "#tbKey", rownumbers: false, remoteSort: false, pagination: true, pageSize: 20 }); $("#winGetKeyBoxKeyInfo").window("open"); } function ShowUserSelector() { flashUsersAuthTable(); $("#winGetUserInfo").window("open"); } function resetSearchUser() { document.getElementById("txtName").value = ""; document.getElementById("TextPosition").value = ""; } function f_searchuser() { $('#dgUserSearch').datagrid({ url: '../apply/UserListAjax.aspx?username=' + escape(document.getElementById("txtName").value) + '&position=' + escape(document.getElementById("TextPosition").value) }); } function flashUsersAuthTable() { $('#dgUserSearch').datagrid({ url: '../LockAuthMG/getUsersByRegionNo.ashx?regionno=' + $("#Hid_treeValue3").val() }); } function ConfirmClickUser() { var rows = $('#dgUserSearch').datagrid('getSelections'); if (rows.length === 1) { var row = rows[0]; //window.returnValue = row.UserName; //window.close(); document.getElementById("TextUserNo").value = row.UserNo; $("#winGetUserInfo").window("close"); } else { //alert("请选择一条记录进行操作"); } } function initTreeSelect3(node, data) { //var rootNode = data[0].children[0]; var rootNode = $('#tt').tree('getRoot'); $('#tt').tree('select', rootNode.target); var node = $('#tt').tree('getSelected'); document.getElementById("Hid_treeValue3").value = node.id; if (data) { var childrens = $("#tt").tree("getChildren", rootNode.target); if (childrens) { for (var i = 0; i < childrens.length; i++) { $("#ut1").tree("collapse", childrens[i].target); } } } flashUsersAuthTable(); } function loadTarget3() { var node = $('#tt').tree('getSelected'); document.getElementById("Hid_treeValue3").value = node.id; flashUsersAuthTable(); }