<textarea name="filter" style="display:none"><{$filter}></textarea>
<div class="division">
<div class="notice"><{t}>共需同步<{/t}><strong><{$editInfo|count}></strong><{t}>條數據。<{/t}><br>小提示:同步過程中請不要關閉窗口
</div>
<table border="0" cellpadding="0" cellspacing="0" id="tongbumembers">
<tr>
<th style="text-align:center">
序號
</th>
<th style="text-align:center">
注冊時間
</th>
<th style="text-align:center">手機號
</th>
<th style="text-align:center">同步結果
</th>
</tr>
<{foreach from=$editInfo item=item key=key name="foo"}>
<{if $item.mobile!=""}>
<tr>
<td style="text-align:center"><{$smarty.foreach.foo.iteration}></td>
<td style="text-align:center"><{$item.regtime|cdate:FDATE_FTIME}></td>
<td style="text-align:center"><{input class="tongbumobile" member_id="{$item.member_id}" type="hidden" name="mobiles[{$item.member_id}]" value=$item.mobile}><{$item.mobile}></td>
<td id="tongburesult_<{$item.member_id}>" style="font-weight:bold" ></td>
</tr>
<{/if}>
<{/foreach}>
</table>
</div>
<{area inject=".mainFoot"}>
<center>
<{button label="同步" type="button" id="batch_edit_btn"}>
</center>
<{/area}>
<script> $('batch_edit_btn').addEvent('click',function(){ $('batch_edit_btn').set('html','正在同步中,請稍候....') var allrows=$ES('#tongbumembers .tongbumobile'); var allrowslength=allrows.length; var currentIndex=0;//退出遞歸的條件變量 function newRequest(){ if(currentIndex>=allrowslength){ //infos是存放主機名稱的數組 MessageBox.success('同步結束'); // window.finderDialog.close(); $('batch_edit_btn').set('html','同步結束'); return; } var item = allrows[currentIndex]; new Request({ 'url':'index.php?ctl=<{$env.get.ctl}>&act=saveTongBu&r='+Math.random(), 'data':{'member_id':item.get('member_id'),'mobile':item.value}, 'method':'post', onSuccess:function(r){ currentIndex++; r=eval('('+r+')'); if(r.status=='exist'){ $('tongburesult_'+item.get('member_id')).set('html', '<span style="color:#F00">×庫里已存在</span>'); } else if(r.status=='success'){ $('tongburesult_'+item.get('member_id')).set('html', '<span style="color:#6db248">√同步成功'); } else if(r.status=='failed'){ $('tongburesult_'+item.get('member_id')).set('html', '<span style="color:#F00">×插入失敗'+r.error_msg); } else{ $('tongburesult_'+item.get('member_id')).set('html', '<span style="color:#F00">×手機號檢測結果</span>'+r.status); } newRequest(); } }).send(); } newRequest(); //window.finderDialog.close(); }); </script>