Przeglądaj źródła

ios考勤统计列表排序的bug

fancy 5 lat temu
rodzic
commit
a9fec93e80

+ 3 - 0
o2ios/O2Platform/App/IM-聊天/View/IMConversationItemCell.swift

@@ -93,6 +93,9 @@ class IMConversationItemCell: UITableViewCell {
                 self.messageLabel.isHidden = true
                 self.emojiImg.isHidden = true
             }
+        }else {
+            self.messageLabel.isHidden = true
+            self.emojiImg.isHidden = true
         }
         //unread number
         let number = conversation.unreadNumber ?? 0

+ 33 - 17
o2ios/O2Platform/App/NewAttance-考勤打卡/c/OOAttanceTotalController.swift

@@ -22,44 +22,59 @@ class OOAttanceTotalController: UITableViewController {
     }()
     
     private var models:[OOAttandanceCheckinTotal] = []
+    
+    private var year: String = {
+        let currentDate = Date()
+        return String(currentDate.year)
+    }()
+    private var month: String = {
+        let currentDate = Date()
+        return currentDate.month > 9 ? "\(currentDate.month)" : "0\(currentDate.month)"
+    }()
         
     override func viewDidLoad() {
         super.viewDidLoad()
 //        title = "统计"
         NotificationCenter.default.addObserver(self, selector: #selector(showDatePicker(_:)), name: OONotification.staticsTotal.notificationName, object: nil)
         tableView.register(UINib.init(nibName: "OOAttandanceTotalItemCell", bundle: nil), forCellReuseIdentifier: "OOAttandanceTotalItemCell")
-//        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "关闭", style: .plain, target: self, action: #selector(closeWindow))
-        let currentDate = Date()
-        let year = String(currentDate.year)
-        let month = currentDate.month > 9 ? "\(currentDate.month)" : "0\(currentDate.month)"
-        getTotalDetailList(year, month)
         tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: {
-            self.getTotalDetailList(year, month)
+            self.getTotalDetailList()
         })
-        
+        getTotalDetailList()
     }
     
     @objc private func showDatePicker(_ notification:Notification) {
         self.datePickerTapped("选择日期", .date, "yyyy-MM") { (result) in
-            let year = result.toString("yyyy")
-            let month = result.toString("MM")
+            self.year = result.toString("yyyy")
+            self.month = result.toString("MM")
             DispatchQueue.main.async {
-                self.getTotalDetailList(year, month)
+                self.getTotalDetailList()
             }
         }
     }
     
-    func getTotalDetailList(_ year:String,_ month:String){
-        MBProgressHUD_JChat.showMessage(message: "loading...", toView: view)
-        viewModel.getCheckinCycle(year,month).then { (cycleDetail) -> Promise<(OOAttandanceAnalyze,[OOAttandanceCheckinTotal])> in
-             self.headerView.requestBean = cycleDetail
+    func getTotalDetailList(){
+        self.showLoading()
+        viewModel.getCheckinCycle(self.year, self.month).then { (cycleDetail) -> Promise<(OOAttandanceAnalyze,[OOAttandanceCheckinTotal])> in
+                self.headerView.requestBean = cycleDetail
                return all(self.viewModel.getCheckinAnalyze(cycleDetail), self.viewModel.getCheckinTotal(cycleDetail))
             }.then { (result) in
                 self.headerView.config(withItem: result.0)
+                let list = result.1
                 self.models.removeAll()
-                self.models.append(contentsOf: result.1)
+                if !list.isEmpty {
+                    let newList = list.sorted { (f, s) -> Bool in
+                        if let fd = f.recordDateString, let sd = s.recordDateString {
+                            return fd.toDate(formatter: "yyyy-MM-dd") < sd.toDate(formatter: "yyyy-MM-dd")
+                        }else {
+                            return false
+                        }
+                    }
+                    self.models.append(contentsOf: newList)
+                }
+                
             }.always {
-                MBProgressHUD_JChat.hide(forView: self.view, animated: true)
+                self.hideLoading()
                 self.tableView.reloadData()
                 if self.tableView.mj_header.isRefreshing() {
                     self.tableView.mj_header.endRefreshing()
@@ -67,7 +82,8 @@ class OOAttanceTotalController: UITableViewController {
                 
             }.catch { (myError) in
                 let customError = myError as? OOAppError
-                MBProgressHUD_JChat.show(text:(customError?.failureReason)! , view: self.view)
+                self.showError(title: (customError?.failureReason)!)
+                
         }
     }
     

+ 3 - 2
o2ios/O2Platform/App/NewAttance-考勤打卡/v/OOAttandanceTotalHeaderView.swift

@@ -59,10 +59,11 @@ class OOAttandanceTotalHeaderView: UIView,Configurable {
         guard let model = item as? OOAttandanceAnalyze else {
             return
         }
-        normalLabel.text = String(model.onDutyTimes! < model.offDutyTimes! ? model.onDutyTimes! : model.offDutyTimes!)
+        
+        normalLabel.text = String(model.onDutyTimes!)
         lateLabel.text = String(model.lateTimes!)
         leaveLabel.text = String(model.leaveEarlyTimes!)
-        abnormalLabel.text = String(model.abNormalDutyCount!)
+        abnormalLabel.text = String(model.onSelfHolidayCount!)
         
     }
     

+ 5 - 7
o2ios/O2Platform/App/NewAttance-考勤打卡/v/OOAttandanceTotalHeaderView.xib

@@ -1,11 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <device id="retina4_7" orientation="portrait">
-        <adaptation id="fullscreen"/>
-    </device>
+<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">
+    <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -80,7 +78,7 @@
                                     <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                 </label>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="正常" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WEH-FS-2MP">
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="签到" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WEH-FS-2MP">
                                     <rect key="frame" x="0.0" y="45" width="40" height="24"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="40" id="Gke-mC-z9x"/>
@@ -158,7 +156,7 @@
                                     <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                 </label>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="异常" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HLJ-as-qhK">
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="休假" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HLJ-as-qhK">
                                     <rect key="frame" x="0.0" y="45" width="40" height="24"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="40" id="OU1-Tn-nTv"/>

+ 13 - 0
o2ios/O2Platform/App/NewAttance-考勤打卡/v/OOAttandanceTotalItemCell.swift

@@ -37,6 +37,19 @@ class OOAttandanceTotalItemCell: UITableViewCell,Configurable {
         checkinDateLabel.text = model.recordDateString
         startTimeLabel.text = model.onDutyTime
         endTimeLabel.text = model.offDutyTime
+        if model.isLate == true {
+            self.iconLabel.text = "迟"
+            self.iconLabel.backgroundColor = UIColor(hex: "#F5A623")
+        }else if model.isLeaveEarlier  == true {
+            self.iconLabel.text = "早"
+            self.iconLabel.backgroundColor = UIColor(hex: "#AC71E3")
+        }else if model.isGetSelfHolidays  == true {
+            self.iconLabel.text = "假"
+            self.iconLabel.backgroundColor = UIColor(hex: "#4FB2E3")
+        }else {
+            self.iconLabel.text = "正"
+            self.iconLabel.backgroundColor = UIColor(hex: "#FB4747")
+        }
     }
     
 }

+ 2 - 2
o2ios/O2Platform/Info.plist

@@ -17,7 +17,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>5.1.2</string>
+	<string>5.1.3</string>
 	<key>CFBundleURLTypes</key>
 	<array>
 		<dict>
@@ -32,7 +32,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>72</string>
+	<string>73</string>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
 	<key>NSAppTransportSecurity</key>