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
71765617
Commit
71765617
authored
Jun 01, 2020
by
ljh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
待完善工作中心
parent
d5d6a059
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
171 additions
and
49 deletions
+171
-49
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
...ata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
...ujunhong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+23
-0
GeliBusinessPlatform/Model/Work/WorkcenterIndexModel.swift
GeliBusinessPlatform/Model/Work/WorkcenterIndexModel.swift
+3
-0
GeliBusinessPlatform/ViewController/工作中心/WorkCViewController.swift
...essPlatform/ViewController/工作中心/WorkCViewController.swift
+61
-25
GeliBusinessPlatform/ViewController/工作中心/WorkItemTableViewCell.swift
...sPlatform/ViewController/工作中心/WorkItemTableViewCell.swift
+45
-17
GeliBusinessPlatform/ViewController/工作中心/编辑工作中心/EditWorkCViewController.swift
.../ViewController/工作中心/编辑工作中心/EditWorkCViewController.swift
+39
-7
No files found.
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/UserInterfaceState.xcuserstate
View file @
71765617
No preview for this file type
GeliBusinessPlatform.xcworkspace/xcuserdata/liujunhong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
View file @
71765617
...
...
@@ -3,4 +3,27 @@
uuid =
"5B8F44F7-39A9-41EF-84D0-455B68FF56A8"
type =
"0"
version =
"2.0"
>
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.ExceptionBreakpoint"
>
<BreakpointContent
uuid =
"133D1437-55DD-4ABF-AA73-308367DE7A99"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
breakpointStackSelectionBehavior =
"1"
scope =
"1"
stopOnStyle =
"0"
>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.SwiftErrorBreakpoint"
>
<BreakpointContent
uuid =
"FC4B7CDB-AB19-420A-9D96-9F442C622FBC"
shouldBeEnabled =
"Yes"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
GeliBusinessPlatform/Model/Work/WorkcenterIndexModel.swift
View file @
71765617
...
...
@@ -35,6 +35,8 @@ class WorkcenterIndexDataModel: Mappable {
var
confirm
:
Int
?
//待确认订单数
var
apply_in
:
Int
?
//入库申请数
var
apply_out
:
Int
?
//出库申请数
var
purchase
:
Int
?
//采购入库
var
auth_res
:
Array
<
WorkcenterIndexAuthResModel
>
?
required
init
?(
map
:
Map
)
{
...
...
@@ -49,6 +51,7 @@ class WorkcenterIndexDataModel: Mappable {
confirm
<-
map
[
"confirm"
]
apply_in
<-
map
[
"apply_in"
]
apply_out
<-
map
[
"apply_out"
]
purchase
<-
map
[
"purchase"
]
auth_res
<-
map
[
"auth_res"
]
}
...
...
GeliBusinessPlatform/ViewController/工作中心/WorkCViewController.swift
View file @
71765617
...
...
@@ -8,18 +8,51 @@
import
UIKit
import
RealmSwift
import
IQKeyboardManagerSwift
class
WorkCViewController
:
BaseViewController
,
UITableViewDelegate
,
UITableViewDataSource
,
WorkSelectTimeViewDelegate
,
WorkItemTableViewCellDelegate
{
@IBOutlet
weak
var
topNavBtn
:
UIButton
!
@IBOutlet
weak
var
contentView
:
UIView
!
var
isFirstEnter
:
Bool
=
true
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
//MARK:--viewWillAppear 因重写出现问题,需要补写
self
.
navigationController
?
.
navigationBar
.
isHidden
=
true
IQKeyboardManager
.
shared
.
shouldPlayInputClicks
=
true
IQKeyboardManager
.
shared
.
enable
=
true
IQKeyboardManager
.
shared
.
shouldResignOnTouchOutside
=
true
//每次进来都更新,之前在其他页面更新过的本地数据
//查询所有记录
let
items
=
realm
.
objects
(
WorkDataModel
.
self
)
// 已经有记录的话就不插入了
if
items
.
count
>
0
{
print
(
"有数据哦--"
)
let
workTestMd
:
WorkDataModel
=
items
[
0
];
let
dataModelStr
=
workTestMd
.
dataModelStr
self
.
dataModel
=
WorkcenterIndexDataModel
(
JSONString
:
dataModelStr
)
//旧的常用功能
let
oftenStr
=
workTestMd
.
oftenArrStr
if
oftenStr
.
count
>
0
{
self
.
oftenArr
?
.
removeAll
()
self
.
oftenArr
=
Array
<
WorkcenterIndexAuthResModel
>
(
JSONString
:
oftenStr
)
}
self
.
tableV
.
reloadData
()
}
else
{
print
(
"没有数据hehe--"
)
}
}
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setTabv
()
}
//MARK:--二维码方法
@IBAction
func
codeAction
(
_
sender
:
UIButton
)
{
print
(
"二维码方法"
)
print
(
"二维码方法"
)
//加一个透明的显示弹窗
}
//MARK:--头部按钮方法
let
selectV
=
WorkSelectTimeView
()
...
...
@@ -45,6 +78,22 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
selelctIndex
=
sender
;
topNavBtn
.
setImage
(
UIImage
.
init
(
named
:
"workxiala"
),
for
:
.
normal
)
topNavBtn
.
isSelected
=
false
switch
sender
{
case
1001
:
topNavBtn
.
setTitle
(
"今日"
,
for
:
.
normal
)
break
case
1002
:
topNavBtn
.
setTitle
(
"本周"
,
for
:
.
normal
)
break
case
1003
:
topNavBtn
.
setTitle
(
"本月"
,
for
:
.
normal
)
break
case
1004
:
topNavBtn
.
setTitle
(
"自定义时间"
,
for
:
.
normal
)
break
default
:
break
}
}
//MARK:--列表视图
var
tableV
:
UITableView
!
...
...
@@ -67,32 +116,10 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
//rowHeight属性设置为UITableViewAutomaticDimension
tableV
.
rowHeight
=
UITableView
.
automaticDimension
//查询所有记录
let
items
=
realm
.
objects
(
WorkDataModel
.
self
)
// 已经有记录的话就不插入了
if
items
.
count
>
0
{
print
(
"有数据哦--"
)
let
workTestMd
:
WorkDataModel
=
items
[
0
];
let
dataModelStr
=
workTestMd
.
dataModelStr
self
.
dataModel
=
WorkcenterIndexDataModel
(
JSONString
:
dataModelStr
)
//旧的常用功能
let
oftenStr
=
workTestMd
.
oftenArrStr
if
oftenStr
.
count
>
0
{
self
.
oftenArr
?
.
removeAll
()
self
.
oftenArr
=
Array
<
WorkcenterIndexAuthResModel
>
(
JSONString
:
oftenStr
)
}
self
.
tableV
.
reloadData
()
}
else
{
print
(
"没有数据hehe--"
)
}
//下拉刷新相关设置
headerMJ
.
setRefreshingTarget
(
self
,
refreshingAction
:
#selector(
loadData
)
)
self
.
tableV
!.
mj_header
=
headerMJ
//
self.tableV.mj_header?.beginRefreshing()
self
.
tableV
.
mj_header
?
.
beginRefreshing
()
}
...
...
@@ -170,6 +197,7 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
self
.
tableV
.
mj_header
?
.
endRefreshing
()
}
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
dataModel
==
nil
{
return
0
...
...
@@ -213,6 +241,7 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
break
case
2
:
let
tempArr
:[
String
]
=
[
"未发货订单"
,
"待确认订单"
,
"入库申请"
,
"出库申请"
,
"采购入库"
]
cell
.
dataModel
=
self
.
dataModel
//对本地数据库进行更新,每次进入工作中心就可以刷新啦
cell
.
reloadData
(
title
:
arr
[
indexPath
.
row
-
1
],
items
:
tempArr
)
break
...
...
@@ -247,6 +276,13 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
}
}
//MARK:--常用功能无数据跳转
func
WorkItemNoDataTableViewCell
()
{
let
vc
=
EditWorkCViewController
()
vc
.
oftenArr
=
self
.
oftenArr
vc
.
dataModel
=
self
.
dataModel
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
indexPath
.
row
==
0
{
...
...
GeliBusinessPlatform/ViewController/工作中心/WorkItemTableViewCell.swift
View file @
71765617
...
...
@@ -10,6 +10,7 @@ import UIKit
@objc
protocol
WorkItemTableViewCellDelegate
{
@objc
optional
func
WorkItemTableViewCellBtnClick
(
sender
:
WorkItemTableViewCell
,
idx
:
IndexPath
)
@objc
optional
func
WorkItemTableViewCellAuthId
(
sender
:
WorkItemTableViewCell
,
auth_id
:
Int
)
@objc
optional
func
WorkItemNoDataTableViewCell
()
}
class
WorkItemTableViewCell
:
UITableViewCell
,
UICollectionViewDelegate
,
UICollectionViewDataSource
{
...
...
@@ -18,6 +19,8 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
@IBOutlet
weak
var
collectionView
:
UICollectionView
!
@IBOutlet
weak
var
titleLbl
:
UILabel
!
@IBOutlet
weak
var
gotoImgV
:
UIImageView
!
var
dataModel
:
WorkcenterIndexDataModel
?
=
nil
var
dataIndexSection
=
0
//数据
var
itemArrs
:[
String
]
=
[]
...
...
@@ -58,6 +61,9 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
if
dataIndexSection
==
1
&&
itemArrs
.
count
==
0
{
return
1
}
return
itemArrs
.
count
}
...
...
@@ -66,33 +72,49 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"WorkItemCollectionViewCell"
,
for
:
indexPath
)
as!
WorkItemCollectionViewCell
//临时代码
cell
.
itemImgV
.
image
=
UIImage
.
init
(
named
:
"worktest1"
)
//常用功能无数据处理
if
dataIndexSection
==
1
&&
itemArrs
.
count
==
0
{
cell
.
itemImgV
.
image
=
UIImage
.
init
(
named
:
"lmn_btn_plus"
)
cell
.
bgImV
.
image
=
UIImage
.
init
(
named
:
"workkuang"
)
cell
.
itemNameLbl
.
text
=
"添加"
return
cell
}
if
dataIndexSection
==
2
{
cell
.
countLbl
.
isHidden
=
false
cell
.
itemImgV
.
image
=
UIImage
.
init
(
named
:
(
"work"
+
itemArrs
[
indexPath
.
row
]))
cell
.
countLbl
.
text
=
StringByInt
(
number
:
indexPath
.
row
)
if
indexPath
.
row
==
0
{
cell
.
countLbl
.
text
=
"100"
switch
indexPath
.
row
{
case
0
:
cell
.
countLbl
.
text
=
StringByInt
(
number
:
(
self
.
dataModel
?
.
shipping
!
)
!
)
break
case
1
:
cell
.
countLbl
.
text
=
StringByInt
(
number
:
(
self
.
dataModel
?
.
confirm
!
)
!
)
break
case
2
:
cell
.
countLbl
.
text
=
StringByInt
(
number
:
(
self
.
dataModel
?
.
apply_in
!
)
!
)
break
case
3
:
cell
.
countLbl
.
text
=
StringByInt
(
number
:
(
self
.
dataModel
?
.
apply_out
!
)
!
)
break
case
4
:
cell
.
countLbl
.
text
=
StringByInt
(
number
:
(
self
.
dataModel
?
.
purchase
!
)
!
)
break
default
:
break
}
if
cell
.
countLbl
.
text
==
"0"
{
cell
.
countLbl
.
isHidden
=
true
}
else
{
cell
.
countLbl
.
isHidden
=
false
}
}
else
{
cell
.
countLbl
.
isHidden
=
true
}
cell
.
itemNameLbl
.
text
=
itemArrs
[
indexPath
.
row
]
//加减图——用于编辑工作中心用
// if indexPath.row % 2 == 0 {
// cell.bgImV.image = UIImage.init(named: "workjia")
// }else{
// cell.bgImV.image = UIImage.init(named: "workjian")
//
// }
//边框图——用于编辑工作中心用
// if indexPath.row == 10 {
// cell.bgImV.image = UIImage.init(named: "workkuang")
// cell.itemImgV.isHidden = true
// cell.itemNameLbl.isHidden = true
// }
return
cell
}
...
...
@@ -100,6 +122,10 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
dataIndexSection
==
2
{
delegate
?
.
WorkItemTableViewCellBtnClick
?(
sender
:
self
,
idx
:
indexPath
)
}
else
{
//常用功能无数据处理
if
dataIndexSection
==
1
&&
itemArrs
.
count
==
0
{
delegate
?
.
WorkItemNoDataTableViewCell
?()
}
else
{
let
rowModel
=
self
.
itemDataArrs
[
indexPath
.
row
]
//真实数据要穿 auth_id
...
...
@@ -108,6 +134,8 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
}
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
...
...
GeliBusinessPlatform/ViewController/工作中心/编辑工作中心/EditWorkCViewController.swift
View file @
71765617
...
...
@@ -7,14 +7,18 @@
//
import
UIKit
import
RealmSwift
class
EditWorkCViewController
:
BaseViewController
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
{
class
EditWorkCViewController
:
BaseViewController
,
UICollectionViewDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegateFlowLayout
,
GeliAlertViewDelegate
{
var
dataModel
:
WorkcenterIndexDataModel
?
=
nil
var
oftenArr
:
Array
<
WorkcenterIndexAuthResModel
>
?
=
[]
//常用功能
//MARK:--一级分类
var
titleStrArr
:[
String
]
=
[]
var
pAuthResModelArr
:[
WorkcenterIndexAuthResModel
]
=
[]
let
realm
=
try!
Realm
()
//数据库
@IBOutlet
weak
var
topLayou
:
NSLayoutConstraint
!
@IBOutlet
weak
var
itemListCollectionView
:
UICollectionView
!
...
...
@@ -68,6 +72,38 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
}
//MARK:--保存方法
func
rightBtnClick
()
{
print
(
"要记得保存哦"
)
//保存本地
let
alertView
=
GeliAlertView
(
frame
:
self
.
view
.
window
!.
bounds
)
alertView
.
delegate
=
self
;
alertView
.
tishiLbl
.
text
=
""
alertView
.
titileLbl
.
text
=
"是否保存当前编辑?"
alertView
.
rightBtn
.
setAttributedTitle
(
NSAttributedString
(
string
:
"保存"
),
for
:
.
normal
)
alertView
.
rightBtn
.
tag
=
1001
self
.
view
.
window
?
.
addSubview
(
alertView
)
}
func
sureGeliAlertViewAction
(
sender
:
UIButton
)
{
if
sender
.
tag
==
1001
{
let
items
=
self
.
realm
.
objects
(
WorkDataModel
.
self
)
if
items
.
count
>
0
{
let
workTestMd
:
WorkDataModel
=
items
[
0
];
// 在一个事务中更新对象
let
oftenStr
=
self
.
oftenArr
?
.
toJSONString
()
try!
realm
.
write
{
workTestMd
.
oftenArrStr
=
oftenStr
!
}
HUD
.
flash
(
.
label
(
"保存成功"
),
onView
:
nil
,
delay
:
1.2
)
{
(
istrue
)
in
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
else
{
//无此状态,等bug出现
}
}
}
func
numberOfSections
(
in
collectionView
:
UICollectionView
)
->
Int
{
if
collectionView
==
self
.
itemListCollectionView
{
...
...
@@ -150,7 +186,7 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
headerV
.
subviews
.
forEach
{
(
view
)
in
view
.
removeFromSuperview
()
}
let
headerLbl
=
UILabel
(
frame
:
CGRect
(
x
:
15*
glscale
,
y
:
10*
glscale
,
width
:
10
0*
glscale
,
height
:
20*
glscale
))
let
headerLbl
=
UILabel
(
frame
:
CGRect
(
x
:
15*
glscale
,
y
:
10*
glscale
,
width
:
36
0*
glscale
,
height
:
20*
glscale
))
headerLbl
.
text
=
titleStrArr
[
indexPath
.
section
]
headerLbl
.
textColor
=
UIColor
.
init
(
named
:
"标题字颜色"
)
headerLbl
.
font
=
UIFont
.
systemFont
(
ofSize
:
13
)
...
...
@@ -230,11 +266,7 @@ class EditWorkCViewController: BaseViewController, UICollectionViewDelegate, UIC
}
}
//MARK:--保存方法
func
rightBtnClick
()
{
print
(
"要记得保存哦"
)
//保存本地
}
//MARK:--长按所需的参数
var
indexPath
:
IndexPath
?
var
targetIndexPath
:
IndexPath
?
...
...
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