selectFromMECHandlerPool.jsp 5 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.weaver.formmodel.util.StringHelper"%>
<%@ include file="/mobilemode/admin/init.jsp"%>
<%
String id = StringHelper.null2String(request.getParameter("id"),"");
%>
<HTML><HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" href="/mobilemode/css/mec/mec_design_wev8.css" />
<link type="text/css" rel="stylesheet" href="/font/mobilemode/plugin/iconfont.css" />
<link type="text/css" rel="stylesheet" href="/mobilemode/admin/src/common/css/common.css" />
<style>
*{
	font: 12px Microsoft YaHei;
}
html,body{
	height: 100%;
	margin: 0px;
	padding: 0px;
	overflow: hidden;
}
.mec_item {
	display: block;
	border: 1px solid #fff;
	width: calc(100% - 12px);
	height: 36px;
	margin: 4px;
}
.mec_items:after {
	content: " ";
	clear: both;
	display: table;
}
.item_sel:after {
	content: "\e66f";
	position: relative;
	float: right;
	top: 6px;
	right: 6px;
	font-size: 16px;
	color: #108EE9;
}
.mec_node {
	width: 100%;
	height: 36px;
	display: block;
	font-family: iconfont;
	font-size: 16px;
}
.mec_node:hover {
	color: #108EE9;
	transition: .3 all ease;
}
.mec_node em{
	margin: 0;
	background: none;
	font-size: 20px;
	line-height: 1;
	vertical-align: middle;
}
.mec_node span{
	margin: 2px 0 0 2px;
    display: inline-block;
	width: 78%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font: 16px Microsoft YaHei;
}
.mec_item, 
.mec_node, 
.mec_node em,
.mec_node span{
	cursor: pointer;
	text-align: left;
}
#mecSearchInput {
	position: fixed;
	width: calc(100% - 24px);
}
#mecHandlerContainer {
	margin-top: 40px;
	height: calc(100% - 40px);
	overflow-y: auto;
	overflow-x: hidden;

}
/**
	页面加载后没有数据的提示样式
 */
#noDataMes {
	text-align: center;
	color: #666;
	padding-right: 10px;
	padding-top: 15px;
	font-size: 12px;
}
#openCreateTabDialog{
	cursor: pointer;
	color: #0aa7ee;
	text-decoration-line: underline;
}

</style>
<script>
	define('mec_handlerpool', ['jquery'], function(){
        var mecHandlerids = [];
        var isCreate = false;
        $(document).ready(function () {
            var htm = top.MEC_Tab_BeChoose_Html_<%=id%>;
            htm = htm.length == 0 ? "<div id='noDataMes'><%=SystemEnv.getHtmlNoteName(6249, user.getLanguage())%>,<span id='openCreateTabDialog'><%=SystemEnv.getHtmlNoteName(4362, user.getLanguage())%></span></div>" : htm;

            var $mecHandlerContainer = $("#mecHandlerContainer");
            $mecHandlerContainer.append(htm);

            $(".mec_node").click(function(){
                var $this = $(this);
                var id = $this.attr('id');
                if(!$this.hasClass("item_sel")){
                    $this.addClass("item_sel");
                    !~mecHandlerids.indexOf(id) && mecHandlerids.push($(this).attr('id'));
                }else{
                    $this.removeClass("item_sel");
                    ~mecHandlerids.indexOf(id) && mecHandlerids.splice(mecHandlerids.indexOf(id), 1);
                }
            });
            $('#mecSearchInput input').on('input', function(){
                var inputEl = $(this),
					val = (inputEl.val() || '').toLowerCase(),
					keyEls = $('#mecHandlerContainer .mec_item span'),
					ismatch = false;
                if(keyEls.length == 0) return;

                keyEls.each(function(index, keyEl){
                    keyEl = $(keyEl);
                    ismatch = (keyEl.text() || '').toLowerCase().indexOf(val) != -1;

                    keyEl.parents('.mec_item').toggle(ismatch);
				});
			});
            //点击新建
            $("#openCreateTabDialog").click(function () {
                //关闭从页面添加的弹出框
                isCreate = true;
                onOK();
            })
        });

        return {
            returnResult: function(){
                var id = '<%=id%>';

                var mecHandleridJsons = []
                mecHandlerids.forEach(function(item){
                    var mecHandlerid = {};
                    mecHandlerid['mecHandlerid'] = item;
                    mecHandleridJsons.push(mecHandlerid);
				});

                if(top && top.callTopDlgHookFn){
                    var result = {
                        "mecHandlerIDs" : $.isEmptyObject(mecHandleridJsons) ? "" : JSON.stringify(mecHandleridJsons),
                        "tabID" : id,
						"isCreate" : isCreate
                    };
                    top.callTopDlgHookFn(result);

                }
                if (!isCreate) onClose();
            }
		}
	});
    require(['mec_handlerpool']);

function onOK(){
    require(['mec_handlerpool'], function (mec_handlerpool) {
        mec_handlerpool.returnResult();
    });
}

function onClose(){
	top.closeTopDialog();
}
</script>
</HEAD>
<body>
<div style="padding: 10px 0px 10px 12px;height: 100%;">
	<div id="mecSearchInput">
		<input class="form-control" placeholder="<%=SystemEnv.getHtmlNoteName(4748, user.getLanguage())%>">
	</div>
	<div id="mecHandlerContainer"></div>
</div>
</body>
</html>