{template 'common/header_public'}
<link rel="stylesheet" type="text/css" href="/Html_yong/css/c_task_allot.css">
<style>
.showlink{
	width: 60px;
	 overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
</style>
<style>
				    .haha{
				    	position: relative;
				    }
						.shuru{
							height: 30px;
							width: 66%;
							position: relative;
							margin-left: auto;
							margin-right: auto;
							float: left;
						}
						.shuru_bi{
							display: none;
							position: absolute;
							left: -10px;
							top: -2px;
							height: 34px;
							width: 18px;
							background-color: #ffffff;
						}
						.shuru_qd{
							display: none;
							position: absolute;
							z-index: 999;
							height: 28px;
							width: 34px;
							background-color: #ffffff;
							border-top:1px solid #dcdcdc;
							border-right:1px solid #dcdcdc;
							border-bottom:1px solid #dcdcdc;
							left: 67%;
							cursor: pointer;
							
						}
						.input_a{
							outline:none;
						}
				    </style>
<script type="text/javascript">
$(function(){
	$(".yg_sousuo").change(function(){
				    var opt=$(".yg_sousuo").val();
				    if (opt==1) {
				    	window.location.href="{php echo $this->createMobileUrl('c_task_allot',array('group'=>1,'id'=>$_GPC['id']))}"; 
				    }else if(opt==2){
				    	window.location.href="{php echo $this->createMobileUrl('c_task_allot',array('group'=>2,'id'=>$_GPC['id']))}";
				    }else{
				    	window.location.href="{php echo $this->createMobileUrl('c_task_allot',array('group'=>0,'id'=>$_GPC['id']))}";
				    };
				});

	$('.shuru').mouseover(function(){
		//alert(2);
		var a=($(this).parent().children(".shuru_qd").css('display'));
		if (a=="none") {
			$(this).children(".shuru_bi").show();
		}
		
	})
	$('.shuru').mouseout(function(){
		//alert(2);
		$(this).children(".shuru_bi").hide();

	}) 
	
	$('.input_a').focus(function(){
		$(this).css({border:'1px solid #5bc0de'});
		$(this).parent().find(".shuru_bi").hide();
		$(this).parent().parent().find(".shuru_qd").show();
	})
	$('.input_a').blur(function(){
		var nimei=($(this).parent().parent().children(".shuru_qd").css('display'));
		if (nimei="block") {
			$(this).css({border:'1px solid #dcdcdc'});
		}
	})
	$('.shuru_qd').click(function(){
		var userid=($(this).parent().children(".shuru").children(".input_a").attr('userid'));
		var wanchengliang=$(this).parent().parent().parent().parent().find(".wanchengliang").html();
		var arr=wanchengliang.split('/')
		var w=arr[0]
		var l=arr[1]
		var lianjiehtml='<input style="height:30px;" value='+"{$_W['siteroot']}app/index.php?i={$_GPC['i']}&c=entry&taskid={$_GPC['id']}&mid="+userid+"&do=task_link&m=we7_tgl>";
		var lianjie=$(this).parent().parent().parent().parent().find(".wanchengliang").html();
		
		var wo=$(this);
		var calue=($(this).parent().children(".shuru").children(".input_a").val());
		
		//var edit=($(this).parent().children(".shuru").children(".input_a").attr('edit'));
		var taskid=($(this).parent().children(".shuru").children(".input_a").attr('taskid'));
		//alert(calue+"/"+userid);
		$.post("{php echo $this->createMobileUrl('c_task_allot')}"+"&userid="+userid+"&value="+calue+"&id="+taskid,
			function(t){

					if(  t == 'taiduo' ){
						wo.parent().children('.shuru').children(".input_a").focus();
						alert('分配任务量不能大于任务总量');

					}
					if(  t == 'tongyang' ){
						//var aaaa=3
						wo.hide();
						wo.parent().children('.shuru').children(".input_a").css({border:'0'});
						//return;
					}
					if(  t == 'ling' ){
						//var aaaa=3
						alert('分配任务失败,任务量不能为0')
						wo.hide();
						wo.parent().children('.shuru').children(".input_a").css({border:'0'});
						//wo.parent().parent().parent().find(".wanchengliang").html("0/0");
						//wo.parent().parent().parent().parent().find(".lianjie").hide();
						//return;
					}
					if(  t == 'add_success' ){
						//alert('分配任务量不能大于任务总量')
						wo.hide();
						wo.parent().children('.shuru').children(".input_a").css({border:'0'});
						wo.parent().parent().parent().find(".wanchengliang").html("0/"+calue);
						wo.parent().parent().parent().find(".lianjie").html(lianjiehtml);

					}
					if(  t == 'edit_success' ){
						//alert('分配任务量不能大于任务总量')
						wo.hide();
						wo.parent().children('.shuru').children(".input_a").css({border:'0'});
						wo.parent().parent().parent().find(".wanchengliang").html(w+"/"+calue);
					}
					if(  t == 'edit_error' ){
						alert('分配任务失败')
						wo.hide();
						wo.parent().children('.shuru').children(".input_a").css({border:'0'});
						
					}
					if(  t == 'add_error' ){
						alert('分配任务失败')
						wo.hide();
						wo.parent().children('.shuru').children(".input_a").css({border:'0'});
					}
			}
		) 

							 	
							
	})
})

/*function tijiao(){
	//$('#form').submit();
	alert(2)
	$('this').find('.shuru_bi').show();
}*/

</script>
				<div class="right_member">
					<div class="xiangzuo"><img src="/Html_yong/images/xiangzuo.jpg" alt="" style="float: left;margin-top: -3px;"><p class="right_bt">任务列表>{$task['name']}</p></div>
					<div class="member_info">
						<!-- <div class="username">
							火星人
						</div> -->
						<div class="member_cover">
							<img src="/attachment/{$task['img']}" alt="" width="200" height="200">
						</div>
						<ul>
							<li>
								<div class="yonghu">{$task['name']}</div>
								<div class="riqi">{php echo date('Y-m-d',$task['start_time'])} 至 {php echo date('Y-m-d',$task['end_time'])}</div>

								<div class="liang">
									{$task['needclick']}<br>
									<span class="liang_bt">期待推广量</span>
								</div>
								<div class="liang" style="margin-top:6px;">
									<span class="da">{$task['click']}</span>/{$task['needclick']}<br>
									<span class="liang_bt">完成推广量</span>
								</div>
								<div class="liang">
									<span class="da">{$task_member1}</span>人<br>
									<span class="liang_bt">推广员工</span>
								</div>
								<div class="liang">
									<span  class="da">{$task_member2}</span>人<br>
									<span class="liang_bt">承载推客</span>
								</div>
								<!-- <div class="liang">
									{$task['url']}<br>
									<span class="liang_bt">推广链</span>
								</div> -->
							</li>
						</ul>
						
					</div>
				</div>

				<div class="right_list">
					<p class="right_bt">
						<span>任务分配详情</span>
						<span class="select">
							<select class="yg_sousuo" size="1">
								<option value="0" {if 0==$_GPC['group']}selected ="selected"{/if}>全部员工</option>
								<option value="1" {if 1==$_GPC['group']}selected ="selected"{/if}>企业员工</option>
								<option value="2" {if 2==$_GPC['group']}selected ="selected"{/if}>外聘员工</option>
							</select>
							<div class="select_icon"><img src="/Html_yong/images/select_icon.png" alt=""></div>
						</span>
					</p>
					 <form action="" id="form" method="post" enctype="multipart/form-data">
                    <table width="100%"  cellspacing="0" cellpadding="0">
				  <tr class="tr_one">
				    <td width="12%"></td>
				    <td width="20%">员工用户名</td>
				    <td width="13%">任务量</td>
				    <td width="13%">回馈</td>
				    <td width="13%">点击</td>
				    <!-- <td width="10%">QQ</td>
				    <td width="10%">转发</td>
				    <td width="10%">分享</td> -->
				    <td width="17%">完成量</td>
				    <td width="15%">推广连</td>
			      </tr>
			       {loop $m_list $ui}
			      {if $ui['needclick']}<!--已经有了任务的为修改-->
						<input type="hidden" name="edit[]" value="{$ui['uid']}">
			      {else}
						<input type="hidden" name="edit[]" value="">
			      {/if}
			       	<input type="hidden" name="ids[]" value="{$ui['uid']}">
			       	<input type="hidden" name="allot" value="确定">
				  <tr class="list_list">
				  <div>
				   <td width="12%" style="text-align: right;"><img class="list_cover" src="/attachment/{$ui['img']}" alt="" width="36" height="36"></td>
				    <td width="20%">{$ui['username']}</td>

				    <td width="13%">
				    <!-- onMouseOver="tijiao()" -->
				    <div class="haha">
				    	<div class="shuru" ><div class="shuru_bi"><img style="margin-top: 5px;" src="/Html_yong/images/bi.jpg" alt="" height="22" width="18"></div>
				    		<input type="text" class="input_a" userid="{$ui['uid']}" edit="t" taskid="{$_GPC['id']}" value="{if $ui['needclick']}{$ui['needclick']}{else}0{/if}" name="rwl[]" style="border: 0;width: 100%;margin-left: auto;margin-right: auto;text-align: center;height: 30px;" >
				    		
				    	</div>
				    	<div class="shuru_qd"><img style="margin-top: 4px;" src="/Html_yong/images/queding.png" alt="" height="20" width="17"></div>
				    	</div>
				    	</td>

				    <td width="13%"><!-- {if $ui['feedback']}{$ui['feedback']}{else}0{/if} -->{$ui['card_num']}</td>
				    <td width="13%">{if $ui['click']}{$ui['click']}{else}0{/if}</td>
				    <!-- <td width="9%">{$ui['qqforword']}</td>
				    <td width="9%">{$ui['wechatforword']}</td>
				    <td width="9%">{$ui['wechatshare']}</td> -->
				    <td width="17%" class="wanchengliang">{if $ui['click']}{$ui['click']}{else}0{/if}/{if $ui['needclick']}{$ui['needclick']}{else}0{/if}</td>
				    <td width="15%" class="lianjie" title="{if $ui['needclick']}{$_W['siteroot']}app/index.php?i={$_GPC['i']}&c=entry&taskid={$_GPC['id']}&mid={$ui['uid']}&do=task_link&m=we7_tgl{/if}" >{if $ui['needclick']}<input style="height: 30px;" value="{$_W['siteroot']}app/index.php?i={$_GPC['i']}&c=entry&taskid={$_GPC['id']}&mid={$ui['uid']}&do=task_link&m=we7_tgl">{/if}</td>
				    </div>
			      </tr>
				
			     {/loop}
			  </table>
				<input type="hidden" name="token" value="{$_W['token']}">
			  </form>
			  <!-- <div class="daochu">
			  					确认分配
			  </div>
			  <div class="daochu">
			  					批量分配
			  </div> -->
			  <div class="daochu">
					<a href="{php echo $this->createMobileUrl('daochu_data',array('types'=>'task_allot','id'=>$_GPC['id']))}" style="display: block;text-decoration: none;color: #ffffff;">一键导出</a>
			  </div>
			  <div class="fenye">
					<!-- <ul>
						<li><a href=""><img style="height:23px;margin-top:1px" src="/Html_yong/images/fenye_qq.png" alt=""></a></li>
						<li><a href=""><img style="height:23px;margin-top:1px" src="/Html_yong/images/fenye_q.png" alt=""></a></li>
						<li><a class="fenye_on" href="">1</a></li>
						<li><a href="">2</a></li>
						<li><a href="">3</a></li>
						<li><a href="">4</a></li>
						<li><a href=""><img style="height:23px;margin-top:1px" src="/Html_yong/images/fenye_h.png" alt=""></a></li>
						<li><a href=""><img style="height:23px;margin-top:1px" src="/Html_yong/images/fenye_hh.png" alt=""></a></li>
					</ul> -->
					{$pager}
			  </div>
				</div>
				
			</div>
		</div>

	</div>
</body>
</html>