Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart
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
wangqinghua
smart
Commits
e0fdfcea
Commit
e0fdfcea
authored
Aug 13, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug 修正
parent
f61dd0ed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
common.service.ts
src/main/webapp/app/shared/common/common.service.ts
+29
-8
No files found.
src/main/webapp/app/shared/common/common.service.ts
View file @
e0fdfcea
...
@@ -2,9 +2,13 @@ import {Injectable, OnInit} from '@angular/core';
...
@@ -2,9 +2,13 @@ import {Injectable, OnInit} from '@angular/core';
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
SERVER_API_URL
,
SERVER_API_URL_COMS
}
from
'../../app.constants'
;
import
{
SERVER_API_URL
,
SERVER_API_URL_COMS
}
from
'../../app.constants'
;
import
{
DatePipe
}
from
'@angular/common'
;
import
{
DatePipe
}
from
'@angular/common'
;
import
{
WorkService
}
from
'../../work/work.service'
;
declare
var
ActiveXObject
:
ActiveXObject
;
declare
var
ActiveXObject
:
ActiveXObject
;
interface
ActiveXObject
{
interface
ActiveXObject
{
new
(
type
:
string
):
ActiveXObject
;
new
(
type
:
string
):
ActiveXObject
;
SendKeys
(
key
:
string
):
void
;
SendKeys
(
key
:
string
):
void
;
}
}
...
@@ -12,7 +16,7 @@ interface ActiveXObject {
...
@@ -12,7 +16,7 @@ interface ActiveXObject {
export
class
CommonService
implements
OnInit
{
export
class
CommonService
implements
OnInit
{
constructor
(
private
modalSer
:
NzModalService
,
private
datePipe
:
DatePipe
,
constructor
(
private
modalSer
:
NzModalService
,
private
datePipe
:
DatePipe
,
private
message
:
NzMessageService
)
{
private
message
:
NzMessageService
,
private
workSer
:
WorkService
)
{
// 定义发射事件
// 定义发射事件
}
}
...
@@ -143,11 +147,11 @@ export class CommonService implements OnInit {
...
@@ -143,11 +147,11 @@ export class CommonService implements OnInit {
ieEDGE
=
navigator
.
userAgent
.
match
(
/Edge/g
),
ieEDGE
=
navigator
.
userAgent
.
match
(
/Edge/g
),
ieVer
=
(
ie
?
ie
[
1
]
:
(
ie11
?
11
:
(
ieEDGE
?
12
:
-
1
)));
ieVer
=
(
ie
?
ie
[
1
]
:
(
ie11
?
11
:
(
ieEDGE
?
12
:
-
1
)));
if
(
ieVer
>
-
1
)
{
if
(
ieVer
>
-
1
)
{
if
(
typeof
(
<
any
>
window
).
ActiveXObject
!==
"undefined"
)
{
if
(
typeof
(
<
any
>
window
).
ActiveXObject
!==
'undefined'
)
{
//这的方法 模拟f11键,使浏览器全屏
//这的方法 模拟f11键,使浏览器全屏
const
wscript
=
new
ActiveXObject
(
"WScript.Shell"
);
const
wscript
=
new
ActiveXObject
(
'WScript.Shell'
);
if
(
wscript
!=
null
)
{
if
(
wscript
!=
null
)
{
wscript
.
SendKeys
(
"{F11}"
);
wscript
.
SendKeys
(
'{F11}'
);
}
}
}
}
}
}
...
@@ -227,7 +231,7 @@ export class CommonService implements OnInit {
...
@@ -227,7 +231,7 @@ export class CommonService implements OnInit {
}
}
//内存单位换算
//内存单位换算
unitConversion
(
unit
){
unitConversion
(
unit
)
{
let
res
;
let
res
;
let
Gbps
=
1000
*
1000
*
1000
;
let
Gbps
=
1000
*
1000
*
1000
;
let
Mbps
=
1000
*
1000
;
let
Mbps
=
1000
*
1000
;
...
@@ -240,8 +244,25 @@ export class CommonService implements OnInit {
...
@@ -240,8 +244,25 @@ export class CommonService implements OnInit {
}
else
if
(
size
/
kbps
>
1
)
{
}
else
if
(
size
/
kbps
>
1
)
{
res
+=
(
size
/
kbps
).
toFixed
(
2
)
+
'kbps'
;
res
+=
(
size
/
kbps
).
toFixed
(
2
)
+
'kbps'
;
}
else
{
}
else
{
res
+=
(
size
)
+
'bps'
;
res
+=
(
size
)
+
'bps'
;
}
}
return
res
;
return
res
;
}
}
/**
* 文件预览
*/
previewFile
(
fileUrl
)
{
// this.workSer.getPreview().subscribe(
// (res)=>{
//
// }
// )
console
.
log
(
window
.
location
.
host
+
'/zabbixBox'
);
const
previeUrl1
=
"http://10.10.38.99:8282"
+
fileUrl
;
// const previeUrl = "http://10.10.38.99:8282/file/knowledge/zyh.jpg";
window
.
open
(
'http://10.10.38.99:8012/onlinePreview?url='
+
encodeURIComponent
(
previeUrl1
)
);
// window.open('http://10.10.38.99:8012/onlinePreview?url=' + encodeURIComponent(previeUrl) );
// window.open(window.location.host + '/zabbixBox' + fileUrl);
}
}
}
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