Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GeliBusinessPlatform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljy
GeliBusinessPlatform
Commits
cb170a49
Commit
cb170a49
authored
Feb 05, 2021
by
lujunye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
入库报告修改为多图上传
parent
2d507706
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
33 deletions
+106
-33
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
...erdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform/ViewController/1.1入库&出库/入库/NewRKVc.swift
...BusinessPlatform/ViewController/1.1入库&出库/入库/NewRKVc.swift
+51
-7
GeliBusinessPlatform/ViewController/溯源/Add_Report_View.swift
GeliBusinessPlatform/ViewController/溯源/Add_Report_View.swift
+51
-11
GeliBusinessPlatform/ViewController/溯源/Add_Report_View.xib
GeliBusinessPlatform/ViewController/溯源/Add_Report_View.xib
+4
-15
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/junyelu.xcuserdatad/UserInterfaceState.xcuserstate
View file @
cb170a49
No preview for this file type
GeliBusinessPlatform/ViewController/1.1入库&出库/入库/NewRKVc.swift
View file @
cb170a49
...
...
@@ -14,8 +14,43 @@ protocol NewRKVcDelegate {
func
NewRKVcFinish
()
}
class
NewRKVc
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
NewOnlyRKCellDelegate
,
NewSelectItemVcDelegate
,
NewSelectWarehouseVCDelegate
,
GLAlertSelectViewDelegate
,
GeliAlertTextViewDelegate
,
ShowTimeSelectViewDelegate
,
GYSListViewControllerDelegate
,
GYSGLViewControllerDelegate
,
Add_Report_View_Delegate
{
func
Add_Report_View_ChangeImg
(
view
:
Add_Report_View
,
idx
:
Int
)
{
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
option
.
isSynchronous
=
true
option
.
isNetworkAccessAllowed
=
true
for
asset
in
assets
{
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
// print("上传图片==\(image)")
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
idx
)
})
}
}
}
func
Add_Report_View_DelImg
(
view
:
Add_Report_View
,
idx
:
Int
)
{
maxFiveImgsArr
.
remove
(
at
:
idx
)
goods_banner
?
.
insert
(
""
,
at
:
5
)
goods_banner
?
.
remove
(
at
:
idx
)
report_view
?
.
imgs_datas
=
maxFiveImgsArr
report_view
?
.
layoutIfNeeded
()
}
var
report_sn
=
""
func
Add_Report_View_Submit_Action
(
view
:
Add_Report_View
)
{
var
lastGoodsBanner
:
Array
<
String
>
=
[]
self
.
goods_banner
?
.
forEach
({
(
str
)
in
if
str
.
count
>
0
{
lastGoodsBanner
.
append
(
str
)
}
})
var
goods_bannerStr
:
String
=
""
if
lastGoodsBanner
.
count
>
0
{
goods_bannerStr
=
dataChangeString
(
sender
:
lastGoodsBanner
)
}
report_sn
=
view
.
report_sn_tf
.
text
!
let
model
=
rkSelectArr
[
view
.
tag
]
...
...
@@ -24,7 +59,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
"report_type"
:
view
.
select_idx
!
+
1
as
Any
,
"goods_id"
:
model
.
goods_id
as
Any
,
"sku_id"
:
model
.
sku_id
as
Any
,
"file_url"
:
view
.
img_url
as
Any
"file_url"
:
goods_bannerStr
as
Any
]
GoodsReportAdd
(
dic
)
{
(
data
)
in
let
model
=
data
as!
GoodsReportAddModel
...
...
@@ -52,7 +87,8 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
var
maxFiveImgsArr
:
Array
<
String
>
=
[]
//多图
func
Add_Report_View_Select_Img
(
view
:
Add_Report_View
)
{
print
(
"选择"
)
_
=
self
.
presentHGImagePicker
(
maxSelected
:
1
)
{
(
assets
)
in
let
num
=
5
-
maxFiveImgsArr
.
count
_
=
self
.
presentHGImagePicker
(
maxSelected
:
num
)
{
(
assets
)
in
//结果处理
print
(
"共选择了
\(
assets
.
count
)
张图片,分别如下:"
)
let
option
=
PHImageRequestOptions
()
...
...
@@ -62,7 +98,8 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
PHImageManager
.
default
()
.
requestImage
(
for
:
asset
,
targetSize
:
PHImageManagerMaximumSize
,
contentMode
:
.
default
,
options
:
option
,
resultHandler
:
{
(
image
,
_
:
[
AnyHashable
:
Any
]?)
in
//调用上传图片
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
true
,
tag
:
0
)
self
.
maxFiveImgsArr
.
append
(
"insert"
)
self
.
uploadImg
(
imge
:
image
!
,
isOriginal
:
false
,
tag
:
self
.
maxFiveImgsArr
.
count
-
1
)
})
}
...
...
@@ -70,7 +107,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
}
}
var
goods_banner
:
Array
<
String
>
?
=
[
""
,
""
,
""
,
""
,
""
]
//商品副图,多张,最多5张,使用一维数组转json格式
func
uploadImg
(
imge
:
UIImage
,
isOriginal
:
Bool
,
tag
:
Int
){
let
upLoadImg
=
imge
as!
UIImage
HUD
.
show
(
.
progress
)
...
...
@@ -79,8 +116,15 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
if
dataM
.
code
==
1
{
print
(
"图片上传成功
\(
dataM
.
data
?
.
url
)
"
)
self
.
report_view
?
.
img_url
=
(
dataM
.
data
?
.
url
)
!
self
.
goods_banner
?
.
insert
((
dataM
.
data
?
.
url
!
)
!
,
at
:
tag
)
self
.
goods_banner
?
.
remove
(
at
:
tag
+
1
)
self
.
maxFiveImgsArr
.
removeAll
()
self
.
goods_banner
?
.
forEach
({
(
str
)
in
if
str
.
count
>
0
{
self
.
maxFiveImgsArr
.
append
(
str
)
}
})
self
.
report_view
?
.
imgs_datas
=
self
.
maxFiveImgsArr
self
.
report_view
?
.
layoutIfNeeded
()
HUD
.
hide
()
}
...
...
@@ -602,7 +646,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
cell
.
timeLbl
.
text
=
data
.
createDayStr
}
if
report_sn
.
count
>
0
{
cell
.
btn_title_lbl
.
text
=
report_sn
cell
.
btn_title_lbl
.
text
=
"sn:"
+
report_sn
}
return
cell
}
...
...
GeliBusinessPlatform/ViewController/溯源/Add_Report_View.swift
View file @
cb170a49
...
...
@@ -11,25 +11,65 @@ import LGButton
protocol
Add_Report_View_Delegate
{
func
Add_Report_View_Select_Img
(
view
:
Add_Report_View
)
func
Add_Report_View_Submit_Action
(
view
:
Add_Report_View
)
func
Add_Report_View_ChangeImg
(
view
:
Add_Report_View
,
idx
:
Int
)
func
Add_Report_View_DelImg
(
view
:
Add_Report_View
,
idx
:
Int
)
}
class
Add_Report_View
:
UIView
{
@IBOutlet
weak
var
btm_view
:
UIView
!
var
scrollView
=
UIScrollView
()
override
func
layoutIfNeeded
()
{
super
.
layoutIfNeeded
()
if
img_url
.
count
>
0
{
bg_view_width
.
constant
=
80
img_bg
.
backgroundColor
=
UIColor
.
red
let
imgView
=
UIImageView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
80
,
height
:
img_bg
.
bounds
.
size
.
height
))
add_img_btn
.
isHidden
=
true
self
.
img_bg
.
addSubview
(
imgView
)
imgView
.
sd_setImage
(
with
:
URL
(
string
:
SERVERCE_ImageHost
+
img_url
))
{
(
img
,
err
,
type
,
url
)
in
scrollView
.
subviews
.
forEach
{
(
item
)
in
item
.
removeFromSuperview
()
}
btm_view
.
addSubview
(
scrollView
)
scrollView
.
frame
=
CGRect
(
x
:
15
,
y
:
add_img_btn
.
frame
.
maxY
+
20
,
width
:
ScreenWidth
-
30
,
height
:
100.5
)
for
i
in
0
..<
imgs_datas
.
count
{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
Double
(
i
)
*
(
100.5
+
15
),
y
:
0
,
width
:
100.5
,
height
:
100.5
))
scrollView
.
addSubview
(
view
)
let
imgview
=
UIImageView
(
frame
:
CGRect
(
x
:
0
,
y
:
7.5
,
width
:
93
,
height
:
93
))
view
.
addSubview
(
imgview
)
imgview
.
sd_setImage
(
with
:
URL
(
string
:
SERVERCE_ImageHost
+
imgs_datas
[
i
]))
let
btn1
=
UIButton
(
frame
:
imgview
.
frame
)
btn1
.
tag
=
i
btn1
.
backgroundColor
=
UIColor
(
named
:
"标题字颜色"
)
btn1
.
alpha
=
0.4
btn1
.
addTarget
(
self
,
action
:
#selector(
changeImgAction(btn:)
)
,
for
:
.
touchUpInside
)
view
.
addSubview
(
btn1
)
let
img2
=
UIImageView
(
frame
:
CGRect
(
x
:
100.5
-
15
,
y
:
0
,
width
:
15
,
height
:
15
))
img2
.
image
=
UIImage
(
named
:
"shanchuDel"
)
view
.
addSubview
(
img2
)
let
delBtn
=
UIButton
(
frame
:
CGRect
(
x
:
100.5
-
30
,
y
:
0
,
width
:
30
,
height
:
30
))
delBtn
.
tag
=
i
delBtn
.
addTarget
(
self
,
action
:
#selector(
delImgAction(btn:)
)
,
for
:
.
touchUpInside
)
view
.
addSubview
(
delBtn
)
}
scrollView
.
contentSize
=
CGSize
(
width
:
Double
(
imgs_datas
.
count
)
*
103.5
,
height
:
103.5
)
}
@objc
func
delImgAction
(
btn
:
UIButton
){
delegate
?
.
Add_Report_View_DelImg
(
view
:
self
,
idx
:
btn
.
tag
)
}
@objc
func
changeImgAction
(
btn
:
UIButton
){
delegate
?
.
Add_Report_View_ChangeImg
(
view
:
self
,
idx
:
btn
.
tag
)
}
@IBOutlet
weak
var
report_sn_tf
:
UITextField
!
var
delegate
:
Add_Report_View_Delegate
?
var
img
_url
=
""
var
img
s_datas
:
Array
<
String
>
=
[]
@IBOutlet
weak
var
select_view
:
UIView
!
var
select_idx
:
Int
?
=
-
1
{
didSet
{
...
...
@@ -38,8 +78,8 @@ class Add_Report_View: UIView {
}
}
}
@IBOutlet
weak
var
img_bg
:
UIView
!
@IBOutlet
weak
var
bg_view_width
:
NSLayoutConstraint
!
@IBAction
func
add_img_action
(
_
sender
:
UIButton
)
{
delegate
?
.
Add_Report_View_Select_Img
(
view
:
self
)
}
...
...
@@ -53,7 +93,7 @@ class Add_Report_View: UIView {
HUD
.
flash
(
.
label
(
"请选择报告类型"
),
delay
:
1.2
)
return
}
if
img
_url
.
count
==
0
{
if
img
s_datas
.
count
==
0
{
HUD
.
flash
(
.
label
(
"请选择报告图片"
),
delay
:
1.2
)
return
}
...
...
GeliBusinessPlatform/ViewController/溯源/Add_Report_View.xib
View file @
cb170a49
...
...
@@ -13,8 +13,7 @@
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"Add_Report_View"
customModule=
"TestClass"
customModuleProvider=
"target"
>
<connections>
<outlet
property=
"add_img_btn"
destination=
"glR-fE-Q1j"
id=
"6j1-UX-imB"
/>
<outlet
property=
"bg_view_width"
destination=
"HNq-up-1f4"
id=
"lZj-gw-mXg"
/>
<outlet
property=
"img_bg"
destination=
"QcK-RN-zvv"
id=
"QTU-iL-Yty"
/>
<outlet
property=
"btm_view"
destination=
"TPf-jf-iIq"
id=
"A8F-Hr-rwN"
/>
<outlet
property=
"img_y"
destination=
"Mng-xH-L9j"
id=
"HGL-mf-Nhb"
/>
<outlet
property=
"report_sn_tf"
destination=
"XkS-5B-cWo"
id=
"cYz-x9-CTZ"
/>
<outlet
property=
"select_img"
destination=
"yX5-IM-zDi"
id=
"Zzc-iq-lu0"
/>
...
...
@@ -60,7 +59,7 @@
<nil
key=
"highlightedColor"
/>
</label>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"TPf-jf-iIq"
>
<rect
key=
"frame"
x=
"0.0"
y=
"4
75"
width=
"414"
height=
"343
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"4
36"
width=
"414"
height=
"382
"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"添加报告"
textAlignment=
"center"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"b3f-iV-kkj"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"51"
/>
...
...
@@ -163,14 +162,6 @@
<action
selector=
"add_img_action:"
destination=
"-1"
eventType=
"touchUpInside"
id=
"bxg-Hs-iiD"
/>
</connections>
</button>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"QcK-RN-zvv"
>
<rect
key=
"frame"
x=
"80.5"
y=
"196.5"
width=
"0.0"
height=
"128"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraint
firstAttribute=
"width"
id=
"HNq-up-1f4"
/>
<constraint
firstAttribute=
"height"
constant=
"128"
id=
"cHz-WT-ma7"
/>
</constraints>
</view>
<view
hidden=
"YES"
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"1E2-Hg-cjR"
>
<rect
key=
"frame"
x=
"80.5"
y=
"171.5"
width=
"318.5"
height=
"149"
/>
<subviews>
...
...
@@ -261,8 +252,6 @@
<constraint
firstItem=
"b3f-iV-kkj"
firstAttribute=
"top"
secondItem=
"TPf-jf-iIq"
secondAttribute=
"top"
id=
"1Av-1J-jC8"
/>
<constraint
firstItem=
"3BL-M6-nIJ"
firstAttribute=
"leading"
secondItem=
"TPf-jf-iIq"
secondAttribute=
"leading"
id=
"3Dz-G1-gAh"
/>
<constraint
firstItem=
"H2A-87-WoL"
firstAttribute=
"leading"
secondItem=
"mUx-GL-l3u"
secondAttribute=
"trailing"
constant=
"10"
id=
"4vf-Sp-BRg"
/>
<constraint
firstItem=
"glR-fE-Q1j"
firstAttribute=
"leading"
secondItem=
"QcK-RN-zvv"
secondAttribute=
"trailing"
id=
"71x-Vz-zc0"
/>
<constraint
firstItem=
"QcK-RN-zvv"
firstAttribute=
"top"
secondItem=
"glR-fE-Q1j"
secondAttribute=
"top"
id=
"7Ix-vy-Agm"
/>
<constraint
firstItem=
"1E2-Hg-cjR"
firstAttribute=
"top"
secondItem=
"H2A-87-WoL"
secondAttribute=
"bottom"
id=
"7kc-ZS-Ef3"
/>
<constraint
firstItem=
"1E2-Hg-cjR"
firstAttribute=
"width"
secondItem=
"Jk6-Rf-sLp"
secondAttribute=
"width"
id=
"Bnt-Jt-fww"
/>
<constraint
firstItem=
"0cs-Vs-XiS"
firstAttribute=
"top"
secondItem=
"mUx-GL-l3u"
secondAttribute=
"bottom"
constant=
"43.5"
id=
"EkY-88-zp9"
/>
...
...
@@ -272,7 +261,6 @@
<constraint
firstAttribute=
"trailing"
secondItem=
"H2A-87-WoL"
secondAttribute=
"trailing"
constant=
"15"
id=
"KiK-8f-j9J"
/>
<constraint
firstItem=
"0cs-Vs-XiS"
firstAttribute=
"leading"
secondItem=
"TPf-jf-iIq"
secondAttribute=
"leading"
constant=
"15"
id=
"PkD-iU-3Gm"
/>
<constraint
firstItem=
"0lt-zx-kbK"
firstAttribute=
"top"
secondItem=
"3BL-M6-nIJ"
secondAttribute=
"bottom"
constant=
"29.5"
id=
"PpK-6Z-iy1"
/>
<constraint
firstItem=
"QcK-RN-zvv"
firstAttribute=
"leading"
secondItem=
"0cs-Vs-XiS"
secondAttribute=
"trailing"
constant=
"10"
id=
"QOX-UY-QPa"
/>
<constraint
firstItem=
"0lt-zx-kbK"
firstAttribute=
"leading"
secondItem=
"TPf-jf-iIq"
secondAttribute=
"leading"
constant=
"15"
id=
"a3j-FU-2cQ"
/>
<constraint
firstItem=
"mUx-GL-l3u"
firstAttribute=
"top"
secondItem=
"0lt-zx-kbK"
secondAttribute=
"bottom"
constant=
"43.5"
id=
"aaA-Lu-dyP"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"b3f-iV-kkj"
secondAttribute=
"trailing"
id=
"bia-6m-sbk"
/>
...
...
@@ -280,7 +268,8 @@
<constraint
firstItem=
"glR-fE-Q1j"
firstAttribute=
"centerY"
secondItem=
"0cs-Vs-XiS"
secondAttribute=
"centerY"
id=
"eIE-tz-gu4"
/>
<constraint
firstItem=
"3BL-M6-nIJ"
firstAttribute=
"top"
secondItem=
"b3f-iV-kkj"
secondAttribute=
"bottom"
id=
"kNq-Y9-fbw"
/>
<constraint
firstItem=
"mUx-GL-l3u"
firstAttribute=
"leading"
secondItem=
"TPf-jf-iIq"
secondAttribute=
"leading"
constant=
"15"
id=
"lKn-Ea-Tqh"
/>
<constraint
firstAttribute=
"height"
constant=
"343"
id=
"orV-h3-smX"
/>
<constraint
firstItem=
"glR-fE-Q1j"
firstAttribute=
"leading"
secondItem=
"0cs-Vs-XiS"
secondAttribute=
"trailing"
constant=
"10"
id=
"m5e-N5-UZ8"
/>
<constraint
firstAttribute=
"height"
constant=
"382"
id=
"orV-h3-smX"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"3BL-M6-nIJ"
secondAttribute=
"trailing"
id=
"rch-sK-mTh"
/>
<constraint
firstItem=
"b3f-iV-kkj"
firstAttribute=
"leading"
secondItem=
"TPf-jf-iIq"
secondAttribute=
"leading"
id=
"vvV-w6-bnC"
/>
<constraint
firstItem=
"xaF-9D-Hi3"
firstAttribute=
"leading"
secondItem=
"0lt-zx-kbK"
secondAttribute=
"trailing"
constant=
"10"
id=
"wsF-1r-riL"
/>
...
...
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