|
window.submitUrl = "/Pages/business/SeckillBusinessEdit.aspx"; //设置当前页的提交路径
|
window.FastKeyDistinctived = true; //例外快捷键(不使用通用快捷键)
|
/*
|
获取数据
|
*/
|
function GetData(isReturnJson) {
|
try {
|
var data = {
|
BusinessName: document.getElementById('txtBusinessName').value,
|
PrintTypeId: document.getElementById('selPrintTypes').value,
|
Specifications: document.getElementById('txtSpecifications').value,
|
OrderCount: document.getElementById('txtOrderCount').value,
|
PrintCount: document.getElementById('txtPrintCount').value,
|
Price: document.getElementById('txtPrice').value,
|
SurplusOrderCount: document.getElementById('txtSurplusOrderCount').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: document.getElementById('txtRemark').value
|
};
|
} 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 == null || data.PrintTypeId == "") ? "14" : data.PrintTypeId);
|
document.getElementById('selState').value = data.State;
|
window.IsNoName = !data.BusinessName;
|
document.getElementById('ckIsSaveAndPublish').checked = !data.Keyid;
|
if (!data.Keyid) {
|
$("#EditStatus").hide();
|
}
|
}
|
|
/*
|
验证界面
|
*/
|
function ValidateForm() {
|
if (window.isShower) return false; else;
|
document.getElementById('btnSave').focus();
|
var txtEndTime = document.getElementById('txtEndTime');
|
if (!txtEndTime) return; else;
|
|
var date = new Date();
|
var seperator1 = '-';
|
var seperator2 = ':';
|
var month = date.getMonth() + 1;
|
var strDate = date.getDate();
|
if (month >= 1 && month <= 9) {
|
month = '0' + month;
|
}
|
if (strDate >= 0 && strDate <= 9) {
|
strDate = '0' + strDate;
|
}
|
var currentdate = date.getYear() + seperator1 + month + seperator1 + strDate
|
+ ' ' + date.getHours() + seperator2 + date.getMinutes();
|
if (txtEndTime.value <= currentdate) {
|
alertMsg('截止日期不能小于当前时间');
|
txtEndTime.focus();
|
return false;
|
}
|
return verfy_form(document.forms[0]);
|
}
|
/*
|
保存(新增/修改)
|
*/
|
function Save() {
|
if (!ValidateForm()) return; else;
|
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();
|
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();
|
|
} 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 HH:mm');
|
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.MemberName = 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 txtBusinessName = document.getElementById('txtBusinessName');
|
txtBusinessName.value = window.IsNoName ? (sel.value ? sel.options[sel.selectedIndex].text : '') : txtBusinessName.value;
|
}
|