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
995c905e
Commit
995c905e
authored
Dec 24, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7c32670a
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
159 additions
and
27 deletions
+159
-27
common.service.ts
src/main/webapp/app/shared/common/common.service.ts
+16
-0
group.component.html
src/main/webapp/app/system/group/group.component.html
+5
-3
group.component.ts
src/main/webapp/app/system/group/group.component.ts
+24
-1
system.service.ts
src/main/webapp/app/system/system.service.ts
+19
-1
asset-part.component.html
...main/webapp/app/work/asset-part/asset-part.component.html
+2
-2
asset-part.component.ts
src/main/webapp/app/work/asset-part/asset-part.component.ts
+14
-1
child-assets.component.ts
...pp/work/asset-part/child-assets/child-assets.component.ts
+1
-1
upload.component.html
src/main/webapp/app/work/modal/upload/upload.component.html
+1
-1
upload.component.ts
src/main/webapp/app/work/modal/upload/upload.component.ts
+72
-17
work.service.ts
src/main/webapp/app/work/work.service.ts
+5
-0
No files found.
src/main/webapp/app/shared/common/common.service.ts
View file @
995c905e
import
{
Injectable
,
OnInit
}
from
"@angular/core"
;
import
{
NzModalService
}
from
'ng-zorro-antd'
;
import
{
SERVER_API_URL
,
SERVER_API_URL_COMS
}
from
'../../app.constants'
;
@
Injectable
()
export
class
CommonService
implements
OnInit
{
...
...
@@ -80,4 +81,19 @@ export class CommonService implements OnInit {
nzOnCancel
:
()
=>
console
.
log
(
'Cancel'
),
})
}
/**
* 下载文件
* @param url 文件URL
*/
downloadFile
(
title
,
data
:
Response
)
{
const
blob
=
new
Blob
([
data
],
{
type
:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
});
const
url
=
window
.
URL
.
createObjectURL
(
blob
);
let
link
=
document
.
createElement
(
"a"
);
link
.
setAttribute
(
"href"
,
url
);
link
.
setAttribute
(
"download"
,
title
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
document
.
body
.
removeChild
(
link
);
}
}
src/main/webapp/app/system/group/group.component.html
View file @
995c905e
...
...
@@ -51,9 +51,9 @@
<button
(
click
)="
showUserModal
()"
nz-button
nzType=
"primary"
>
新增用户
</button>
<button
(
click
)="
batchDelete
()"
nz-button
nzType=
"default"
>
批量删除
</button>
<button
nz-button
nzType=
"default"
>
批量修改
</button>
<button
nz-button
nzType=
"default"
>
下载模版
</button>
<button
nz-button
nzType=
"default"
>
导入组织
</button>
<button
nz-button
nzType=
"default"
>
导入用户
</button>
<button
(
click
)="
downLoad
()"
nz-button
nzType=
"default"
>
下载模版
</button>
<button
(
click
)="
showUploadModalOrg
()"
nz-button
nzType=
"default"
>
导入组织
</button>
<button
(
click
)="
showUploadModalUser
()"
nz-button
nzType=
"default"
>
导入用户
</button>
</div>
<nz-table
#
basicTable
[
nzData
]="
dataSet
"
[
nzFrontPagination
]="
false
"
[
nzTotal
]="
totalNum
"
[
nzPageIndex
]="
pageNum
"
[
nzPageSize
]="
pageSize
"
(
nzPageIndexChange
)="
changePage
($
event
)"
>
...
...
@@ -91,4 +91,6 @@
<smart-group-modal
#
smartGroupModal
(
done
)="
getGroup
()"
></smart-group-modal>
<!--授予角色-->
<smart-select-role
#
smartSelectRole
(
done
)="
setRole
($
event
)"
></smart-select-role>
<!--导入文件-->
<smart-upload
#
smartUpload
></smart-upload>
src/main/webapp/app/system/group/group.component.ts
View file @
995c905e
...
...
@@ -5,7 +5,9 @@ import {UserComponent} from '../modal/user/user.component';
import
{
GroupModalComponent
}
from
'../modal/group-modal/group-modal.component'
;
import
{
SelectRoleComponent
}
from
'../../modal/select-role/select-role.component'
;
import
{
CommonService
}
from
'../../shared/common/common.service'
;
import
{
pageSize
}
from
'../../app.constants'
;
import
{
pageSize
,
SERVER_API_URL_COMS
}
from
'../../app.constants'
;
import
'rxjs/Rx'
;
import
{
UploadComponent
}
from
'../../work/modal/upload/upload.component'
;
@
Component
({
selector
:
'jhi-group'
,
...
...
@@ -17,6 +19,7 @@ export class GroupComponent implements OnInit {
@
ViewChild
(
'power'
)
power
;
@
ViewChild
(
'smartUser'
)
smartUser
:
UserComponent
;
@
ViewChild
(
'smartGroupModal'
)
smartGroupModal
:
GroupModalComponent
;
@
ViewChild
(
"smartUpload"
)
smartUpload
:
UploadComponent
;
dataSet
:
any
[];
groupList
:
any
[];
...
...
@@ -270,9 +273,29 @@ export class GroupComponent implements OnInit {
}
}
//选择角色
selectRoleModal
()
{
this
.
setType
=
'批量'
;
this
.
smartSelectRole
.
showModal
(
'选择角色'
,
null
);
}
//下载模版
downLoad
(){
this
.
systemSer
.
downloadTemplate
().
subscribe
(
data
=>
{
this
.
commonSer
.
downloadFile
(
"模版"
,
data
)
}
);
}
//导入用户
showUploadModalUser
(){
this
.
smartUpload
.
showModal
(
"上传用户文件"
);
}
//导入组织
showUploadModalOrg
(){
this
.
smartUpload
.
showModal
(
"上传组织文件"
);
}
}
src/main/webapp/app/system/system.service.ts
View file @
995c905e
...
...
@@ -3,11 +3,14 @@ import {Observable} from "rxjs/Rx";
import
{
Injectable
}
from
'@angular/core'
;
import
{
SERVER_API_URL_COMS
}
from
"../app.constants"
;
import
{
CommonService
}
from
'../shared/common/common.service'
;
import
{
LocalStorageService
,
SessionStorageService
}
from
'ngx-webstorage'
;
import
{
RequestOptions
}
from
'@angular/http'
;
@
Injectable
()
export
class
SystemService
{
constructor
(
private
http
:
HttpClient
,
private
commonSer
:
CommonService
)
{
constructor
(
private
http
:
HttpClient
,
private
commonSer
:
CommonService
,
private
localStorage
:
LocalStorageService
,
private
sessionStorage
:
SessionStorageService
)
{
}
//角色列表
...
...
@@ -207,4 +210,19 @@ export class SystemService {
getMenuBySeparation
():
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL_COMS
+
'/resources/getMenuBySeparation'
);
}
//下载文件
downloadTemplate
():
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL_COMS
+
'/user/downloadTemplate'
,{
responseType
:
'text'
}
);
}
//用户导入
importUser
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL_COMS
+
'/user/importUser'
,
data
);
}
//组织导入
importOrg
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL_COMS
+
'/organization/importOrg'
,
data
);
}
}
src/main/webapp/app/work/asset-part/asset-part.component.html
View file @
995c905e
...
...
@@ -31,7 +31,7 @@
<button
(
click
)="
showUploadModal
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-upload"
></i>
导入资产
</button>
</div>
<div
nz-col
nzSpan=
"3"
class=
"text-center"
>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-download"
></i>
下载模版
</button>
<button
(
click
)="
downLoad
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-download"
></i>
下载模版
</button>
</div>
<div
nz-col
nzSpan=
"8"
></div>
<div
nz-col
nzSpan=
"6"
class=
"text-right"
>
...
...
@@ -41,7 +41,7 @@
</div>
</div>
<nz-table
#
nzTable
[
nzData
]="
childrenList
"
>
<nz-table
#
nzTable
[
nzData
]="
childrenList
"
[
nzShowPagination
]="
true
"
>
<thead>
<tr>
<th>
子分类
</th>
...
...
src/main/webapp/app/work/asset-part/asset-part.component.ts
View file @
995c905e
...
...
@@ -99,6 +99,10 @@ export class AssetPartComponent implements OnInit {
//删除父分类
deleteParentType
(){
if
(
this
.
obj
.
type
==
"all"
){
this
.
messge
.
warning
(
"请选择需要删除的分类"
);
return
false
;
}
const
data
=
{
inventoryTypeIds
:[]
};
...
...
@@ -144,6 +148,15 @@ export class AssetPartComponent implements OnInit {
//导入资产
showUploadModal
(){
this
.
smartUpload
.
showModal
();
this
.
smartUpload
.
showModal
(
"上传资产文件"
);
}
//下载模版
downLoad
(){
this
.
workSer
.
download
(
"inventory"
).
subscribe
(
(
data
)
=>
{
this
.
commonSer
.
downloadFile
(
"资产模版"
,
data
);
}
)
}
}
src/main/webapp/app/work/asset-part/child-assets/child-assets.component.ts
View file @
995c905e
...
...
@@ -80,7 +80,7 @@ export class ChildAssetsComponent implements OnInit {
//导入资产
showUploadModal
(){
this
.
smartUpload
.
showModal
();
this
.
smartUpload
.
showModal
(
"上传资产文件"
);
}
}
src/main/webapp/app/work/modal/upload/upload.component.html
View file @
995c905e
<!--添加图片-->
<nz-modal
[(
nzVisible
)]="
isVisible
"
nzTitle=
"上传文件
"
(
nzOnCancel
)="
handleCancel
()"
(
nzOnOk
)="
handleOk
()"
>
<nz-modal
[(
nzVisible
)]="
isVisible
"
[
nzTitle
]="
title
"
(
nzOnCancel
)="
handleCancel
()"
(
nzOnOk
)="
handleOk
()"
>
<form
nz-form
>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
7
"
nzRequired
nzFor=
"group"
>
选择文件
</nz-form-label>
...
...
src/main/webapp/app/work/modal/upload/upload.component.ts
View file @
995c905e
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
NzMessageService
,
UploadFile
}
from
'ng-zorro-antd'
;
import
{
WorkService
}
from
'../../work.service'
;
import
{
SystemService
}
from
'../../../system/system.service'
;
@
Component
({
selector
:
'smart-upload'
,
...
...
@@ -9,53 +10,107 @@ import {WorkService} from '../../work.service';
})
export
class
UploadComponent
implements
OnInit
{
title
;
isVisible
=
false
;
fileList
:
UploadFile
[]
=
[];
constructor
(
private
message
:
NzMessageService
,
private
workSer
:
WorkService
)
{
}
constructor
(
private
message
:
NzMessageService
,
private
workSer
:
WorkService
,
private
systemSer
:
SystemService
)
{
}
ngOnInit
()
{
}
showModal
(){
showModal
(
title
)
{
this
.
title
=
title
;
this
.
isVisible
=
true
;
}
beforeUpload
=
(
file
:
UploadFile
):
boolean
=>
{
console
.
log
(
file
.
type
);
const
isExcel
=
file
.
type
===
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
;
if
(
!
isExcel
)
{
this
.
message
.
error
(
'请上传excel文件!'
);
}
else
{
}
else
{
this
.
fileList
.
push
(
file
);
}
return
false
;
};
handleCancel
(){
handleCancel
()
{
this
.
isVisible
=
false
;
this
.
fileList
=
[];
}
handleOk
(){
if
(
this
.
fileList
.
length
==
0
)
{
this
.
message
.
warning
(
"请选择文件"
);
handleOk
()
{
if
(
this
.
fileList
.
length
==
0
)
{
this
.
message
.
warning
(
'请选择文件'
);
return
false
;
}
if
(
this
.
title
==
'上传资产文件'
)
{
this
.
assetsUpload
();
}
if
(
this
.
title
==
'上传用户文件'
)
{
this
.
userUpload
();
}
if
(
this
.
title
==
'上传组织文件'
)
{
this
.
orgUpload
();
}
}
//上传资产文件
assetsUpload
()
{
const
formData
=
new
FormData
();
this
.
fileList
.
forEach
((
file
:
any
)
=>
{
formData
.
append
(
'file'
,
file
);
})
this
.
fileList
.
forEach
((
file
:
any
)
=>
{
formData
.
append
(
'file'
,
file
);
})
;
this
.
workSer
.
importInventory
(
formData
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
isVisible
=
false
;
this
.
fileList
=
[];
this
.
message
.
success
(
'上传成功'
);
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
}
);
}
//导入用户
userUpload
()
{
const
formData
=
new
FormData
();
this
.
fileList
.
forEach
((
file
:
any
)
=>
{
formData
.
append
(
'user'
,
file
);
});
this
.
systemSer
.
importUser
(
formData
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
isVisible
=
false
;
this
.
fileList
=
[];
this
.
message
.
success
(
"上传成功"
);
}
else
{
this
.
message
.
success
(
'上传成功'
);
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
}
)
)
;
}
//导入组织
orgUpload
()
{
const
formData
=
new
FormData
();
this
.
fileList
.
forEach
((
file
:
any
)
=>
{
formData
.
append
(
'organization'
,
file
);
});
this
.
systemSer
.
importOrg
(
formData
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
isVisible
=
false
;
this
.
fileList
=
[];
this
.
message
.
success
(
'上传成功'
);
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
}
);
}
}
src/main/webapp/app/work/work.service.ts
View file @
995c905e
...
...
@@ -168,4 +168,9 @@ export class WorkService {
deleteTypeByparams
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/syseventType/delete'
,
data
);
}
//下载模版
download
(
params
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/api/template/download/'
+
params
,{
responseType
:
'text'
});
}
}
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