<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>企业信息管理</title>
	<meta name="decorator" content="default"/>
	<style type="text/css">
		img {
			/*width: 50px; */
			/*height: 50px;*/
			max-width: 50px;
			max-height: 50px;
		}
	</style>
	<script type="text/javascript">
        // $(document).ready(function() {
        //     $("img").not(".upload_ico").each(function () {
        //         var num = 1 ;
        //         $(this).click(function () {
        //             var flag = num%2;
        //             if(flag == 1){
        //                 $(this).css("width","90%");
        //                 $(this).css("height","90%");
        //                 num++;
        //             }else if(flag ==0){
        //                 $(this).css("width","50px");
        //                 $(this).css("height","50px");
        //                 num++;
        //             }
        //         })
        //     });
        // });
	</script>
	<style>
		body{
			background-color:transparent;
			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
			color:#ffffff;
			background-color:rgba(255,255,255,0);
			height:100%;
		}
	</style>
</head>
<body>
<div class="wrapper wrapper-content">
		<sys:message content="${message}"/>
		<div class="layui-row">
			<div class="full-width fl">
				<div class="contentShadow layui-row" id="queryDiv">
					<shiro:hasPermission name="sys:company:list">
						<!--查询条件-->
								<form:form id="searchForm" modelAttribute="company" action="${ctx}/sys/company/useableCompany" method="post" class="form-inline">
									<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
									<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
									<input id="createBy" name="createBy" type="hidden" value="${fns:getUser().id}"/>
									<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->

									<div class="commonQuery">
										<div class="layui-item query athird">
											<label class="layui-form-label">公司名称：</label>
											<div class="layui-input-block with-icon">
												<form:input path="name" htmlEscape="false" maxlength="64"  class=" form-control layui-input"/>
											</div>
										</div>

										<div class="layui-item athird fr">
											<div class="input-group">
												<button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
												<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
											</div>
										</div>
										<div style="    clear:both;"></div>
									</div>
								</form:form>
					</shiro:hasPermission>
				</div>
			</div>

			<div class="full-width fl">
				<div class="contentShadow layui-form contentDetails">
					<div class="nav-btns">
						<button class="nav-btn nav-btn-refresh" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i>&nbsp;刷新</button>
						<div style="clear: both;"></div>
					</div>
					<div class="with-profile">
						<table class="oa-table layui-table" id="contentTable"></table>
					<!-- 表格 -->
					<!-- 分页代码 -->
					<table:page page="${page}"></table:page>
					</div>
					<div style="clear: both;"></div>
				</div>
			</div>
	</div>
	<div id="changewidth"></div>
</div>
<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
<script>
    layui.use('table', function(){
        layui.table.render({
            limit:${ page.pageSize }
            ,elem: '#contentTable'
            ,page: false
            ,cols: [[
                // {checkbox: true, fixed: true},
                {field:'index',align:'center',  width:40,title: '序号'}
                ,{field:'name',align:'center', title: '公司名称', minWidth:120,templet:function(d){
                        return "<span title='"+ d.name +"'>" + d.name + "</span>";
                    }}
                ,{align:'center', title: '营业执照', width:66,templet:function(d){
                        var xml="";
                        if(d.licences != undefined)
                            xml = "<img src=\"" + d.licences + "?x-oss-process=image/resize,w_50,limit_0\" onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.licences + "','95%','95%')\"/>";
                        return xml;
                    }}
                ,{field:'number',align:'center', title: '统一社会信用代码(注册号)', width:160,templet:function(d){
                        return "<span title='"+ d.number +"'>" + d.number + "</span>";
                    }}
                ,{field:'legalPerson', align:'center',title: '法人', width:80,templet:function(d){
                        return "<span title='"+ d.legalPerson +"'>" + d.legalPerson + "</span>";
                    }}
                ,{field:'tuser',align:'center', title: '申请人编号|姓名', width:110,templet:function(d){
                        return "<span title='"+ d.tuser +"'>" + d.tuser + "</span>";
                    }}

                ,{field:'phone', align:'center',title: '申请人电话', width:90,templet:function(d){
                        return "<span title='"+ d.phone +"'>" + d.phone + "</span>";
                    }}
                ,{field:'email', align:'center',title: '申请人邮箱',width:130,templet:function(d){
                        return "<span title='"+ d.email +"'>" + d.email + "</span>";
                    }}
                ,{field:'usable',align:'center', title: '是否启用', width:70,templet:function(d){
                        return "<span title='"+ d.usable +"'>" + d.usable + "</span>";
                    }}
                ,{field:'op',align:'center',title:"操作",width:130,templet:function(d){
                        ////对操作进行初始化
                        var xml = "";
                        if(d.canview != undefined && d.canview == "1")
                            xml += "<a href=\"javascript:void(0)\" onclick=\"openDialogView('查看企业信息', '${ctx}/sys/company/form?id="+ d.id +"&readAttr=disabled','95%','95%')\" class=\"op-btn op-btn-view\" ><i class=\"fa fa-search-plus\"></i> 查看</a>";
                        if(d.canapply != undefined && d.canapply == "1")
                            xml +="<a href=\"javascript:void(0)\" onclick=\"openDialog('邀请加入企业', '${ctx}/sys/company/addUserInfo','95%','95%')\" class=\"op-btn op-btn-add\" ><i class=\"fa fa-search-plus\"></i> 邀请</a>";

                        return xml;
                    }}
            ]]
            ,data: [
                <c:if test="${ not empty page.list}">
                <c:forEach items="${page.list}" var="company" varStatus="index">
                <c:if test="${index.index != 0}">,</c:if>
                {
                    "index":"${index.index+1}"
                    ,"id":"${company.id}"
                    ,"name":"${company.name}"
                    <c:if test="${not empty company.licences}"><c:forTokens items="${company.licences}" delims="," var="licenceStr">
                    ,"licences":"${licenceStr}"</c:forTokens></c:if>
                    ,"number":"${company.number}"
                    ,"legalPerson":"${company.legalPerson}"
                    ,"tuser":"${company.tuser.name}"
                    ,"phone":"${company.phone}"
                    ,"email":"${company.email}"
                    ,"usable":"${fns:getDictLabel(company.USEABLE, 'useable', '')}"
                    <shiro:hasPermission name="sys:company:view">,"canview":"1"</shiro:hasPermission>
                    <shiro:hasPermission name="sys:company:applyCompany">
					<c:if test="${not empty company.master && company.master > 0}">
                    	,"canapply":"1"
					</c:if>
					</shiro:hasPermission>
                }
                </c:forEach>
                </c:if>
            ]
            // ,even: true
            // ,height: 315
        });

    })

    resizeListTable(130);
</script>
	<script>
        resizeListWindow1();
        $(window).resize(function(){
            resizeListWindow1();
        });
	</script>
</body>
</html>