pull/530/head
江世峰 8 years ago
parent 0dec647116
commit fd52a85dbb

@ -5,18 +5,11 @@
{% block custom_head_css_js %}
<link href="{% static 'css/plugins/select2/select2.min.css' %}" rel="stylesheet">
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
<link href="{% static 'css/plugins/dataTables/datatables.min.css' %}" rel="stylesheet">
<script src="{% static 'js/plugins/dataTables/datatables.min.js' %}"></script>
<style>
<!--table.dataTable tbody tr.selected {-->
<!--background-color: white;-->
<!--color:#676a6c;-->
<!--//background-color: transparent;-->
<!--}-->
<!--table.dataTable tbody tr.selected td.text-center{-->
<!--background-color: #B0BED9;-->
<!--}-->
div.dataTables_wrapper div.dataTables_filter,
.dataTables_length {
float: left;
}
</style>
{% endblock %}
{% block content %}
@ -50,7 +43,7 @@
{{ form.name|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
<div class="hr-line-dashed"></div>
<h3 class="widget-head-color-box">资产数量</h3>
<h3 class="widget-head-color-box">用户选择的资产</h3>
<div class="form-group">
<label class="col-sm-2 control-label">已选</label>
<div class="col-sm-9" id="asset_sed">

@ -9,7 +9,7 @@
<thead>
<tr>
<th class="text-center" style="background-color:white">
<input type="checkbox" id="check_all" onclick="checkAll('check_all', 'checked')">
<input type="checkbox" id="check_all" onclick="checkAll()">
</th>
<th id="th_no">id</th>
<th>资产名称</th>
@ -21,11 +21,12 @@
</thead>
<tbody>
{% for asset in asset_modal_list %}
<tr>
{% if asset.id in group_assets %}
<td class="text-center" ><input type="checkbox" name="checked" value="{{ asset.id }}" checked="checked"></td>
<tr name="oAssets" class="odd selected">
<td class="text-center" ><input type="checkbox" name="checked" value="{{ asset.id }}" checked="checked" ></td>
{% else %}
<td class="text-center" ><input type="checkbox" name="checked" value="{{ asset.id }}"></td>
<tr name="oAssets">
<td class="text-center" ><input type="checkbox" name="checked" value="{{ asset.id }}" ></td>
{% endif %}
<td>{{ asset.id }}</td>
<td>{{ asset.hostname }}</td>
@ -54,6 +55,9 @@ $(document).ready(function(){
"aaSorting": [[2, "asc"]],
"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0 ] }],
"bAutoWidth": false,
"language": {
"url": "/static/js/plugins/dataTables/i18n/zh-hans.json"
},
columns: [
{data: "checkbox"},
{data: "id"},
@ -64,36 +68,56 @@ $(document).ready(function(){
{data: "dp"}
]
});
//讲ID列隐藏
table.column('1').visible(false);
$('#editable tbody').on( 'click', 'tr', function () {
$(this).toggleClass('selected');
//alert($(this).hasClass('selected'));
if($(this).hasClass('selected')){
$(this).removeClass('selected');
this.children[0].children[0].checked=0;
}else{
$(this).addClass('selected');
this.children[0].children[0].checked=1;
};
});
$('#save-btn').on('click',function(){
//alert( table.rows('.selected').data().length +' row(s) selected' );
// alert( table.rows('.selected').data().length +' row(s) selected' );
var d = table.rows('.selected').data();
var size = d.length;
document.getElementById('add_asset').value = size;
var column2 = table.rows('.selected').data();
$("#asset_sed").find("input[name='assets']").remove();
for(var i=0;i<column2.length;i++){
column2[i].checkbox='<input name="checked" value="1" checked="" type="checkbox">';
var value = column2[i].id;
$("#asset_sed").append("<input type='hidden' name='assets' value='"+value+"'>");
}
$('#modal').modal('hide');
});
});
$('#close-btn').on('click',function(){
//alert('点击关闭按钮时触发;')
$('#modal').modal('hide');
});
}); //$(document).ready
var bCheck = 1;
function checkAll(){
if(bCheck){
$("tr[name='oAssets']").each(function(){
oCheckbox = this.children[0].children[0];
$(this).toggleClass('selected',true);
oCheckbox.checked=1;
});
document.getElementById('check_all').checked=1;
bCheck = 0;
}else{
$("tr[name='oAssets']").each(function(){
oCheckbox = this.children[0].children[0];
$(this).toggleClass('selected',false);
oCheckbox.checked=0;
});
document.getElementById('check_all').checked=0;
bCheck = 1;
};
};
</script>

@ -1,15 +1,15 @@
{% load static %}
<!-- css file -->
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<link href="{% static "css/font-awesome.css" %}" rel="stylesheet">
<link href="{% static "css/plugins/toastr/toastr.min.css" %}" rel="stylesheet">
<link href="{% static "css/plugins/sweetalert/sweetalert.css" %}" rel="stylesheet">
<link href="{% static "css/style.css" %}" rel="stylesheet">
<link href="{% static "css/plugins/vaildator/jquery.validator.css" %}" rel="stylesheet">
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'css/font-awesome.css' %}" rel="stylesheet">
<link href="{% static 'css/plugins/toastr/toastr.min.css' %}" rel="stylesheet">
<link href="{% static 'css/plugins/sweetalert/sweetalert.css' %}" rel="stylesheet">
<link href="{% static 'css/style.css' %}" rel="stylesheet">
<link href="{% static 'css/plugins/vaildator/jquery.validator.css' %}" rel="stylesheet">
<link href="{% static 'css/plugins/dataTables/datatables.min.css' %}" rel="stylesheet">
<!-- scripts -->
<script src="{% static 'js/jquery-2.1.1.js' %}"></script>
<!-- Sweet alert -->
<script src="{% static 'js/plugins/sweetalert/sweetalert.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/plugins/dataTables/datatables.min.js' %}"></script>

@ -8,10 +8,10 @@
<title>Jumpserver</title>
<link rel="shortcut icon" href={% static "img/facio.ico" %} type="image/x-icon">
<link rel="shortcut icon" href="{% static 'img/facio.ico' %}" type="image/x-icon">
{% include '_head_css_js.html' %}
<link href="{% static 'css/jumpserver.css' %}" rel="stylesheet">
{% block custom_head_css_js %} {% endblock %}
<link href="{% static "css/jumpserver.css" %}" rel="stylesheet">
</head>
<body>

Loading…
Cancel
Save