<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ attribute name="url" type="java.lang.String" required="true"%>
<%-- 使用方法： 1.将本tag写在查询的form之前；2.传入controller的url --%>
<script type="text/javascript">

    function getChange(){
        alert(333);
        var formData = new FormData();
        formData.append("file",top.$("#uploadFile")[0].files[0]);
        $.ajax({
            type: 'post',
            url:'${ctx}/workexample/workExample/excel',
            data: formData,
            dataType: "json",
            cache: false,
            processData: false,
            contentType: false,
        }).success(function (result) {

            top.layer.msg(result.message);
        }).error(function () {
            top.layer.msg("导入文件失败！");
        });
    }

    $(document).ready(function() {

        $("#btnImport").click(function(){
            top.layer.open({
                type: 1,
                area: ['60%','80%'],
                title:"导入数据",
                skin: 'three-btns with-demo',
                content:$("#importBox").html() ,
                btn: ['下载模板','确定', '关闭'],
                btn1: function(index, layero){
                    window.location.href='http://cdn.gangwaninfo.com/app-data/appVersion/ruihuaoa.apk';
                },
                btn2: function(index, layero){
                    var inputForm =top.$("#importForm");
                    var top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
                    inputForm.attr("target",top_iframe);//表单提交成功后，从服务器返回的url在当前tab中展示
                    top.$("#importForm").submit();
                    top.layer.close(index);
                },

                btn3: function(index){
                    top.layer.close(index);
                }
            });
        });

    });

</script>
<button id="btnImport" class="nav-btn nav-btn-import" data-toggle="tooltip" data-placement="left" title="导入"><i class="fa fa-folder-open-o"></i> 导入</button>
<div id="importBox" class="hide">
	<form id="importForm"  action="${url}" method="post" enctype="multipart/form-data"
			 style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
		<div class="layui-item layui-col-sm6">
			<div class="layui-input-block">
				<div class="input-group">
					<input id="uploadFile"  name="file" type="file" />
				</div>
			</div>
		</div>
				<div class="layui-item nav-btns" >
					<a href="javascript:void(0)" onclick="openDialogreExcel()" class="nav-btn nav-btn-edit" ><i class="fa fa-plus"></i>设置对应关系</a>

				</div>
				<div class="layui-item layui-col-xs12 form-table-container" >
					<table id="" class="table table-bordered table-condensed can-edit no-bottom-margin">
						<thead>
						<tr>
							<th width="200px">sheet名称</th>
							<th width="200px">对应指标项</th>
						</tr>
						</thead>
						<tbody id="tbodyList">
							<%--<c:forEach items="${list}" var="workExampleExcel" varStatus="index">--%>
								<tr id="list${index.index}">
									<td>
										<input id="workExampleExcel${index.index}_1"  readonly="true"    type="text" value="${workExampleExcel.sheetName}"   class="form-control "/>
									</td>
									<td>
										<sys:treeselectJob id="workChangeJobUserList${index.index}_after" name="" value="" labelName="" labelValue=""
														   title="指标类型" url="/workexample/workExampleIndices/treeDataExampleInfo"  cssClass="form-control layui-input required" allowClear="false" notAllowSelectParent="true"/>
									</td>
								</tr>
							<%--</c:forEach>--%>
						</tbody>
					</table>
				</div>

	</form>
</div>
