mirror of https://github.com/jumpserver/jumpserver
Merge branch 'dev' of github.com:jumpserver/jumpserver into dev
commit
179018bf67
|
@ -57,6 +57,10 @@
|
||||||
<script>
|
<script>
|
||||||
var zTree2, asset_table2 = 0;
|
var zTree2, asset_table2 = 0;
|
||||||
function initTable2() {
|
function initTable2() {
|
||||||
|
if(asset_table2){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
ele: $('#asset_list_modal_table'),
|
ele: $('#asset_list_modal_table'),
|
||||||
ajax_url: '{% url "api-assets:asset-list" %}?show_current_asset=1',
|
ajax_url: '{% url "api-assets:asset-list" %}?show_current_asset=1',
|
||||||
|
|
|
@ -32,6 +32,7 @@ $(document).ready(function () {
|
||||||
}).on('click', '.select2-selection__rendered', function (e) {
|
}).on('click', '.select2-selection__rendered', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$("#asset_list_modal").modal();
|
$("#asset_list_modal").modal();
|
||||||
|
initSelectedAssets2Table();
|
||||||
})
|
})
|
||||||
.on('click', '#btn_asset_modal_confirm', function () {
|
.on('click', '#btn_asset_modal_confirm', function () {
|
||||||
var assets = asset_table2.selected;
|
var assets = asset_table2.selected;
|
||||||
|
|
|
@ -113,6 +113,7 @@ $(document).ready(function () {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
$("#asset_list_modal").modal();
|
$("#asset_list_modal").modal();
|
||||||
|
initSelectedAssets2Table();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -812,3 +812,32 @@ function initPopover($container, $progress, $idPassword, $el, password_check_rul
|
||||||
$idPassword.pwstrength(options);
|
$idPassword.pwstrength(options);
|
||||||
popoverPasswordRules(password_check_rules, $el);
|
popoverPasswordRules(password_check_rules, $el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解决input框中的资产和弹出表格中资产的显示不一致
|
||||||
|
function initSelectedAssets2Table(){
|
||||||
|
var inputAssets = $('#id_assets').val();
|
||||||
|
var selectedAssets = asset_table2.selected.concat();
|
||||||
|
|
||||||
|
// input assets无,table assets选中,则取消勾选(再次click)
|
||||||
|
if (selectedAssets.length !== 0){
|
||||||
|
$.each(selectedAssets, function (index, assetId){
|
||||||
|
if ($.inArray(assetId, inputAssets) === -1){
|
||||||
|
$('#'+assetId).trigger('click'); // 取消勾选
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// input assets有,table assets没选,则选中(click)
|
||||||
|
if (inputAssets !== null){
|
||||||
|
asset_table2.selected = inputAssets;
|
||||||
|
$.each(inputAssets, function(index, assetId){
|
||||||
|
var dom = document.getElementById(assetId);
|
||||||
|
if (dom !== null){
|
||||||
|
var selected = dom.parentElement.parentElement.className.indexOf('selected')
|
||||||
|
}
|
||||||
|
if (selected === -1){
|
||||||
|
$('#'+assetId).trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue