window.submitUrl = "/Pages/business/SeckillInfoEdit.aspx"; //设置当前页的提交路径 window.FastKeyDistinctived = true; //例外快捷键(不使用通用快捷键) /* 获取数据 */ function GetData(isReturnJson) { try { var data = { BusinessInfoName: "", PrintTypeId: "14", BusinessContent: document.getElementById('txtBusinessContent').value, Contacts: document.getElementById('txtContacts').value, ContactPhone: document.getElementById('txtContactPhone').value, QQ: document.getElementById('txtQQ').value, EndTime: document.getElementById('txtEndTime').value, State: document.getElementById('selState').value, Remark: "" }; } catch (ex) { global.DealDataException(ex); return; } var keyid = document.getElementById('txtKeyid').value; // if (!keyid &&document.getElementById('ckIsSaveAndPublish').checked) { data['State'] = -1; } //勾选了保存时发布后将状态保存为发布 if (keyid) { data.Keyid = keyid; } else { } window.NoneData = window.NoneData ? window.NoneData : data; return isReturnJson ? data : window.ConvertJsonToString(data); } /* 设置数据到界面 */ function SetData(data) { window.SetJsonToDom(data); //document.getElementById('selPrintTypes').value = data.PrintTypeId; document.getElementById('selState').value = data.State; window.IsNoName = !data.BusinessInfoName; document.getElementById('ckIsSaveAndPublish').checked = !data.Keyid; } /* 验证界面 */ function ValidateForm() { if (window.isShower) return false; else; document.getElementById('btnSave').focus(); var txtEndTime = document.getElementById('txtEndTime'); if (!txtEndTime) return; else; if (Date.Parse(txtEndTime.value) <= Date_ForDay()) { alertMsg('截止日期不能小于当前时间'); txtEndTime.focus(); return false; } return verfy_form(document.forms[0]); } /* 保存(新增/修改) */ function Save() { if (!ValidateForm()) return; else; GetData(); CallServer({ Target: "SaveInfo", RequestParams: GetData() }, function (data, textStatus) { DefaultSuccessCallback(data, textStatus); window.Saved = '1' == data; }); } var keyDownHook = new KeyBehaviorHook('keydown'); keyDownHook.Regist(window.Keys.S, "Save()", window.WithKey.Ctrl); //Ctrl+s 保存 keyDownHook.Regist(window.Keys.Enter, "Save()", window.WithKey.Ctrl); //Ctrl+Enter 保存 keyDownHook.Regist(window.Keys.R, "ClearData()", window.WithKey.Ctrl); //Ctrl+R 重置 keyDownHook.Regist(window.Keys.Q, "CloseOpenWindow(window.Saved)", window.WithKey.Ctrl); //Ctrl+Q 退出(Quit) $(function () { keyDownHook.Binding(); global.SetReqMsg(); //设置空信息提示 // var txtTemp1 = document.createElement('input'); // txtTemp1.style.display = 'none'; // top.frmright.document.appendChild(txtTemp1); // $(document).keydown(function (e) { alert(e.keycode); }); // txtTemp1.focus(); try { var thisForm = document.forms[0]; var data = document.getElementById('txtModeldata').value; var tr_sap = document.getElementById('tr_sap'); if (tr_sap) tr_sap.style.display = data ? 'none' : ''; if (data) { window.NoneData = eval('[' + data + ']')[0]; window.NoneData.EndTime = window.NoneData.EndTime.ToString('yyyy-MM-dd HH:mm'); if (thisForm && thisForm.id == 'formShower') { ShowData(); return; } //当是展示页面引用该js时用 } else GetData(); var id = $("#txtKeyid").val(); if (id != "") { $("#stateTr").show(); } } catch (e) { GetData(); } ClearData(); }); /* 清空界面值 */ function ClearData() { if (window.NoneData && !window.isShower) { var isNew = false; window.NoneData.EndTime = (isNew = window.NoneData.EndTime) ? window.NoneData.EndTime : new Date().ToFuture({ day: 1 }).ToString('yyyy-MM-dd'); SetData(window.NoneData); window.NoneData.EndTime = isNew ? window.NoneData.EndTime : ''; } else { ReLoad(); } } /* 显示信息 */ function ShowData() { window.isShower = true; window.NoneData.PrintTypeName = window.NoneData.PrintType.PrintName; // window.NoneData.StateName = window.NoneData.StateType.Name; window.NoneData.SellerName = window.NoneData.MemberBasic.Name; window.NoneData.CreateTime = window.NoneData.CreateTime.ToString('yyyy-MM-dd'); window.NoneData.LastUpdateTime = window.NoneData.LastUpdateTime.ToString('yyyy-MM-dd'); window.SetJsonToDom(window.NoneData, 'spn', "innerHTML"); } function printTypeChange(sel) { var txtBusinessInfoName = document.getElementById('txtBusinessInfoName'); txtBusinessInfoName.value = window.IsNoName ? (sel.value ? sel.options[sel.selectedIndex].text : '') : txtBusinessInfoName.value; }