|

楼主 |
发表于 2024-1-16 17:06:42
|
显示全部楼层
{% load static %}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>eCommerce template By Adobe Dreamweaver</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="{% static 'css/eCommerceStyle.css' %}">
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.js' %}"></script>
<script src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="mainWrapper">
<header>
<div class="dropdown" style="position: absolute; top: 10px; right: 10px;">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{ request.session.info.name }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a href="#">设置</a></li>
<li><a href="http://127.0.0.1:8000/zx/" title="Link">退出</a></li>
</ul>
</div>
</header>
<div id="content">
<section class="sidebar">
<div id="menubar">
<nav class="menu">
<ul>
<li>
<a href="#" title="Link">首页</a></li>
<li><a href="#" title="Link">监控网站</a></li>
<li><a href="#" title="Link">博客网站</a></li>
<li><a href="#" title="Link">容器网站</a></li>
<li><a href="http://127.0.0.1:8000/rootuseradd/" title="Link">测试python界面</a></li>
<li class="notimp"><!-- notimp class is applied to remove this link from the tablet and phone views --><a href="#" title="Link"> </a></li>
</ul>
</nav>
<nav class="menu">
<h2>设置 </h2>
<!-- Title for menuset 2 -->
<hr>
<ul>
<!--List of links under menuset 2 -->
<li><a href="#" title="Link">设置 </a></li>
<li class="notimp"><!-- notimp class is applied to remove this link from the tablet and phone views --><a href="#" title="Link">退出</a></li>
</ul>
</nav>
</div>
</section>
<section class="mainContent">
<div class="productRow"><!-- Each product row contains info of 3 elements -->
<style>
.panel {
border: none;
}
.table {
text-align: center;
margin-left: auto;
margin-right: auto;
}
</style>
<body>
<div class="bs-example" data-example-id="panel-without-body-with-table">
<div class="panel panel-default">
<table class="table">
<tr>
<th scope="row"></th>
<td><a href="http://127.0.0.1:8000/useradd/" title="Link">用户添加</a></td>
<td><a href="http://127.0.0.1:8000/view/" title="Link">用户查看</a></td>
<td><a href="http://127.0.0.1:8000/user_add/" title="Link">部门添加</a></td>
<td><a href="http://127.0.0.1:8000/user_add/" title="Link">部门查看</a></td>
</tr>
</table>
</div>
</div>
</body>
<div class="bs-example" data-example-id="panel-without-body-with-table">
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading">用户信息
<form method="get">
</form>
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search for...">
</form>
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
</span>
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
</div><!-- /.row -->
<!-- Table -->
<table class="table">
<tr>
{% for s in deat %}
<td align="left">{{ s.id }}</td>
<td align="left">{{ s.get_j_display }}</td>
<td align="left">{{ s.bt }}</td>
<td align="left">{{ s.detail }}</td>
<td align="left">{{ s.user }}</td>
<td>
<input uid="{{ s.id }}" type="button" class="btn btn-primary btn-xs btn-edit1" value="编辑" >
<input uid="{{ s.id }}" class="btn btn-danger btn-xs btn-delete" type="button" value="删除">
</td>
<!-- 删除数据模态框 -->
<div class="modal fade" id="deleteuid" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">删除</h4>
</div>
<div class="modal-body">
确认要删除吗?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button id="date2" type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</div>
</div>
<!-- 编辑数据模态框 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form id="btn412" novalidate>
{% for f in form %}
<div class="form-group">
{{ f.label }} : {{ f }}
<span class="error-msg" style="color:red; postition:absolute;"></span>
</div>
{% endfor %}
</div>
<div class="modal-footer">
<button id="etidszzz" type="button" class="btn btn-primary">保存</button>
{# <button id="etidszzz" type="submit" class="btn btn-primary">提交</button>#}
<input type="reset" name="resetBtn" id="resetBtn" value="重置">
</div>
</div>
</div>
</div>
</tr>
{% endfor %}
</table>
<script>
$(function () {
console.log("aja2 function called");
bb();
delete1();
})
function bb() {
$(".btn-edit1").click(function() {
var uid =$(this).attr("uid")
$.ajax({
url: "/ajaview",
type: "get",
data :{
uid: uid
},
dataType: "JSON",
success:function (res){
if(res.status){
$.each(res.data,function (name,value){
$("#id_" + name).val(value);
})
$('#myModal').modal('show');
console.log(res);
}else{
alert(res.error);
}
}
})
});
};
$(function() {
$("#etidszzz").click(function() {
console.log("guanb"); // 输出 "guanb" 到控制台
var modal = document.getElementById("view");
var bootstrapModal = new bootstrap.Modal(modal);
bootstrapModal.hide(); // 关闭模态框
});
});
function delete1() {
$(".btn-delete").click(function() {
$('#deleteuid').modal('show');
DELETE_ID=$(this).attr("uid");
var uid=$(this).attr("uid");
console.log(uid);
});
};
{# $(function () {#}
{# $("#date2").click(function() {#}
{# console.log("guanb");#}
{# $.ajax({#}
{# url: "/ajdelete",#}
{# type: "GET",#}
{# data: {#}
{# uid: DELETE_ID#}
{# },#}
{# dataType: "JSON",#}
{# success: function (res) {#}
{# if (res.status) {#}
{# location.reload(); // 刷新界面的js代码#}
{# } else {#}
{# alert(res.error);#}
{# }#}
{# }#}
{# });#}
{# });#}
{#});#}
</script>
</body>
<ul class="pagination">
{{ ymm }}</ul>
</tr>
</tbody>
</table>
</div>
</div>
</article>
</div>
{% block b %}{% endblock %}
</section>
</div>
<footer>
<!-- This is the footer with default 3 divs -->
<div>
<p>没有数据</p>
</div>
<div>
<p>没有数据</p>
</div>
<div class="footerlinks">
<p><a href="#" title="Link">Link 1 </a></p>
<p><a href="#" title="Link">Link 2</a></p>
<p><a href="#" title="Link">Link 3</a></p>
</div>
</footer>
</div>
</body>
</html>
|
|