實現js調用彈窗
//Html代碼:點擊控制項實現調用“收件者彈窗” <script src="') ?>"></script>
【對應的user.js】
$(function(){ /* 彈出層選使用者 */ $('.user-group').on('click','.user-add',function (){ div = $(this).parent('div.user-group'); box = $(this).next('div.user-gather'); single = (typeof(div.attr('data-multi'))=='undefined'); window.top.art.dialog.open('base/user/index/dialog?single='+ (single),{//此處調用對應的dialog頁面樣式 title:'選擇' + (single?'一':'多') +'位同事', width:480, height:440, lock:true, ok: function () { users = this.iframe.contentWindow.$(".active"); users.each(function(i,dom){ id = $(dom).attr('data-uid'); if (div.find('div[data-uid='+id+']').length){ window.top.art.dialog.tips('請不要重複添加'); return; } input = ''; $(dom).append(input); if (single){ box.html(dom.outerHTML); }else{ box.append(dom.outerHTML); } window.top.art.dialog.tips('已添加'); }); if (!single) return false; }, cancel: true }); }); /* 使用者刪除 */ $('.user-group').on('click','.user-event',function (){ if (confirm('您確定刪除這個使用者嗎')){ $(this).remove(); } }); /* 使用者還原 */ $('.user-group').each(function (i){ var _this = this; var _data =$(_this).attr('data'); var _edit = $(_this).attr('data-form'); if(_edit) $(_this).append('
點擊選擇'); $(_this).append(''); if (_data && _data!=0){ $.each(_data.split(','), function(i,id){ if (!id) return; $.getJSON(window.top.site_url + 'base/user/query?id='+id,function (json){ if (!json) return; var _html = ''; if(_edit) _html +=''; _html += ''+json.realname; _html +=''; $(_this).find('.user-gather').append(_html); }); }); } });});
【對應的dialog頁面】
<script> $(function(){ $('.user-item').on('click',function (){ input->get('single') == 'true'): ?> $(this).siblings().removeClass('active'); $(this).toggleClass('active'); }) ; }); </script> id ?>" data-name="http://blog.csdn.net/u011781769/article/details/name ?>">photo ? $user->photo : config_item('unfound_photo') ?>">
http://blog.csdn.net/u011781769/article/details/name ?> 全選 反選
【效果預覽】