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
a5b655ff
Commit
a5b655ff
authored
Jun 04, 2019
by
niuxiaolin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
盘点接口新修改以及资源上传
parent
04fc4797
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
21 deletions
+114
-21
util.service.ts
src/app/layout/service/util.service.ts
+24
-0
check-add.component.html
.../assets-used/checkPlan/check-add/check-add.component.html
+3
-3
check-add.component.ts
...ts/assets-used/checkPlan/check-add/check-add.component.ts
+79
-10
api.service.ts
src/app/service/layout/service/api.service.ts
+7
-6
form-select.component.ts
...pp/shared/components/form-select/form-select.component.ts
+1
-2
yarn.lock
yarn.lock
+0
-0
No files found.
src/app/layout/service/util.service.ts
View file @
a5b655ff
...
...
@@ -128,3 +128,26 @@ export function convertModelToUrlData(data = {}, form = null, namespace = "") {
}
return
formData
;
}
export
function
b64toBlob
(
b64Data
,
contentType
,
sliceSize
=
512
)
{
contentType
=
contentType
||
''
;
sliceSize
=
sliceSize
||
512
;
var
byteCharacters
=
atob
(
b64Data
);
var
byteArrays
=
[];
for
(
var
offset
=
0
;
offset
<
byteCharacters
.
length
;
offset
+=
sliceSize
)
{
var
slice
=
byteCharacters
.
slice
(
offset
,
offset
+
sliceSize
);
var
byteNumbers
=
new
Array
(
slice
.
length
);
for
(
var
i
=
0
;
i
<
slice
.
length
;
i
++
)
{
byteNumbers
[
i
]
=
slice
.
charCodeAt
(
i
);
}
var
byteArray
=
new
Uint8Array
(
byteNumbers
);
byteArrays
.
push
(
byteArray
);
}
var
blob
=
new
Blob
(
byteArrays
,
{
type
:
contentType
});
return
blob
;
}
\ No newline at end of file
src/app/routes/assets/assets-used/checkPlan/check-add/check-add.component.html
View file @
a5b655ff
<form
[
formGroup
]="
registerForm
"
(
ngSubmit
)="
onSubmit
()"
>
<input
type=
"hidden"
formControlName=
"id"
[
ngModel
]="
detail
.
id
"
>
<List
[
renderHeader
]=(
renderHeader
)
>
<ListItem
[
extra
]="
detail
.
modelNum
"
>
盘点单号
</ListItem>
<ListItem
[
extra
]="
detail
.
name
"
>
事项名称
</ListItem>
...
...
@@ -16,7 +16,7 @@
<ListItem
[
extra
]="
detail
.
useUnit
"
>
产权单位
</ListItem>
<ListItem
[
extra
]="
detail
.
company
"
>
管理单位
</ListItem>
<ListItem
[
extra
]="
detail
.
useUnit
"
>
使用单位
</ListItem>
<app-form-select
[
options
]="
checkStaType
"
formControlName=
"checkSta"
>
<app-form-select
[
options
]="
checkStaType
"
formControlName=
"checkSta"
>
<font
color=
"red"
>
*
</font>
盘点状态
</app-form-select>
<!-- <InputItem [placeholder]="'盘点单号'" [value]="detail.modelNum" [disabled]="disabled" [(ngModel)]="detail.modelNum">
...
...
@@ -76,7 +76,7 @@
<ListItem>
<div
class=
"submit-btn"
>
<button
Button
[
type
]="'
primary
'"
[
size
]="'
small
'"
[
inline
]="
true
"
(
click
)="
onCheck
()"
>
<button
Button
[
type
]="'
primary
'"
[
size
]="'
small
'"
[
inline
]="
true
"
>
执行
</button>
<button
Button
type=
"button"
style=
"margin-left: 2.5px;"
[
size
]="'
small
'"
[
inline
]="
true
"
(
onClick
)="
onReset
()"
>
...
...
src/app/routes/assets/assets-used/checkPlan/check-add/check-add.component.ts
View file @
a5b655ff
...
...
@@ -2,7 +2,7 @@ import { Component, OnInit } from "@angular/core";
import
{
Router
,
ActivatedRoute
}
from
"@angular/router"
;
import
{
switchMap
}
from
"rxjs/operators"
;
import
{
Modal
,
Picker
,
Toast
}
from
"ng-zorro-antd-mobile"
;
import
{
Modal
,
Picker
,
Toast
,
PickerService
,
ToastService
,
ModalService
}
from
"ng-zorro-antd-mobile"
;
import
{
FormGroup
,
...
...
@@ -15,6 +15,7 @@ import {
GaoDeLocation
,
PositionOptions
}
from
"@ionic-native/gao-de-location/ngx"
;
import
{
b64toBlob
}
from
'src/app/layout/service/util.service'
;
const
data
=
[];
@
Component
({
...
...
@@ -30,7 +31,8 @@ export class CheckAddComponent implements OnInit {
private
api
:
APIService
,
private
fb
:
FormBuilder
,
private
route
:
Router
,
private
gaoDeLocation
:
GaoDeLocation
private
gaoDeLocation
:
GaoDeLocation
,
private
_toast
:
ToastService
)
{
this
.
getCurrentPosition
();
}
...
...
@@ -46,7 +48,8 @@ export class CheckAddComponent implements OnInit {
registerForm
:
FormGroup
;
submit
:
any
=
{
checkPlanAssetList
:
[]
};
inventoryType
=
[
"资产明细盘点"
,
"资产范围盘点"
];
checkStaType
=
[
"未开始"
,
"待审核"
,
"清查中"
,
"已完成"
];
checkStaType
=
[
"未开始"
,
"待审核"
,
"清查中"
,
"已完成"
,
"其他"
];
fileStrs
:[]
=
[];
detail
:
any
=
{
asset
:
{},
belongUnit
:
{},
projectTeam
:
{},
assetClass
:
{}
};
msg
:
any
=
""
;
formErrors
:
any
=
{
...
...
@@ -93,6 +96,7 @@ export class CheckAddComponent implements OnInit {
buildForm
():
void
{
this
.
registerForm
=
this
.
fb
.
group
({
mode
:
"add"
,
id
:[],
invoicesNum
:
[
""
,
Validators
.
required
],
name
:
[
""
,
Validators
.
required
],
inventoryType
:
[],
...
...
@@ -105,9 +109,45 @@ export class CheckAddComponent implements OnInit {
remarks
:
[]
});
this
.
registerForm
.
valueChanges
.
subscribe
(
data
=>
this
.
onValueChanged
(
data
));
this
.
registerForm
.
controls
[
'checkSta'
].
valueChanges
.
subscribe
(
value
=>
{
if
(
value
==
"其他"
){
this
.
showPromptPromise
();
}
});
this
.
onValueChanged
();
}
showPromptPromise
()
{
ModalService
.
prompt
(
'自定义盘点状态'
,
''
,
[
{
text
:
'关闭'
,
onPress
:
value
=>
new
Promise
(
resolve
=>
{
resolve
();
})
},
{
text
:
'确定'
,
onPress
:
value
=>
new
Promise
((
resolve
,
reject
)
=>
{
this
.
detail
.
checkSta
=
value
;
this
.
registerForm
.
controls
[
"checkSta"
].
setValue
(
value
);
resolve
();
})
}
],
'default'
,
null
);
}
onValueChanged
(
data
?:
any
)
{
if
(
!
this
.
registerForm
)
{
return
;
...
...
@@ -151,9 +191,13 @@ export class CheckAddComponent implements OnInit {
}
onSubmit
()
{
var
result
=
this
.
registerForm
.
value
;
console
.
log
(
result
);
result
.
checkPlanAssetList
=
[
this
.
detail
];
// var result = this.registerForm.value;
// console.log(result);
// result.checkPlanAssetList = [this.detail];
console
.
log
(
this
.
registerForm
.
value
);
var
result
=
{
id
:
this
.
registerForm
.
value
.
id
,
remarks
:
this
.
registerForm
.
value
.
remarks
,
checkSta
:
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
,
"*"
);
...
...
@@ -174,11 +218,36 @@ export class CheckAddComponent implements OnInit {
fileChange
(
params
)
{
console
.
log
(
params
);
const
{
files
,
type
,
index
}
=
params
;
const
{
files
,
type
,
index
,
operationType
}
=
params
;
if
(
operationType
==
"remove"
){
this
.
fileStrs
.
splice
(
index
);
return
;
}
this
.
files
=
files
;
var
data
=
new
FormData
();
data
.
append
(
"file"
,
files
[
0
]);
this
.
api
.
upload
(
data
,
"/asset/checkPlan"
);
var
block
=
files
[
0
].
url
.
split
(
";"
);
// Get the content type of the image
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...."
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"
};
var
xhr
=
new
XMLHttpRequest
();
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
)
{
return
;
}
_this
.
fileStrs
.
push
((
JSON
.
parse
(
xhr
.
responseText
).
body
.
url
)
as
never
);
}
}
imageClick
(
params
)
{
...
...
src/app/service/layout/service/api.service.ts
View file @
a5b655ff
...
...
@@ -58,9 +58,10 @@ const ConsumableInspect = "asset/a/asset/consumableInspect/data";
const
ConsumableReceive
=
"asset/a/asset/consumableReceive/data"
;
const
FixedAssets
=
"asset/a/asset/assets/data?kindAsset=2"
;
const
QrCode
=
"asset/a/asset/qrCode/data"
;
const
CheckTask
=
"asset/a/asset/assets/view/qrCode/"
;
const
CheckSave
=
"asset/a/asset/checkPlan/save"
;
const
Upload
=
"asset/a/sys/file/webupload/upload?uploadPath=/asset/checkPlan"
;
const
CheckTask
=
"asset/a/asset/checkPlan/view/checkPlanList/"
;
const
CheckDetail
=
"asset/a/asset/checkPlan/view/checkInfo/"
;
const
CheckSave
=
"asset/a/asset/checkPlan/save/result"
;
const
Upload
=
"asset/a/sys/file/webupload/upload"
;
@
Injectable
({
providedIn
:
"root"
})
...
...
@@ -88,9 +89,9 @@ export class APIService {
});
}
upload
(
data
:
FormData
,
path
:
string
)
{
upload
(
data
:
FormData
,
obj
:
any
)
{
return
this
.
http
.
post
<
any
>
(
Upload
,
data
,
{
params
:
{
uploadPath
:
path
}
,
params
:
obj
,
headers
:
new
HttpHeaders
({
"Content-Type"
:
"multipart/form-data;"
})
});
}
...
...
@@ -99,7 +100,7 @@ export class APIService {
return
this
.
http
.
post
<
any
>
(
CheckTask
+
id
,
{});
}
getCheckTaskText
(
id
,
detailId
):
Observable
<
any
>
{
return
this
.
http
.
post
<
any
>
(
Check
Task
+
id
+
"/"
+
detailId
,
{});
return
this
.
http
.
post
<
any
>
(
Check
Detail
+
id
+
"/"
+
detailId
,
{});
}
addCheckPlan
(
obj
):
Observable
<
any
>
{
...
...
src/app/shared/components/form-select/form-select.component.ts
View file @
a5b655ff
...
...
@@ -21,8 +21,7 @@ export class FormSelectComponent implements OnInit ,ControlValueAccessor {
selected
:
any
=
""
;
change
(
$event
){
const
index
=
this
.
options
.
indexOf
(
$event
[
0
]);
this
.
propagateChange
(
index
);
this
.
propagateChange
(
$event
[
0
]);
}
writeValue
(
obj
:
any
):
void
{
this
.
selected
=
obj
;
...
...
yarn.lock
View file @
a5b655ff
This diff is collapsed.
Click to expand it.
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