//通用JS $(function () { $("#liquery").find(".divquery").css("display", "none"); $.SystemGeneral = (function () { //获取url中的参数 var getUrlParam = function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); //匹配目标参数 if (r != null) return unescape(r[2]); return null; //返回参数值 } return { 'getUrlParam': getUrlParam }; })(); }); //通用JS var SystemBatchModifyControl = { BatchModifyControl: function (data) { var batch = eval('(' + data.Value + ')'); var hidcolumn = $("#PL_hiddenBatchModifycolumnName").val(); var str = new Array(); str = hidcolumn.split(','); for (var i = 0; i < str.length; i++) { var controltdiv = batch.Value + batch.ControlType + "_div"; if (str[i] == controltdiv) { if (batch.ControlType == "TextBox") $("#" + batch.Value + "_TextBox").val(""); else if (batch.ControlType == "DropdownList") $("#" + batch.Value + "_DropdownList").combobox("setValue", "请选择"); else if (batch.ControlType == "DictionaryDropDownList") $("#" + batch.Value + "_DictionaryDropDownList").combobox("setValue", "请选择"); else if (batch.ControlType == "CheckBox") $("#" + batch.Value + "_CheckBox").removeAttr("checked"); else if (batch.ControlType == "ComboGrid") { $("#" + batch.Value + "_ComboGrid").combogridX("setValue", ""); } else if (batch.ControlType == "TextBoxDate") $("#" + batch.Value + "_TextBoxDate").val(""); else if (batch.ControlType == "TextBoxDateTime") $("#" + batch.Value + "_TextBoxDateTime").val(""); else if (batch.ControlType == "NumberBox") $("#" + batch.Value + "_NumberBox").val(""); $("#" + controltdiv).css("display", "inline-block"); } else { $("#" + str[i]).css("display", "none"); } } }, showBatchModifydiv: function () { $("#li_div").find(".divbatchmodify").css("display", "none"); $("#li_div").find(".divbatchmodify").first().css("display", "inline-block"); $("#BatchModifydiv").css("display", "inline-block"); }, closeBatchModifydiv: function () { $("#BatchModifydiv").css("display", "none"); }, OnSubmit: null, BatchModifysubmit: function () { if (SystemBatchModifyControl.OnSubmit) { var isCancel = SystemBatchModifyControl.OnSubmit.call(null); if (typeof (isCancel) == "boolean" && !isCancel) return; } if (isCancel) return; var batch = validChoose().join(','); //先清空 $("#PL_hiddenBatchModify").val(""); if ($("input[name='DropdownBatchModify']").val() == "-1") { $.messager.alert("系统提示", "请选择您要批量修改的字段!!"); return; } //重新赋值 $("#PL_hiddenBatchModify").val(batch); if ($("#PL_hiddenBatchModify").val() == "") { $.messager.alert("系统提示", "请选择您要批量修改的数据!!"); return; } $.messager.confirm("系统提示", "您确定要批量修改选择的数据吗?", function (r) { if (r) { $("#formBatchModify").submit(); } }); } }; var SystemQueryControl = function () { }; SystemQueryControl.ControlCache = {}; SystemQueryControl.QueryControl = function (data) { var batch = eval('(' + data.Value + ')'), dic = SystemQueryControl.ControlCache, $parent = $(this).parent().next().next(), template = "
"; for (var item in dic) { dic[item].$wrapper.hide(); //SetDefaultValue(dic[item].$control, dic[item].ControlType); } if (batch.ControlType == "TextBox") { var controlName = batch.Value + "_QueryTextBox", $control, $wrapper = $(template); if (!dic[controlName]) { $control = $(""); AddControlAndCache($wrapper, $control, controlName, batch.ControlType); } else { ShowControl(controlName); } } else if (batch.ControlType == "TextBoxDate") { var controlName = batch.Value + "_QueryTextBoxDate", $control, $wrapper = $(template); if (!dic[controlName]) { $control = $(""); AddControlAndCache($wrapper, $control, controlName, batch.ControlType); } else { ShowControl(controlName); } } else if (batch.ControlType == "DropdownList" || batch.ControlType == "DictionaryDropDownList") { var controlName = batch.Value + (batch.ControlType == "DropdownList" ? "_QueryDropdownList" : "_QueryDictionaryDropDownList"), $control, $wrapper = $(template); if (!dic[controlName]) { $control = $(""); AddControlAndCache($wrapper, $control, controlName, batch.ControlType); $control.combobox({ url: batch.PostUrl, textField: batch.ControlTextFiled, valueField: batch.ControlValueFiled, onSelect: function (record) { BowinFunction.Combobox.OnSelect.call(this, record, null); }, onUnselect: function (record) { BowinFunction.Combobox.OnUnselect.call(this, record, null); }, onLoadSuccess: function () { BowinFunction.Combobox.OnLoadSuccess.call(this, null); }, panelHeight: 'auto', editable: false, multiple: false }); } else { ShowControl(controlName); } } else if (batch.ControlType == "ComboGrid") { var controlName = batch.Value + "_QueryComboGrid", $control, $wrapper = $(template); if (!dic[controlName]) { var sb = ""; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + " "; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + " "; sb = sb + " "; sb = sb + " "; for (var i = 0; i < batch.Sys_ConfiguretermsExpand.length; i++) { sb = sb + " "; } sb = sb + " "; sb = sb + "
"; sb = sb + "
"; sb = sb + batch.Sys_ConfiguretermsExpand[i].ColumnName; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; sb = sb + "
"; $control = $(sb); AddControlAndCache($wrapper, $control, controlName, batch.ControlType); $control.combogridX(); $control.find('.easyui-cmsXDataTable').cmsXDataTable(); } else { ShowControl(controlName); } } function ShowControl(controlName) { dic[controlName].$wrapper.show(); } function AddControlAndCache($wrapper, $control, controlName, controlType) { $parent.append($wrapper.append($control)); dic[controlName] = { $wrapper: $wrapper, $control: $control, ControlType: controlType }; }; function SetDefaultValue($control, controlType) { if (controlType == "TextBox" || controlType == "TextBoxDate") { $control.val(''); } else if (controlType == "DropdownList" || controlType == "DictionaryDropDownList") { $control.combobox("setValue", "-1"); } else if (controlType == "ComboGrid") { $control.combogridX("setValue", ""); } }; }; //var SystemQueryControl = { // QueryControl: function (data) { // var batch = eval('(' + data.Value + ')'); // var hidcolumn = $("#QuerycolumnName").val(); // var str = new Array(); // str = hidcolumn.split(','); // for (var i = 0; i < str.length; i++) { // var controlName = batch.Value.replace('.', ''); // var controltdiv = controlName + "Query" + batch.ControlType + "_div"; // if (str[i] == controltdiv) { // if (batch.ControlType == "TextBox") // $("#" + controlName + "_QueryTextBox").val(""); // else if (batch.ControlType == "DropdownList") // $("#" + controlName + "_QueryDropdownList").combobox("setValue", "全部"); // else if (batch.ControlType == "DictionaryDropDownList") // $("#" + controlName + "_QueryDictionaryDropDownList").combobox("setValue", "全部"); // else if (batch.ControlType == "CheckBox") // $("#" + controlName + "_QueryCheckBox").removeAttr("checked"); // else if (batch.ControlType == "ComboGrid") { // $("#" + controlName + "_QueryComboGrid").combogridX("setValue", ""); // } // else if (batch.ControlType == "TextBoxDate") // $("#" + controlName + "_QueryTextBoxDate").val(""); // $("#" + controltdiv).css("display", "block"); // } else { // $("#" + str[i]).css("display", "none"); // } // } // } //}; var EMISFunction = { ReportingServices: $(CMS_SystemConfig.GetConfig()).find("configuration>reportServer").attr("url"), UserRole: { Popup: function (userID) { top.$('#sysWindow').dialog({ title: '用户类型', width: 800, height: 600, content: '', modal: true }); } }, ApproveStatus: { Popup: function (tableName, formID) { top.$('#sysWindow').dialog({ title: '审核历史', width: 800, height: 280, content: '', modal: true }); } }, FormSubmit: function (formID) { $('a').attr('disabled', 'disabled'); $.each($('a'), function () { if ($.data(this, "linkbutton")) { $(this).linkbutton('disable'); } }); $('#loading').show(); }, FormComplete: function () { $.each($('a'), function () { if ($.data(this, "linkbutton")) { $(this).linkbutton('enable'); } }); $('a').removeAttr('disabled', 'disabled'); $('#loading').hide(); }, FormSuccess: function (data) { $('a').removeAttr('disabled', 'disabled'); $('#loading').hide(); $.messager.alert('系统信息', data.Message, null, function () { if (data.IsSuccess) { if (data.RedictUrl != null && data.RedictUrl != "") { window.location.href = data.RedictUrl; } var dialogId = $.SystemGeneral.getUrlParam('WindowID'); dialogId = (dialogId == null || dialogId == '') ? 'sysWindow' : dialogId; top.$('#' + dialogId).window('close'); var $iframe = top.$("#centerIframe"); if ($iframe[0].contentWindow.location.reload) $iframe[0].contentWindow.location.reload(); } }); }, LoadContextMenuBar: function (id, formClass, mnu) { $.post(CMS_SystemConfig.VirtualDirectoryPath + '/Common/GetContextMenuList', { FormClass: formClass, Mnu: mnu }, function (data) { var $id = $('#' + id); for (var i = 0; i < data.length; i++) { var $sb = $("" + data[i].Text + ""); $id.append($sb); $sb.linkbutton(); } }, 'json'); }, LoadPositionCondition: function (id, menuClass, mnu, url) { $.post(url, { MenuClass: menuClass, Mnu: mnu }, function (data) { var $id = $('#' + id); var $control1 = $(""); var $control2 = $("=',Value:'>=' },{ Text:'>',Value:'>' },{ Text:'<=',Value:'<=' },{ Text:'<',Value:'<' },{ Text:'<>',Value:'<>' },{ Text:'左',Value:'左' },{ Text:'右',Value:'右' },{ Text:'中',Value:'中' }],value:'=',editable:false,multiple:false\" isonload=\"0\" />"); $id.children("li:nth-child(2)").append($control1); $id.children("li:nth-child(3)").append($control2); $control1.combobox({ url: data.Url, textField: data.TextField, valueField: data.ValueField, onSelect: function (record) { if ($(this).attr("isOnload") == 1) BowinFunction.Combobox.OnSelect.call(this, record, SystemQueryControl.QueryControl); BowinFunction.Combobox.OnSelect.call(this, record, SystemQueryControl.QueryControl); }, onUnselect: function (record) { BowinFunction.Combobox.OnUnselect.call(this, record, null); }, onLoadSuccess: function () { BowinFunction.Combobox.OnLoadSuccess.call(this, function (data) { if (data.length > 0) $(this).combo("setValue", data[0].Value) }); }, panelHeight: 'auto', editable: false, multiple: false }); $control2.combobox({ width: 50 }); }, 'json'); } }; function initGlobalStyle() { $("label").parent().addClass("labelClass"); $("label").parents(".search_list").addClass("popupWindowContent"); $(".popupWindowContent td").not(":has(label)").addClass("formTdClass"); $(".popupWindowContent").prev('.p_title').find('div').css("color", "#333"); } $(function () { SystemBatchModifyControl.closeBatchModifydiv(); //全局设置样式 initGlobalStyle(); });