
<style type="text/css">
.layui-form-item .layui-input-inline {width: 300px !important}
</style>
<div class="layui-form" lay-filter="layuiadmin-form-backendadmin" style="padding: 20px 0 0 0;">
  <script type="text/html" template>
    <input type="hidden" name="id" value="{{ d.params.id || '' }}" class="layui-input">
  </script>

  <div class="layui-form-item">
    <label class="layui-form-label">源IP</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="text" name="backend_addr" value="{{ d.params.addr || '' }}" placeholder="1.2.3.4" autocomplete="off" class="layui-input">
      </script>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">权重</label>
    <div class="layui-input-inline">
      <script type="text/html" template>
        <input type="text" name="backend_weight" value="{{ d.params.weight || '1' }}" placeholder="1-10" autocomplete="off" class="layui-input">
      </script>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">状态</label>
    <div class="layui-input-inline">
        <select lay-filter="backend_state" id="backend_state"  name="backend_state" lay-verify="required">
          <option value="up">上线</option>
          <option value="down">下线</option>
          <option value="backup">备用</option>
        </select>    
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-inline">
      <input type="button" lay-submit lay-filter="LAY-stream-stream-edit-backend-add-submit" value="确认" class="layui-btn">
    </div>
  </div>
</div>

<script type="text/javascript">
var form = layui.form
var $ = layui.$
form.render()
form.on('radio(amount)', function(data){
  if (data.value == "single") {
    $(".multiple").addClass("layui-hide")
    $(".single").removeClass("layui-hide")
  } else {
    $(".single").addClass("layui-hide")
    $(".multiple").removeClass("layui-hide")
  }
});  

</script>