<extend name="Public/base" />

<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<style>.tabcon1711 textarea {width:400px;}</style>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/jquery.form.js"></script>
<script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
    
    <div class="cf main-place top_nav_list navtab_list">
        <h3 class="page_title">批量加服</h3>
        <p class="description_text">说明:此功能为批量新增游戏区服的功能</p>
    </div>
    
    
    <!-- 标签页导航 -->
<div class="tab-wrap">

    <div class="tab-content tabcon1711">
    <!-- 表单 -->
    <form id="form1" action="{:U('batch')}" method="post" class="form-horizontal" enctype="multipart/form-data">
        <!-- 基础文档模型 -->
        <div id="tab1" class="tab-pane in tab1 ">
            <table  border="0" cellspacing="0" cellpadding="0">
                <tbody>
                <tr>
                    <td class="l noticeinfo">添加方式:</td>
                    <td class="r table_radio">
                        <span class="form_radio">
                            <label>
                                <input type="radio" class="inp_radio" value="1" name='excel' checked="checked">Excel导入
                            </label>
                            <label>
                                <input type="radio" class="inp_radio" value="2" name='excel'> 批量输入
                            </label>
                        </span>
                    </td>
                </tr>
                </tbody>
            </table>
            <table id="excel" border="0" cellspacing="0" cellpadding="0" >
                <tbody>
                    <tr>
                        <td class="r"> Execl模板:</td>
                        <td><a href="/Uploads/excel/区服列表-游戏名称.xls">下载模板</a></td>
                    </tr>
                    <tr>
                        <td class="r">导入模板</td>
                        <td class="r"><input type="file" name="fileExcel" accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"></td>
                    </tr>
                </tbody>
            </table>
    		<table id="batch" border="0" cellspacing="0" cellpadding="0" style="display:none">
                <tbody>
                <tr>
                    <td class="r">批量加服(按模板样式添加,一行一个,最多可同时添加100行,用“;”隔开)</td>
                </tr>
                <tr>
                    <td class="r" >
                        <textarea name="server" class="txt_area" placeholder="">game_id=1,server_name=初出茅庐,time=2017-01-04 15:00:00;</textarea><br>
                        说明:game_id(游戏ID),server_name(区服名称),time(开服时间)
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="form-item cf">
              <input type="hidden" id="batchType" name="batchType" value="1">
              <button class="submit_btn" id="submit" type="button" target-form="form-horizontal">
                  保存
              </button>
              <a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
                  返回
              </a>
          </div>
    </form>
        
    </div>
</div>

<div class="common_settings">
			<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
			<form class="addShortcutIcon">
				<input type="hidden" name="title" value="{$m_title}">
				<input type="hidden" name="url" value="Server/lists">
			</form>
			<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
		</div>

</block>

<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('Server/lists')}");

$(function(){
    $('#submit').click(function(){
        $('#form1').ajaxSubmit({
            url:"{:U('batch')}",
            type:'POST',
            cache:false,
            contentType:false,  
            processData:false,
            mimeType: 'multipart/form-data',
            dataType:'json',
            //data:new FormData($("#form1")[0]),
            success:function(data){
							if (data.status == 1) {
                layer.msg(data.info);
								setTimeout(function() {
									if (data.url) {
										window.location.href = data.url;
									} else {
										window.location.reload();
									}
								},3000);
							} else {
								layer.msg(data.info);
							}
            },error:function(){
                layer.msg('服务器故障,请稍候再试');
            }
        });
    });

    $("#game_name").val($("#game_id option:selected").text());
    $('.date').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });
    $('.time').datetimepicker({
    language:"zh-CN",
     hour: 13,
       minute: 15
    });
    showTab();

});

/*获取游戏名称*/
$("#game_id").change(function() {
    $("#game_name").val($("#game_id option:selected").text());
});

$("input[name='excel']").change(function(){
    switch($(this).val()){
        case "1":
            $("#excel").show();
            $("#batch").hide();
        break;
        case "2":
            $("#excel").hide();
            $("#batch").show();
        break
    }
    $("#batchType").val($(this).val());
})

</script>
</block>