Commit fc9cc84a authored by 刘俊宏's avatar 刘俊宏

调整工作中心UI

parent 37b529ee
...@@ -14,7 +14,9 @@ import SwiftyJSON ...@@ -14,7 +14,9 @@ import SwiftyJSON
class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource ,WorkSelectTimeViewDelegate,WorkItemTableViewCellDelegate,EditWorkCViewControllerDelegate, GeliAlertViewDelegate{ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource ,WorkSelectTimeViewDelegate,WorkItemTableViewCellDelegate,EditWorkCViewControllerDelegate, GeliAlertViewDelegate{
//MARK:--一级分类
var titleStrArr:[String] = []
var pAuthResModelArr:[WorkcenterIndexAuthResModel] = []
@IBOutlet weak var topNavBtn: UIButton! @IBOutlet weak var topNavBtn: UIButton!
@IBOutlet weak var contentView: UIView! @IBOutlet weak var contentView: UIView!
...@@ -39,9 +41,6 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -39,9 +41,6 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
super.viewDidLoad() super.viewDidLoad()
setTabv() setTabv()
NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification2"), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification2"), object: nil)
...@@ -244,6 +243,28 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -244,6 +243,28 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
UserDefaults.standard.set(userDataStr, forKey: "WorkDataModel") UserDefaults.standard.set(userDataStr, forKey: "WorkDataModel")
UserDefaults.standard.synchronize() UserDefaults.standard.synchronize()
self.titleStrArr.removeAll()
self.pAuthResModelArr.removeAll()
self.dataModel?.auth_res?.forEach({ (md) in
if md.auth_pid == 0 {
var chlicdAuthResModelArr:[WorkcenterIndexAuthResModel] = []
let pAuthModel = md//父model
self.dataModel?.auth_res?.forEach({ (model) in //子model
if pAuthModel.auth_id == model.auth_pid {
chlicdAuthResModelArr.append(md)
}
})
if chlicdAuthResModelArr.count > 0 {
self.titleStrArr.append(md.auth_name!)
self.pAuthResModelArr.append(md)
}
}
})
self.tableV.reloadData() self.tableV.reloadData()
} }
self.tableV.mj_header?.endRefreshing() self.tableV.mj_header?.endRefreshing()
...@@ -252,11 +273,12 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -252,11 +273,12 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
} }
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if dataModel == nil { if dataModel == nil {
return 0 return 0
} }
return 4 return 3 + pAuthResModelArr.count
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...@@ -272,6 +294,8 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -272,6 +294,8 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
return cell return cell
}else{ }else{
let cell = tableView.dequeueReusableCell(withIdentifier: "WorkItemTableViewCell") as! WorkItemTableViewCell let cell = tableView.dequeueReusableCell(withIdentifier: "WorkItemTableViewCell") as! WorkItemTableViewCell
cell.cellHeaderHeight.constant = CGFloat(15)
cell.headerLeftLineV.isHidden = true
//下面这两个语句一定要添加,否则第一屏显示的collection view尺寸,以及里面的单元格位置会不正确 //下面这两个语句一定要添加,否则第一屏显示的collection view尺寸,以及里面的单元格位置会不正确
cell.frame = tableView.bounds cell.frame = tableView.bounds
cell.delegate = self cell.delegate = self
...@@ -299,21 +323,26 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -299,21 +323,26 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
cell.reloadData(title: arr[indexPath.row - 1], items: tempArr) cell.reloadData(title: arr[indexPath.row - 1], items: tempArr)
break break
case 3:
default:
var tempArr:[String] = [] var tempArr:[String] = []
var itemDataArrs:[WorkcenterIndexAuthResModel] = [] var itemDataArrs:[WorkcenterIndexAuthResModel] = []
self.dataModel?.auth_res?.forEach({ (md) in let pAuthModel = pAuthResModelArr[indexPath.row - 3]//父model
if md.auth_pid != 0 { self.dataModel?.auth_res?.forEach({ (md) in //子model
if pAuthModel.auth_id == md.auth_pid {
tempArr.append(md.auth_name!) tempArr.append(md.auth_name!)
itemDataArrs.append(md) itemDataArrs.append(md)
} }
}) })
cell.itemDataArrs = itemDataArrs cell.itemDataArrs = itemDataArrs
cell.reloadData(title: arr[indexPath.row - 1], items: tempArr) cell.reloadData(title: pAuthModel.auth_name!, items: tempArr)
break if indexPath.row != 3 {
cell.cellHeaderHeight.constant = CGFloat(1)
cell.headerLeftLineV.isHidden = false
}
default:
break break
} }
return cell return cell
...@@ -625,6 +654,26 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -625,6 +654,26 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
self.oftenArr?.removeAll() self.oftenArr?.removeAll()
self.oftenArr = Array<WorkcenterIndexAuthResModel>(JSONString: oftenStr!) self.oftenArr = Array<WorkcenterIndexAuthResModel>(JSONString: oftenStr!)
} }
self.titleStrArr.removeAll()
self.pAuthResModelArr.removeAll()
self.dataModel?.auth_res?.forEach({ (md) in
if md.auth_pid == 0 {
var chlicdAuthResModelArr:[WorkcenterIndexAuthResModel] = []
let pAuthModel = md//父model
self.dataModel?.auth_res?.forEach({ (model) in //子model
if pAuthModel.auth_id == model.auth_pid {
chlicdAuthResModelArr.append(md)
}
})
if chlicdAuthResModelArr.count > 0 {
self.titleStrArr.append(md.auth_name!)
self.pAuthResModelArr.append(md)
}
}
})
self.tableV.reloadData() self.tableV.reloadData()
}else{ }else{
print("没有数据hehe--") print("没有数据hehe--")
......
...@@ -21,6 +21,8 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle ...@@ -21,6 +21,8 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
@IBOutlet weak var gotoImgV: UIImageView! @IBOutlet weak var gotoImgV: UIImageView!
var dataModel:WorkcenterIndexDataModel? = nil var dataModel:WorkcenterIndexDataModel? = nil
@IBOutlet weak var headerLeftLineV: UIView!
@IBOutlet weak var cellHeaderHeight: NSLayoutConstraint!
var dataIndexSection = 0 var dataIndexSection = 0
//数据 //数据
var itemArrs:[String] = [] var itemArrs:[String] = []
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
...@@ -57,11 +57,21 @@ ...@@ -57,11 +57,21 @@
</attributedString> </attributedString>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="c96-cW-eMw">
<rect key="frame" x="0.0" y="0.0" width="15" height="1"/>
<color key="backgroundColor" name="白色背景色"/>
<constraints>
<constraint firstAttribute="width" constant="15" id="UKJ-QV-ncL"/>
<constraint firstAttribute="height" constant="1" id="fvs-sZ-6mf"/>
</constraints>
</view>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="U2a-kl-3Rs" secondAttribute="trailing" id="638-Yz-CeV"/> <constraint firstAttribute="trailing" secondItem="U2a-kl-3Rs" secondAttribute="trailing" id="638-Yz-CeV"/>
<constraint firstItem="c96-cW-eMw" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="CqF-jY-SlM"/>
<constraint firstItem="j1a-a2-V8p" firstAttribute="top" secondItem="U2a-kl-3Rs" secondAttribute="bottom" id="DGo-Kv-a2w"/> <constraint firstItem="j1a-a2-V8p" firstAttribute="top" secondItem="U2a-kl-3Rs" secondAttribute="bottom" id="DGo-Kv-a2w"/>
<constraint firstItem="j1a-a2-V8p" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="E4F-HD-NeP"/> <constraint firstItem="j1a-a2-V8p" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="E4F-HD-NeP"/>
<constraint firstItem="c96-cW-eMw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="GBY-nd-0j0"/>
<constraint firstAttribute="bottom" secondItem="j1a-a2-V8p" secondAttribute="bottom" id="N7G-JE-GMy"/> <constraint firstAttribute="bottom" secondItem="j1a-a2-V8p" secondAttribute="bottom" id="N7G-JE-GMy"/>
<constraint firstAttribute="trailing" secondItem="dum-a9-xsC" secondAttribute="trailing" constant="15" id="NZp-Yo-rhh"/> <constraint firstAttribute="trailing" secondItem="dum-a9-xsC" secondAttribute="trailing" constant="15" id="NZp-Yo-rhh"/>
<constraint firstItem="U2a-kl-3Rs" firstAttribute="top" secondItem="Ihn-Ad-uPT" secondAttribute="bottom" constant="15" id="UiX-Hp-vmw"/> <constraint firstItem="U2a-kl-3Rs" firstAttribute="top" secondItem="Ihn-Ad-uPT" secondAttribute="bottom" constant="15" id="UiX-Hp-vmw"/>
...@@ -76,9 +86,11 @@ ...@@ -76,9 +86,11 @@
<gestureRecognizers/> <gestureRecognizers/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections> <connections>
<outlet property="cellHeaderHeight" destination="ERR-BB-bri" id="zqE-s5-ybd"/>
<outlet property="collectionView" destination="j1a-a2-V8p" id="Tgt-LU-8iy"/> <outlet property="collectionView" destination="j1a-a2-V8p" id="Tgt-LU-8iy"/>
<outlet property="collectionViewHeight" destination="v8g-As-Pb6" id="mea-yU-erh"/> <outlet property="collectionViewHeight" destination="v8g-As-Pb6" id="mea-yU-erh"/>
<outlet property="gotoImgV" destination="dum-a9-xsC" id="oxC-Yd-2dT"/> <outlet property="gotoImgV" destination="dum-a9-xsC" id="oxC-Yd-2dT"/>
<outlet property="headerLeftLineV" destination="c96-cW-eMw" id="prF-bc-iJd"/>
<outlet property="titleLbl" destination="U2a-kl-3Rs" id="pbp-im-yey"/> <outlet property="titleLbl" destination="U2a-kl-3Rs" id="pbp-im-yey"/>
</connections> </connections>
<point key="canvasLocation" x="170.28985507246378" y="87.053571428571431"/> <point key="canvasLocation" x="170.28985507246378" y="87.053571428571431"/>
...@@ -92,5 +104,8 @@ ...@@ -92,5 +104,8 @@
<namedColor name="标题字颜色"> <namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources> </resources>
</document> </document>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment