{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/webuploader/webuploader.css?v={$v}" />
{/block}
{block name="js"}
<script type='text/javascript' src='__STATIC__/plugins/webuploader/webuploader.js?v={$v}' type="text/javascript"></script>
<script src="__ADMIN__/staffs/staffs.js?v={$v}" type="text/javascript"></script>
{/block}
{block name="main"}
<form autocomplete='off'> 
<input type='hidden' id='staffId' class='ipt' value="{$object['staffId']}"/>
<table class='wst-form wst-box-top'>
  <tr>
     <th width='150'>登录账号:</th>
     <td width='300'>{$object['loginName']}</td>
     <td rowspan='5'>
       <div style='border:1px solid #ccc;width:130px;height:130px;margin-bottom:5px;'>
           <img id='prevwPhoto' height='130' width='130' src='__IMGURL__/{if $object["staffPhoto"] != " " }{$object["staffPhoto"]} {else}__ADMIN__/img/img_mrtx_gly.png{/if}'/>
       </div>
       <div id='photoPicker' style='margin-left:32px;'>上传头像<span id='uploadMsg'></span></div>
       <input type='hidden' id='staffPhoto' class='ipt' value='{$object["staffPhoto"]}'/>
     </td>
  </tr>
  <tr>
     <th>职员名称<font color='red'>*</font>:</th>
     <td><input type="text" id='staffName' class='ipt' value="{$object['staffName']}" maxLength='20' data-rule="职员名称: required;"/></td>
  </tr>
  <tr>
     <th>职员编号:</th>
     <td><input type="text" id='staffNo' class='ipt' value="{$object['staffNo']}" maxLength='20'/></td>
  </tr>
  <tr>
     <th>角色:</th>
     <td>
     <select id='staffRoleId' class='ipt'>
        <option value='0'>请选择</option>
        {volist name="roles" id="vo"}
		<option value="{$vo['roleId']}" {if condition="$object['staffRoleId'] == $vo['roleId']"}selected{/if}>{$vo.roleName}</option>
		{/volist}
     </select>
     </td>
  </tr>
  <tr>
     <th>手机号码:</th>
     <td><input type="text" id='staffPhone' class='ipt'  maxLength='100' data-rule="mobile" value="{$object['staffPhone']}"/></td>
  </tr>
  <tr>
     <th>微信OPENID:</th>
     <td><input type="text" id='wxOpenId' class='ipt'  maxLength='100' value="{$object['wxOpenId']}"/></td>
  </tr>
  <tr>
     <th>工作状态:</th>
     <td class="layui-form">
       <label>
           <input id="workStatus1" name="workStatus" value="1" class='ipt' {if condition="$object['workStatus'] == 1"}checked{/if} type="radio" title='在职'>
       </label>
       <label>
           <input id="workStatus0" name="workStatus" value="0" class='ipt' {if condition="$object['workStatus'] == 0"}checked{/if} type="radio" title='离职'>
       </label>
             
     </td>
  </tr>
  <tr>
     <th>账号状态:</th>
     <td colspan='2' class="layui-form">
       <label>
          <input type='radio' id='staffStatus1' class='ipt' name='staffStatus' {if condition="$object['staffStatus'] == 1"}checked{/if} value='1' title='开启'>
       </label>
       <label>
          <input type='radio' id='staffStatus0' class='ipt' name='staffStatus' {if condition="$object['staffStatus'] == 0"}checked{/if} value='0' title='停用'>
       </label>
     </td>
  </tr>
  <tr>
     <td colspan='3' align='center' class='wst-bottombar'>
     	 <button type="button" onclick='javascript:save()' class='btn btn-primary btn-mright'><i class="fa fa-check"></i>保存</button>
       <button type="button" onclick='javascript:history.go(-1)' class='btn'><i class="fa fa-angle-double-left"></i>返回</button>
     </td>
  </tr>
</table>
</form>
<script>
$(function(){
	WST.upload({
  	  pick:'#photoPicker',
  	  formData: {dir:'staffs'},
  	  accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
  	  callback:function(f){
  		  var json = WST.toAdminJson(f);
  		  if(json.status==1){
  			$('#uploadMsg').empty().hide();
  			$('#prevwPhoto').attr('src',WST.conf.IMGURL+'/'+json.savePath+json.name);
  			$('#staffPhoto').val(json.savePath+json.name);
  		  }
	  },
	  progress:function(rate){
	      $('#uploadMsg').show().html('已上传'+rate+"%");
	  }
    });
});
</script>
{/block}