123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453 |
- //通用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 = "<div></div>";
- 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 = $("<input name=\"" + controlName + "\" data-condition=\"" + batch.listControl + "\" type=\"text\" value=\"\" />");
- 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 = $("<input name=\"" + controlName + "\" data-condition=\"" + batch.listControl + "\" onfocus=\"WdatePicker({autoUpdateOnChanged:true,dateFmt:'yyyy-MM-dd'})\" type=\"text\" value=\"\" />");
- 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 = $("<input name=\"" + controlName + "\" data-condition=\"" + batch.listControl + "\" class=\"easyui-combobox combobox-f combo-f\" isonload=\"0\" />");
- 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 = $("<a class=\"easyui-linkbutton\" name=\"" + data[i].Name + "\" href=\"javascript:" + data[i].OnClick + "\" data-options=\"iconCls:'" + data[i].Icon + "',plain:'true'\" onfocus=\"this.blur()\" >" + data[i].Text + "</a>");
- $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 = $("<input name=\"Attribute\" class=\"easyui-combobox combobox-f combo-f\" data-condition=\"" + data.Condition + "\" isonload=\"0\" />");
- //岭南要求默认为右
- var $control2 = $("<input name=\"Condition\" data-condition=\"" + data.Condition + "\" class=\"easyui-combobox combobox-f combo-f\" data-options=\"textField:'Text',valueField:'Value',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',data:[{ Text:'=',Value:'=' },{ Text:'>=',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();
- });
|