Commit 88948f34 authored by lujunye's avatar lujunye

修复刷新数据bug.

parent c2fa930d
......@@ -15,8 +15,8 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
didSet{
if is_gys{
title_lbl.text = "新增供应商"
loadData()
}
loadData()
}
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
......@@ -38,34 +38,33 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
func loadData(){
print("1")
HUD.flash(.progress)
if title_lbl.text == "新增供应商" {
if is_gys {
print("2")
if gys_centers.count == 0 {
getSupShop(["user_token":UserToken as Any]) { (data) in
let model = data as! getSupShopModel
model.data?.forEach({ (item) in
self.gys_centers.append(item)
})
self.bottom_tableview.reloadData()
HUD.hide()
} failture: { (err) in
getSupShop(["user_token":UserToken as Any]) { (data) in
let model = data as! getSupShopModel
model.data?.forEach({ (item) in
self.gys_centers.append(item)
})
self.bottom_tableview.reloadData()
HUD.hide()
} failture: { (err) in
}
}
return
}else{
print("3")
if centers.count == 0 {
getDbtShop(["user_token":UserToken as Any]) { (data) in
let model = data as! getDbtShopModel
model.data?.forEach({ (item) in
self.centers.append(item)
})
self.bottom_tableview.reloadData()
HUD.hide()
} failture: { (err) in
getDbtShop(["user_token":UserToken as Any]) { (data) in
let model = data as! getDbtShopModel
model.data?.forEach({ (item) in
self.centers.append(item)
})
self.bottom_tableview.reloadData()
HUD.hide()
} failture: { (err) in
}
}
......@@ -124,7 +123,7 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
cell.selectBtn.isSelected = false
}
}
return cell
}
......@@ -149,7 +148,7 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView != bottom_tableview {
bottom_tableview.isHidden = true
bottom_tableview.isHidden = true
}
}
......@@ -190,11 +189,19 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
if sender.tag == 0 {
var shop_id = ""
var d:Array<String> = []
datas.forEach { (str) in
let results = datas.enumerated().filter { (index,value) -> Bool in
return datas.firstIndex(of: value) == index
}.map {
$0.element
}
results.forEach { (str) in
if str != "" {
d.append(str)
}
}
if title_lbl.text == "新增供应商" {
for i in 0 ..< d.count{
let str = d[i]
......@@ -223,6 +230,7 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
}
for i in 0 ..< d.count{
let str = d[i]
centers.forEach { (item) in
if item.shop_name == str {
if i < d.count-1 {
......@@ -274,7 +282,7 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
bottom_tableview.separatorStyle = .none
bottom_tableview.register(UINib(nibName: "TitleAndSelectCell", bundle: nil), forCellReuseIdentifier: "TitleAndSelectCell")
loadData()
// loadData()
}
// /初始化时将xib中的view添加进来
required init?(coder aDecoder: NSCoder) {
......@@ -302,3 +310,4 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
return view
}
}
......@@ -50,6 +50,8 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
alertView.bottom_tableview.isHidden = true
if title_str != "分销商管理" {
alertView.is_gys = true
}else{
alertView.is_gys = false
}
self.view.window?.addSubview(alertView)
}
......
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