<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->

<!--{if $a == "run"}-->
<div class="layui-fluid oe_fluid">

  <form class="layui-form" id="mysearch" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">站点管理</a><span lay-separator="">/</span>
      <a href="javascript:;">院校管理</a><span lay-separator="">/</span>
      <a><cite>院校列表</cite></a>
    </div>
  </div>
  <!--//Top End -->
  
  <div class="oe_searchbar layui-form">
    <div class="more_search_open"></div>
    <div class="layui-form-item">
    
      <div class="layui-inline">
        <div class="layui-form-label">所在地区：</div>
        <div class="layui-input-inline">
          <!--{area type='select' name='sarea' depth='1' child='1' text='=请选择=' value=$sarea1}-->
        </div>
      </div>
      <div class="layui-inline">
        <div class="layui-form-label">学校名称：</div>
        <div class="layui-input-inline">
          <input type="text" name="sname" id="sname" class="layui-input" value="<!--{$sname}-->" />
        </div>
      </div>
      
      <div class="layui-inline">
        <button class="layui-btn layui-btn-sm search" id="but_submit_search2" lay-submit lay-filter="searchform2">
          <i class="layui-icon layui-icon-search"></i>
          搜索
          <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
        </button>
      </div>
      
    </div>
  </div>
  <!--//search End -->
  </form>

  <div class="oe_table_wrap layui-form">
  
    <div class="oe_tbl_tool clearfix">
      <div class="oe_gnbar clearfix">
        <div class="select btn fl">
          <input type="checkbox" name="allid[]" lay-skin="primary" title="全选" lay-filter="selectAll">
        </div>
        <div class="btn del fl" f="handle-array" data-form="myform">
          <i class="layui-icon layui-icon-delete"></i>
          <span>删除</span>
        </div>
        <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add" class="btn add fl">
          <i class="layui-icon layui-icon-add-1"></i>
          <span>添加</span>
        </a>
      </div>
      <div class="oe_tongji_bar clearfix current">
        <span><b><!--{$total}--></b> 条记录</span>
      </div>
    </div>
    
    <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
    <input type="hidden" name="a" id="a" value="del" />
    <table class="layui-table">
      <thead>
        <tr>
          <th width="4%"></th>
          <th width="10%">ID</th>
          <th>学校</th>
          <th width="8%">首字母</th>
          <th width="12%">地区</th>
          <th width="11%">类型</th>
          <th width="11%">院校性质</th>
          <th width="15%">添加时间</th>
          <th width="12%">操作</th>
        </tr> 
      </thead>
      
      <!--{if empty($school)}-->
      <tr>
        <td colspan="9" class="text_center">没有符合条件的信息</td>
      </tr>
      <!--{else}-->
      <!--{foreach $school as $volist}-->
      <tr>
        <td class="check text_center">
          <input type="checkbox" name="id[]" lay-skin="primary" value="<!--{$volist.schid}-->" />
        </td>
        <td class="text_center">
          <!--{$volist.schid}-->
        </td>
        <td class="text_center"><!--{$volist.name}--></td>
        <td class="text_center">
          <!--{if !empty($volist.firstchar)}-->
          <!--{$volist.firstchar}-->
          <!--{else}-->
          --
          <!--{/if}-->
        </td>
        <td class="text_center">
          <!--{area type="text" value=$volist.area1}--> 
          <!--{area type="text" value=$volist.area2}-->
        </td>
        <td class="text_center"><!--{$volist.type}--></td>
        <td class="text_center"><!--{$volist.quality}--></td>
        <td class="text_center"><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
        <td class="text_center">
          <div class="btn_box">
            <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.schid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-normal">编辑</a>
            <a href="javascript:;" f="handle-one" data-url="<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.schid}-->&<!--{$comeurl}-->" class="layui-btn layui-btn-xs layui-btn-danger">删除</a>
          </div>
        </td>
      </tr>
      <!--{/foreach}-->
      <!--{/if}-->
    </table>
    </form>
    <div class="oe_page_box"><!--{$showpage}--></div>

  </div>
</div>
<!--{/if}-->

<!--{if $a == "add"}-->
<div class="layui-fluid oe_fluid">

  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">站点管理</a><span lay-separator="">/</span>
      <a href="javascript:;">院校管理</a><span lay-separator="">/</span>
      <a><cite>添加院校</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="addform">
        添加保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <span class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius"><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">返回列表</a></span>
    </div> 
  </div>
  
  <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post">
  <input type="hidden" name="a" id="a" value="saveadd" />
  <div class="layui-card">
    <div class="layui-card-header">添加院校</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%"><font color="red">*</font>所在地区：</th>
          <td width="85%">
            <div class="layui-input-inline input-150">
              <!--{assign var="distlist" value=vo_list("mod={area} where={v.parentid='0'} orderby={v.orders ASC}")}-->
              <select name="area1" id="area1" lay-filter="area" data-depth="1" data-name="area" data-text="=请选择=">
                <option value="">=请选择=</option>
                <!--{foreach $distlist as $val}-->
                <option value="<!--{$val.areaid}-->"><!--{$val.areaname}--></option>
                <!--{/foreach}-->
              </select>
            </div>
            <div class="layui-input-inline input-150" id="json_area2">
              <select name="area2" id="area2" lay-filter="area">
                <option value="">=请选择=</option>
              </select>
            </div> 
            
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>学校名称：</th>
          <td>
            <input type="text" name="name" id="name" class="layui-input input-300" />
            <span class="text_tip_inline">（225个字以内）</span>
          </td>
        </tr>
        <tr>
          <th>首字母：</th>
          <td>
            <input type="text" name="firstchar" id="firstchar" class="layui-input input-200" />
          </td>
        </tr>
        <tr>
          <th>类型：<span class="f_red"></span></th>
          <td>
            <input type="text" name="type" id="type" class="layui-input input-200" />
          </td>
        </tr>
        <tr>
          <th>院校性质：<span class="f_red"></span></th>
          <td>
            <input type="text" name="quality" id="quality" class="layui-input input-200" />
          </td>
        </tr>
      </table>
    </div>
  </div>
  </form>
  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="addform">
      添加保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>

<script type="text/javascript">
$(function(){
    
    layui.use('form', function(){
        $form = layui.form;
        //保存...
        $form.on('submit(addform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
                
                if ($("#area1").val().length  == 0) {
                    layer.msg("请选择所在地区");
                    return false;
                }
                
                if ($("#name").val().length  == 0) {
                    layer.msg("请填写学校名称");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                //...
                $("#myform").submit();
            }
        });   
    });
    
});
</script>
<!--{/if}-->

<!--{if $a == "edit"}-->
<div class="layui-fluid oe_fluid">

  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">站点管理</a><span lay-separator="">/</span>
      <a href="javascript:;">院校管理</a><span lay-separator="">/</span>
      <a><cite>编辑院校</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="editform">
        编辑保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <span class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius"><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">返回列表</a></span>
    </div> 
  </div>
  
  <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post">
  <input type="hidden" name="a" id="a" value="saveedit" />
	<input type="hidden" name="id" id="id" value="<!--{$id}-->" />
  <div class="layui-card">
    <div class="layui-card-header">编辑院校</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%"><font color="red">*</font>所在地区：</th>
          <td width="85%">
            <div class="layui-input-inline input-150">
              <!--{assign var="distlist" value=vo_list("mod={area} where={v.parentid='0'} orderby={v.orders ASC}")}-->
              <select name="area1" id="area1" lay-filter="area" data-depth="1" data-name="area" data-text="=请选择=">
                <option value="">=请选择=</option>
                <!--{foreach $distlist as $val}-->
                <option value="<!--{$val.areaid}-->"<!--{if $school.area1 == $val.areaid}--> selected<!--{/if}-->><!--{$val.areaname}--></option>
                <!--{/foreach}-->
              </select>
            </div>
            <div class="layui-input-inline input-150" id="json_area2">
              <!--{if $school.area1 > 0}-->
              <!--{assign var="distlist2" value=vo_list("mod={area} where={v.parentid='<!--{$school.area1}-->'}")}-->
              <select name="area2" id="area2" lay-filter="area" data-depth="2" data-name="area" data-text="=请选择=">
                <option value="">=请选择=</option>
                <!--{foreach $distlist2 as $val}-->
                <option value="<!--{$val.areaid}-->"<!--{if $school.area2 == $val.areaid}--> selected<!--{/if}-->><!--{$val.areaname}--></option>
                <!--{/foreach}-->
              </select>
              <!--{else}-->
              <select name="area2" id="area2" lay-filter="area">
                <option value="">=请选择=</option>
              </select>
              <!--{/if}-->
            </div> 
            
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>学校名称：</th>
          <td>
            <input type="text" name="name" id="name" class="layui-input input-300" value="<!--{$school.name}-->" />
            <span class="text_tip_inline">（225个字以内）</span>
          </td>
        </tr>
        <tr>
          <th>首字母：</th>
          <td>
            <input type="text" name="firstchar" id="firstchar" class="layui-input input-200" value="<!--{$school.firstchar}-->" />
          </td>
        </tr>
        <tr>
          <th>类型：<span class="f_red"></span></th>
          <td>
            <input type="text" name="type" id="type" class="layui-input input-200" value="<!--{$school.type}-->" />
          </td>
        </tr>
        <tr>
          <th>院校性质：<span class="f_red"></span></th>
          <td>
            <input type="text" name="quality" id="quality" class="layui-input input-200" value="<!--{$school.quality}-->" />
          </td>
        </tr>
      </table>
    </div>
  </div>
  </form>
  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="editform">
      编辑保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>
<script type="text/javascript">
$(function(){

    layui.use('form', function(){
        $form = layui.form;
        //保存...
        $form.on('submit(editform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
            
                if ($("#area1").val().length  == 0) {
                    layer.msg("请选择所在地区");
                    return false;
                }
                
                if ($("#name").val().length  == 0) {
                    layer.msg("请填写学校名称");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                //...
                $("#myform").submit();
            }
        });   
    });
    
});
</script>
<!--{/if}-->
</body>
</html>