
 <div class="layui-form-item">
          <label class="layui-form-label">合伙人/员工</label>
          <div class="layui-input-inline">
              <?=select2(app("user")->partner(),0,"hhr")?>
          </div>
          
          <div class="layui-input-inline">
                <select name="yg" lay-filter="aihao" id="yg1">
      
                    <option value="0">全部</option>
                   </select>
          </div>
  </div>

  <script>
    
      layui.use(['form'], function () {

            var $ = layui.jquery,
            form = layui.form;


         form.on('select(hhr)', function(data){
         pid=data.value;
             $("#yg1").empty();
    
         if (pid==0){
        
         $("#yg1").append(' <option value="0">请选择</option>  ');  
         form.render('select');    
         return false
          }
         if (ygs[pid]=="")
           $("#yg1").append(' <option value="0">全部</option>  ');
          else{
        $("#yg1").append(' <option value="0">全部</option>  ');
        $("#yg1").append(ygs[pid]);
      }
     
      //从新刷新了一下下拉框
      form.render('select');      //重新渲染
     });
  
    
  
  


ygs=Array();
<?
foreach (app("user")->partner() as $k=>$row){ 

        $ztypes=db()->select_all("user","*","role=".YG." and  pid=".$k); 
        array_unshift( $ztypes,array("id"=>$k,"realname"=>$row));
        $str="";

   foreach ($ztypes as $row1){
     $id=$row1['id'];
     $title=$row1['realname'];
     $str.="<option value='$id'>$title</option>";
     } 


?>
ygs[<?=$k?>]="<?=$str?>";

<? }?>




      })
  </script>