//通用JS var DropdownListSelectValueList; var DropdownListSelectValue; $.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 }; })(); $(function () { $("#liquery").find(".divquery").css("display", "none"); }); var ScoreFormulaFunction = { ScoreFormulaChangeHidden: function (record) { $('[name="' + $(this).attr("id") + '"]').val(eval("("+record.Value+")").ScoreFormulaID); }, GradePointFormularChangeHidden: function (record) { $('[name="' + $(this).attr("id") + '"]').val(eval("(" + record.Value + ")").GradePointFormulaID); }, CreditFormularChangeHidden: function (record) { $('[name="' + $(this).attr("id") + '"]').val(eval("(" + record.Value + ")").CreditFormulaID); } }; //通用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"); $("#" + batch.Value + "_CheckBox").val("false"); } 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"); } } $(".batchUpdateCheckbox").click(function () { if ($(this).attr("checked")) { $(this).val(true); } else { $(this).val(false); } }); }, showBatchModifydiv: function () { $("#li_div").find(".divbatchmodify").css("display", "none"); $("#li_div").find(".divbatchmodify").first().css("display", "inline-block"); $("#BatchModifydiv").css("display", "inline-block"); //获取选中要修改的 DropdownListSelectValue = $("[name='DropdownBatchModify']").val(); var value = DropdownListSelectValue; if (value != "" && value != null) { //$("[name='DropdownBatchModify']").attr("value", value); var valuelist = value.split(","); var batchModifyName = valuelist[2]; //获取修改列 var batchModifyValue = valuelist[3]; //获取修改列对应的控件 var name = batchModifyName.split(":"); var namestr = name[1].replace("\"", "").replace("\"", ""); var value = batchModifyValue.split(":"); var valuestr = value[1].replace("\"", "").replace("\"", ""); var inid = namestr + valuestr + "_div"; $(".divbatchmodify").css("display", "none"); $("#" + inid).css("display", "inline-block"); } }, closeBatchModifydiv: function () { $("#BatchModifydiv").css("display", "none"); }, SelectFunction: null, OnSubmit: null, OnComplete: null, BatchModifysubmit: function () { if (SystemBatchModifyControl.OnSubmit) { var isCancel = SystemBatchModifyControl.OnSubmit.call(null); if (typeof (isCancel) == "boolean" && !isCancel) return; } if (SystemBatchModifyControl.SelectFunction == null) SystemBatchModifyControl.SelectFunction = validChoose; var batch = SystemBatchModifyControl.SelectFunction.call(null); //先清空 $("#PL_hiddenBatchModify").val(""); if ($("input[name='DropdownBatchModify']").val() == "-1") { $.messager.alert("系统提示", "请选择您要批量修改的字段。"); return; } //重新赋值 $("#PL_hiddenBatchModify").val(batch.join(',')); if ($("#PL_hiddenBatchModify").val() == "") { $.messager.alert("系统提示", "请选择您要批量修改的信息。"); return; } $.messager.confirm("系统提示", "您确定要批量修改选择的信息吗?", function (r) { if (r) { var formValue = $("#formBatchModify").getJsonFormParams(); var batchModifyValue = eval('('+$("#DropdownBatchModify").combobox("getValue")+')'); var columnName = batchModifyValue.Value; var modifyValue = $("[name='" + columnName + "_" + batchModifyValue.ControlType + "']").val(); var url = $("#formBatchModify").attr("action"); if (SystemBatchModifyControl.OnComplete) { $.postWithLoading(url, formValue, function (data) { if (data.IsSuccess) { SystemBatchModifyControl.OnComplete.call(data, columnName, modifyValue, batch); } EMISFunction.FormSuccess(data); }, 'json'); } else { $.postWithLoading(url, formValue, EMISFunction.FormSuccess, 'json'); } $("#BatchModifydiv").css("display", "none"); } }); } }; 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]) { $.post(CMS_SystemConfig.VirtualDirectoryPath + '/Common/GetPositionConditionComboGrid', { controlName: controlName, dataCondition: batch.listControl, textField: batch.ControlTextFiled, valueFiled: batch.ControlValueFiled, url: batch.PostUrl, configuretermsExpandJson: JSON.stringify(batch.Sys_ConfiguretermsExpand) }, function (htmlString) { $control = $(htmlString); 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", ""); } }; }; SystemQueryControl.FormatOperator = function (operator) { var result = ''; switch (operator) { case '左': result = " like '%{0}'"; break; case '中': result = " like '%{0}%'"; break; case '右': result = " like '{0}%'"; break; default: result = operator + "'{0}'"; break; } return result; }; SystemQueryControl.GetValue = function () { var attributeControl = $('[name="Attribute"]'); var attributeObj = eval('(' + attributeControl.val() + ')'); if (attributeObj.ControlType == "TextBox") return $("[name='" + attributeObj.Value + "_QueryTextBox']").val(); else if (attributeObj.ControlType == "DropdownList") return $("[name='" + attributeObj.Value + "_QueryDropdownList']").combobox("getValue"); else if (attributeObj.ControlType == "DictionaryDropDownList") return $("#" + attributeObj.Value + "_QueryDictionaryDropDownList").combobox("getValue"); else if (attributeObj.ControlType == "ComboGrid") { return $("#" + attributeObj.Value + "_QueryComboGrid").combogridX("getValue"); } else if (attributeObj.ControlType == "TextBoxDate") return $("#" + attributeObj.Value + "_QueryTextBoxDate").val(); }; //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) { $.popupTopWindow('用户类型', CMS_SystemConfig.VirtualDirectoryPath + '/Common/UserRole?UserID=' + userID + '&MNU=' + $.SystemGeneral.getUrlParam("MNU"), 800, 600); } }, ApproveStatus: { Popup: function (tableName, formID) { $.popupTopWindow('审核历史', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveStatus?tableName=' + tableName + '&formID=' + formID, 800, 280); } }, 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) { var dialogId = $.SystemGeneral.getUrlParam('WindowID'); dialogId = (dialogId == null || dialogId == '') ? 'sysWindow' : dialogId; try { top.$('#' + dialogId).window('close'); } catch (e) { } var tab = top.$('#index_center_tabs').tabs('getSelected'); var $iframe = tab.panel('body').find("iframe"); if ($iframe[0].contentWindow.reload) $iframe[0].contentWindow.reload(); } }); }, FormSuccessNoClose: function (data) { $('a').removeAttr('disabled', 'disabled'); $('#loading').hide(); $.messager.alert('系统信息', data.Message, null, function () { if (data.IsSuccess) { } }); }, 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"); var windowID = $.SystemGeneral.getUrlParam("WindowID"); if (windowID) { if (windowID != "") { $("body").addClass("popupWindowBody"); $("label").parents(".search_list").addClass("popupWindowContent"); } else { $("label").parents(".search_list").addClass("noPopupContent"); } } else { $("label").parents(".search_list").addClass("noPopupContent"); } $(".popupWindowContent td").not(":has(label)").addClass("formTdClass"); $(".popupWindowContent").prev('.p_title').find('div').css("color", "#f0f0f0"); $(".noPopupContent td").not(":has(label)").addClass("formTdClass"); $(".noPopupContent").prev('.p_title').find('div').css("color", "#f0f0f0"); } $(function () { SystemBatchModifyControl.closeBatchModifydiv(); //全局设置样式 initGlobalStyle(); });