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

添加单选的生产时间

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