123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- //通用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 = "<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]) {
- var sb = "<span class=\"easyui-combogridX \" comboname=\"" + controlName + "\" data-condition=\"" + batch.listControl + "\"";
- sb = sb + " data-options=\"textField:'" + batch.ControlTextFiled + "',valueField:'" + batch.ControlValueFiled + "',value:'-1'\"";
- sb = sb + " id=\"" + controlName + "\">";
- sb = sb + " <input class=\"combo-text\" type=\"text\" /><span><span class=\"combo-arrow combogridX-arrow\"></span></span><input";
- sb = sb + " class=\"combogridX-value\" name=\"" + controlName + "\" type=\"hidden\" /><div class=\"easyui-panel combogridX-expander\">";
- sb = sb + " <div class=\"easyui-cmsXDataTable xDataTablePanel \" data-options=\"pagerType:1,singleSelect:false,checkOnSelect:true,isPostBack:false,rownumbers:true,url:'" + batch.PostUrl + "',striped:'True',fitColumns:true,nowrap:false,onLoadSuccess:function (data) { CMSFunction.DataTable.OnLoadSuccessFunction.call(this, data, null) },pagination:true,pageSize:10\"";
- sb = sb + " id=\"" + controlName + "_gridX\">";
- sb = sb + " <div class=\"xpanel_head\">";
- sb = sb + " <div class=\"xpanel_head_title\">";
- sb = sb + " <span></span>";
- sb = sb + " </div>";
- sb = sb + " </div>";
- sb = sb + " <div class='xDataTable_bodyPanel'>";
- sb = sb + " <input id=\"" + controlName + "_gridX_datajson\" name=\"" + controlName + "_gridX_datajson\"";
- sb = sb + " type=\"hidden\" />";
- sb = sb + " <table class=\"xDataTable\" cellpadding=\"0\" cellspacing=\"0\">";
- sb = sb + " <tr class=\"header\">";
- for (var i = 0; i < batch.Sys_ConfiguretermsExpand.length; i++) {
- sb = sb + " <th columnname=\"\" width=\"10.00%\" data-options=\"width:$(this).width() * 0.1,align:'center',hidden:false,field:'" + batch.Sys_ConfiguretermsExpand[i].ColumnValue + "',formatter:function(value,row,index){ return CMSFunction.DataTable.ColumnFormatterFunction.call(this,value,row,index,0,null,null); }\">";
- sb = sb + " <div style='width: 100%'>";
- sb = sb + batch.Sys_ConfiguretermsExpand[i].ColumnName;
- sb = sb + " </div>";
- sb = sb + " </th>";
- }
- sb = sb + " </tr>";
- sb = sb + " </table>";
- sb = sb + " </div>";
- sb = sb + " <div class=\"xDataTablePanel_pager\">";
- sb = sb + " <div class=\"xDataTablePanel_pager_Simp\">";
- sb = sb + " </div>";
- sb = sb + " </div>";
- sb = sb + " </div>";
- sb = sb + " </div>";
- sb = sb + "</span>";
- $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: '<iframe id="iframeUserRoleControl" frameborder="0" scrolling="no" src="' + CMS_SystemConfig.VirtualDirectoryPath + '/Common/UserRole?UserID=' + userID + '&MNU=' + $.SystemGeneral.getUrlParam("MNU") + '"></iframe>',
- modal: true
- });
- }
- },
- ApproveStatus: {
- Popup: function (tableName, formID) {
- top.$('#sysWindow').dialog({
- title: '审核历史',
- width: 800,
- height: 280,
- content: '<iframe id="iframeApproveStatusControl" frameborder="0" scrolling="no" src="' + CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveStatus?tableName=' + tableName + '&formID=' + formID + '"></iframe>',
- 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 = $("<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");
- $("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();
- });
|