?$.monitorScreenSet?=?function?(param)?{
????????var?p?=?$.extend({
????????????id:?"mss",? //id
????????????name:?"",?? //參數名字
????????????range:?[], //取值范圍
????????????width:?569, //寬度
????????????height:?265, //高度
????????????values:?[], ????//參數值
????????????refreshTime:?[],????????????????//刷新時間【1,2,3,4】
????????????
????????????closeFun:?function?(values)?{
????????????} //點擊確定后執行的方法
????????????//cancelFun:function(values){}
????????},?param);
????????//參數輸入框
????????var?paramStr?=?"";
????????//驗證規則
????????var?rules?=?{};
????????//參數index
????????var?varIndex?=?0;
????????if?(p.name)?{
????????????paramStr?=?"<p><label?for='"?+?p.id?+?"_name'>"?+?p.name?+?"</label>"
????????????+?"<span?style='margin:?auto?5px;'><</span>"
????????????+?"<input?id='"?+?p.id?+?"_name'?type='text'?name='"?+?p.id?+?"_name'?style='width:50px;'?value='"?+?p.values[0]?+?"'>"
????????????+?"<span>"?+?(p.values[2]?||?"")?+?"</span>"
????????????+?"</p>";
????????????rules[p.id?+?'_name']?=?{
????????????????required:?true,
????????????????number:?true,
????????????????range:?p.range,
????????????????decimalLength:?2
????????????};
????????????varIndex?=?1;
????????}?else?{
????????????varIndex?=?0;
????????}
????????var?firstTime?=?'<span?class="text">'?+Msg.gs.backInv.refresh5Min+?'</span>';
????????var?secondTime?=?'<span?class="text">'?+Msg.gs.backInv.refresh15FMin+?'</span>';
????????var?thirdTime?=?'<span?class="text">'?+Msg.gs.backInv.refresh45Min+?'</span>';
????????var?forthTime?=?'<span?class="text">'?+Msg.gs.euh.onehour+?'</span>';
????????var?first?=?'5';
????????var?second?=?'15';
????????var?third?=?'45';
????????var?forth?=?'60';
????????if?(p.refreshTime.length?==?4)?{
????????????firstTime?=?p.refreshTime[0]?+?'<span?class="text">'?+Msg.second+?'</span>';
????????????secondTime?=?p.refreshTime[1]?+'<span?class="text">'?+Msg.second+?'</span>';
????????????thirdTime?=?p.refreshTime[2]?+?'<span?class="text">'?+Msg.second+?'</span>';
????????????forthTime?=?p.refreshTime[3]?+?'<span?class="text">'?+Msg.second+?'</span>';
????????????first?=?p.refreshTime[0];
????????????second?=?p.refreshTime[1];
????????????third?=?p.refreshTime[2];
????????????forth?=?p.refreshTime[3];
????????}???
????????var?contentStr?=?"<form>"
????????????+?paramStr
????????????+?"<p?style='margin:?10px?auto;'><span?class='text'>"?+?Msg.gs.euh.dataRefreshCycle?+?"</span></p>"
????????????+?"<input?type='radio'?name='refreshTime'?id='"?+?p.id?+?"_1'?style='margin-left:0;'?value='"?+?first?+?"'><label?for='"?+?p.id?+?"_1'?style='margin-right:20px'>"?+?firstTime?+?"</label>"
????????????+?"<input?type='radio'?name='refreshTime'?id='"?+?p.id?+?"_2'?value='"?+?second?+?"'><label?for='"?+?p.id?+?"_2'?style='margin-right:20px'>"?+?secondTime?+?"</label>"
????????????+?"<input?type='radio'?name='refreshTime'?id='"?+?p.id?+?"_3'?value='"?+?third?+?"'><label?for='"?+?p.id?+?"_3'?style='margin-right:20px'>"?+?thirdTime?+?"</label>"
????????????+?"<input?type='radio'?name='refreshTime'?id='"?+?p.id?+?"_4'?value='"?+?forth?+?"'><label?for='"?+?p.id?+?"_4'?style='margin-right:20px'>"?+?forthTime?+?"</label>"
????????????+"</form>"
????????var?form?=?$(contentStr);
????????if?(p.values[varIndex])?{
????????????form.find("input[value='"?+?p.values[varIndex]?+?"']").attr("checked",?"true");
????????}?else?{
????????????form.find("#"?+?p.id?+?"_1").attr("checked",?"true");
????????}
????????if?(p.name)?{
????????????form.validate({rules:?rules});
????????}
????????var?getValue?=?function?()?{
????????????var?result?=?[];
????????????if?(p.name)?{
????????????????result.push(parseFloat(form.find("#"?+?p.id?+?"_name").val()));
????????????}
????????????result.push(form.find("input[name='refreshTime']:checked").val());
????????????return?result;
????????};
????????App.alert({
????????????id:?p.id,
????????????title:Msg.widget.ExpandTable.head,
????????????width:?p.width,
????????????height:?p.height,
????????????content:?"?",
????????????btns:?[{
????????????????id:?'okId',
????????????????text:?Msg.sure?||?'OK',
????????????????click:?function?(d)?{
????????????????????if?(p.name)?{
????????????????????????if?(form.valid())?{
????????????????????????????p.closeFun(getValue());
????????????????????????????$(this).dialog('close');
????????????????????????}
????????????????????}?else?{
????????????????????????p.closeFun(getValue());
????????????????????????$(this).dialog('close');
????????????????????}
????????????????}
????????????},?{
????????????????id:?'cancelId',
????????????????text:?Msg.cancel?||?'Cancel',
????????????????click:?function?(d)?{
????????????????????$(this).dialog('close');
????????????????}
????????????}]
????????}).append(form);
????????if?(p.name)?{
????????????form[0].onkeydown?=?function?(e)?{
????????????};
????????????form.validate();
????????}
????};
????$.monitorScrSetCookie?=?function?(name,?val)?{
????????var?t?=?new?Date();
????????t.setFullYear(t.getFullYear()?+?1);
????????Cookies.set(name,?val,?t);
????};
????$.monitorScrGetCookie?=?function?(name,?isAjax,?def)?{
????????var?val?=?Cookies.get(name);
????????if?(isAjax)?{
????????????if?(val?==?null)?{
????????????????$.omcAjax("groupParameter/getParameterById",?{
????????????????????paramKey:?name
????????????????},?function?(data)?{
????????????????????if?(data.success)?{
????????????????????????val?=?data.data.paramValue;
????????????????????}
????????????????},?null,?false);
????????????}?else?{
????????????????$.monitorScrSetCookie(name,?val);
????????????}
????????}?else?{
????????????if?(val?==?null)?{
????????????????val?=?def?||?5;
????????????}
????????}
????????return?val;
????}
jQuery給項目中設置頁面添加"屏蔽數據的功能"
Caelebs
2016-06-07 20:53:01