<style type="text/css">
.center-col{overflow: hidden;}
</style>

<div class="col-xs-24 zhiban-top" style="background:#f5f5f5;padding-top:10px;">
   <span class="col-xs-24">员工列表</span>
</div>
<div class="row">
  <div class="col-xs-5 nopadding" style="overflow:hidden;">
    <div class="col-xs-24 nopadding user_list_box pull-right" style="overflow: scroll;margin-right:-12px;">
    <?php foreach ($userlist as $key => $u) { ?>
      <div class="col-xs-24 user_position <?php if(isset($userinfo) && $u->whu_uid==$userinfo->whu_uid) echo 'active'; ?>" id="user_position_<?php echo $u->whu_uid; ?>">
        <a href="<?php echo site_url('apps/workflow/index/user_manage/'.$u->whu_uid); ?>"><?php echo $key+1,'.',$u->whu_uname; ?></a>
      </div>
    <?php } ?>
    </div>
    <div class="col-xs-24 btn-lg"></div>
  </div>

  <div class="col-xs-19">
    <div class="col-xs-24 btn-lg"></div>
    <legend>员工资料编辑</legend>
	<ul class="nav nav-tabs" role="tablist" style="margin-bottom:40px">
		<li role="presentation" class="active"><a href="#add" aria-controls="add" role="tab" data-toggle="tab" onclick="location.href='<?php echo site_url('apps/workflow/index/user_manage')?>'">新增</a></li>
		<li role="presentation"><a href="#delete" aria-controls="delete" role="tab" data-toggle="tab">删除</a></li>
		<li role="presentation"><a href="#update" aria-controls="update" role="tab" data-toggle="tab">修改</a></li>
	</ul>
	<div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="add">
	<form class="form-horizontal form_user_add" method="post" action="<?php echo site_url('apps/workflow/index/user_edit'); ?>">
      <div class="form-group">
        <label class="col-sm-4 control-label">姓名</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_uname" value="<?php if(isset($userinfo)) echo $userinfo->whu_uname; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">Email</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_email" value="<?php if(isset($userinfo)) echo $userinfo->whu_email; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">IP地址</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_ip" value="<?php if(isset($userinfo)) echo $userinfo->whu_ip; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">事业部</label>
        <div class="col-sm-10">
          <select class="form-control" name="department">
            <?php foreach ($typelist as $type) { ?>
              <option value="<?php echo $type->wt_sn; ?>" <?php if(isset($userinfo) && $type->wt_sn==$userinfo->department) echo 'selected'; ?>><?php echo $type->wt_name; ?></option>
            <?php } ?>
          </select>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">职务</label>
        <div class="col-sm-20">
          <div class="checkbox">
            <?php foreach ($rolelist as $role) { ?>
              <label><input type="checkbox" name="userrole[]" value="<?php echo $role->wt_sn; ?>" <?php if(isset($userrole) && in_array($role->wt_sn, $userrole)) echo 'checked'; ?>> <?php echo $role->wt_name; ?></label>
            <?php } ?>
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="btn-group col-sm-offset-4 col-xs-5">
          <input type="hidden" name="whu_uid" value="<?php if(isset($userinfo)) echo $userinfo->whu_uid; ?>">
		  <input type="hidden" name="type" value="add">
          <button type="button" class="btn btn-danger" onclick="ajaxSubmit('.form_user_add');">保存</button>
            
        </div>
      </div>
    </form>
	</div>
    <div role="tabpanel" class="tab-pane" id="delete">
	<form class="form-horizontal form_user_delete" method="post" action="<?php echo site_url('apps/workflow/index/user_edit'); ?>">
      <div class="form-group">
        <label class="col-sm-4 control-label">姓名</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_uname" value="<?php if(isset($userinfo)) echo $userinfo->whu_uname; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">Email</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_email" value="<?php if(isset($userinfo)) echo $userinfo->whu_email; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">IP地址</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_ip" value="<?php if(isset($userinfo)) echo $userinfo->whu_ip; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">事业部</label>
        <div class="col-sm-10">
          <select class="form-control" name="department">
            <?php foreach ($typelist as $type) { ?>
              <option value="<?php echo $type->wt_sn; ?>" <?php if(isset($userinfo) && $type->wt_sn==$userinfo->department) echo 'selected'; ?>><?php echo $type->wt_name; ?></option>
            <?php } ?>
          </select>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">职务</label>
        <div class="col-sm-20">
          <div class="checkbox">
            <?php foreach ($rolelist as $role) { ?>
              <label><input type="checkbox" name="userrole[]" value="<?php echo $role->wt_sn; ?>" <?php if(isset($userrole) && in_array($role->wt_sn, $userrole)) echo 'checked'; ?>> <?php echo $role->wt_name; ?></label>
            <?php } ?>
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="btn-group col-sm-offset-4 col-xs-5">
          <input type="hidden" name="whu_uid" value="<?php if(isset($userinfo)) echo $userinfo->whu_uid; ?>">
		   <input type="hidden" name="type" value="delete">
          <button type="button" class="btn btn-danger" onclick="ajaxSubmit('.form_user_delete');">删除</button>
            
        </div>
      </div>
    </form></div>
    <div role="tabpanel" class="tab-pane" id="update">
	<form class="form-horizontal form_user_update" method="post" action="<?php echo site_url('apps/workflow/index/user_edit'); ?>">
      <div class="form-group">
        <label class="col-sm-4 control-label">姓名</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_uname" value="<?php if(isset($userinfo)) echo $userinfo->whu_uname; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">Email</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_email" value="<?php if(isset($userinfo)) echo $userinfo->whu_email; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">IP地址</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" name="whu_ip" value="<?php if(isset($userinfo)) echo $userinfo->whu_ip; ?>">
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">事业部</label>
        <div class="col-sm-10">
          <select class="form-control" name="department">
            <?php foreach ($typelist as $type) { ?>
              <option value="<?php echo $type->wt_sn; ?>" <?php if(isset($userinfo) && $type->wt_sn==$userinfo->department) echo 'selected'; ?>><?php echo $type->wt_name; ?></option>
            <?php } ?>
          </select>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-4 control-label">职务</label>
        <div class="col-sm-20">
          <div class="checkbox">
            <?php foreach ($rolelist as $role) { ?>
              <label><input type="checkbox" name="userrole[]" value="<?php echo $role->wt_sn; ?>" <?php if(isset($userrole) && in_array($role->wt_sn, $userrole)) echo 'checked'; ?>> <?php echo $role->wt_name; ?></label>
            <?php } ?>
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="btn-group col-sm-offset-4 col-xs-5">
          <input type="hidden" name="whu_uid" value="<?php if(isset($userinfo)) echo $userinfo->whu_uid; ?>">
		  <input type="hidden" name="type" value="update">
          <button type="button" class="btn btn-danger" onclick="ajaxSubmit('.form_user_update');">修改</button>
            
        </div>
      </div>
    </form>
	</div>
  </div>

    
  </div>

</div>

<script type="text/javascript">
$(".center-col").css({"min-height":(window.screen.height-180)});
$(".user_list_box").css({"height":(window.screen.height-200)});
<?php if(isset($userinfo)) { ?>
var scroll_h=$("#user_position_<?php echo $userinfo->whu_uid; ?>").position().top-50;
if (scroll_h>(window.screen.height-300)) {
  $(".user_list_box").scrollTop(scroll_h);
};
<?php } ?>
</script>