南强小屋 Design By 杰米
父层:
<div class="col-xs-12"> <div class="box"> <div class="box-header"> <h3 class="box-title">主机监控列表</h3> </div> <!-- /.box-header --> <div class="box-body" style="overflow: auto"> <table id="example2" class="table table-bordered table-hover"> <thead> <tr> <th>ID</th> <th>标签</th> <th>IP地址</th> <th>主机名</th> <th>监控用户名</th> <th>主机通断告警</th> <th>CPU使用率告警</th> <th>内存使用率告警</th> <th>磁盘使用率告警</th> <th style="width: 10px"></th> <th style="width: 10px"></th> </tr> </thead> {% for linux_server in linuxs_servers %} <tr> <td>{{ forloop.counter }} </td> <td>{{ linux_server.tags}} </td> <td>{{ linux_server.host}} </td> <td>{{ linux_server.host_name}} </td> <td>{{ linux_server.user}} </td> <td align="center">{{ linux_server.connect_cn}} </td> <td align="center">{{ linux_server.cpu_cn }} </td> <td align="center">{{ linux_server.mem_cn }} </td> <td align="center">{{ linux_server.disk_cn }} </td> <td> <div class="box-tools pull-right"> <a href="#" rel="external nofollow" > <button type="button" class="btn btn-default btn-sm" οnclick="return pop(this.value)" value="{{ linux_server.id }}"><i class="fa fa-edit"></i></button></a> </div> </td> <td> <div class="box-tools pull-right"> <a href="/linux_servers_del" rel="external nofollow" > <button type="button" class="btn btn-default btn-sm"><i class="fa fa-trash-o"></i></button></a> </div> </td> </tr> {% endfor %} </table> </div> <div class="box-footer clearfix"> <span class="step-links"> {% if linuxs_servers.has_previous %} <a href="" rel="external nofollow" >上一页</a> {% endif %} <span class="current"> 当前页{{ linuxs_servers.number }} 共计{{ linuxs_servers.paginator.num_pages }} </span> {% if linuxs_servers.has_next %} <a href="" rel="external nofollow" >下一页</a> {% endif %} </span> <div class="pull-right"> <a href="/linux_servers_add" rel="external nofollow" class="btn btn-primary btn-block btn-flat">新增</a> </div> </div> <!-- /.box-body --> </div> <!-- /.box --> {#用于接收linux_server__edit.html中layui子层的传值#} <input id="handle_status" value="" hidden="hidden"> </div>
点击编辑按钮,执行方法:
<script> function pop(n){ layer.open({ type: 2, title: '编辑主机信息', closeBtn: 1, area: ['700px', '550px'], shadeClose: true, //点击遮罩关闭 content: ['/linux_servers_edit"#handle_status").val(); if ( handle_status == '1' ) { layer.msg('保存成功!',{ icon: 1, time: 2000 //2秒关闭(如果不配置,默认是3秒) },function(){ history.go(0); }); } else if ( handle_status == '2' ) { layer.msg('修改失败!',{ icon: 2, time: 2000 //2秒关闭(如果不配置,默认是3秒) },function(){ history.go(0); }); } } }); } </script>
--linux_server_edit编辑方法:
@login_required(login_url='/login') def linux_servers_edit(request): status = 0 rid = request.GET.get('id') linux_server_edit = models_linux.TabLinuxServers.objects.get(id=rid) if request.method == "POST": if request.POST.has_key('commit'): tags = request.POST.get('tags', None) host_name = request.POST.get('host_name', None) host = request.POST.get('host', None) user = request.POST.get('user', None) password = base64.encodestring(request.POST.get('password', None)) connect_cn = request.POST.get('connect', None) connect = tools.isno(connect_cn) cpu_cn = request.POST.get('cpu', None) cpu = tools.isno(cpu_cn) mem_cn = request.POST.get('mem', None) mem = tools.isno(mem_cn) disk_cn = request.POST.get('disk', None) disk = tools.isno(disk_cn) models_linux.TabLinuxServers.objects.filter(id=rid).update(tags=tags,host_name=host_name, host=host, user=user, password=password, connect_cn=connect_cn, connect=connect, cpu_cn=cpu_cn, cpu=cpu, mem_cn=mem_cn, mem=mem, disk_cn=disk_cn, disk=disk) status = 1 elif request.POST.has_key('logout'): logout(request) return HttpResponseRedirect('/login/') return render_to_response('linux_servers_edit.html', {'linux_server_edit': linux_server_edit,'status':status})
对应的template
<!DOCTYPE html> <!-- This is a starter template page. Use this page to start your new project from scratch. This page gets rid of all links and provides the needed markup only. --> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>DB monitor | Starter</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <link rel="stylesheet" href="/static/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="external nofollow" > <!-- Font Awesome --> <link rel="stylesheet" href="/static/bower_components/font-awesome/css/font-awesome.min.css" rel="external nofollow" > <!-- Ionicons --> <link rel="stylesheet" href="/static/bower_components/Ionicons/css/ionicons.min.css" rel="external nofollow" > <!-- Theme style --> <link rel="stylesheet" href="/static/dist/css/AdminLTE.min.css" rel="external nofollow" > <!-- AdminLTE Skins. We have chosen the skin-blue for this starter page. However, you can choose any other skin. Make sure you apply the skin class to the body tag so the changes take effect. --> <link rel="stylesheet" href="/static/dist/css/skins/skin-blue.min.css" rel="external nofollow" > <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="/UploadFiles/2021-04-08/html5shiv.min.js">以上这篇对django layer弹窗组件的使用详解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
南强小屋 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
南强小屋 Design By 杰米
暂无对django layer弹窗组件的使用详解的评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。