Jelajahi Sumber

学员统计 筛选基本完成 未测试

openlockPPP 1 tahun lalu
induk
melakukan
2c70b95d6d

+ 77 - 0
.gitignore

@@ -399,3 +399,80 @@ Pods/UMCommon/UMCommon_7.4.1/UMCommon.framework/Versions/A/Headers/UMCommon.h
 Pods/UMCommon/UMCommon_7.4.1/UMCommon.framework/Versions/A/Headers/UMConfigure.h
 Pods/UMDevice/UMDevice_3.1.0/UMDevice.framework/UMDevice
 Pods/UMDevice/UMDevice_3.1.0/UMDevice.framework/Headers/UMZid.h
+Pods/PGDatePicker/LICENSE
+Pods/PGDatePicker/README.md
+Pods/PGDatePicker/PGDatePicker/NSBundle+PGDatePicker.h
+Pods/PGDatePicker/PGDatePicker/NSBundle+PGDatePicker.m
+Pods/PGDatePicker/PGDatePicker/NSDate+PGCategory.h
+Pods/PGDatePicker/PGDatePicker/NSDate+PGCategory.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Common.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Common.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Date.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Date.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateAndTime.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateAndTime.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHour.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHour.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHourMinute.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHourMinute.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHourMinuteSecond.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHourMinuteSecond.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Logic.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Logic.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MinuteAndSecond.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MinuteAndSecond.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDay.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDay.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHour.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHour.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHourMinute.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHourMinute.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHourMinuteSecond.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHourMinuteSecond.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Time.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Time.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+TimeAndSecond.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+TimeAndSecond.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Year.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+Year.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+YearAndMonth.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker+YearAndMonth.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker.h
+Pods/PGDatePicker/PGDatePicker/PGDatePicker.m
+Pods/PGDatePicker/PGDatePicker/PGDatePickerHeader.h
+Pods/PGDatePicker/PGDatePicker/PGDatePickerView.h
+Pods/PGDatePicker/PGDatePicker/PGDatePickerView.m
+Pods/PGDatePicker/PGDatePicker/PGDatePickManager.h
+Pods/PGDatePicker/PGDatePicker/PGDatePickManager.m
+Pods/PGDatePicker/PGDatePicker/PGDatePickManagerHeaderView.h
+Pods/PGDatePicker/PGDatePicker/PGDatePickManagerHeaderView.m
+Pods/PGDatePicker/PGDatePicker/PGEnumeration.h
+Pods/PGDatePicker/PGDatePicker/UIColor+PGHex.h
+Pods/PGDatePicker/PGDatePicker/UIColor+PGHex.m
+Pods/PGDatePicker/PGDatePicker/PGDatePicker.bundle/en.lproj/Localizable.strings
+Pods/PGDatePicker/PGDatePicker/PGDatePicker.bundle/zh-Hans.lproj/Localizable.strings
+Pods/PGDatePicker/PGDatePicker/PGDatePicker.bundle/zh-Hant.lproj/Localizable.strings
+Pods/PGPickerView/LICENSE
+Pods/PGPickerView/README.md
+Pods/PGPickerView/PGPickerView/PGPickerColumnCell.h
+Pods/PGPickerView/PGPickerView/PGPickerColumnCell.m
+Pods/PGPickerView/PGPickerView/PGPickerColumnView.h
+Pods/PGPickerView/PGPickerView/PGPickerColumnView.m
+Pods/PGPickerView/PGPickerView/PGPickerTableView.h
+Pods/PGPickerView/PGPickerView/PGPickerTableView.m
+Pods/PGPickerView/PGPickerView/PGPickerView.h
+Pods/PGPickerView/PGPickerView/PGPickerView.m
+Pods/Target Support Files/PGDatePicker/PGDatePicker-dummy.m
+Pods/Target Support Files/PGDatePicker/PGDatePicker-Info.plist
+Pods/Target Support Files/PGDatePicker/PGDatePicker-prefix.pch
+Pods/Target Support Files/PGDatePicker/PGDatePicker-umbrella.h
+Pods/Target Support Files/PGDatePicker/PGDatePicker.debug.xcconfig
+Pods/Target Support Files/PGDatePicker/PGDatePicker.modulemap
+Pods/Target Support Files/PGDatePicker/PGDatePicker.release.xcconfig
+Pods/Target Support Files/PGPickerView/PGPickerView-dummy.m
+Pods/Target Support Files/PGPickerView/PGPickerView-Info.plist
+Pods/Target Support Files/PGPickerView/PGPickerView-prefix.pch
+Pods/Target Support Files/PGPickerView/PGPickerView-umbrella.h
+Pods/Target Support Files/PGPickerView/PGPickerView.debug.xcconfig
+Pods/Target Support Files/PGPickerView/PGPickerView.modulemap
+Pods/Target Support Files/PGPickerView/PGPickerView.release.xcconfig

+ 8 - 0
JiaPeiManage.xcodeproj/project.pbxproj

@@ -7,6 +7,8 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		900C73132A4D216D00532B3D /* StatisticsSelectDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 900C73122A4D216D00532B3D /* StatisticsSelectDateView.swift */; };
+		900C73152A4D220000532B3D /* StatisticsSelectDateView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 900C73142A4D220000532B3D /* StatisticsSelectDateView.xib */; };
 		903628BB2A40431800F0AA6C /* TraineeInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 903628BA2A40431800F0AA6C /* TraineeInfoModel.swift */; };
 		903628BE2A41766B00F0AA6C /* MeTraineeDetails01Controller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 903628BD2A41766B00F0AA6C /* MeTraineeDetails01Controller.swift */; };
 		903628C02A41767900F0AA6C /* MeTraineeDetails02Controller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 903628BF2A41767900F0AA6C /* MeTraineeDetails02Controller.swift */; };
@@ -167,6 +169,8 @@
 
 /* Begin PBXFileReference section */
 		1FC2879EF62A9D4DF6777C62 /* Pods_JiaPeiManage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JiaPeiManage.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		900C73122A4D216D00532B3D /* StatisticsSelectDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsSelectDateView.swift; sourceTree = "<group>"; };
+		900C73142A4D220000532B3D /* StatisticsSelectDateView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatisticsSelectDateView.xib; sourceTree = "<group>"; };
 		903628BA2A40431800F0AA6C /* TraineeInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TraineeInfoModel.swift; sourceTree = "<group>"; };
 		903628BD2A41766B00F0AA6C /* MeTraineeDetails01Controller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeTraineeDetails01Controller.swift; sourceTree = "<group>"; };
 		903628BF2A41767900F0AA6C /* MeTraineeDetails02Controller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeTraineeDetails02Controller.swift; sourceTree = "<group>"; };
@@ -459,6 +463,8 @@
 				90971E932A4AB18D00267B7F /* StatisticsPageHeaderView.xib */,
 				90971E952A4AB1F400267B7F /* StatisticsPageCell.swift */,
 				90971E972A4AB20600267B7F /* StatisticsPageCell.xib */,
+				900C73122A4D216D00532B3D /* StatisticsSelectDateView.swift */,
+				900C73142A4D220000532B3D /* StatisticsSelectDateView.xib */,
 			);
 			path = Views;
 			sourceTree = "<group>";
@@ -1006,6 +1012,7 @@
 				90CE528A2A36E5460033BD06 /* PopOverViewCell.xib in Resources */,
 				909DA5D12A3AC2460034501F /* UpdatePasswordViewController.xib in Resources */,
 				90CE52222A36C0720033BD06 /* Assets.xcassets in Resources */,
+				900C73152A4D220000532B3D /* StatisticsSelectDateView.xib in Resources */,
 				90971E942A4AB18D00267B7F /* StatisticsPageHeaderView.xib in Resources */,
 				9076C5DC2A386B2F00E5E33F /* MineViewController.xib in Resources */,
 				903628C82A417B2D00F0AA6C /* MeTraineeDetails01Cell.xib in Resources */,
@@ -1199,6 +1206,7 @@
 				90CE52D62A36E6000033BD06 /* NYSwRouter.swift in Sources */,
 				90C9C5552A4C7189006D3921 /* StatisticsOfficialPageController.swift in Sources */,
 				90CE52AB2A36E59A0033BD06 /* UIViewController+NetAnimation.swift in Sources */,
+				900C73132A4D216D00532B3D /* StatisticsSelectDateView.swift in Sources */,
 				90CE527A2A36E5460033BD06 /* LWPlayerDelegate.swift in Sources */,
 				90CE52CC2A36E5EC0033BD06 /* NotificationCenter+Rx.swift in Sources */,
 				90CE52A72A36E59A0033BD06 /* UIImage+Placeholder.swift in Sources */,

+ 153 - 0
JiaPeiManage/Sources/Constants/NYMacros.swift

@@ -63,4 +63,157 @@ struct NYDate {
         dateFormatter.dateFormat = "YYYY-MM-dd"
         return  dateFormatter.string(from: currentDate)
     }
+    //获取昨日时间
+    static func getLastDate()->String {
+        let calendar = Calendar.current
+        let yesterday = calendar.date(byAdding: .day, value: -1, to: Date())
+
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "YYYY-MM-dd"
+
+        if let yesterdayDate = yesterday {
+            let yesterdayString = dateFormatter.string(from: yesterdayDate)
+            return yesterdayString
+        }
+        return ""
+    }
+    //获取当月
+    static func getDateMonth()-> [String] {
+        let calendar = Calendar.current
+        let currentDate = Date()
+
+        // 获取本月的起始日期
+        let startDate = calendar.date(from: calendar.dateComponents([.year, .month], from: calendar.startOfDay(for: currentDate)))!
+
+        // 获取本月的结束日期
+        let endDate = calendar.date(byAdding: DateComponents(month: 1, day: -1), to: startDate)!
+
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "YYYY-MM-dd"
+
+        let startDateString = dateFormatter.string(from: startDate)
+        let endDateString = dateFormatter.string(from: endDate)
+        return [startDateString,endDateString]
+    }
+    //获取上月
+    static func getDateMonthLast()-> [String] {
+        let calendar = Calendar.current
+        let currentDate = Date()
+
+        // 获取上个月的起始日期
+        var dateComponents = calendar.dateComponents([.year, .month], from: currentDate)
+        dateComponents.month! -= 1
+        let startDate = calendar.date(from: dateComponents)!
+
+        // 获取上个月的结束日期
+        let range = calendar.range(of: .day, in: .month, for: startDate)!
+        let lastDayOfMonth = range.upperBound - 1
+        dateComponents.day = lastDayOfMonth
+        let endDate = calendar.date(from: dateComponents)!
+
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "YYYY-MM-dd"
+
+        let startDateString = dateFormatter.string(from: startDate)
+        let endDateString = dateFormatter.string(from: endDate)
+        return [startDateString,endDateString]
+    }
+    //获取近n月
+    static func getDateMonthSectionNum(num:Int)-> [String] {
+        let calendar = Calendar.current
+        let currentDate = Date()
+
+        // 获取当前月份的起始日期
+        let currentMonthStartDate = calendar.date(from: calendar.dateComponents([.year, .month], from: calendar.startOfDay(for: currentDate)))!
+
+        // 计算近三个月之前的日期
+        let threeMonthsAgoDate = calendar.date(byAdding: DateComponents(month: num), to: currentMonthStartDate)!
+
+        // 获取近三个月的起始日期
+        let startDate = calendar.date(from: calendar.dateComponents([.year, .month], from: threeMonthsAgoDate))!
+
+        // 获取当前月份的结束日期
+        let currentMonthEndDate = calendar.date(byAdding: DateComponents(month: 1, day: -1), to: currentMonthStartDate)!
+
+        // 获取近三个月的结束日期
+        let endDate = calendar.date(byAdding: DateComponents(day: -1), to: currentMonthEndDate)!
+
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "YYYY-MM-dd"
+
+        let startDateString = dateFormatter.string(from: startDate)
+        let endDateString = dateFormatter.string(from: endDate)
+        return [startDateString,endDateString]
+    }
+    //获取本年
+    static func getDateYear()-> [String] {
+        let calendar = Calendar.current
+        let currentDate = Date()
+
+        // 获取当前年份
+        let currentYear = calendar.component(.year, from: currentDate)
+
+        // 构建日期组件,设置年份为当前年份,月份和日份分别为1
+        var dateComponents = DateComponents()
+        dateComponents.year = currentYear
+        dateComponents.month = 1
+        dateComponents.day = 1
+
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "YYYY-MM-dd"
+
+        // 获取本年起始日期
+        var startDateString = ""
+        if let startDate = calendar.date(from: dateComponents) {
+            startDateString = dateFormatter.string(from: startDate)
+        }
+
+        // 获取本年结束日期
+        var endDateString = ""
+        dateComponents.year = currentYear + 1
+        dateComponents.day = -1
+        if let endDate = calendar.date(from: dateComponents) {
+            //calendar.date(byAdding: DateComponents(year: 1, day: -1), to: currentDate) {
+            endDateString = dateFormatter.string(from: endDate)
+        }
+
+        return [startDateString,endDateString]
+    }
+    //获取近n年
+    static func getDateYearSectionNum(num:Int)-> [String] {
+        let calendar = Calendar.current
+        let currentDate = Date()
+
+        // 获取当前年份
+        let currentYear = calendar.component(.year, from: currentDate)
+
+        // 计算起始年份
+        let startYear = currentYear - num
+
+        // 构建日期组件,设置年份为起始年份,月份和日份分别为1
+        var dateComponents = DateComponents()
+        dateComponents.year = startYear
+        dateComponents.month = 1
+        dateComponents.day = 1
+
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "YYYY-MM-dd"
+
+        // 获取起始日期
+        var startDateString = ""
+        if let startDate = calendar.date(from: dateComponents) {
+            startDateString = dateFormatter.string(from: startDate)
+        }
+
+        // 获取结束日期
+        var endDateString = ""
+        dateComponents.year = currentYear+1
+        dateComponents.month = 1
+        dateComponents.day = -1
+        if let endDate = calendar.date(from: dateComponents) { //calendar.date(byAdding: DateComponents(year: num, day: -1), to: currentDate) {
+            endDateString = dateFormatter.string(from: endDate)
+        }
+
+        return [startDateString,endDateString]
+    }
 }

+ 141 - 23
JiaPeiManage/Sources/Modulars/Statistics/Controllers/StatisticsPageController.swift

@@ -23,10 +23,18 @@ final class StatisticsPageController: BaseGroupTableViewController {
     let navBar = MeTraineeNavBar.loadFromNib().then {
         $0.title_label.text = "全部报名统计"
     }
-    
+    //头部 view
     let headerView = StatisticsPageHeaderView.loadFromNib().then {
         $0.backgroundColor = .db_theme
     }
+    //头部 日期选择
+    let selectDateViewBgBtn = UIButton(type:.custom).then {
+        $0.isHidden = true
+        $0.backgroundColor = UIColor.clear
+    }
+    let selectDateView = StatisticsSelectDateView.loadFromNib().then {
+        $0.isHidden = true
+    }
     // MARK: 数据
     var stuTotalCountDataModel:StuTotalCountDataModel?
     var stuCountDataModel:StuCountDataModel?
@@ -36,8 +44,6 @@ final class StatisticsPageController: BaseGroupTableViewController {
     var fieldType:Int = 1 //1:时间 2:学员数
     var sortType:Int = 2 //1:正序 2:倒序
     
-    var datePicCount = 0 //选择器 -日期end 2
-    
     override func setupConstraints() {
         
         statusBar.snp.makeConstraints { (make) in
@@ -56,6 +62,15 @@ final class StatisticsPageController: BaseGroupTableViewController {
             make.left.right.bottom.equalToSuperview()
         }
         
+        selectDateViewBgBtn.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+        }
+        
+        selectDateView.snp.remakeConstraints { make in
+            make.top.equalTo(352.f)
+            make.left.right.equalToSuperview()
+            make.height.equalTo(172.f)
+        }
     }
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -65,9 +80,33 @@ final class StatisticsPageController: BaseGroupTableViewController {
     }
     
     // MARK: 私有方法
+    //显示selectDateView
+    func showSelectDateView(){
+        if(self.selectDateView.isHidden)
+        {
+            //计算相对坐标
+            let headerFrameInSuperview = tableView.convert(CGPoint(x: 0, y: headerView.qmui_bottom), to: tableView.superview)
+            selectDateView.snp.remakeConstraints { make in
+                make.top.equalTo(headerFrameInSuperview.y-navBar.bottom)
+                make.left.right.equalToSuperview()
+                make.height.equalTo(172.f)
+            }
+            self.loadViewIfNeeded()//提醒刷
+            //显示
+            self.selectDateView.startdate_button.setTitle(startDate, for: .normal)
+            self.selectDateView.enddate_button.setTitle(endDate, for: .normal)
+            self.selectDateView.setDateType(type: dateType)
+            self.selectDateView.isHidden = false
+            self.selectDateViewBgBtn.isHidden = false
+        }else{
+            //隐藏
+            self.selectDateView.isHidden = true
+            self.selectDateViewBgBtn.isHidden = true
+        }
+        
+    }
     //显示时间选择器
-    func showPGDatePickManager(){
-        self.datePicCount+=1
+    func showPGDatePickManager(tag:Int){
         switch dateType {
         case .day:
             let datePickerManager = PGDatePickManager()
@@ -77,6 +116,7 @@ final class StatisticsPageController: BaseGroupTableViewController {
             datePickerManager.cancelButtonTextColor = .db_fontGray
             datePickerManager.confirmButtonTextColor = .db_green
             let datePicker = datePickerManager.datePicker!
+            datePicker.tag = tag
             datePicker.lineBackgroundColor = .db_green
             datePicker.textColorOfSelectedRow = .db_green
             datePicker.backgroundColor = UIColor("#031223")
@@ -93,6 +133,7 @@ final class StatisticsPageController: BaseGroupTableViewController {
             datePickerManager.cancelButtonTextColor = .db_fontGray
             datePickerManager.confirmButtonTextColor = .db_green
             let datePicker = datePickerManager.datePicker!
+            datePicker.tag = tag
             datePicker.lineBackgroundColor = .db_green
             datePicker.textColorOfSelectedRow = .db_green
             datePicker.backgroundColor = UIColor("#031223")
@@ -109,6 +150,7 @@ final class StatisticsPageController: BaseGroupTableViewController {
             datePickerManager.cancelButtonTextColor = .db_fontGray
             datePickerManager.confirmButtonTextColor = .db_green
             let datePicker = datePickerManager.datePicker!
+            datePicker.tag = tag
             datePicker.lineBackgroundColor = .db_green
             datePicker.textColorOfSelectedRow = .db_green
             datePicker.backgroundColor = UIColor("#031223")
@@ -119,9 +161,25 @@ final class StatisticsPageController: BaseGroupTableViewController {
             self.present(datePickerManager, animated: false, completion: nil)
         }
     }
+    //配置-日期
+    func configDefaulthDate(){
+        switch dateType {
+        case .day:
+            let dates = NYDate.getDateMonth()
+            self.endDate = dates[1]
+            self.startDate = dates[0]
+        case .month:
+            let dates = NYDate.getDateMonthSectionNum(num: -2)
+            self.endDate =  String(dates[1].prefix(7))
+            self.startDate =  String(dates[0].prefix(7))
+        case .year:
+            let dates = NYDate.getDateYearSectionNum(num: 4)
+            self.endDate =  String(dates[1].prefix(4))
+            self.startDate =  String(dates[0].prefix(4))
+        }
+    }
     //配置显示时间
     func configUIdata(){
-        
         // 根据不同的 dateType 进行相应的数据请求
         var starttime = ""
         var endtime = ""
@@ -139,21 +197,51 @@ final class StatisticsPageController: BaseGroupTableViewController {
         headerView.date_section_button.setTitle("\(starttime)~\(endtime)", for: .normal)
         
     }
+    //confirm 确定处理
+    func confirmHandledo(){
+        //刷新数据
+        self.startDate = selectDateView.startdate_button.currentTitle!
+        self.endDate = selectDateView.enddate_button.currentTitle!
+        self.configUIdata()
+        self.showSelectDateView()
+        self.switchStatisticsStuCount()
+    }
+    //重置
+    func resetHandledo(){
+        self.selectDateView.startdate_button.setTitle(getButtonDate(date: self.startDate), for: .normal)
+        self.selectDateView.enddate_button.setTitle(getButtonDate(date: self.endDate), for: .normal)
+        self.selectDateView.setDateType(type: dateType)
+    }
+    
+    func getButtonDate(date:String)->String{
+        var _date = ""
+        switch dateType {
+        case .month:
+            _date = String(date.prefix(7))
+        case .year:
+            _date = String(date.prefix(4))
+        case .day:
+            _date = String(date.prefix(10))
+        }
+        return _date
+    }
     
     func setupUI(){
         self.view.addSubview(navBar)
         self.view.addSubview(statusBar)
         self.view.backgroundColor = .db_theme
+        self.view.insertSubview(selectDateViewBgBtn, at: 9998)
+        self.view.insertSubview(selectDateView, at: 9999)
         self.navBar.back_button.addTarget(self, action: #selector(actionBackdo), for: .touchUpInside)
         self.navBar.search_button.isHidden = true
-        self.endDate = NYDate.getThisDate()
-        self.startDate = self.endDate.prefix(7)+"-01"
+        configDefaulthDate()
         configUIdata()
         //header - 事件
         headerView.items_date_segmented.rx.selectedSegmentIndex
                 .map { DateType(rawValue: $0)! }
                     .subscribe(onNext: { [weak self] dateType in
                         self?.dateType = dateType
+                        self?.configDefaulthDate()
                         self?.configUIdata()
                         self?.switchStatisticsStuCount()
                         print("datetype = \(dateType)")
@@ -161,7 +249,7 @@ final class StatisticsPageController: BaseGroupTableViewController {
                     .disposed(by: disposeBag)
         //日前选择
         headerView.date_section_button.rx.tap.subscribe ({  [unowned self] (_) in
-            self.showPGDatePickManager()
+            self.showSelectDateView()
         }).disposed(by: disposeBag)
         //时间排序
         headerView.time_button.rx.tap
@@ -178,6 +266,43 @@ final class StatisticsPageController: BaseGroupTableViewController {
             self.sortType = headerView.student_button.isSelected ? 1:2
             self.switchStatisticsStuCount()
         }).disposed(by: disposeBag)
+        //hide showSelectDateView
+        selectDateViewBgBtn.rx.tap.subscribe ({  [unowned self] (_) in
+            self.showSelectDateView()
+        }).disposed(by: disposeBag)
+        //开始时间 事件
+        selectDateView.startdate_button.rx.tap.subscribe ({  [unowned self] (_) in
+            self.showPGDatePickManager(tag: 1)
+        }).disposed(by: disposeBag)
+        //结束时间 事件
+        selectDateView.enddate_button.rx.tap.subscribe ({  [unowned self] (_) in
+            self.showPGDatePickManager(tag: 2)
+        }).disposed(by: disposeBag)
+        //本月
+        selectDateView.month_button.rx.tap.subscribe ({  [unowned self] (_) in
+            selectDateView.selectItemIndex(index: 0)
+        }).disposed(by: disposeBag)
+        //上月
+        selectDateView.lastmonth_button.rx.tap.subscribe ({  [unowned self] (_) in
+            selectDateView.selectItemIndex(index: 1)
+        }).disposed(by: disposeBag)
+        //近3月
+        selectDateView.threemonth_button.rx.tap.subscribe ({  [unowned self] (_) in
+            selectDateView.selectItemIndex(index: 2)
+        }).disposed(by: disposeBag)
+        //本年
+        selectDateView.year_button.rx.tap.subscribe ({  [unowned self] (_) in
+            selectDateView.selectItemIndex(index: 3)
+        }).disposed(by: disposeBag)
+        //重置
+        selectDateView.reset_button.rx.tap.subscribe ({  [unowned self] (_) in
+            self.resetHandledo()
+        }).disposed(by: disposeBag)
+        //确定
+        selectDateView.confirm_button.rx.tap.subscribe ({  [unowned self] (_) in
+            self.confirmHandledo()
+        }).disposed(by: disposeBag)
+        
     }
     func biandView(){
         tableView.delegate = self
@@ -308,20 +433,13 @@ extension StatisticsPageController: PGDatePickerDelegate {
     func datePicker(_ datePicker: PGDatePicker!, didSelectDate dateComponents: DateComponents!) {
         
         print("dateComponents = ", dateComponents)
-        if datePicCount>=2 {
-            self.endDate = String(format: "%02d", dateComponents.year ?? 0)+"-"+String(format: "%02d", dateComponents.month ?? 0)+"-"+String(format: "%02d", dateComponents.day ?? 0)
-            datePicCount=0
-            configUIdata()
-            self.switchStatisticsStuCount()
-        }
-        else {
-            self.startDate = String(format: "%02d", dateComponents.year ?? 0)+"-"+String(format: "%02d", dateComponents.month ?? 0)+"-"+String(format: "%02d", dateComponents.day ?? 0)
-            configUIdata()
-            DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
-                // 在延迟 1 秒后执行的代码
-                self.showPGDatePickManager()
-            }
-            
+        var date = String(format: "%02d", dateComponents.year ?? 0)+"-"+String(format: "%02d", dateComponents.month ?? 0)+"-"+String(format: "%02d", dateComponents.day ?? 0)
+        date = getButtonDate(date: date)
+        if datePicker.tag == 1 {
+            self.selectDateView.startdate_button.setTitle(date, for: .normal)
+        }else if datePicker.tag == 2 {
+            self.selectDateView.enddate_button.setTitle(date, for: .normal)
         }
+
     }
 }

+ 167 - 0
JiaPeiManage/Sources/Modulars/Statistics/Views/StatisticsSelectDateView.swift

@@ -0,0 +1,167 @@
+//
+//  StatisticsSelectDateView.swift
+//  JiaPeiManage
+//
+//  Created by Ning.ge on 2023/6/29.
+//
+
+
+final class StatisticsSelectDateView: UIView,NibLoadable {
+    
+    //开始时间
+    @IBOutlet weak var startdate_button: UIButton!
+    //结束时间
+    @IBOutlet weak var enddate_button: UIButton!
+    //本月
+    @IBOutlet weak var month_button: UIButton!
+    //上月
+    @IBOutlet weak var lastmonth_button: UIButton!
+    //3个月
+    @IBOutlet weak var threemonth_button: UIButton!
+    //本年
+    @IBOutlet weak var year_button: UIButton!
+    //重置
+    @IBOutlet weak var reset_button: UIButton!
+    //确定
+    @IBOutlet weak var confirm_button: UIButton!
+    //选中的 btn
+    public var current_button: UIButton!
+    var dateType:DateType = .day
+    var startDate:String = ""
+    var endDate:String = ""
+    var selectIndex = 0
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        //本月
+        month_button.tag = 99+0
+        //上月
+        lastmonth_button.tag = 99+1
+        //3个月
+        threemonth_button.tag = 99+2
+        //本年
+        year_button.tag = 99+3
+        current_button = month_button
+    }
+    //日月年
+    func setDateType(type:DateType){
+        dateType = type
+        switch dateType {
+        case .day:
+            month_button.setTitle("昨日", for: .normal)
+            lastmonth_button.setTitle("今日", for: .normal)
+            threemonth_button.setTitle("本月", for: .normal)
+            year_button.setTitle("上月", for: .normal)
+            current_button.backgroundColor = UIColor("#0B2B4D")!
+            current_button = threemonth_button
+            current_button.backgroundColor = UIColor("#597CA1")!
+        case .month:
+            month_button.setTitle("本月", for: .normal)
+            lastmonth_button.setTitle("上月", for: .normal)
+            threemonth_button.setTitle("近3月", for: .normal)
+            year_button.setTitle("本年", for: .normal)
+            current_button.backgroundColor = UIColor("#0B2B4D")!
+            current_button = threemonth_button
+            current_button.backgroundColor = UIColor("#597CA1")!
+        case .year:
+            month_button.setTitle("本年", for: .normal)
+            lastmonth_button.setTitle("去年", for: .normal)
+            threemonth_button.setTitle("近3年", for: .normal)
+            year_button.setTitle("近5年", for: .normal)
+            current_button.backgroundColor = UIColor("#0B2B4D")!
+            current_button = year_button
+            current_button.backgroundColor = UIColor("#597CA1")!
+        }
+    }
+    //选中 - func
+    func selectItemIndex(index:Int){
+        selectIndex = index
+        let button = self.viewWithTag(99+index) as! UIButton
+//        button.backgroundColor = UIColor("#06203A")!
+        if current_button != button {
+            current_button.backgroundColor = UIColor("#0B2B4D")!
+            button.backgroundColor = UIColor("#597CA1")!
+            current_button = button
+            datehandledo()
+        }
+    }
+    //计算 - 日期
+    func datehandledo(){
+        switch dateType {
+        case .day:
+            dayhandledo()
+        case .month:
+            monthhandledo()
+        case .year:
+            yearhandledo()
+        }
+    }
+    
+    func dayhandledo(){
+        switch selectIndex {
+            case 0:
+            let date = NYDate.getLastDate() //昨日
+            startdate_button.setTitle(date, for: .normal)
+            enddate_button.setTitle(date, for: .normal)
+            case 1:
+            let date = NYDate.getThisDate() //今日
+            startdate_button.setTitle(date, for: .normal)
+            enddate_button.setTitle(date, for: .normal)
+            case 2:
+            let dates = NYDate.getDateMonth()//本月
+            startdate_button.setTitle(dates[0], for: .normal)
+            enddate_button.setTitle(dates[1], for: .normal)
+            case 3:
+            let dates = NYDate.getDateMonthLast()//上月
+            startdate_button.setTitle(dates[0], for: .normal)
+            enddate_button.setTitle(dates[1], for: .normal)
+        default:
+            let date = NYDate.getLastDate() //昨日
+            startdate_button.setTitle(date, for: .normal)
+            enddate_button.setTitle(date, for: .normal)
+        }
+    }
+    
+    func monthhandledo(){
+        var dates = [""]
+        switch selectIndex {
+            case 0:
+            dates = NYDate.getDateMonth()//本月
+            case 1:
+            dates = NYDate.getDateMonthLast()//上月
+            case 2:
+            dates = NYDate.getDateMonthSectionNum(num: -2)//近3月
+            case 3:
+            dates = NYDate.getDateYear() //本年
+        default:
+            let date = NYDate.getLastDate() //昨日
+            startdate_button.setTitle(date, for: .normal)
+            enddate_button.setTitle(date, for: .normal)
+        }
+        startdate_button.setTitle(String(dates[0].prefix(7)), for: .normal)
+        enddate_button.setTitle(String(dates[1].prefix(7)), for: .normal)
+    }
+    
+    func yearhandledo(){
+        var dates = [""]
+        switch selectIndex {
+            case 0:
+            dates = NYDate.getDateYear() //本年
+            case 1:
+            dates = NYDate.getDateYearSectionNum(num: 1)//去年
+            startdate_button.setTitle(String(dates[0].prefix(4)), for: .normal)
+            enddate_button.setTitle(String(dates[0].prefix(4)), for: .normal)
+            return
+            case 2:
+            dates = NYDate.getDateYearSectionNum(num: 2)//近3年
+            case 3:
+            dates = NYDate.getDateYearSectionNum(num: 4)//近5年
+        default:
+            let date = NYDate.getLastDate() //昨日
+            startdate_button.setTitle(date, for: .normal)
+            enddate_button.setTitle(date, for: .normal)
+        }
+        startdate_button.setTitle(String(dates[0].prefix(4)), for: .normal)
+        enddate_button.setTitle(String(dates[1].prefix(4)), for: .normal)
+    }
+    
+}

+ 222 - 0
JiaPeiManage/Sources/Modulars/Statistics/Views/StatisticsSelectDateView.xib

@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina5_9" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="StatisticsSelectDateView" customModule="JiaPeiManage" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="172"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6Tp-GR-x2X">
+                    <rect key="frame" x="15" y="12" width="135" height="30"/>
+                    <color key="backgroundColor" red="0.043137254901960784" green="0.16862745098039217" blue="0.30196078431372547" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="135" id="iwn-BJ-gYz"/>
+                        <constraint firstAttribute="height" constant="30" id="kG9-Ng-eO4"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="2023-03">
+                        <color key="titleColor" red="0.83137254901960778" green="0.8666666666666667" blue="0.90196078431372551" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fte-fZ-a9z">
+                    <rect key="frame" x="225" y="12" width="135" height="30"/>
+                    <color key="backgroundColor" red="0.043137254899999998" green="0.16862745100000001" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="135" id="6ot-Vl-b40"/>
+                        <constraint firstAttribute="height" constant="30" id="Hux-y1-IAS"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="2023-03">
+                        <color key="titleColor" red="0.83137254900000002" green="0.86666666670000003" blue="0.90196078430000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0xF-rg-dtG">
+                    <rect key="frame" x="15" y="70" width="76" height="30"/>
+                    <color key="backgroundColor" red="0.043137254899999998" green="0.16862745100000001" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="76" id="Hu5-Jg-k3N"/>
+                        <constraint firstAttribute="height" constant="30" id="jYP-DV-svF"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="本月">
+                        <color key="titleColor" red="0.83137254900000002" green="0.86666666670000003" blue="0.90196078430000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8OA-08-29x">
+                    <rect key="frame" x="104" y="70" width="76" height="30"/>
+                    <color key="backgroundColor" red="0.043137254899999998" green="0.16862745100000001" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="76" id="eT4-ze-May"/>
+                        <constraint firstAttribute="height" constant="30" id="ipp-uI-Zbo"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="上月">
+                        <color key="titleColor" red="0.83137254900000002" green="0.86666666670000003" blue="0.90196078430000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="54W-Kd-hXg">
+                    <rect key="frame" x="195" y="70" width="76" height="30"/>
+                    <color key="backgroundColor" red="0.043137254899999998" green="0.16862745100000001" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="76" id="t9Q-Vn-09Q"/>
+                        <constraint firstAttribute="height" constant="30" id="uYD-7e-a1y"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="近3月">
+                        <color key="titleColor" red="0.83137254900000002" green="0.86666666670000003" blue="0.90196078430000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ruz-cf-mzq">
+                    <rect key="frame" x="284" y="70" width="76" height="30"/>
+                    <color key="backgroundColor" red="0.043137254899999998" green="0.16862745100000001" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="30" id="EKP-1b-TG9"/>
+                        <constraint firstAttribute="width" constant="76" id="Zyg-kH-0pX"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="本年">
+                        <color key="titleColor" red="0.83137254900000002" green="0.86666666670000003" blue="0.90196078430000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gux-vY-3iZ">
+                    <rect key="frame" x="15" y="115" width="162" height="45"/>
+                    <color key="backgroundColor" red="0.043137254899999998" green="0.16862745100000001" blue="0.30196078430000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="162" id="HGF-BH-FTP"/>
+                        <constraint firstAttribute="height" constant="45" id="kfo-5W-IuW"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="重置">
+                        <color key="titleColor" red="0.83137254900000002" green="0.86666666670000003" blue="0.90196078430000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="1"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                            <color key="value" red="0.22745098039215686" green="0.33725490196078434" blue="0.45098039215686275" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Do2-bK-8Kk">
+                    <rect key="frame" x="198" y="115" width="162" height="45"/>
+                    <color key="backgroundColor" red="0.20784313725490194" green="0.74901960784313726" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="162" id="XfA-Pf-6YK"/>
+                        <constraint firstAttribute="height" constant="45" id="eTv-wd-Mak"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="确定">
+                        <color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="aLRatio" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </button>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="至" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V5H-Oj-PhB">
+                    <rect key="frame" x="169.66666666666666" y="17" width="36" height="21"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="21" id="Txa-v2-hTG"/>
+                        <constraint firstAttribute="width" constant="36" id="nnE-VA-BAq"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <color key="textColor" red="0.18823529411764706" green="0.69019607843137254" blue="0.36078431372549019" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+            </subviews>
+            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
+            <color key="backgroundColor" red="0.023529411764705882" green="0.12549019607843137" blue="0.22745098039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="8OA-08-29x" firstAttribute="leading" secondItem="0xF-rg-dtG" secondAttribute="trailing" constant="13" id="7DS-8U-ZQR"/>
+                <constraint firstAttribute="bottom" secondItem="gux-vY-3iZ" secondAttribute="bottom" constant="12" id="NyJ-mi-95b"/>
+                <constraint firstItem="fte-fZ-a9z" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="12" id="Qgd-y7-GmT"/>
+                <constraint firstItem="0xF-rg-dtG" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="15" id="QiD-8C-LOS"/>
+                <constraint firstItem="6Tp-GR-x2X" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="SYn-c9-l1r"/>
+                <constraint firstItem="V5H-Oj-PhB" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="TOm-sb-EyM"/>
+                <constraint firstItem="gux-vY-3iZ" firstAttribute="top" secondItem="0xF-rg-dtG" secondAttribute="bottom" constant="15" id="XnG-oP-hiD"/>
+                <constraint firstItem="6Tp-GR-x2X" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="12" id="Zul-KO-yzc"/>
+                <constraint firstItem="Do2-bK-8Kk" firstAttribute="top" secondItem="54W-Kd-hXg" secondAttribute="bottom" constant="15" id="Zwq-mR-bWd"/>
+                <constraint firstItem="gux-vY-3iZ" firstAttribute="top" secondItem="8OA-08-29x" secondAttribute="bottom" constant="15" id="eNJ-Pt-EP3"/>
+                <constraint firstItem="Ruz-cf-mzq" firstAttribute="leading" secondItem="54W-Kd-hXg" secondAttribute="trailing" constant="13" id="fPD-Ic-4Ag"/>
+                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="Do2-bK-8Kk" secondAttribute="trailing" constant="15" id="gXw-ed-3KQ"/>
+                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="Ruz-cf-mzq" secondAttribute="trailing" constant="15" id="iuz-Yr-y60"/>
+                <constraint firstAttribute="trailing" secondItem="fte-fZ-a9z" secondAttribute="trailing" constant="15" id="pcz-Q1-8X3"/>
+                <constraint firstItem="gux-vY-3iZ" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="15" id="tws-S7-bw0"/>
+                <constraint firstAttribute="bottom" secondItem="Do2-bK-8Kk" secondAttribute="bottom" constant="12" id="vBC-kG-SbR"/>
+                <constraint firstItem="Do2-bK-8Kk" firstAttribute="top" secondItem="Ruz-cf-mzq" secondAttribute="bottom" constant="15" id="x18-YM-Ic8"/>
+                <constraint firstItem="V5H-Oj-PhB" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="17" id="xrN-3L-Exs"/>
+            </constraints>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <connections>
+                <outlet property="confirm_button" destination="Do2-bK-8Kk" id="Ff6-xl-Y4x"/>
+                <outlet property="enddate_button" destination="fte-fZ-a9z" id="GVR-vD-M2C"/>
+                <outlet property="lastmonth_button" destination="8OA-08-29x" id="8d0-FE-0oA"/>
+                <outlet property="month_button" destination="0xF-rg-dtG" id="HE1-Fs-vcU"/>
+                <outlet property="reset_button" destination="gux-vY-3iZ" id="JwX-DJ-IO3"/>
+                <outlet property="startdate_button" destination="6Tp-GR-x2X" id="naW-ZJ-JA8"/>
+                <outlet property="threemonth_button" destination="54W-Kd-hXg" id="vxn-3y-1bl"/>
+                <outlet property="year_button" destination="Ruz-cf-mzq" id="GSM-Jq-tQW"/>
+            </connections>
+            <point key="canvasLocation" x="64.799999999999997" y="-12.561576354679804"/>
+        </view>
+    </objects>
+</document>

+ 1 - 0
JiaPeiManage/Sources/Modulars/学员/Controllers/MeTraineeSubjectPageViewController.swift

@@ -80,6 +80,7 @@ final class MeTraineeSubjectPageViewController: BaseTableViewController {
                     self.hideLoadAnimation()
                     self.tableView.reloadData()
                     self.stopRefresh()
+                    NotificationCenter.default.post(name: Notification.updateItemTopTotalNameNotification, object: [traineeDataModel.total,Int(self.state)!-1])
                 }, onError: { error in
                     self.stopRefresh()
                 })