Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
04bf37b5
Commit
04bf37b5
authored
Nov 23, 2015
by
wangyong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cmdb' into dev
parents
47ace5d6
5a3c11f6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
145 additions
and
129 deletions
+145
-129
ansible_api.py
jasset/ansible_api.py
+0
-0
asset_api.py
jasset/asset_api.py
+66
-3
models.py
jasset/models.py
+1
-1
urls.py
jasset/urls.py
+1
-0
views.py
jasset/views.py
+29
-56
settings.py
jumpserver/settings.py
+5
-0
asset.xlsx
static/files/excels/asset.xlsx
+0
-0
cmdb_excel_2015_11_14_11_38.xlsx
static/files/excels/cmdb_excel_2015_11_14_11_38.xlsx
+0
-0
cmdb_excel_2015_11_14_11_39.xlsx
static/files/excels/cmdb_excel_2015_11_14_11_39.xlsx
+0
-0
cmdb_excel_2015_11_19_22_05.xlsx
static/files/excels/cmdb_excel_2015_11_19_22_05.xlsx
+0
-0
asset_detail.html
templates/jasset/asset_detail.html
+10
-4
asset_edit.html
templates/jasset/asset_edit.html
+7
-1
asset_edit_batch.html
templates/jasset/asset_edit_batch.html
+0
-27
asset_list.html
templates/jasset/asset_list.html
+20
-31
idc_list.html
templates/jasset/idc_list.html
+4
-4
nav_li_profile.html
templates/nav_li_profile.html
+2
-2
No files found.
jasset/ansible_api.py
deleted
100644 → 0
View file @
47ace5d6
This diff is collapsed.
Click to expand it.
jasset/asset_api.py
View file @
04bf37b5
...
...
@@ -4,6 +4,8 @@ import xlsxwriter
from
django.db.models
import
AutoField
from
jumpserver.api
import
*
from
jasset.models
import
ASSET_STATUS
,
ASSET_TYPE
,
ASSET_ENV
,
IDC
,
AssetRecord
from
jperm.ansible_api
import
MyRunner
from
jperm.perm_api
import
gen_resource
def
group_add_asset
(
group
,
asset_id
=
None
,
asset_ip
=
None
):
...
...
@@ -359,7 +361,6 @@ def ansible_record(asset, ansible_dic, username):
old
=
asset_dic
.
get
(
field
)
new
=
ansible_dic
.
get
(
field
)
if
unicode
(
old
)
!=
unicode
(
new
):
print
old
,
new
,
type
(
old
),
type
(
new
)
setattr
(
asset
,
field
,
value
)
asset
.
save
()
alert_dic
[
field
]
=
[
old
,
new
]
...
...
@@ -384,16 +385,17 @@ def excel_to_db(excel_file):
row
=
table
.
row_values
(
row_num
)
if
row
:
ip
,
port
,
hostname
,
use_default_auth
,
username
,
password
,
group
=
row
use_default_auth
=
1
if
use_default_auth
==
u'默认'
else
0
if
get_object
(
Asset
,
hostname
=
hostname
):
continue
use_default_auth
=
1
if
use_default_auth
==
u'默认'
else
0
password_encode
=
CRYPTOR
.
encrypt
(
password
)
if
password
else
''
if
hostname
:
asset
=
Asset
(
ip
=
ip
,
port
=
port
,
hostname
=
hostname
,
use_default_auth
=
use_default_auth
,
username
=
username
,
password
=
password
password
=
password
_encode
)
asset
.
save
()
group_list
=
group
.
split
(
'/'
)
...
...
@@ -406,3 +408,64 @@ def excel_to_db(excel_file):
asset
.
group
=
group_instance
asset
.
save
()
return
True
def
get_ansible_asset_info
(
asset_ip
,
setup_info
):
disk_all
=
setup_info
.
get
(
"ansible_devices"
)
disk_need
=
{}
for
disk_name
,
disk_info
in
disk_all
.
iteritems
():
if
disk_name
.
startswith
(
'sd'
)
or
disk_name
.
startswith
(
'hd'
)
or
disk_name
.
startswith
(
'vd'
):
disk_need
[
disk_name
]
=
disk_info
.
get
(
"size"
)
all_ip
=
setup_info
.
get
(
"ansible_all_ipv4_addresses"
)
other_ip_list
=
all_ip
.
remove
(
asset_ip
)
if
asset_ip
in
all_ip
else
[]
other_ip
=
','
.
join
(
other_ip_list
)
if
other_ip_list
else
''
# hostname = setup_info.get("ansible_hostname")
# ip = setup_info.get("ansible_default_ipv4").get("address")
mac
=
setup_info
.
get
(
"ansible_default_ipv4"
)
.
get
(
"macaddress"
)
brand
=
setup_info
.
get
(
"ansible_product_name"
)
cpu_type
=
setup_info
.
get
(
"ansible_processor"
)[
1
]
cpu_cores
=
setup_info
.
get
(
"ansible_processor_count"
)
cpu
=
cpu_type
+
' * '
+
unicode
(
cpu_cores
)
memory
=
setup_info
.
get
(
"ansible_memtotal_mb"
)
disk
=
disk_need
system_type
=
setup_info
.
get
(
"ansible_distribution"
)
system_version
=
setup_info
.
get
(
"ansible_distribution_version"
)
# asset_type = setup_info.get("ansible_system")
sn
=
setup_info
.
get
(
"ansible_product_serial"
)
asset_info
=
[
other_ip
,
mac
,
cpu
,
memory
,
disk
,
sn
,
system_type
,
system_version
,
brand
]
return
asset_info
def
asset_ansible_update
(
obj_list
,
name
=
''
):
resource
=
gen_resource
(
obj_list
)
ansible_instance
=
MyRunner
(
resource
)
ansible_asset_info
=
ansible_instance
.
run
(
module_name
=
'setup'
,
pattern
=
'*'
)
for
asset
in
obj_list
:
try
:
setup_info
=
ansible_asset_info
[
'contacted'
][
asset
.
hostname
][
'ansible_facts'
]
except
KeyError
:
continue
else
:
asset_info
=
get_ansible_asset_info
(
asset
.
ip
,
setup_info
)
other_ip
,
mac
,
cpu
,
memory
,
disk
,
sn
,
system_type
,
system_version
,
brand
=
asset_info
asset_dic
=
{
"other_ip"
:
other_ip
,
"mac"
:
mac
,
"cpu"
:
cpu
,
"memory"
:
memory
,
"disk"
:
disk
,
"sn"
:
sn
,
"system_type"
:
system_type
,
"system_version"
:
system_version
,
"brand"
:
brand
}
ansible_record
(
asset
,
asset_dic
,
name
)
def
asset_ansible_update_all
():
name
=
u'定时更新'
asset_all
=
Asset
.
objects
.
all
()
asset_ansible_update
(
asset_all
,
name
)
jasset/models.py
View file @
04bf37b5
...
...
@@ -73,7 +73,7 @@ class Asset(models.Model):
memory
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
null
=
True
,
verbose_name
=
u'内存'
)
disk
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
null
=
True
,
verbose_name
=
u'硬盘'
)
system_type
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
null
=
True
,
verbose_name
=
u"系统类型"
)
system_version
=
models
.
CharField
(
max_length
=
8
,
blank
=
True
,
null
=
True
,
verbose_name
=
u"版本号"
)
system_version
=
models
.
CharField
(
max_length
=
8
,
blank
=
True
,
null
=
True
,
verbose_name
=
u"
系统
版本号"
)
cabinet
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
null
=
True
,
verbose_name
=
u'机柜号'
)
position
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
,
verbose_name
=
u'机器位置'
)
number
=
models
.
CharField
(
max_length
=
32
,
blank
=
True
,
null
=
True
,
verbose_name
=
u'资产编号'
)
...
...
jasset/urls.py
View file @
04bf37b5
...
...
@@ -11,6 +11,7 @@ urlpatterns = patterns('',
url
(
r"^asset_detail/$"
,
asset_detail
),
url
(
r'^asset_edit/$'
,
asset_edit
),
url
(
r'^asset_update/$'
,
asset_update
),
url
(
r'^asset_update_batch/$'
,
asset_update_batch
),
# url(r'^search/$', host_search),
# url(r"^show_all_ajax/$", show_all_ajax),
url
(
r'^group_add/$'
,
group_add
),
...
...
jasset/views.py
View file @
04bf37b5
# coding:utf-8
import
ast
from
django.db.models
import
Q
from
jasset.asset_api
import
*
from
jumpserver.api
import
*
from
jumpserver.models
import
Setting
from
jasset.forms
import
AssetForm
,
IdcForm
from
jasset.models
import
Asset
,
IDC
,
AssetGroup
,
ASSET_TYPE
,
ASSET_STATUS
from
ansible_api
import
Tasks
from
jperm.ansible_api
import
Tasks
,
MyRunner
from
jperm.perm_api
import
gen_resource
@require_role
(
'admin'
)
...
...
@@ -95,8 +95,6 @@ def group_list(request):
"""
header_title
,
path1
,
path2
=
u'查看资产组'
,
u'资产管理'
,
u'查看资产组'
keyword
=
request
.
GET
.
get
(
'keyword'
,
''
)
gid
=
request
.
GET
.
get
(
'gid'
)
sid
=
request
.
GET
.
get
(
'sid'
)
asset_group_list
=
AssetGroup
.
objects
.
all
()
if
keyword
:
...
...
@@ -200,7 +198,7 @@ def asset_edit(request):
header_title
,
path1
,
path2
=
u'修改资产'
,
u'资产管理'
,
u'修改资产'
asset_id
=
request
.
GET
.
get
(
'id'
,
''
)
username
=
request
.
session
.
get
(
'username'
,
'admin'
)
username
=
request
.
user
.
username
asset
=
get_object
(
Asset
,
id
=
asset_id
)
if
asset
:
password_old
=
asset
.
password
...
...
@@ -211,6 +209,7 @@ def asset_edit(request):
ip
=
request
.
POST
.
get
(
'ip'
,
''
)
hostname
=
request
.
POST
.
get
(
'hostname'
,
''
)
password
=
request
.
POST
.
get
(
'password'
,
''
)
is_active
=
True
if
request
.
POST
.
get
(
'is_active'
)
==
'1'
else
False
use_default_auth
=
request
.
POST
.
get
(
'use_default_auth'
,
''
)
try
:
...
...
@@ -230,6 +229,7 @@ def asset_edit(request):
if
password_old
!=
password
:
password_encode
=
CRYPTOR
.
encrypt
(
password
)
af_save
.
password
=
password_encode
af_save
.
is_active
=
True
if
is_active
else
False
af_save
.
save
()
af_post
.
save_m2m
()
# asset_new = get_object(Asset, id=asset_id)
...
...
@@ -250,6 +250,7 @@ def asset_list(request):
"""
asset list view
"""
header_title
,
path1
,
path2
=
u'查看资产'
,
u'资产管理'
,
u'查看资产'
idc_all
=
IDC
.
objects
.
filter
()
asset_group_all
=
AssetGroup
.
objects
.
all
()
asset_types
=
ASSET_TYPE
...
...
@@ -311,7 +312,7 @@ def asset_list(request):
@require_role
(
'admin'
)
def
asset_edit_batch
(
request
):
af
=
AssetForm
()
name
=
request
.
session
.
get
(
'username'
,
'admin'
)
name
=
request
.
user
.
username
asset_group_all
=
AssetGroup
.
objects
.
all
()
if
request
.
method
==
'POST'
:
...
...
@@ -382,9 +383,8 @@ def asset_edit_batch(request):
asset
.
save
()
if
alert_list
:
username
=
unicode
(
name
)
+
' - '
+
u'批量'
print
alert_list
AssetRecord
.
objects
.
create
(
asset
=
asset
,
username
=
username
,
content
=
alert_list
)
recode_name
=
unicode
(
name
)
+
' - '
+
u'批量'
AssetRecord
.
objects
.
create
(
asset
=
asset
,
username
=
recode_name
,
content
=
alert_list
)
return
HttpResponse
(
'ok'
)
return
my_render
(
'jasset/asset_edit_batch.html'
,
locals
(),
request
)
...
...
@@ -410,53 +410,30 @@ def asset_update(request):
"""
asset_id
=
request
.
GET
.
get
(
'id'
,
''
)
asset
=
get_object
(
Asset
,
id
=
asset_id
)
name
=
request
.
user
.
username
if
not
asset
:
return
HttpResponseRedirect
(
'/jasset/asset_detail/?id=
%
s'
%
asset_id
)
name
=
request
.
session
.
get
(
'username'
,
'admin'
)
if
asset
.
use_default_auth
:
default
=
Setting
.
objects
.
all
()
if
default
:
default
=
default
[
0
]
username
=
default
.
default_user
password
=
default
.
default_password
port
=
default
.
default_port
else
:
return
HttpResponse
(
u'没有设置默认用户名和密码!'
)
else
:
username
=
asset
.
username
password
=
asset
.
password
port
=
asset
.
port
resource
=
[{
"hostname"
:
asset
.
ip
,
"port"
:
port
,
"username"
:
username
,
"password"
:
password
}]
ansible_instance
=
Tasks
(
resource
)
ansible_asset_info
=
ansible_instance
.
get_host_info
()
if
ansible_asset_info
[
'status'
]
==
'ok'
:
asset_info
=
ansible_asset_info
[
'result'
][
asset
.
ip
]
if
asset_info
:
hostname
=
asset_info
.
get
(
'hostname'
)
other_ip
=
','
.
join
(
asset_info
.
get
(
'other_ip'
))
cpu_type
=
asset_info
.
get
(
'cpu_type'
)[
1
]
cpu_cores
=
asset_info
.
get
(
'cpu_cores'
)
cpu
=
cpu_type
+
' * '
+
unicode
(
cpu_cores
)
memory
=
asset_info
.
get
(
'memory'
)
disk
=
asset_info
.
get
(
'disk'
)
sn
=
asset_info
.
get
(
'sn'
)
brand
=
asset_info
.
get
(
'brand'
)
system_type
=
asset_info
.
get
(
'system_type'
)
system_version
=
asset_info
.
get
(
'system_version'
)
asset_dic
=
{
"hostname"
:
hostname
,
"other_ip"
:
other_ip
,
"cpu"
:
cpu
,
"memory"
:
memory
,
"disk"
:
disk
,
"system_type"
:
system_type
,
"system_version"
:
system_version
,
"brand"
:
brand
,
"sn"
:
sn
}
ansible_record
(
asset
,
asset_dic
,
name
)
asset_ansible_update
(
asset_list
,
name
)
return
HttpResponseRedirect
(
'/jasset/asset_detail/?id=
%
s'
%
asset_id
)
@require_role
(
'admin'
)
def
asset_update_batch
(
request
):
if
request
.
method
==
'POST'
:
asset_list
=
[]
name
=
unicode
(
request
.
user
.
username
)
+
' - '
+
u'自动更新'
asset_id_all
=
unicode
(
request
.
POST
.
get
(
'asset_id_all'
,
''
))
asset_id_all
=
asset_id_all
.
split
(
','
)
for
asset_id
in
asset_id_all
:
asset
=
get_object
(
Asset
,
id
=
asset_id
)
if
asset
:
asset_list
.
append
(
asset
)
asset_ansible_update
(
asset_list
,
name
)
return
HttpResponse
(
u'批量更新成功!'
)
return
HttpResponse
(
u'批量更新成功!'
)
@require_role
(
'admin'
)
def
idc_add
(
request
):
"""
...
...
@@ -477,9 +454,7 @@ def idc_add(request):
return
HttpResponseRedirect
(
"/jasset/idc_list/"
)
else
:
idc_form
=
IdcForm
()
return
render_to_response
(
'jasset/idc_add.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
my_render
(
'jasset/idc_add.html'
,
locals
(),
request
)
@require_role
(
'admin'
)
...
...
@@ -495,9 +470,7 @@ def idc_list(request):
else
:
posts
=
IDC
.
objects
.
exclude
(
name
=
'ALL'
)
.
order_by
(
'id'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
posts
,
request
)
return
render_to_response
(
'jasset/idc_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
return
my_render
(
'jasset/idc_list.html'
,
locals
(),
request
)
@require_role
(
'admin'
)
...
...
jumpserver/settings.py
View file @
04bf37b5
...
...
@@ -66,6 +66,7 @@ INSTALLED_APPS = (
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django.contrib.humanize'
,
'django_crontab'
,
'bootstrapform'
,
'jumpserver'
,
'juser'
,
...
...
@@ -149,3 +150,7 @@ USE_TZ = False
STATIC_URL
=
'/static/'
BOOTSTRAP_COLUMN_COUNT
=
10
CRONJOBS
=
[
(
'0 1 * * *'
,
'jasset.asset_api.asset_ansible_update_all'
)
]
static/files/excels/asset.xlsx
deleted
100644 → 0
View file @
47ace5d6
File deleted
static/files/excels/cmdb_excel_2015_11_14_11_38.xlsx
deleted
100644 → 0
View file @
47ace5d6
File deleted
static/files/excels/cmdb_excel_2015_11_14_11_39.xlsx
deleted
100644 → 0
View file @
47ace5d6
File deleted
static/files/excels/cmdb_excel_2015_11_19_22_05.xlsx
deleted
100644 → 0
View file @
47ace5d6
File deleted
templates/jasset/asset_detail.html
View file @
04bf37b5
...
...
@@ -11,9 +11,15 @@
<div
class=
"ibox-title"
>
<span
class=
"text text-primary"
><b>
{{ asset.ip }}
</b></span>
<div
class=
"ibox-tools"
>
<a
class=
""
href=
"/jasset/asset_update/?id={{ asset.id }}"
>
<i
class=
"fa fa-refresh"
></i>
</a>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<ul
class=
"dropdown-menu dropdown-user"
>
</ul>
<a
class=
"close-link"
>
...
...
@@ -29,14 +35,14 @@
<div>
<div
class=
"text-left"
>
<table
class=
"table"
>
<tr>
<td
class=
"text-navy"
>
IP
</td>
<td>
{{ asset.ip|default_if_none:"" }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
主机名
</td>
<td>
{{ asset.hostname|default_if_none:"" }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
IP
</td>
<td>
{{ asset.ip|default_if_none:"" }}
</td>
</tr>
<tr>
<td
class=
"text-navy"
>
其他IP
</td>
<td>
...
...
templates/jasset/asset_edit.html
View file @
04bf37b5
...
...
@@ -77,7 +77,7 @@
<div
class=
"hr-line-dashed"
></div>
<label
class=
"col-sm-2 control-label"
>
端口
<span
class=
"red-fonts"
>
*
</span>
</label>
<div
class=
"col-sm-8"
>
<input
type=
"text"
placeholder=
"Port"
value=
"{{ asset.port }}"
name=
"port"
class=
"form-control"
>
<input
type=
"text"
placeholder=
"Port"
value=
"{{ asset.port
|default_if_none:"
"
}}"
name=
"port"
class=
"form-control"
>
</div>
</div>
...
...
@@ -96,6 +96,12 @@
<div
class=
"hr-line-dashed"
></div>
{{ af.memory|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
{{ af.system_type|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
{{ af.system_version|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
{{ af.disk|bootstrap_horizontal }}
...
...
templates/jasset/asset_edit_batch.html
View file @
04bf37b5
...
...
@@ -54,29 +54,17 @@
<div
class=
"col-sm-2"
>
<div
class=
"radio i-checks"
>
<label>
<
<<<<<<
HEAD
<
input
type=
"radio"
checked=
""
value=
"no_action"
id=
"no"
name=
"use_default_auth"
class=
"auth"
><span>
不修改
</span>
=======
<input
type=
"radio"
checked=
""
value=
""
id=
"no"
name=
"use_default_auth"
class=
"auth"
><span>
不修改
</span>
>>>>>>> cmdb
</label>
</div>
<div
class=
"radio i-checks"
>
<label>
<
<<<<<<
HEAD
<
input
type=
"radio"
id=
"default"
name=
"use_default_auth"
class=
"auth"
><span>
使用默认
</span>
=======
<input
type=
"radio"
id=
"default"
name=
"use_default_auth"
class=
"auth"
value=
"default"
><span>
使用默认
</span>
>>>>>>> cmdb
</label>
</div>
<div
class=
"radio i-checks"
>
<label>
<
<<<<<<
HEAD
<
input
type=
"radio"
id=
"pass"
name=
"use_default_auth"
class=
"auth"
><span>
用户名密码
</span>
=======
<input
type=
"radio"
id=
"pass"
name=
"use_default_auth"
class=
"auth"
value=
"user_passwd"
><span>
用户名密码
</span>
>>>>>>> cmdb
</label>
</div>
</div>
...
...
@@ -138,21 +126,6 @@
</div>
<script>
$
(
document
).
ready
(
function
()
{
<<<<<<<
HEAD
$
(
'#host_edit'
).
click
(
function
()
{
var
args
=
{};
var
match
=
null
;
var
uuid
=
decodeURIComponent
(
location
.
search
.
substring
(
1
));
var
reg
=
/
(?:([^
&
]
+
)
=
([^
&
]
+
))
/g
;
while
((
match
=
reg
.
exec
(
uuid
))
!==
null
){
args
[
match
[
1
]]
=
match
[
2
];
}
var
ids
=
args
[
'uuid'
];
$
(
'#uuid'
).
val
(
ids
)
});
=======
>>>>>>>
cmdb
$
(
'.auth'
).
click
(
function
(){
if
(
$
(
this
).
attr
(
'id'
)
==
'pass'
){
$
(
'#admin_account'
).
css
(
'display'
,
'block'
)
...
...
templates/jasset/asset_list.html
View file @
04bf37b5
...
...
@@ -130,7 +130,6 @@
<a
href=
"/jasset/asset_detail/?id={{ asset.id }}"
class=
"btn btn-xs btn-primary"
>
详情
</a>
{% ifnotequal session_role_id 0 %}
<a
href=
"/jasset/asset_edit/?id={{ asset.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"/jasset/asset_update/?id={{ asset.id }}"
class=
"btn btn-xs btn-info"
>
更新
</a>
<a
value=
"/jasset/asset_del/?id={{ asset.id }}"
class=
"btn btn-xs btn-danger asset_del"
>
删除
</a>
{% endifnotequal %}
</td>
...
...
@@ -142,6 +141,7 @@
<div
class=
"col-sm-6"
>
<input
type=
"button"
id=
"asset_del"
class=
"btn btn-danger btn-sm"
name=
"del_button"
value=
"删除"
/>
<a
value=
"/jasset/asset_edit_batch/"
type=
"button"
class=
"btn btn-sm btn-warning iframe"
>
修改
</a>
<input
type=
"button"
id=
"asset_update"
class=
"btn btn-info btn-sm"
name=
"update_button"
value=
"更新"
/>
</div>
{% include 'paginator.html' %}
</div>
...
...
@@ -155,23 +155,10 @@
{% block self_footer_js %}
<script>
$
(
'table td'
).
on
(
'change'
,
function
(
env
,
id
){
var
url
=
"/jasset/show_all_ajax/?env="
+
env
+
"&id="
+
id
;
console
.
log
(
url
);
$
.
ajax
({
type
:
"GET"
,
url
:
url
,
// data: $("#search_form").serialize(),
success
:
function
(
data
)
{
$
(
"#j_dept_"
+
id
).
html
(
data
);
}
});
});
$
(
document
).
ready
(
function
(){
$
(
'.asset_del'
).
click
(
function
(){
var
row
=
$
(
this
).
closest
(
'tr'
);
if
(
confirm
(
"确定删除"
))
{
if
(
confirm
(
"确定删除
?
"
))
{
$
.
get
(
$
(
this
).
attr
(
'value'
),
{},
...
...
@@ -221,12 +208,11 @@
$
(
'#asset_del'
).
click
(
function
()
{
var
asset_id_all
=
getIDall
();
console
.
log
(
asset_id_all
);
if
(
asset_id_all
==
''
){
alert
(
"请至少选择一行!"
);
return
false
;
}
if
(
confirm
(
"确定删除"
))
{
if
(
confirm
(
"确定删除
?
"
))
{
$
.
ajax
({
type
:
"post"
,
data
:
{
asset_id_all
:
asset_id_all
},
...
...
@@ -238,6 +224,23 @@
}
});
$
(
'#asset_update'
).
click
(
function
()
{
var
asset_id_all
=
getIDall
();
if
(
asset_id_all
==
''
){
alert
(
"请至少选择一行!"
);
return
false
;
}
layer
.
msg
(
'玩命更新中...'
,
{
time
:
200000
});
$
.
ajax
({
type
:
"post"
,
data
:
{
asset_id_all
:
asset_id_all
},
url
:
"/jasset/asset_update_batch/"
,
success
:
function
()
{
parent
.
location
.
reload
();
}
});
});
function
change_info
(){
var
args
=
$
(
"#asset_form"
).
serialize
();
...
...
@@ -249,19 +252,6 @@
change_info
()
}
});
function
show_all
(
env
,
id
)
{
var
url
=
"/jasset/show_all_ajax/?env="
+
env
+
"&id="
+
id
;
console
.
log
(
url
);
$
.
ajax
({
type
:
"GET"
,
url
:
url
,
success
:
function
(
data
)
{
$
(
"#j_group_"
+
id
).
html
(
data
);
}
});
}
</script>
{% endblock %}
\ No newline at end of file
templates/jasset/idc_list.html
View file @
04bf37b5
...
...
@@ -30,6 +30,7 @@
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/jasset/idc_add"
class=
"btn btn-sm btn-primary "
>
添加IDC
</a>
<input
type=
"button"
id=
"del_check"
class=
"btn btn-danger btn-sm"
name=
"del_button"
value=
"删除所选"
/>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
...
...
@@ -78,10 +79,9 @@
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
{% ifequal session_role_id 2 %}
<input
type=
"button"
id=
"del_check"
class=
"btn btn-danger btn-sm"
name=
"del_button"
value=
"删除"
/>
<!--<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />-->
{% endifequal %}
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
</div>
</div>
{% include 'paginator.html' %}
</div>
...
...
templates/nav_li_profile.html
View file @
04bf37b5
...
...
@@ -36,7 +36,7 @@
<script>
$
(
".iframe_user"
).
on
(
'click'
,
function
(){
var
url
=
$
(
this
).
attr
(
"value"
);
$
.
layer
({
layer
.
open
({
type
:
2
,
title
:
'个人信息'
,
maxmin
:
true
,
...
...
@@ -45,7 +45,7 @@
shade
:
[
0.5
,
'#000000'
],
shadeClose
:
true
,
area
:
[
'800px'
,
'600px'
],
iframe
:
{
src
:
url
}
content
:
url
});
});
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment