var CMSFunction = { ComboGrid: { SetValue: function (source, text, value) { var opts = $.data(source[0], "combogridX").options; if (text == "") { $(source).find('.combo-text').val(opts.emptyText); } else { $(source).find('.combo-text').val(text); } $(source).find('.combogridX-value').val(value); $(source).attr("loaded", "true"); if ("undefined" != typeof EasyUIValidate) { if (EasyUIValidate.Events.ComboGridXOnChange) { EasyUIValidate.Events.ComboGridXOnChange.call(this); } } if (opts.onChange) opts.onChange.call(source); }, OnLoadSuccessFunction: function (source, tableData, callBack) { var opts = $.data(source[0], "combogridX").options; var callbackCalled = false; var text = source.find(".combo-text").val(); if (text == '' || text == null) { source.find('.combogridX-value').val(""); } if (opts.value != '' && opts.value != -1 && $(source).attr("loaded") != "true") { callbackCalled = true; var dataGrid = source.find('.easyui-cmsXDataTable'); var formData; if (opts.formData) { formData = $.unpackFormParams(opts.formData.QueryParamsDatas); } else { formData = new Object(); } formData.Attribute = "{ \"ID\":\"00000000-0000-0000-0000-000000000000\",\"Value\":\"" + opts.valueField + "\",\"ControlType\":\"TextBox\"}"; formData.Condition = "="; formData[opts.valueField + "_QueryTextBox"] = opts.value; var jsonString = "({'QueryParamsDatas':'" + $.packFormParams(formData) + "',page: 0,rows: 10 })"; // var jsonString = "({'QueryParamsDatas':'Attribute|*|{\"ID\":\"00000000-0000-0000-0000-000000000000\",\"Value\":\"" + opts.valueField // + "\",\"ControlType\":\"TextBox\"}|@|Condition|*|=|@|ConditionValue|*|" + opts.value // + "|@|" + opts.valueField + "_QueryTextBox|*|" + opts.value + "|@|',page: 0,rows: 10 })"; try { var dataGridOptions = dataGrid.cmsXDataTable("options"); var url = dataGridOptions.url; $.post(url, eval(jsonString), function (data) { if (data.rows.length > 0) { CMSFunction.ComboGrid.SetValue(source, data.rows[0][opts.textField], opts.value); if (callBack) { callBack.call(source, tableData); } } }); } catch (err) { } } var nowVal = source.find('.combogridX-value').val(); if (!(nowVal && nowVal != "") && opts.selectedIndex != null && $(source).attr("loaded") != "true") { if (tableData.rows.length > opts.selectedIndex) { CMSFunction.ComboGrid.SetValue(source, tableData.rows[opts.selectedIndex][opts.textField], tableData.rows[opts.selectedIndex][opts.valueField]); } } //source.find(".combogridX-expander").width(source.find("table").width() + 16); source.find('tr.row>td').css("cursor", "pointer"); source.find('tr.row').click(function () { var comboGrid = $(this).parents('.easyui-combogridX:first'); var grid = $(this).parents('.easyui-cmsXDataTable:first'); var opts = $.data(comboGrid[0], "combogridX").options; var gridOpts = $.data(grid[0], "cmsXDataTable").options; var gridData = gridOpts.data; var rowIndex = parseInt($(this).attr("xRowIndex")); var rowData = gridData.rows[rowIndex]; CMSFunction.ComboGrid.SetValue(comboGrid, rowData[opts.textField], rowData[opts.valueField]); if (opts.onSelect) opts.onSelect.call(this, rowData); comboGrid.find(".combogridX-expander").css("display", "none"); }); var expander = source.find(".combogridX-expander"); // expander.css("width", ""); source.combogridX("setExpanderPosition", { expander: expander, dropdown: source, arrow: source.find('.combo-arrow') }); if (callBack && !callbackCalled) { callBack.call(source, tableData); } } }, Tree: { setParentsChecked: function (jq, node, ischeck) { var parent = jq.tree('getParent', node.target); if (parent) { if (parent.checked != ischeck) { if (!parent.attributes) parent.attributes = new Object(); parent.attributes.isRecursionParent = true; jq.tree('update',{ target: parent.target, attributes: parent.attributes }); if (ischeck) { jq.tree('check', parent.target); } else { jq.tree('uncheck', parent.target); } } //CMSFunction.Tree.setParentsChecked(jq, parent, ischeck); } }, setChildrenChecked: function (jq, node, checked) { var childNodes = jq.tree('getChildren', node.target); for (var i = 0; i < childNodes.length; i++) { if (childNodes[i].checked != checked) { if (!childNodes[i].attributes) childNodes[i].attributes = new Object(); childNodes[i].attributes.isRecursionChild = true; jq.tree('update',{ target: childNodes[i].target, attributes: childNodes[i].attributes }); if (checked) jq.tree('check', childNodes[i].target); else jq.tree('uncheck', childNodes[i].target); } } }, OnBeforeCheck: function (node, checked) { var treeView = $(this); var opts = treeView.tree('options'); if (!node.attributes) node.attributes = new Object(); if (!opts.cascadeCheck) { if (checked == node.checked) { return true; } if (checked) { if (!node.attributes.isRecursionChild) { CMSFunction.Tree.setParentsChecked(treeView, node, checked); } } if (!node.attributes.isRecursionParent) { CMSFunction.Tree.setChildrenChecked(treeView, node, checked); } node.attributes.isRecursionParent = false; node.attributes.isRecursionChild = false; treeView.tree('update',{ target: node.target, attributes: node.attributes }); // else { // //opts.cascadeCheck = false; // var childNodes = treeView.tree('getChildren', node.target); // for (var i = 0; i < childNodes.length; i++) { // if (checked) treeView.tree('check', childNodes[i].target); // else treeView.tree('uncheck', childNodes[i].target); // } // } } }, CheckBranch: function () { var parentid = event.srcElement.id; var myCheck = $(event.srcElement).attr("checked"); $(event.srcElement).find("input[id^='" + parentid + "']").each(function () { if (!myCheck) { $(this).removeAttr("checked"); } else { $(this).attr("checked", myCheck); } }); }, OnClick: function (node) { var tree = $(node.target).parents('.easyui-tree'); if (tree.tree('getChildren', node.target).length > 0) { tree.tree('toggle', node.target); } } }, DataTable: { TriggerIndex: null, TriggerData: null, /// /// 本对象专门用于操作jQueryEasyUI框架的DataGrid /// OnLoadSuccessFunction: function (data, callBack) { var target = $(this); var comboGrid = $(this).parents('.easyui-combogridX:first'); if (comboGrid.length > 0) { CMSFunction.ComboGrid.OnLoadSuccessFunction(comboGrid, data, callBack); } else { if (callBack) { callBack.call(this, data); } } }, CorssRowsStylerFunction: function (value, row, index) { if (index % 2 != 0) { //偶数行 return 'background-color:#DAEEE1;'; } else { //奇数行 } }, ColumnFormatterFunction: function (value, row, index, formatType, formatString, customFormatFun, overflowlength) { if (formatType == FormatType.None) { if (!value && value != 0) { value = ""; } } else if (formatType == FormatType.DateTime) { if (!value && value != 0) { value = ""; } else { try{ value = value.toDateString(formatString); } catch(error){} } } if (overflowlength > 3) { value = value.toString().length <= overflowlength ? value : value.toString().substring(0, overflowlength - 3) + '...'; } if (customFormatFun) { return customFormatFun.call(this, index, row, value); } return value; }, OperaterColumnFormatterFunction: function (value, row, index, buttonArrayString) { var htmlString = " "; buttonArrayString = buttonArrayString.replace(/\^\^/g, "\""); var buttonArray = $.parseJSON(buttonArrayString); for (var i = 0; i < buttonArray.length; i++) { htmlString += buttonArray[i][i] + " "; } return htmlString; }, LinkButtonColumnFormatterFunction: function (value, row, index, text, handleScript, formatType, formatString, overflowlength, emptyText) { var content = (text ? text : (!value && value != 0 ? "" : value)); if(emptyText == undefined){ emptyText = ""; } if (content.length == 0 && emptyText.length > 0) { content = emptyText; } if (overflowlength > 3) { content = content.length < overflowlength ? content : content.substring(0, overflowlength - 3) + '...'; } var html = "" + content + ""; return html; }, GetRowData: function (table) { /// /// 获取table中所有被选中的数据(最后返回的是数据是JSON格式的String类型数据) /// jQuery对象,不传则默认为当前选项卡中的第一个DataGrid /// var $table = null; if (table == undefined || table == null) { var $tabs = $('#index_center').tabs(); $table = $tabs.tabs('getSelected').find("div.easyui-cmsXDataTable").eq(0); } else { $table = $(table); } if ($table == null || $table == undefined) { return "" } ; var rowsData = $table.cmsXDataTable('getSelections'); if (rowsData.length > 0) { for (var i = 0; i < rowsData.length; i++) { var data = rowsData[i]; data = BowinFunction.Untility.ConvertObjectDateFormat(data); } } // return rowsData == null ? "" : rowsData.length > 1 ? JSON.stringify(rowsData) : "[" + JSON.stringify(rowsData) + "]"; return rowsData == null ? "" : JSON.stringify(rowsData); }, GetCurrentRowData: function (obj) { /// /// 获取ojb对象所在行的数据(最后返回的是数据是JSON格式的String类型数据) /// var rowIndex = $(obj).closest('tr').attr("xRowIndex"); var rowDatas = $(obj).closest('.easyui-cmsXDataTable').cmsXDataTable("getRows"); var data = BowinFunction.Untility.ConvertObjectDateFormat(rowDatas[rowIndex]); return "[" + JSON.stringify(data) + "]"; } }, DataTableFormatter: { TwoDigit: function (index, row, value) { if (!value || isNaN(value)) { if(value === 0)//判断是否为0 { return value.toFixed(2).toString(); } return ""; } return value.toFixed(2).toString(); } }, DragDrop: { dragX: 0, dragY: 0, offsetX: 0, offsetY: 0, isInnerDrag: false, curPopupContainerItem: null, DropContainerItemClick: function (e) { var x = e.x || e.layerX || 0; var y = e.y || e.layerY || 0; var containerID = $(e.srcElement).parent().parent().attr("id"); var menuID = containerID + "_menu"; CMSFunction.DragDrop.curPopupContainerItem = $(e.srcElement).parent(); $("#" + menuID).menu("show", { left: x, top: y }); }, DropFunc: function (e, source) { if (CMSFunction.DragDrop.isInnerDrag != true) { var newObj = $(source).clone(); var myLeft = e.currentTarget.clientLeft; var myTop = e.currentTarget.clientTop; var myWidth = e.currentTarget.clientWidth; var myHeight = e.currentTarget.clientHeight; var myObj = e.currentTarget; var opts = $.data(this, "droppableContainer").options; newObj.css('top', CMSFunction.DragDrop.dragY - CMSFunction.DragDrop.offsetY) .css('position', 'absolute') .css('left', CMSFunction.DragDrop.dragX - CMSFunction.DragDrop.offsetX); newObj.find(".draggableTitle").css("color", opts.foreColor) newObj.appendTo($(this)); newObj.draggable({ handle: '.draggableTitle', onDrag: function (e) { CMSFunction.DragDrop.dragX = e.clientX; CMSFunction.DragDrop.dragY = e.clientY; }, onBeforeDrag: function (e) { CMSFunction.DragDrop.offsetX = e.offsetX + e.srcElement.offsetLeft; CMSFunction.DragDrop.offsetY = e.offsetY + e.srcElement.offsetTop; CMSFunction.DragDrop.isInnerDrag = true; }, onStopDrag: function (e) { if (e.clientX < myLeft || e.clientX > myLeft + myWidth || e.clientY < myTop || e.clientY > myTop + myHeight) { $(e.srcElement).offsetParent().remove(); } } }); } var hidden = $(e.currentTarget.nextSibling); hidden.val(''); $.each($(e.currentTarget).find('.easyui-draggable'), function () { var valStr = ''; if (hidden.val() != '') valStr = ','; var titleDiv = $(this).find('.draggableTitle'); valStr += titleDiv.attr('value') + '|' + titleDiv.html() + '|' + $(this).css('left').replace("px", "") + '|' + $(this).css('top').replace("px", ""); hidden.val(hidden.val() + valStr); }); } } }; //2013-05-31 begin added by pengbb 新增部门选择控件,由项目易系统开发提供 var departmentSelector = function (dataUrl, multipleChoice, handlers) { var win; var tree; var pitchOnDataGrid; var rightTopQuey; var hasEasyUI = function (elementTypeName) { if ($(elementTypeName).length > 0) { return true; } else { return false; } } //private 创建Html元素 var createElement = function (elementTypeName, elements, parentElments) { $(elementTypeName).removeClass(); if (typeof parentElments != "undefined" && typeof elements == "string") { var elementsObject = $(elements); parentElments.append(elementsObject); return elementsObject; } else { if (typeof elements == "string") return $(elements); } }; var createLinkButton = function (elements) { var links = elements.find("a"); for (var i = 0; i < links.length; i++) { $(links[i]).linkbutton(); } }; var createTableString = function (name) { var table = "", ""); }; var registEvent = function (target, eventType, handler) { target.unbind(eventType, handler); target.bind(eventType, handler); } //private 选择部门 var selectWaitOrg = function (node) { var selectUser; if (multipleChoice) { selectUser = tree.tree('getChecked'); } else { var selectUser = new Array(); selectUser.push(node); } if (selectUser.length > 0) { if (!multipleChoice && selectUser.length > 1) { window.top.$.messager.alert("系统消息", "一次只能选择一个部门!"); } else { var dataSource = "{\"total\":".concat(selectUser.length, ",", "\"rows\":["); for (var i = 0; i < selectUser.length; i++) { dataSource = dataSource.concat('{"OrgID":', "\"", selectUser[i].id, "\",", '"DepartmentName":', "\"", selectUser[i].text, "\"}," ); } dataSource = dataSource.substring(0, dataSource.length - 1); dataSource = dataSource.concat("]}"); pitchOnDataGrid.datagrid("loadData", $.parseJSON(dataSource)); } } else if (multipleChoice == false) { window.top.$.messager.alert("系统消息", "未选择任何用户!"); } }; var InitGridFile = function (dataGrid, pagination, url) { return dataGrid.datagrid({ url: pagination ? url : "", queryParams: pagination ? { departmentID: DepartmentID, userName: rightTopQuey.find("input[name='txtUserName']").val() } : "", pagination: pagination, pageSize: 1, pageList: [5, 10], loadMsg: "请稍等....", columns: [[ { field: 'id', title: '', checkbox: true }, { field: 'DepartmentName', title: '部门机构' } ]] }); } var loadDepartmentTree = function () { var inputDepartment = leftQuery.find("input[name='txtDepartmentName']").val(); $.cmsPost("/Common/GetSelectUserControlDepartmentTree", { departmentID: "", departmentName: inputDepartment }, function (data) { $(tree).tree('loadData', data); }); } var deleteSelectUser = function () { var deleteSource = pitchOnDataGrid.datagrid("getChecked"); if (deleteSource.length > 0) { for (var i = 0; i < deleteSource.length; i++) { var rowIndex = pitchOnDataGrid.datagrid("getRowIndex", deleteSource[i]); pitchOnDataGrid.datagrid("deleteRow", rowIndex); if (multipleChoice) { var node = tree.tree("find", deleteSource[i].OrgID); tree.tree('uncheck', node.target); } } } else { window.top.$.messager.alert("系统消息", "未选中任何行!"); } }; var close = function () { var btnSelectOk = $((rightTopQuey.find("a"))[1]); btnSelectOk.unbind(); btnSelectOk.bind("click", function () { var selectUser = pitchOnDataGrid.datagrid("getData"); if (handlers instanceof Array) { for (var i = 0; i < handlers.length; i++) { handlers[i](selectUser); } } else if (typeof handlers != "undefined") { handlers(selectUser); } if (typeof (pitchOnDataGrid.data("SelectedUser")) != "undefined") { var catchData = pitchOnDataGrid.data("SelectedUser"); pitchOnDataGrid.removeData("SelectedUser"); } win.window("close"); }); }; this.show = function () { if (true) { $("div[name='winOrgWarp']").remove(); var warpElement = "
"; //var warp = createElement(".selectOrg_warp", warpElement, win); var warp = window.top.$(warpElement).appendTo(window.top.document.body); win = warp.window({ width: 780, height: 530, modal: true, maximizable: false, title: '部门信息选择' }); var elementLeft = createElement(".selectOrg_left", "
", warp); var elementRight = createElement(".selectOrg_right", "
", warp); var leftQueryTable = ""; leftQueryTable = leftQueryTable.concat(""); leftQueryTable = leftQueryTable.concat(""); leftQueryTable = leftQueryTable.concat(""); leftQueryTable = leftQueryTable.concat("
渠道名称:查询
"); leftQuery = createElement(".query", leftQueryTable, elementLeft); createLinkButton(leftQuery); var left_panel_warp = createElement("div[panel_postion='org_left']", "
", elementLeft); left_panel_warp.panel({ width: 350, height: 450, title: '部门信息', closable: false, collapsible: true, minimizable: false, maximizable: false }); tree = $(left_panel_warp.find("ul[name='departmentTree']")[0]).tree({ url: dataUrl + "?departmentName=", lines: true, checkbox: multipleChoice, onBeforeLoad: function (node, param) { if (node == null) { return true; } else { var children = $(this).tree("getChildren", node.target); if (children == "") { return true; } else { return false; } } }, onClick: function (node) { selectWaitOrg(node); }, onCheck: function (node) { selectWaitOrg(); } }); var rightQuery = '

删除'; rightQuery = rightQuery.concat("  确定

"); rightTopQuey = createElement("p[pPostion='org_right_top']", rightQuery, elementRight); createLinkButton(rightTopQuey); var left_panel_warp = createElement("div[panel_postion='right_selectOrg']", "
", elementRight); var pitchOnPanel = left_panel_warp.panel({ width: 380, height: 450, title: '已选部门', closable: false, collapsible: true, minimizable: false, maximizable: false }); var pitchOnTable = createElement("table[name='pitchOnOrgDataGrid']", createTableString("pitchOnOrgDataGrid"), pitchOnPanel); pitchOnDataGrid = (InitGridFile(pitchOnTable, false)); //查询部门树 registEvent(leftQuery.find("a:first"), "click", loadDepartmentTree); //删除 registEvent($(rightTopQuey.find("a")[0]), "click", deleteSelectUser); //确认 close(handlers); } else { $("div[name='winOrgWarp']").window('open'); } } }; //2013-05-31 end added by pengbb 新增部门选择控件,由项目易系统开发提供 // var brandSelector = function (dataUrl, multipleChoice, triggerboxTarget, handlers) { var win; var tree; var pitchOnDataGrid; var rightTopQuey; var hasEasyUI = function (elementTypeName) { if ($(elementTypeName).length > 0) { return true; } else { return false; } } //private 创建Html元素 var createElement = function (elementTypeName, elements, parentElments) { $(elementTypeName).removeClass(); if (typeof parentElments != "undefined" && typeof elements == "string") { var elementsObject = $(elements); parentElments.append(elementsObject); return elementsObject; } else { if (typeof elements == "string") return $(elements); } }; var createLinkButton = function (elements) { var links = elements.find("a"); for (var i = 0; i < links.length; i++) { $(links[i]).linkbutton(); } }; var createTableString = function (name) { var table = "", ""); }; var registEvent = function (target, eventType, handler) { target.unbind(eventType, handler); target.bind(eventType, handler); } //private 选择品牌 var selectWaitOrg = function (node) { var selectUser; if (multipleChoice) { selectUser = tree.tree('getChecked'); } else { var selectUser = new Array(); selectUser.push(node); } var removeArray = new Array(); for (var i = 0; i < selectUser.length; i++) { if (!selectUser[i].attributes.parentDepartmentID) {//查找根节点 removeArray.push(selectUser[i]); } else { for (var x = 0; x < selectUser.length; x++) { if (selectUser[i].attributes.parentDepartmentID == selectUser[x].id) {//查找父节点 removeArray.push(selectUser[x]); } } } } for (var i = 0; i < removeArray.length; i++) { //移除选中项 for (var x = 0; x < selectUser.length; x++) { if (removeArray[i].id == selectUser[x].id) { selectUser.splice(x, 1); break; } } } $(tree).data("Selections", selectUser); }; this.show = function () { if (true) { $("div[name='winOrgWarp']").remove(); var warpElement = "
"; var warp = window.top.$(warpElement).appendTo(window.top.document.body); var elementLeft = createElement(".selectOrg_left", "
", warp); var elementRight = createElement(".selectOrg_right", "
", warp); var left_panel_warp = createElement("div[panel_postion='org_left']", "
    ", elementLeft); tree = $(left_panel_warp.find("ul[name='departmentTree']")[0]).tree({ url: dataUrl + "?departmentName=", lines: true, checkbox: multipleChoice, onBeforeLoad: function (node, param) { if (node == null) { return true; } else { var children = $(this).tree("getChildren", node.target); if (children == "") { return true; } else { return false; } } }, onLoadSuccess: function (node, data) { var checkedData = $(triggerboxTarget).triggerbox("getValue"); if (checkedData != "") { var checkedArray = checkedData.split(';'); for (var i = 0; i < checkedArray.length; i++) { var checkedNode = tree.tree("find", checkedArray[i]); tree.tree("check", checkedNode.target); } } }, onClick: function (node) { selectWaitOrg(node); }, onCheck: function (node) { selectWaitOrg(); } }); win = warp.dialog({ width: 400, height: 600, modal: true, maximizable: false, title: '品牌信息选择', buttons: [{ text: '确定', handler: function () { var result = $(tree).data("Selections") || new Array(); if (handlers instanceof Array) { for (var i = 0; i < result.length; i++) { handlers[i](result); } } else if (typeof handlers != "undefined") { handlers(result); } warp.dialog("close"); } }, { text: '取消', handler: function () { warp.dialog("close"); } }] }); } else { $("div[name='winOrgWarp']").dialog('open'); } } }; var brandSelectorHandlers = function (targe, node) { var datas = []; $.each(node, function () { datas.push([{ 'text': this.text, 'value': this.id }][0]); }); $(targe).triggerbox('setValue', datas); }; // //2013-05-29 begin added by pengbb 新增系统菜单控件 /*用法:定义一个div,指定class 为 easyui-cmsTree
    data-options参数如下: url:'/Common/GetCurrentUserMenuList' onMenuClick:function(node){} */ (function ($) { $.parser.plugins.push("cmsTree"); function _toggleChildMenu(currMenu) { //$(currMenu).next('div').toggle(); if ($(currMenu).next('div').css("display") == "none") { $(currMenu).siblings("div").slideUp("normal"); $(currMenu).next('div').slideDown("normal"); } else { $(currMenu).next('div').slideUp("normal"); } } function _hideAllChildMenu(jq) { $(jq).find('a+div').hide(); } function _init(jq) { var opts = $.data(jq, "cmsTree").options; $(jq).addClass("menu_panel"); //$(jq).height(opts.height); var defaultOpenMenu = null; var newUrl = opts.url; if (opts.loadingMessage) { $(jq).html($("
    ").html(opts.loadingMessage)); } $.post(newUrl, {}, function (responseJson) { var rootPanel = jq; var i = 0; $.each(responseJson, function () { var level1Menu = $("系统首页 "); var level1MenuOption = this; level1Menu.appendTo(rootPanel); level1Menu.find("span").text(level1MenuOption.text); level1Menu.find("span").addClass("menu_item_level1_title"); if (level1MenuOption.text != "系统首页" && level1MenuOption.text != "系统注销" && i == 0) { i = 1; defaultOpenMenu = level1Menu; } if (level1MenuOption.iconUrl) { level1MenuOption.iconUrl = "url(" + level1MenuOption.iconUrl + ")"; level1Menu.find(">span").css({ backgroundPosition: "10px 6px", backgroundImage: level1MenuOption.iconUrl }); } level1Menu.attr("title", level1MenuOption.text); level1Menu.data("menuOption", level1MenuOption); if (level1MenuOption.children.length > 0) { var level2Panel = $("
    ").appendTo(rootPanel); $.each(level1MenuOption.children, function () { var level2Menu = $("系统首页 "); var level2MenuOption = this; level2Menu.appendTo(level2Panel); level2Menu.find("span").text(level2MenuOption.text); level2Menu.find("span").addClass("menu_item_level2_title"); level2Menu.attr("title", level2MenuOption.text); level2Menu.data("menuOption", level2MenuOption); if (level2MenuOption.children.length > 0) { //menu_item_level2_icon_opened //menu_item_level2_icon_closed level2Menu.addClass("menu_item_collapsable") .find("span").css({ paddingLeft: "20px" }).addClass("menu_item_level2_icon_closed"); var levelLeafPanel = $("
    ").appendTo(level2Panel); $.each(level2MenuOption.children, function () { var levelLeafMenu = $("系统首页 "); var levelLeafMenuOption = this; levelLeafMenu.appendTo(levelLeafPanel); levelLeafMenu.find("span").text(levelLeafMenuOption.text); levelLeafMenu.find("span").addClass("menu_item_leaf_title"); levelLeafMenu.find("span").addClass("menu_item_leaf_icon"); levelLeafMenu.find("span").css({ backgroundImage: levelLeafMenuOption.iconUrl }); levelLeafMenu.attr("title", levelLeafMenuOption.text); levelLeafMenu.data("menuOption", levelLeafMenuOption); }); } }); } _hideAllChildMenu(jq); }); if (defaultOpenMenu) { _toggleChildMenu(defaultOpenMenu); } // $(rootPanel).find("div.menu_item_panel").tinyscrollbar(); }, "json"); return { cmsTree: jq }; } $.fn.cmsTree = function (_7be, _7bf) { if (typeof _7be == "string") { var _7c0 = $.fn.cmsTree.methods[_7be]; if (_7c0) { return _7c0(this, _7bf); } else { return this.cmsTree(_7be, _7bf); } } _7be = _7be || {}; return this.each(function () { var _this = this; var _jqThis = $(_this); var cacheData = $.data(_this, "cmsTree"); if (cacheData) { $.extend(cacheData.options, _7be); } else { cacheData = $.data(_this, "cmsTree", { options: $.extend({}, $.fn.cmsTree.defaults, $.fn.cmsTree.parseOptions(this), _7be) }); var initCacheData = _init(_this); initCacheData.clickCallbacks = $.Callbacks(); cacheData = $.data(_this, "cmsTree", $.extend({}, cacheData, initCacheData)); _jqThis.find("a.menu_item").live("click", function (event) { //alert($(this).attr("title")); //alert(JSON.stringify($(this).data("menuOption"))); //menu_item_level2_icon_opened //menu_item_level2_icon_closed if ($(this).hasClass("menu_item_collapsable")) { var span = $(this).find(">span"); if (span.hasClass("menu_item_level2_icon_closed")) { span.removeClass("menu_item_level2_icon_closed"); span.addClass("menu_item_level2_icon_opened"); } else { span.removeClass("menu_item_level2_icon_opened"); span.addClass("menu_item_level2_icon_closed"); } $(this).siblings(".menu_item_collapsable").find(">span").removeClass("menu_item_level2_icon_opened").addClass("menu_item_level2_icon_closed"); } var opts = _jqThis.data("cmsTree").options; _toggleChildMenu(this); var menuOption = $(this).data("menuOption"); if (opts.onMenuClick) { opts.onMenuClick.call(_this, menuOption); } return false; }); //_jqThis.find("div.menu_item_panel").tinyscrollbar({ axis: 'x', size: 20}); } }); }; $.fn.cmsTree.methods = { options: function (jq) { var opts = $.data(jq[0], "cmsTree").options; return opts; } }; $.fn.cmsTree.parseOptions = function (_7c7) { var t = $(_7c7); return $.extend({}, $.fn.cmsTree.defaults, $.parser.parseOptions(_7c7, [])); }; $.fn.cmsTree.defaults = { url: '', loadingMessage: '菜单正在加载中...', onMenuClick: function () { } //, //height: 700 }; })(jQuery); //2013-05-29 end added by pengbb 新增系统菜单控件 //2013-05-21 begin added by pengbb 附件上传控件 /*用法:定义一个div,指定class 为 easyui-AttachmentUploader
    data-options参数如下: title: "附件列表", canUpload: true, //是否可以上传 formData: { ReferenceID: '', ReferenceKeyName: 'CMS' }, multi: true, //是否启用批量上传 fileSizeLimit: 0, // The maximum size of an uploadable file in KB (Accepts units B KB MB GB if string, 0 for no limit) fileTypeDesc : 'Image Files', // The description for file types in the browse dialog fileTypeExts : '*.gif; *.jpg; *.png', // Allowed extensions in the browse dialog (server-side validation should also be used) buttonText: '上传附件', buttonClass: '', swf: '/Scripts/Plugins/Uploadify/uploadify.swf', uploader: '/UploadFile.axd', uploadSuccess: function (file, data, response) { }, uploadFailure: function (file, data, response) { } */ (function ($) { $.parser.plugins.push("AttachmentUploader"); function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } function guid() { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } function _init(jq) { var opts = $.data(jq, "AttachmentUploader").options; var plAttachment = jq; var jqThis = $(jq); var dgAttachment = jqThis.find("div.upload_filelist>div"); var btnUpload = jqThis.find("div.upload_tool>input"); dgAttachment.cmsXDataTable(); return { AttachmentUploader: jq, btnUpload: btnUpload, dgAttachment: dgAttachment }; } function _deleteAttachment(jq, id) { var dgAttachment = $.data(jq, "AttachmentUploader").dgAttachment; $.messager.confirm('系统提示', '确定要删除该附件吗?', function (r) { if (r) { var ops = { URL: ("/" + CMS_SystemConfig.VirtualDirectoryPath + '/Common/RemoveAttachment/').replaceDoubleSlashesToSingle() + id, Before: function (rows) { }, CallBack: function (result) { $.messager.alert('系统提示', '删除成功!', 'info', function () { setTimeout(function () { dgAttachment.cmsXDataTable('load') }, 100); }); } } BowinFunction.Request.AJAX(ops); } }) } $.fn.AttachmentUploader = function (_7be, _7bf) { if (typeof _7be == "string") { var _7c0 = $.fn.AttachmentUploader.methods[_7be]; if (_7c0) { return _7c0(this, _7bf); } else { return this.AttachmentUploader(_7be, _7bf); } } _7be = _7be || {}; return this.each(function () { var _this = this; var cacheData = $.data(_this, "AttachmentUploader"); if (cacheData) { $.extend(cacheData.options, _7be); } else { cacheData = $.data(_this, "AttachmentUploader", { options: $.extend({}, $.fn.AttachmentUploader.defaults, $.fn.AttachmentUploader.parseOptions(this), _7be) }); cacheData.options = $.extend({}, cacheData.options, { onUploadSuccess: function (file, data, response) { setTimeout(function () { dgAttachment.cmsXDataTable("load"); }, 100); if (opts.uploadSuccess) { opts.uploadSuccess.call(this, file, data, response); } }, onAllComplete: function (event, data) { opts.onAllComplete.call(this, event, data); }, onUploadError: function (file, data, response) { if (opts.uploadFailure) { opts.uploadFailure.call(this, file, data, response); } } }); var initCacheData = _init(this); cacheData = $.data(this, "AttachmentUploader", $.extend({}, cacheData, initCacheData)); } var opts = cacheData.options; var btnUpload = cacheData.btnUpload; var dgAttachment = cacheData.dgAttachment; if (opts.canUpload) { btnUpload.show(); try { btnUpload.uploadify("destroy"); } catch (ignore) { } btnUpload.uploadify(opts); } else { btnUpload.hide(); } }); }; $.fn.AttachmentUploader.deleteColumnFormatFun = function (index, row, value) { if (row["IsOwn"]) { return "删除"; } else { return "    "; } }; $.fn.AttachmentUploader.methods = { options: function (jq) { var opts = $.data(jq[0], "AttachmentUploader").options; return opts; }, getDatagrid: function (jq) { var dgAttachment = $.data(jq[0], "AttachmentUploader").dgAttachment; return dgAttachment; }, deleteAttachment: function (jq, id) { return _deleteAttachment(jq[0], id); }, destroy: function (jq) { var btnUpload = $.data(jq[0], "AttachmentUploader").btnUpload; btnUpload.uploadify("destroy"); } }; $.fn.AttachmentUploader.parseOptions = function (_7c7) { var t = $(_7c7); return $.extend({}, $.fn.AttachmentUploader.defaults, $.parser.parseOptions(_7c7, [])); }; $.fn.AttachmentUploader.defaults = { title: "附件列表", canUpload: true, formData: { ReferenceID: '', ReferenceKeyName: 'CMS' }, width: 70, // The width of the browse button height: 26, // The height of the browse button createUserID: "", canDelete: true, multi: true, fileSizeLimit: 0, // The maximum size of an uploadable file in KB (Accepts units B KB MB GB if string, 0 for no limit) fileTypeDesc: '所有文件', // The description for file types in the browse dialog fileTypeExts: '*.*', // Allowed extensions in the browse dialog (server-side validation should also be used) buttonText: '上传附件', buttonClass: '', swf: ('/' + CMS_SystemConfig.VirtualDirectoryPath + '/Scripts/Plugins/Uploadify/uploadify.swf').replaceDoubleSlashesToSingle(), uploader: ('/' + CMS_SystemConfig.VirtualDirectoryPath + '/UploadFile.axd').replaceDoubleSlashesToSingle(), uploadSuccess: function (file, data, response) { }, uploadFailure: function (file, data, response) { }, onAllComplete: function (event, data) { //$('.easyui-window').window('close'); } }; })(jQuery); //2013-05-21 end added by pengbb 附件上传控件 //2013-08-01 begin added by pengbb 新增弹窗上传控件 (function ($) { $.parser.plugins.push("FileUploaderWindow"); function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } function guid() { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } function _init(jq) { var opts = $.data(jq, "FileUploaderWindow").options; var plAttachment = jq; var jqThis = $(jq); var win = jqThis.find(".FileUploaderWindowPanel"); var fileUploader = win.find(".easyui-AttachmentUploader"); //win.window(); return { FileUploaderWindow: jq, FileUploader: fileUploader, Window: win }; } $.fn.FileUploaderWindow = function (_7be, _7bf) { if (typeof _7be == "string") { var _7c0 = $.fn.FileUploaderWindow.methods[_7be]; if (_7c0) { return _7c0(this, _7bf); } else { return this.FileUploaderWindow(_7be, _7bf); } } _7be = _7be || {}; return this.each(function () { var _this = this; var cacheData = $.data(_this, "FileUploaderWindow"); if (cacheData) { $.extend(cacheData.options, _7be); } else { cacheData = $.data(_this, "FileUploaderWindow", { options: $.extend({}, $.fn.FileUploaderWindow.defaults, $.fn.FileUploaderWindow.parseOptions(this), _7be) }); var initCacheData = _init(this); cacheData = $.data(this, "FileUploaderWindow", $.extend({}, cacheData, initCacheData)); } }); }; $.fn.FileUploaderWindow.methods = { options: function (jq) { var opts = $.data(jq[0], "FileUploaderWindow").options; return opts; }, open: function (jq) { var data = $.data(jq[0], "FileUploaderWindow"); var opts = data.options; var win = data.Window; var fileUploader = data.FileUploader; fileUploader.AttachmentUploader(opts); win.window().show().window("open"); }, close: function (jq) { var data = $.data(jq[0], "FileUploaderWindow"); var opts = data.options; var win = data.Window; var fileUploader = data.FileUploader; fileUploader.AttachmentUploader("destroy"); win.window("close"); } }; $.fn.FileUploaderWindow.parseOptions = function (_7c7) { var t = $(_7c7); return $.extend({}, $.fn.FileUploaderWindow.defaults, $.parser.parseOptions(_7c7, [])); }; $.fn.FileUploaderWindow.defaults = $.extend({}, $.fn.AttachmentUploader.defaults, { formData: { ReferenceID: '', ReferenceKeyName: 'TempFile' } }); })(jQuery); //2013-08-01 end added by pengbb 新增弹窗上传控件 //2013-04-28 begin added by pengbb 新增triggerbox控件,用于用户选择和部门选择,号码规则选择 (function ($) { $.parser.plugins.push("triggerbox"); function _init(jq) { var widthCss = $(jq).width(); $(jq).addClass("triggerbox-f").hide(); var span = $("").insertAfter(jq); var span_text = $("").appendTo(span); var span_delete = $("").appendTo(span); var span_search = $("").appendTo(span); $("").appendTo(span); var name = $(jq).attr("name"); if (name) { span.find("input.triggerbox-value").attr("name", name); $(jq).removeAttr("name").attr("triggerboxName", name); } span_text.attr("autocomplete", "off"); //span.css("width", widthCss); span_text.width(widthCss - span_search.width() - span_delete.width() - 10); //span_text.width(span.width() - span_search.width() - span_delete.width()); return { triggerbox: span }; } function _setValue(jq, newData, isValidate) { var opts = $.data(jq, "triggerbox").options; var data = $.data(jq, "triggerbox").data; var span = $.data(jq, "triggerbox").triggerbox; data = newData; var ss = []; for (var i = 0; i < newData.length; i++) { var s = newData[i][opts.valueField]; if (opts.formatter) { s = opts.formatter.call(jq, newData[i]); } ss.push(s); } var oldTriggerboxValue = span.find("input.triggerbox-value").val(); span.find("input.triggerbox-text").val(ss.join(opts.separator)); span.find("input.triggerbox-value").val(JSON.stringify(newData)); var reg = "/" + opts.separator + "/g"; span.find("input.triggerbox-text").attr("title", ss.join(opts.separator).replace(eval(reg), "\r\n")); if (opts.required && isValidate) { //try{ var _769 = span.find("input.triggerbox-text"); _769.validatebox("validate"); // }catch(ignore){} } // if (ss.join(opts.separator).length > 0 && vv.join(opts.separator).length > 0) { // span.find(".triggerbox-delete").css("visibility", "visible"); // } else { // span.find(".triggerbox-delete").css("visibility", "hidden"); // } $.data(jq, "triggerbox", { options: opts, data: data, triggerbox: span }); if (oldTriggerboxValue != span.find("input.triggerbox-value").val()) { var changeFn = opts.change || function () { }; if (typeof (changeFn) == "function") { changeFn.call(jq); } } } function _initValidate(_768, doit) { var opts = $.data(_768, "triggerbox").options; var _769 = $.data(_768, "triggerbox").triggerbox.find("input.triggerbox-text"); _769.validatebox(opts); $(_768).removeClass("easyui-validatebox validatebox-text"); if (doit) { _769.validatebox("validate"); } }; $.fn.triggerbox = function (_7be, _7bf) { if (typeof _7be == "string") { var _7c0 = $.fn.triggerbox.methods[_7be]; if (_7c0) { return _7c0(this, _7bf); } else { return this.triggerbox(_7be, _7bf); } } _7be = _7be || {}; return this.each(function () { var _this = this; var triggerboxData = $.data(this, "triggerbox"); if (triggerboxData) { $.extend(triggerboxData.options, _7be); } else { triggerboxData = $.data(this, "triggerbox", { options: $.extend({}, $.fn.triggerbox.defaults, $.fn.triggerbox.parseOptions(this), _7be) }); var initTriggerboxData = _init(this); triggerboxData = $.data(this, "triggerbox", $.extend({}, triggerboxData, initTriggerboxData)); } if (triggerboxData.options.data) { _setValue(this, triggerboxData.options.data, false); } triggerboxData.triggerbox.find(".triggerbox-search").unbind(".triggerbox"); triggerboxData.triggerbox.find(".triggerbox-delete").unbind(".triggerbox"); //注册事件 triggerboxData.triggerbox.find(".triggerbox-search").bind("mouseenter.triggerbox", function () { $(this).addClass("triggerbox-search-hover"); }).bind("mouseleave.triggerbox", function () { $(this).removeClass("triggerbox-search-hover"); }).bind("mousedown.triggerbox", function () { if (triggerboxData.options.editable) { //查询点击事件 if (triggerboxData.options.onSearch) { triggerboxData.options.onSearch.call(_this); } } }); triggerboxData.triggerbox.find(".triggerbox-search").bind("mouseenter.triggerbox", function () { $(this).addClass("triggerbox-search-hover"); }).bind("mouseleave.triggerbox", function () { $(this).removeClass("triggerbox-search-hover"); }).bind("mousedown.triggerbox", function () { if (triggerboxData.options.editable) { //查询点击事件 if (triggerboxData.options.onSearchClick) { triggerboxData.options.onSearchClick.call(_this); } } }); triggerboxData.triggerbox.find(".triggerbox-delete").bind("mouseenter.triggerbox", function () { $(this).addClass("triggerbox-delete-hover"); }).bind("mouseleave.triggerbox", function () { $(this).removeClass("triggerbox-delete-hover"); }).bind("mousedown.triggerbox", function () { if (triggerboxData.options.editable) { $.fn.triggerbox.methods["clear"]($(_this)); //$(this).css("visibility", "hidden"); } }); _initValidate(_this, true); }); }; $.fn.triggerbox.methods = { options: function (jq) { var opts = $.data(jq[0], "triggerbox").options; return opts; }, getData: function (jq) { return $.data(jq[0], "triggerbox").data; }, setValue: function (jq, newData) { jq.each(function () { _setValue(this, newData, true); }); }, getValue: function (jq) { return eval($.data(jq[0], "triggerbox").triggerbox.find("input.triggerbox-value").val()); }, clear: function (jq) { jq.each(function () { var opts = $(this).triggerbox("options"); opts.data = []; $(this).triggerbox("setValue", opts.data); }); } }; $.fn.triggerbox.parseOptions = function (_7c7) { var t = $(_7c7); return $.extend({}, $.extend({}, $.fn.triggerbox.defaults, $.parser.parseOptions(_7c7, ["valueField", "textField"])), $.fn.validatebox.parseOptions(_7c7)); }; $.fn.triggerbox.defaults = $.extend({}, $.fn.validatebox.defaults, { valueField: "value", textField: "text", separator: ",", editable: true, postData: {}, change: function () { }, formatter: function (row) { var opts = $(this).triggerbox("options"); return row[opts.textField]; } } ); })(jQuery); //2013-04-28 end added by pengbb 新增triggerbox控件,用于用户选择和部门选择,号码规则选择 //2013-05-03 begin added by pengbb 新增号码规则选择控件 function TelNumberRuleSelector(config) { var defaultConfig = { onSelect: null, width: 600, height: 400, postData: {} }; config = $.extend({}, defaultConfig, config); var newUrl = "/Common/GetTelNumberRuleListForSelector"; newUrl = ("/" + CMS_SystemConfig.VirtualDirectoryPath + newUrl).replaceDoubleSlashesToSingle(); var jqPanel = $("
    ").appendTo(document.body); var jqPanelLayout = $('
    ').appendTo(jqPanel); var jqPanelLayoutCenter = jqPanelLayout.find("div.layout-panel-center>div.layout-body"); var jqPanelLayoutCenterContent = $('
    ').appendTo(jqPanelLayoutCenter); var jqPanelLayoutSouth = jqPanelLayout.find("div.layout-panel-south>div.layout-body"); var btnYes = $("确定").appendTo(jqPanelLayoutSouth); var btnNo = $("取消").appendTo(jqPanelLayoutSouth); if (config.width) { jqPanel.width(config.width); } if (config.height) { jqPanel.height(config.height); } jqPanel.window(); btnYes.linkbutton(); btnNo.linkbutton(); var isIE6 = false; if ($.browser.msie) { if ($.browser.version < 7) { isIE6 = true; } } var centerContentConfig = { url: newUrl, postData: config.postData, onLoaded: function () { jqPanelLayoutCenterContent.find("div.cmspanel>div.panel-header>div.panel-tool>a.cmspanel-tool-collapse").click(function () { var _this = $(this); if (_this.hasClass("panel-tool-expand")) { _this.removeClass("panel-tool-expand"); if (isIE6) { _this.closest("div.cmspanel").find("div.panel-body").show(); } else { _this.closest("div.cmspanel").find("div.panel-body").slideDown(); } } else { _this.addClass("panel-tool-expand"); if (isIE6) { _this.closest("div.cmspanel").find("div.panel-body").hide(); } else { _this.closest("div.cmspanel").find("div.panel-body").slideUp(); } } }); } }; jqPanelLayoutCenterContent.cmsLoadHtml(centerContentConfig); var eventManager = { onSelect: [] }; var _select = function (fn) { eventManager["onSelect"].push(fn); } if (config.onSelect) { eventManager["onSelect"].push(config.onSelect); } btnYes.unbind(".SelectTelNumberRule"); btnNo.unbind(".SelectTelNumberRule"); btnYes.bind("click.SelectTelNumberRule", function () { var selectDatas = []; $(jqPanel).find("input[type=checkbox]:checked").each(function () { selectDatas.push({ text: $(this).attr("text"), value: $(this).val() }); }); _postEvent(selectDatas); _hide(); }); btnNo.bind("click.SelectTelNumberRule", function () { _hide(); }); var _show = function () { jqPanel.window('open'); }; var _hide = function () { jqPanel.window('close'); }; var _postEvent = function (p) { $.each(eventManager["onSelect"], function () { this.call(_this, p); }); } var _this = { jq: jqPanel, show: _show, hide: _hide, select: _select }; return _this; } //2013-05-03 end added by pengbb新增号码规则选择控件 var SelectUserContorl = function (departmentID, multipleChoice, handlers) { var groups = {}; var DepartmentID = departmentID; var MultipleChoice = multipleChoice; var waitDataGrid; var pitchOnDataGrid; var rightTopQuey; var tree; var win; var leftQuery; //private 创建Html元素 var createElement = function (elementTypeName, elements, parentElments) { $(elementTypeName).removeClass(); if (typeof parentElments != "undefined" && typeof elements == "string") { var elementsObject = $(elements); parentElments.append(elementsObject); return elementsObject; } else { if (typeof elements == "string") return $(elements); } }; var createTableString = function (name) { var table = "", ""); }; var InitGridFile = function (dataGrid, pagination, url) { return dataGrid.datagrid({ url: pagination ? url : "", queryParams: pagination ? { departmentID: DepartmentID, userName: rightTopQuey.find("input[name='txtUserName']").val() } : "", pagination: pagination, pageSize: 1, pageList: [5, 10], loadMsg: "请稍等....", columns: [[ { field: 'UserID', title: 'UserID', checkbox: true }, { field: 'DepartmentName', title: '部门机构' }, { field: 'LoginName', title: '登录名' }, { field: 'UserName', title: '用户名' } ]] }); } //private 选择用户 var selectWaitUser = function () { var selectUser = waitDataGrid.datagrid("getChecked"); if (selectUser.length > 0) { if (!multipleChoice && selectUser.length > 1) { $.messager.alert("系统消息", "一次只能选择一个用户!"); } else { var dataSource = "{\"total\":".concat(selectUser.length, ",", "\"rows\":["); for (var i = 0; i < selectUser.length; i++) { dataSource = dataSource.concat('{"UserID":', "\"", selectUser[i].UserID, "\",", '"DepartmentName":', "\"", selectUser[i].DepartmentName, "\",\"LoginID\":\"", selectUser[i].LoginName, "\",\"UserName\":\"", selectUser[i].UserName, "\"}," ); } dataSource = dataSource.substring(0, dataSource.length - 1); dataSource = dataSource.concat("]}"); var currentData = $.parseJSON(dataSource); currentData.rows = currentData.rows.sort(function (a, b) { return a > b; }); if (typeof (pitchOnDataGrid.data("SelectedUser")) != "undefined") { //先拿缓存数据 var cachData = pitchOnDataGrid.data("SelectedUser"); for (var i = 0; i < cachData.rows.length; i++) { for (var j = 0; j < currentData.rows.length; j++) { if (cachData.rows[i].UserID == currentData.rows[j].UserID) { currentData.rows.splice(j, 1); } } } cachData.rows = $.merge(currentData.rows, cachData.rows); pitchOnDataGrid.data("SelectedUser", cachData); } else { pitchOnDataGrid.data("SelectedUser", currentData); } pitchOnDataGrid.datagrid("loadData", pitchOnDataGrid.data("SelectedUser")); } } else { $.messager.alert("系统消息", "未选择任何用户!"); } }; var registEvent = function (target, eventType, handler) { target.unbind(eventType, handler); target.bind(eventType, handler); } var close = function () { var btnSelectOk = $((rightTopQuey.find("a"))[1]); btnSelectOk.unbind(); btnSelectOk.bind("click", function () { var selectUser = pitchOnDataGrid.datagrid("getData"); if (handlers instanceof Array) { for (var i = 0; i < handlers.length; i++) { handlers[i](selectUser); } } else if (typeof handlers != "undefined") { handlers(selectUser); } win.window("close"); }); }; var hasEasyUI = function (elementTypeName) { if ($(elementTypeName).length > 0) { return true; } else { return false; } } var createLinkButton = function (elements) { var links = elements.find("a"); for (var i = 0; i < links.length; i++) { $(links[i]).linkbutton(); } }; var getUserInfo = function () { waitDataGrid.datagrid('load', { departmentID: DepartmentID, userName: rightTopQuey.find("input[name='txtUserName']").val() } ); } var deleteSelectUser = function () { var deleteSource = pitchOnDataGrid.datagrid("getChecked"); if (deleteSource.length > 0) { for (var i = 0; i < deleteSource.length; i++) { var rowIndex = pitchOnDataGrid.datagrid("getRowIndex", deleteSource[i]); pitchOnDataGrid.datagrid("deleteRow", rowIndex); } } //else { // $.messager.alert("系统消息", "未选中任何行!"); // } }; var loadDepartmentTree = function () { var inputDepartment = leftQuery.find("input[name='txtDepartmentName']").val(); $.cmsPost("/Common/GetSelectUserControlDepartmentTree", { departmentID: "", departmentName: inputDepartment }, function (data) { $(tree).tree('loadData', data); }); } var show = function () { if (!hasEasyUI("div[name='winWarp']")) { var warpElement = "
    "; var warp = createElement(".selectUser_warp", warpElement, win); win = warp.window({ width: 760, height: 500, modal: true, maximizable: false, title: '用户信息选择' }); var elementLeft = createElement(".selectUser_left", "
    ", warp); var elementRight = createElement(".selectUser_right", "
    ", warp); var leftQueryTable = ""; leftQueryTable = leftQueryTable.concat(""); leftQueryTable = leftQueryTable.concat(""); leftQueryTable = leftQueryTable.concat(""); leftQueryTable = leftQueryTable.concat("
    渠道名称:查询
    "); leftQuery = createElement(".query", leftQueryTable, elementLeft); createLinkButton(leftQuery); var left_panel_warp = createElement("div[panel_postion='left']", "
      ", elementLeft); left_panel_warp.panel({ width: 350, height: 450, title: '部门信息', closable: false, collapsible: true, minimizable: false, maximizable: false }); var departmentName = leftQuery.find("input[name='txtDepartmentName']").val(); tree = $(left_panel_warp.find("ul[name='departmentTree']")[0]).tree({ url: ("/" + CMS_SystemConfig.VirtualDirectoryPath + ("/Common/GetSelectUserControlDepartmentTree?departmentName=" + departmentName).replace(CMS_SystemConfig.VirtualDirectoryPath, "")).replaceDoubleSlashesToSingle(), lines: true, onBeforeLoad: function (node, param) { if (node == null) { return true; } else { var children = $(this).tree("getChildren", node.target); if (children == "") { return true; } else { return false; } } }, onClick: function (node) { DepartmentID = eval(node).id; getUserInfo(); } }); var rightQuery = '

      帐号/用户名: 查询'; rightQuery = rightQuery.concat("  确定

      "); rightTopQuey = createElement("p[pPostion='right_top']", rightQuery, elementRight); createLinkButton(rightTopQuey); var rightWaitChoise_paneDiv = createElement("div[panel_postion='right_middel']", "
      ", elementRight); var waitChoisePanel = rightWaitChoise_paneDiv.panel({ width: 380, title: '待选用户', closable: false, collapsible: true, minimizable: false, maximizable: false }); var selectAndDeteButtonStr = "

      选择     删除

      "; var selectAndDeteButton = createElement("p[pPostion='right_bottom']", selectAndDeteButtonStr, elementRight); createLinkButton(selectAndDeteButton); var left_panel_warp = createElement("div[panel_postion='right_selectUser']", "
      ", elementRight); var pitchOnPanel = left_panel_warp.panel({ width: 380, height: 150, title: '已选用户', closable: false, collapsible: true, minimizable: false, maximizable: false }); var waitTable = createElement("table[name='waitDataGrid']", createTableString("waitDataGrid"), waitChoisePanel); var pitchOnTable = createElement("table[name='pitchOnDataGrid']", createTableString("pitchOnDataGrid"), pitchOnPanel); waitDataGrid = InitGridFile(waitTable, true, ("/" + CMS_SystemConfig.VirtualDirectoryPath + ("/Common/GetSelectUserContorlViewPageList").replace(CMS_SystemConfig.VirtualDirectoryPath, "")).replaceDoubleSlashesToSingle()); pitchOnDataGrid = (InitGridFile(pitchOnTable, false)); //查询部门树 registEvent(leftQuery.find("a:first"), "click", loadDepartmentTree); //选择用户 registEvent(selectAndDeteButton.find("a:first"), "click", selectWaitUser); //删除用户 registEvent($(selectAndDeteButton.find("a")[1]), "click", deleteSelectUser); //关闭 registEvent(rightTopQuey.find("a:first"), "click", getUserInfo); close(handlers); } else { $("div[name='winWarp']").window('open'); } }; return { "show": show }; }; $.extend($.fn.validatebox.defaults.rules, { baseRequired: { validator: function (value, param) { return value && value != ""; }, message: '必填' }, dropdownListRequired: { validator: function (value, param) { return value != "" && value != "-1" && value != "全部" && value != "请选择"; }, message: '必选' }, mobile: { validator: function (value, param) { return (/^1\d{10}$/gi).test(value); }, message: '手机号码格式不对' }, telnumber: { validator: function (value, param) { return (/((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/gi).test(value); }, message: '号码格式不对' }, IDCard: { validator: function (value, param) { var idcard = value; //身份证号码 var Errors = new Array( "验证通过!OK", "身份证号码位数不对!", "身份证号码出生日期超出范围或含有非法字符!", "身份证号码校验错误!", "身份证地区非法!" ); var area = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外" }; var idcard, Y, JYM; var S, M; var idcard_array = new Array(); idcard_array = idcard.split(""); //地区检验 if (area[parseInt(idcard.substr(0, 2))] == null) { this.message = Errors[4]; return false; } //身份号码位数及格式检验 switch (idcard.length) { case 15: if ((parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0 || ((parseInt(idcard.substr(6, 2)) + 1900) % 100 == 0 && (parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0)) { ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/; //测试出生日期的合法性 } else { ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/; //测试出生日期的合法性 } if (ereg.test(idcard)) return true; else { this.message = Errors[2]; return false; } break; case 18: //18位身份号码检测 //出生日期的合法性检查 //闰年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9])) //平年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8])) if (parseInt(idcard.substr(6, 4)) % 4 == 0 || (parseInt(idcard.substr(6, 4)) % 100 == 0 && parseInt(idcard.substr(6, 4)) % 4 == 0)) { ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/; //闰年出生日期的合法性正则表达式 } else { ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/; //平年出生日期的合法性正则表达式 } if (ereg.test(idcard)) {//测试出生日期的合法性 //计算校验位 S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7 + (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9 + (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10 + (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5 + (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8 + (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4 + (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2 + parseInt(idcard_array[7]) * 1 + parseInt(idcard_array[8]) * 6 + parseInt(idcard_array[9]) * 3; Y = S % 11; M = "F"; JYM = "10X98765432"; M = JYM.substr(Y, 1); //判断校验位 if (M == idcard_array[17]) return true; //检测ID的校验位 else { this.message = Errors[3]; return false; }; } else { this.message = Errors[2]; return false; }; break; default: this.message = Errors[1]; return false; break; } }, message: '证件号码格式不对' }, filterWord: { validator: function (value, param) { var returnValue = true; $(param[0]).each(function (i, item) { if (item == value) { returnValue = false; return false; } }); return returnValue; }, message: '敏感字过滤' }, onlyNumber: { validator: function (value, param) { return (/^[0-9]\d*$/gi).test(value); }, message: '仅允许输入数字' }, onlyDiscount: { validator: function (value, param) { //^0\.[0-9]{1,2}$ return (/^(?:0(?:\.(?!00)[0-9]{1,2})?|1)$/gi).test(value); // return (/^[1-9]([.]{1}[1-9])?$/gi).test(value); }, message: '仅允许输入带二位小数的有效数字' }, onlyChar: { validator: function (value, param) { return (/^[A-Za-z0-9]+$/gi).test(value); }, message: '仅允许输入英文及数字' }, onlyMoney: { validator: function (value, param) { return (/^-?\d+(\.\d{1,2})?$/gi).test(value); }, message: '仅允许输入保留二位有效数字' } }); $.extend($.fn.validatebox.methods, { remove: function (jq, newposition) { return jq.each(function () { $(this).removeClass("validatebox-text validatebox-invalid").unbind('focus.validatebox').unbind('blur.validatebox'); }); }, reduce: function (jq, newposition) { return jq.each(function () { var opt = $(this).data().validatebox.options; $(this).addClass("validatebox-text").validatebox(opt); }); } }); $.extend($.fn.validatebox.methods, { removeForCombobox: function (jq, newposition) { return jq.each(function () { var comboxText = $(this).next().find("input").first(); comboxText.removeClass("validatebox-text validatebox-invalid").unbind('focus.validatebox').unbind('blur.validatebox'); }); }, reduceForCombobox: function (jq, newposition) { return jq.each(function () { var comboxText = $(this).next().find("input").first(); var opt = comboxText.data().validatebox.options; comboxText.addClass("validatebox-text").validatebox(opt); }); } }); //2013-12-05 begin added by pengbb 新增ajax加载html内容控件 /*用法:定义一个div,指定class 为 easyui-cmsLoadHtml
      data-options参数如下: url:'/Common/GetHtmlContent', loadingMessage:'正在加载中...', postData : {} */ (function ($) { $.parser.plugins.push("cmsLoadHtml"); function _init(jq) { var opts = $.data(jq, "cmsLoadHtml").options; return { cmsLoadHtml: jq }; } function _load(jq) { var opts = $.data(jq, "cmsLoadHtml").options; if (opts.url && opts.url != "") { if (opts.loadingMessage) { //loadPanel.prependTo(jq); var loadPanel = $("
      ").prependTo(jq); $("
      ").appendTo(jq); $("
      ").appendTo(loadPanel); var msg = $("
      ").html(opts.loadingMessage).appendTo(loadPanel); msg.css("marginLeft", -msg.outerWidth() / 2); } setTimeout(function () { $.ajax({ url: opts.url, data: $.extend({}, {}, opts.postData), cache: false, dataType: "html", success: function (data) { $(jq).html(opts.extractor.call(jq, data)); if (typeof (opts.onLoaded) == "function") { opts.onLoaded.call(jq); } } }); }, opts.delay); } }; $.fn.cmsLoadHtml = function (_7be, _7bf) { if (typeof _7be == "string") { var _7c0 = $.fn.cmsLoadHtml.methods[_7be]; if (_7c0) { return _7c0(this, _7bf); } else { return this.cmsLoadHtml(_7be, _7bf); } } _7be = _7be || {}; return this.each(function () { var _this = this; var _jqThis = $(_this); var cacheData = $.data(_this, "cmsLoadHtml"); if (cacheData) { $.extend(cacheData.options, _7be); } else { cacheData = $.data(_this, "cmsLoadHtml", { options: $.extend({}, $.fn.cmsLoadHtml.defaults, $.fn.cmsLoadHtml.parseOptions(this), _7be) }); var initCacheData = _init(_this); cacheData = $.data(_this, "cmsLoadHtml", $.extend({}, cacheData, initCacheData)); } _load(_this); }); }; $.fn.cmsLoadHtml.methods = { options: function (jq) { var opts = $.data(jq[0], "cmsLoadHtml").options; return opts; }, reload: function (jq) { _load(jq[0]); } }; $.fn.cmsLoadHtml.parseOptions = function (_7c7) { var t = $(_7c7); return $.extend({}, $.fn.cmsLoadHtml.defaults, $.parser.parseOptions(_7c7, [])); }; $.fn.cmsLoadHtml.defaults = { url: '', delay: 0, loadingMessage: '正在加载中...', postData: {}, onLoaded: function () { }, extractor: function (data) { var _1ef = /]*>((.|[\n\r])*)<\/body>/im; var _1f0 = _1ef.exec(data); if (_1f0) { return _1f0[1]; } else { return data; } } }; })(jQuery); //2013-12-05 end added by pengbb 新增ajax加载html内容控件 //2013-12-10 begin added by pengbb 新增下一步审批人控件 /*用法:定义一个div,指定class 为 easyui-cmsNextApproverSelector
      data-options参数如下: url:'/Common/GetHtmlContent', loadingMessage:'正在加载中...', postData : {} */ (function ($) { $.parser.plugins.push("cmsNextApproverSelector"); function _init(jq) { var opts = $.data(jq, "cmsNextApproverSelector").options; var approverCombobox = $("").attr("name", opts.name).appendTo(jq); var workPositionLabel = $("