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

添加单选的生产时间

parent 8ad1e0f2
...@@ -92,12 +92,17 @@ class ShowTimeSelectView: UIView ,TimeSelectViewDelgate{ ...@@ -92,12 +92,17 @@ class ShowTimeSelectView: UIView ,TimeSelectViewDelgate{
make.centerY.equalTo(kuangV) make.centerY.equalTo(kuangV)
make.left.equalTo(kuangV.snp_left).offset(10*glscale) make.left.equalTo(kuangV.snp_left).offset(10*glscale)
} }
calendarV.moreSelection = moreSelection
calendarV.moreSelection = true
contetV.addSubview(calendarV) contetV.addSubview(calendarV)
calendarV.delegate = self calendarV.delegate = self
} }
var moreSelection:Bool = true {
didSet {
calendarV.moreSelection = moreSelection
}
}
let blackView = UIButton(type: .custom) let blackView = UIButton(type: .custom)
let sureBtn = UIButton(type: .custom) let sureBtn = UIButton(type: .custom)
let contetV = UIView() let contetV = UIView()
...@@ -123,18 +128,36 @@ class ShowTimeSelectView: UIView ,TimeSelectViewDelgate{ ...@@ -123,18 +128,36 @@ class ShowTimeSelectView: UIView ,TimeSelectViewDelgate{
var EndDate: Date! = nil var EndDate: Date! = nil
func selectMoreDate(beginDate: Date, endginDate: Date) { func selectMoreDate(beginDate: Date, endginDate: Date) {
print("选择日期·····") print("选择日期·····")
if moreSelection {
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970 let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970 let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970
timeLbl.text = dayByDouble(sender: timeInterval) + "-" + dayByDouble(sender: timeIntervalEnd) timeLbl.text = dayByDouble(sender: timeInterval) + "-" + dayByDouble(sender: timeIntervalEnd)
EndDate = endginDate EndDate = endginDate
BeginDate = beginDate BeginDate = beginDate
}else{
//单选
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
timeLbl.text = dayByDouble(sender: timeInterval)
EndDate = endginDate
BeginDate = beginDate
}
} }
@objc func sureAction(sender:UIButton) { @objc func sureAction(sender:UIButton) {
print("确定日期·····") print("确定日期·····")
if moreSelection {
if EndDate == nil { if EndDate == nil {
HUD.flash(.label("请选择时间段"), delay: 1.2) HUD.flash(.label("请选择时间段"), delay: 1.2)
return return
} }
}else{
//单选
if BeginDate == nil {
HUD.flash(.label("请选择时间"), delay: 1.2)
return
}
}
self.delegate?.showTimeSelectByData(timeStr: timeLbl.text!, beginDate: BeginDate, endginDate: EndDate) self.delegate?.showTimeSelectByData(timeStr: timeLbl.text!, beginDate: BeginDate, endginDate: EndDate)
self.removeFromSuperview() self.removeFromSuperview()
......
...@@ -210,6 +210,12 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate { ...@@ -210,6 +210,12 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
} }
} }
}else{
//单选
BeginDate = date
EndDate = nil
let dateEnd = BeginDate.addingTimeInterval(TimeInterval(60*60*24 - 1)) //无用处
self.delegate?.selectMoreDate(beginDate: BeginDate, endginDate: dateEnd)
} }
self.configureVisibleCells() self.configureVisibleCells()
...@@ -229,6 +235,12 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate { ...@@ -229,6 +235,12 @@ class TimeSelectView: UIView, FSCalendarDataSource, FSCalendarDelegate {
EndDate = nil EndDate = nil
let dateEnd = BeginDate.addingTimeInterval(TimeInterval(60*60*24 - 1)) let dateEnd = BeginDate.addingTimeInterval(TimeInterval(60*60*24 - 1))
self.delegate?.selectMoreDate(beginDate: BeginDate, endginDate: dateEnd) self.delegate?.selectMoreDate(beginDate: BeginDate, endginDate: dateEnd)
}else{
//单选
BeginDate = date
EndDate = nil
let dateEnd = BeginDate.addingTimeInterval(TimeInterval(60*60*24 - 1)) //无用处
self.delegate?.selectMoreDate(beginDate: BeginDate, endginDate: dateEnd)
} }
self.configureVisibleCells() self.configureVisibleCells()
} }
......
...@@ -344,6 +344,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne ...@@ -344,6 +344,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
func NewOnlyRKCellDateSelect(cell: NewOnlyRKCell) { func NewOnlyRKCellDateSelect(cell: NewOnlyRKCell) {
print("跳转日期选择") print("跳转日期选择")
let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds) let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds)
timeSelectV.moreSelection = false
//把默认值传回去 //把默认值传回去
// if time_start != 0 && time_end != 0{ // if time_start != 0 && time_end != 0{
// var time = TimeInterval(exactly: time_start!) // var time = TimeInterval(exactly: time_start!)
...@@ -358,8 +359,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne ...@@ -358,8 +359,7 @@ class NewRKVc: BaseViewController ,UITableViewDelegate,UITableViewDataSource, Ne
//MARK:--选择时间回调数据 //MARK:--选择时间回调数据
func showTimeSelectByData(timeStr: String, beginDate: Date, endginDate: Date) { func showTimeSelectByData(timeStr: String, beginDate: Date, endginDate: Date) {
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970 let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970 print(timeStr,"生产日期",timeInterval)
print("开始时间",timeInterval,"结束时间",timeIntervalEnd)
} }
func NewOnlyRKCellAddRepord(cell: NewOnlyRKCell) { func NewOnlyRKCellAddRepord(cell: NewOnlyRKCell) {
//添加检测报告 //添加检测报告
......
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