Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
luqiao-app
Overview
Overview
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
杨子
luqiao-app
Commits
5adf0760
Commit
5adf0760
authored
Jun 10, 2019
by
杨子
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加退出接口
parent
42bdf35e
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
148 additions
and
79 deletions
+148
-79
proxy.config.json
proxy.config.json
+1
-1
user.component.ts
src/app/layout/default/user/user.component.ts
+13
-2
login.component.html
src/app/layout/passport/login/login.component.html
+2
-0
login.component.ts
src/app/layout/passport/login/login.component.ts
+4
-3
check-add.component.ts
...ts/assets-used/checkPlan/check-add/check-add.component.ts
+94
-61
check-result.component.html
...s-used/checkPlan/check-result/check-result.component.html
+6
-3
check-result.component.scss
...s-used/checkPlan/check-result/check-result.component.scss
+6
-0
check-result.component.ts
...ets-used/checkPlan/check-result/check-result.component.ts
+15
-8
qr-scan.component.ts
src/app/routes/check/qrScan/qrScan/qr-scan.component.ts
+1
-1
api.service.ts
src/app/service/layout/service/api.service.ts
+6
-0
No files found.
proxy.config.json
View file @
5adf0760
{
"/asset/*"
:
{
"target"
:
"http://
localhost:8081
"
,
"target"
:
"http://
192.168.19.171:8082
"
,
"secure"
:
false
,
"logLevel"
:
"debug"
,
"changeOrigin"
:
true
...
...
src/app/layout/default/user/user.component.ts
View file @
5adf0760
import
{
Component
,
OnInit
}
from
"@angular/core"
;
import
{
Component
,
OnInit
,
Inject
}
from
"@angular/core"
;
import
{
Router
}
from
"@angular/router"
;
import
{
APIService
}
from
"src/app/service/layout/service/api.service"
;
import
{
SocialService
,
ITokenService
,
DA_SERVICE_TOKEN
}
from
"@delon/auth"
;
@
Component
({
selector
:
"app-user"
,
templateUrl
:
"./user.component.html"
,
...
...
@@ -9,13 +11,22 @@ export class UserComponent implements OnInit {
data
=
[];
currentArr
=
[];
// 收起
remainArr
=
[];
//更多
constructor
(
private
router
:
Router
)
{}
constructor
(
private
router
:
Router
,
@
Inject
(
DA_SERVICE_TOKEN
)
private
tokenService
:
ITokenService
,
private
apiSrv
:
APIService
)
{}
ngOnInit
()
{}
jumpPassword
()
{
this
.
router
.
navigateByUrl
(
"/admin/user/password"
);
}
logout
()
{
this
.
apiSrv
.
logout
().
subscribe
((
r
:
any
)
=>
{
if
(
r
.
success
==
"1"
)
{
this
.
tokenService
.
clear
();
this
.
router
.
navigateByUrl
(
"/passport/login"
);
}
});
}
}
src/app/layout/passport/login/login.component.html
View file @
5adf0760
...
...
@@ -10,6 +10,7 @@
<a
Button
[
type
]="'
primary
'"
[
size
]="'
large
'"
(
onClick
)="
submit
()"
>
登录
</a>
</ListItem>
</List>
</form>
\ No newline at end of file
src/app/layout/passport/login/login.component.ts
View file @
5adf0760
...
...
@@ -6,6 +6,7 @@ import { HttpClient } from "@angular/common/http";
import
{
catchError
}
from
"rxjs/operators"
;
import
{
of
}
from
"rxjs"
;
import
{
StartupService
}
from
"../../service/startup.service"
;
import
{
APIService
}
from
"src/app/service/layout/service/api.service"
;
@
Component
({
selector
:
"passport-login"
,
...
...
@@ -23,7 +24,8 @@ export class UserLoginComponent {
private
socialService
:
SocialService
,
@
Inject
(
DA_SERVICE_TOKEN
)
private
tokenService
:
ITokenService
,
private
startupSrv
:
StartupService
,
private
http
:
HttpClient
private
http
:
HttpClient
,
private
apiSrv
:
APIService
)
{
this
.
form
=
fb
.
group
({
userName
:
[
null
,
[
Validators
.
required
,
Validators
.
minLength
(
4
)]],
...
...
@@ -44,7 +46,6 @@ export class UserLoginComponent {
// #endregion
submit
()
{
document
.
cookie
=
""
;
this
.
error
=
""
;
console
.
log
(
this
.
form
.
value
);
// 默认配置中对所有HTTP请求都会强制 [校验](https://ng-alain.com/auth/getting-started) 用户 Token
...
...
@@ -79,7 +80,7 @@ export class UserLoginComponent {
this
.
startupSrv
.
load
().
then
(()
=>
{
let
url
=
this
.
tokenService
.
referrer
!
.
url
||
"/"
;
if
(
url
.
includes
(
"/passport"
))
url
=
"/"
;
this
.
router
.
navigateByUrl
(
url
);
this
.
router
.
navigateByUrl
(
"/admin"
);
});
},
error
=>
{
...
...
src/app/routes/assets/assets-used/checkPlan/check-add/check-add.component.ts
View file @
5adf0760
...
...
@@ -2,7 +2,14 @@ import { Component, OnInit } from "@angular/core";
import
{
Router
,
ActivatedRoute
}
from
"@angular/router"
;
import
{
switchMap
,
merge
,
tap
}
from
"rxjs/operators"
;
import
{
Modal
,
Picker
,
Toast
,
PickerService
,
ToastService
,
ModalService
}
from
"ng-zorro-antd-mobile"
;
import
{
Modal
,
Picker
,
Toast
,
PickerService
,
ToastService
,
ModalService
}
from
"ng-zorro-antd-mobile"
;
import
{
FormGroup
,
...
...
@@ -15,9 +22,10 @@ import {
GaoDeLocation
,
PositionOptions
}
from
"@ionic-native/gao-de-location/ngx"
;
import
{
b64toBlob
}
from
'src/app/layout/service/util.service'
;
import
{
isFulfilled
}
from
'q'
;
import
{
defer
,
Observable
,
of
}
from
'rxjs'
;
import
{
b64toBlob
}
from
"src/app/layout/service/util.service"
;
import
{
isFulfilled
}
from
"q"
;
import
{
defer
,
Observable
,
of
}
from
"rxjs"
;
import
{
Location
}
from
"@angular/common"
;
const
data
=
[];
@
Component
({
...
...
@@ -28,14 +36,14 @@ const data = [];
})
export
class
CheckAddComponent
implements
OnInit
{
constructor
(
private
router
:
ActivatedRoute
,
private
activeRoute
:
ActivatedRoute
,
private
_modal
:
Modal
,
private
api
:
APIService
,
private
fb
:
FormBuilder
,
private
route
:
Router
,
private
route
r
:
Router
,
private
gaoDeLocation
:
GaoDeLocation
,
private
_toast
:
ToastService
,
private
router2
:
Router
private
location
:
Location
)
{
this
.
getCurrentPosition
();
}
...
...
@@ -44,18 +52,18 @@ export class CheckAddComponent implements OnInit {
this
.
gaoDeLocation
.
getCurrentPosition
()
.
then
((
res
:
PositionOptions
)
=>
{
console
.
log
(
res
);
// res.address 为位置信息
this
.
address
=
res
.
address
;
console
.
log
(
res
);
// res.address 为位置信息
this
.
address
=
res
.
address
;
})
.
catch
(
error
=>
console
.
error
(
error
));
}
address
:
string
;
address
:
string
;
registerForm
:
FormGroup
;
submit
:
any
=
{
checkPlanAssetList
:
[]
};
inventoryType
=
[
"资产明细盘点"
,
"资产范围盘点"
];
checkStaType
=
[
"未开始"
,
"待审核"
,
"清查中"
,
"已完成"
,
"其他"
];
fileStrs
:
[]
=
[];
detail
:
any
=
{
asset
:
{},
belongUnit
:
{},
projectTeam
:
{}
,
};
checkStaType
=
[
"未开始"
,
"待审核"
,
"清查中"
,
"已完成"
,
"其他"
];
fileStrs
:
[]
=
[];
detail
:
any
=
{
asset
:
{},
belongUnit
:
{},
projectTeam
:
{}
};
msg
:
any
=
""
;
formErrors
:
any
=
{
invoicesNum
:
""
,
...
...
@@ -71,47 +79,63 @@ export class CheckAddComponent implements OnInit {
};
param
=
null
;
ngOnInit
()
{
const
accessPlan
=
(
param
)
=>
{
this
.
api
.
getCheckTaskText
(
param
.
id
,
param
.
planId
)
.
subscribe
(
data
=>
(
this
.
detail
=
data
.
body
.
checkPlanAsset
))
const
accessPlan
=
param
=>
{
this
.
api
.
getCheckTaskText
(
param
.
id
,
param
.
planId
).
subscribe
(
data
=>
{
if
(
!
data
.
success
)
{
const
toast
=
ToastService
.
offline
(
data
.
msg
,
1000
,
()
=>
{
this
.
location
.
back
();
});
}
else
{
this
.
detail
=
data
.
body
.
checkPlanAsset
;
}
const
planDialog
=
(
data
)
=>
{
});
};
const
planDialog
=
data
=>
{
if
(
data
.
success
)
{
Modal
.
operation
(
[{
text
:
"请选择盘点计划:"
}].
concat
(
[{
text
:
"请选择盘点计划:"
}].
concat
(
data
.
body
.
checkList
.
map
(
c
=>
({
text
:
c
.
name
,
onPress
:
()
=>
accessPlan
({...
this
.
param
,
planId
:
c
.
id
})
onPress
:
()
=>
accessPlan
({
...
this
.
param
,
planId
:
c
.
id
})
}))
)
);
}
}
}
;
this
.
buildForm
();
this
.
router
.
params
this
.
activeRoute
.
params
.
pipe
(
tap
(
param
=>
{
this
.
param
=
param
;
console
.
log
(
param
)}),
switchMap
(
param
=>
param
.
planId
?
of
(
param
):
this
.
api
.
getCheckTask
(
param
.
id
))
tap
(
param
=>
{
this
.
param
=
param
;
console
.
log
(
param
);
}),
switchMap
(
param
=>
param
.
planId
?
of
(
param
)
:
this
.
api
.
getCheckTask
(
param
.
id
)
)
)
.
subscribe
(
data
=>
{
if
(
data
.
planId
)
{
if
(
data
.
planId
)
{
accessPlan
(
data
);
}
else
{
}
else
{
if
(
!
data
.
success
)
{
const
toast
=
ToastService
.
offline
(
data
.
msg
,
1000
,
()
=>
{
this
.
location
.
back
();
});
}
else
{
planDialog
(
data
);
}
}
});
}
oninventoryType
()
{}
onCheck
()
{
this
.
route
.
navigateByUrl
(
"../checkResult"
);
this
.
route
r
.
navigateByUrl
(
"../checkResult"
);
}
buildForm
():
void
{
this
.
registerForm
=
this
.
fb
.
group
({
mode
:
"add"
,
id
:[],
id
:
[],
invoicesNum
:
[
""
,
Validators
.
required
],
name
:
[
""
,
Validators
.
required
],
inventoryType
:
[],
...
...
@@ -124,8 +148,8 @@ export class CheckAddComponent implements OnInit {
remarks
:
[]
});
this
.
registerForm
.
valueChanges
.
subscribe
(
data
=>
this
.
onValueChanged
(
data
));
this
.
registerForm
.
controls
[
'checkSta'
].
valueChanges
.
subscribe
(
value
=>
{
if
(
value
==
"其他"
)
{
this
.
registerForm
.
controls
[
"checkSta"
].
valueChanges
.
subscribe
(
value
=>
{
if
(
value
==
"其他"
)
{
this
.
showPromptPromise
();
}
});
...
...
@@ -133,32 +157,27 @@ export class CheckAddComponent implements OnInit {
}
showPromptPromise
()
{
ModalService
.
prompt
(
'自定义盘点状态'
,
''
,
"自定义盘点状态"
,
""
,
[
{
text
:
'关闭'
,
text
:
"关闭"
,
onPress
:
value
=>
new
Promise
(
resolve
=>
{
resolve
();
})
},
{
text
:
'确定'
,
text
:
"确定"
,
onPress
:
value
=>
new
Promise
((
resolve
,
reject
)
=>
{
this
.
detail
.
checkSta
=
value
;
this
.
detail
.
checkSta
=
value
;
this
.
registerForm
.
controls
[
"checkSta"
].
setValue
(
value
);
resolve
();
})
}
],
'default'
,
"default"
,
null
);
}
...
...
@@ -211,14 +230,19 @@ export class CheckAddComponent implements OnInit {
// result.checkPlanAssetList = [this.detail];
console
.
log
(
this
.
registerForm
.
value
);
var
result
=
{
address
:
this
.
address
,
id
:
this
.
registerForm
.
value
.
id
,
remarks
:
this
.
registerForm
.
value
.
remarks
,
checkSta
:
this
.
registerForm
.
value
.
checkSta
,
checkAnnex
:
""
}
result
.
checkAnnex
=
this
.
fileStrs
.
join
(
','
);
var
result
=
{
address
:
this
.
address
||
"pc端测试,可以打开app在手机端获取"
,
id
:
this
.
registerForm
.
value
.
id
,
remarks
:
this
.
registerForm
.
value
.
remarks
,
checkResult
:
this
.
registerForm
.
value
.
checkSta
,
checkAnnex
:
""
};
result
.
checkAnnex
=
this
.
fileStrs
.
join
(
","
);
this
.
api
.
addCheckPlan
(
result
).
subscribe
(
data
=>
{
if
(
!
data
.
success
)
{
this
.
msg
=
data
.
msg
.
replace
(
/
\w
+:/g
,
"*"
);
}
else
{
this
.
router2
.
navigate
([
"/"
]);
}
console
.
log
(
data
);
this
.
router
.
navigate
([
"./admin/assets-used/checkResult"
],
{
queryParams
:
{
isSuccess
:
data
.
success
,
msg
:
data
.
msg
}
});
});
}
onReset
()
{
...
...
@@ -235,9 +259,9 @@ export class CheckAddComponent implements OnInit {
fileChange
(
params
)
{
console
.
log
(
params
);
const
{
files
,
type
,
index
,
operationType
}
=
params
;
const
{
files
,
type
,
index
,
operationType
}
=
params
;
if
(
operationType
==
"remove"
)
{
if
(
operationType
==
"remove"
)
{
this
.
fileStrs
.
splice
(
index
);
return
;
}
...
...
@@ -246,25 +270,34 @@ export class CheckAddComponent implements OnInit {
var
data
=
new
FormData
();
var
block
=
files
[
0
].
url
.
split
(
";"
);
// Get the content type of the image
var
contentType
=
block
[
0
].
split
(
":"
)[
1
];
// In this case "image/gif"
var
contentType
=
block
[
0
].
split
(
":"
)[
1
];
// In this case "image/gif"
// get the real base64 content of the file
var
realData
=
block
[
1
].
split
(
","
)[
1
];
// In this case "R0lGODlhPQBEAPeoAJosM...."
var
realData
=
block
[
1
].
split
(
","
)[
1
];
// In this case "R0lGODlhPQBEAPeoAJosM...."
data
.
append
(
"type"
,
contentType
);
data
.
append
(
"name"
,
"WU_FILE_0.jpg"
);
data
.
append
(
"id"
,
"WU_FILE_0"
);
data
.
append
(
"file"
,
b64toBlob
(
realData
,
contentType
),
"upload.jpg"
);
var
query
=
{
assetNum
:
this
.
detail
.
asset
.
num
,
modeName
:
"盘点"
,
uploadPath
:
"/asset/checkPlan"
};
data
.
append
(
"file"
,
b64toBlob
(
realData
,
contentType
),
"upload.jpg"
);
var
query
=
{
assetNum
:
this
.
detail
.
asset
.
num
,
modeName
:
"盘点"
,
uploadPath
:
"/asset/checkPlan"
};
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
"POST"
,
`asset/a/sys/file/webupload/upload?assetNum=
${
this
.
detail
.
asset
.
num
}
&modelName=盘点&uploadPath=/asset/checkPlan`
);
xhr
.
open
(
"POST"
,
`asset/a/sys/file/webupload/upload?assetNum=
${
this
.
detail
.
asset
.
num
}
&modelName=盘点&uploadPath=/asset/checkPlan`
);
xhr
.
send
(
data
);
const
_this
=
this
;
xhr
.
onreadystatechange
=
function
(
data
)
{
if
(
xhr
.
readyState
!==
4
)
{
const
_this
=
this
;
xhr
.
onreadystatechange
=
function
(
data
)
{
if
(
xhr
.
readyState
!==
4
)
{
return
;
}
_this
.
fileStrs
.
push
((
JSON
.
parse
(
xhr
.
responseText
).
body
.
url
)
as
never
);
}
_this
.
fileStrs
.
push
(
JSON
.
parse
(
xhr
.
responseText
).
body
.
url
as
never
);
};
}
imageClick
(
params
)
{
...
...
src/app/routes/assets/assets-used/checkPlan/check-result/check-result.component.html
View file @
5adf0760
<div
class=
"result-example"
>
<Result
[
img
]="
img1
"
[
message
]="
message1
"
[
title
]="'已完成'"
>
<Result
[
img
]="
img1
"
[
message
]="
message1
"
[
title
]="
isSuccess
?'成功'
:
'失败'"
[
buttonText
]="'继续盘点'"
[
buttonType
]="'
primary
'"
(
onButtonClick
)="
onclick
()"
>
<ng-template
#
img1
>
<Icon
class=
"spe"
[
type
]="'
check-circle
'"
[
color
]="'#
1F90E6
'"
></Icon>
<Icon
class=
"spe"
[
type
]="
isSuccess
?'
check-circle
'
:
'
cross-circle-o
'"
[
color
]="
isSuccess
?'#
1F90E6
'
:
'#
F13642
'"
>
</Icon>
</ng-template>
<ng-template
#
message1
>
<div></div>
<div>
{{msg}}
</div>
</ng-template>
</Result>
</div>
\ No newline at end of file
src/app/routes/assets/assets-used/checkPlan/check-result/check-result.component.scss
View file @
5adf0760
...
...
@@ -8,3 +8,8 @@
height
:
60px
;
display
:
block
;
}
:host
/
deep
/
.am-result
.am-result-title
{
font-size
:
21px
!
important
;
color
:
#000
!
important
;
}
\ No newline at end of file
src/app/routes/assets/assets-used/checkPlan/check-result/check-result.component.ts
View file @
5adf0760
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
"@angular/core"
;
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
@
Component
({
selector
:
'app-check-result'
,
templateUrl
:
'./check-result.component.html'
,
styleUrls
:
[
'./check-result.component.scss'
],
selector
:
"app-check-result"
,
templateUrl
:
"./check-result.component.html"
,
styleUrls
:
[
"./check-result.component.scss"
]
})
export
class
CheckResultComponent
implements
OnInit
{
isSuccess
:
boolean
;
msg
=
""
;
constructor
(
private
activeRoute
:
ActivatedRoute
,
private
router
:
Router
)
{}
constructor
()
{
}
ngOnInit
()
{}
ngOnInit
()
{
this
.
isSuccess
=
this
.
activeRoute
.
snapshot
.
queryParams
[
"isSuccess"
];
this
.
msg
=
this
.
activeRoute
.
snapshot
.
queryParams
[
"msg"
];
}
onclick
()
{
this
.
router
.
navigateByUrl
(
"/admin"
);
}
}
src/app/routes/check/qrScan/qrScan/qr-scan.component.ts
View file @
5adf0760
...
...
@@ -32,7 +32,7 @@ export class QrScanComponent implements OnInit, OnDestroy {
}
loadingToast
(
id
)
{
const
toast
=
Toast
.
loading
(
"Loading..."
,
1000
,
()
=>
{
this
.
router
.
navigate
([
"/admin/assets-used/checkPlanAdd"
,
id
]);
this
.
router
.
navigate
([
"/admin/assets-used/checkPlanAdd"
,
id
,
""
]);
});
}
ngOnDestroy
()
{
...
...
src/app/service/layout/service/api.service.ts
View file @
5adf0760
...
...
@@ -64,6 +64,8 @@ const CheckSave = "asset/a/asset/checkPlan/save/result";
const
Upload
=
"asset/a/sys/file/webupload/upload"
;
const
assetsUrl
=
"asset/a/asset/checkPlan/infoData"
;
const
logoutUrl
=
"asset/a/logout"
;
@
Injectable
({
providedIn
:
"root"
})
...
...
@@ -270,4 +272,8 @@ export class APIService {
getAssets
(
param
,
id
)
{
return
this
.
basePost
(
assetsUrl
+
"/?id="
+
id
,
param
);
}
logout
()
{
return
this
.
http
.
get
(
logoutUrl
+
"?__ajax=true"
);
}
}
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