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

调整工作中心UI

parent 37b529ee
......@@ -14,7 +14,9 @@ import SwiftyJSON
class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource ,WorkSelectTimeViewDelegate,WorkItemTableViewCellDelegate,EditWorkCViewControllerDelegate, GeliAlertViewDelegate{
//MARK:--一级分类
var titleStrArr:[String] = []
var pAuthResModelArr:[WorkcenterIndexAuthResModel] = []
@IBOutlet weak var topNavBtn: UIButton!
@IBOutlet weak var contentView: UIView!
......@@ -37,10 +39,7 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
override func viewDidLoad() {
super.viewDidLoad()
setTabv()
NotificationCenter.default.addObserver(self, selector: #selector(jpushServiceNotification(notion:)), name: NSNotification.Name(rawValue: "jpushServiceNotification2"), object: nil)
......@@ -244,6 +243,28 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
UserDefaults.standard.set(userDataStr, forKey: "WorkDataModel")
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.mj_header?.endRefreshing()
......@@ -252,11 +273,12 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if dataModel == nil {
return 0
}
return 4
return 3 + pAuthResModelArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......@@ -272,6 +294,8 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
return cell
}else{
let cell = tableView.dequeueReusableCell(withIdentifier: "WorkItemTableViewCell") as! WorkItemTableViewCell
cell.cellHeaderHeight.constant = CGFloat(15)
cell.headerLeftLineV.isHidden = true
//下面这两个语句一定要添加,否则第一屏显示的collection view尺寸,以及里面的单元格位置会不正确
cell.frame = tableView.bounds
cell.delegate = self
......@@ -298,22 +322,27 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
cell.reloadData(title: arr[indexPath.row - 1], items: tempArr)
break
case 3:
default:
var tempArr:[String] = []
var itemDataArrs:[WorkcenterIndexAuthResModel] = []
self.dataModel?.auth_res?.forEach({ (md) in
if md.auth_pid != 0 {
let pAuthModel = pAuthResModelArr[indexPath.row - 3]//父model
self.dataModel?.auth_res?.forEach({ (md) in //子model
if pAuthModel.auth_id == md.auth_pid {
tempArr.append(md.auth_name!)
itemDataArrs.append(md)
}
})
cell.itemDataArrs = itemDataArrs
cell.reloadData(title: arr[indexPath.row - 1], items: tempArr)
break
default:
cell.itemDataArrs = itemDataArrs
cell.reloadData(title: pAuthModel.auth_name!, items: tempArr)
if indexPath.row != 3 {
cell.cellHeaderHeight.constant = CGFloat(1)
cell.headerLeftLineV.isHidden = false
}
break
}
return cell
......@@ -625,6 +654,26 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
self.oftenArr?.removeAll()
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()
}else{
print("没有数据hehe--")
......
......@@ -21,6 +21,8 @@ class WorkItemTableViewCell: UITableViewCell , UICollectionViewDelegate, UIColle
@IBOutlet weak var gotoImgV: UIImageView!
var dataModel:WorkcenterIndexDataModel? = nil
@IBOutlet weak var headerLeftLineV: UIView!
@IBOutlet weak var cellHeaderHeight: NSLayoutConstraint!
var dataIndexSection = 0
//数据
var itemArrs:[String] = []
......
<?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"/>
<dependencies>
<deployment identifier="iOS"/>
......@@ -57,11 +57,21 @@
</attributedString>
<nil key="highlightedColor"/>
</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>
<constraints>
<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="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="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"/>
......@@ -76,9 +86,11 @@
<gestureRecognizers/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<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="collectionViewHeight" destination="v8g-As-Pb6" id="mea-yU-erh"/>
<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"/>
</connections>
<point key="canvasLocation" x="170.28985507246378" y="87.053571428571431"/>
......@@ -92,5 +104,8 @@
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</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