Commit 4b7225bd authored by pete谢兆麟's avatar pete谢兆麟

产品走查问题 删除按钮弹窗添加

parent a8214da1
...@@ -39,6 +39,21 @@ class YHCommonAlertView: UIView { ...@@ -39,6 +39,21 @@ class YHCommonAlertView: UIView {
self.messageLabel.text = message self.messageLabel.text = message
self.disAgressButton.setTitle(leftButtonString, for: .normal) self.disAgressButton.setTitle(leftButtonString, for: .normal)
self.agreeButton.setTitle(rightButtonString, for: .normal) self.agreeButton.setTitle(rightButtonString, for: .normal)
if title?.count == 0 || title == nil {
centerView.snp.remakeConstraints { make in
make.center.equalToSuperview()
make.width.equalTo(299)
make.height.equalTo(164)
}
messageLabel.snp.remakeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.height.equalTo(42)
make.top.equalTo(40)
}
}
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
......
...@@ -30,7 +30,11 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -30,7 +30,11 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
var string = "" var string = ""
let array = mainModel.address.area let array = mainModel.address.area
for item in array { for item in array {
string = string + item if string.count != 0 {
string = string + "/" + item
} else {
string = string + item
}
} }
let item1 = YHItemModel(id: .id3, isNeed: true, title: "省市地区", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择省市地区") let item1 = YHItemModel(id: .id3, isNeed: true, title: "省市地区", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择省市地区")
let item2 = YHItemModel(id: .id4, isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请填写小区、楼栋、单元室等", message: mainModel.address.details, isShowPrompts: isShowPrompt, alertMessage:"请填写小区、楼栋、单元室等") let item2 = YHItemModel(id: .id4, isNeed: true, title: "详细地址", isUserKeyBoard: true, prompts: "请填写小区、楼栋、单元室等", message: mainModel.address.details, isShowPrompts: isShowPrompt, alertMessage:"请填写小区、楼栋、单元室等")
...@@ -95,7 +99,11 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -95,7 +99,11 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
var string = "" var string = ""
let array = mainModel.birth_place.area let array = mainModel.birth_place.area
for item in array { for item in array {
string = string + item if string.count != 0 {
string = string + "/" + item
} else {
string = string + item
}
} }
let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择出生城市;") let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择出生城市;")
......
...@@ -118,6 +118,15 @@ class YHWorkExperienceListViewController: YHBaseViewController { ...@@ -118,6 +118,15 @@ class YHWorkExperienceListViewController: YHBaseViewController {
} }
}) })
} }
func showDeleteAlert(_ model: YHWorkItemListModel) {
YHCommonAlertView.show("", "您确定要删除这份工作经验吗?", "取消", "确认") {
self.viewModel?.requestDeleteWorkExperience("\(model.id ?? 0)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.getData()
})
}
}
} }
extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDataSource { extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDataSource {
...@@ -148,10 +157,7 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa ...@@ -148,10 +157,7 @@ extension YHWorkExperienceListViewController: UITableViewDelegate, UITableViewDa
} }
cell.deleteBlock = {[weak self] model in cell.deleteBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.viewModel?.requestDeleteWorkExperience("\(model.id ?? 0)", callBackBlock: {[weak self] success, error in self.showDeleteAlert(model)
guard let self = self else { return }
self.getData()
})
} }
cell.isMoreBlock = {[weak self] isMore in cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -198,6 +198,30 @@ class YHWorkExperienceViewController: YHBaseViewController { ...@@ -198,6 +198,30 @@ class YHWorkExperienceViewController: YHBaseViewController {
} }
} }
func showDeleteAlert(_ model: YHWorkExperienceProjectModel) {
YHCommonAlertView.show("", "确定要删除该项目介绍吗?", "取消", "确认") {[weak self] in
guard let self = self else { return }
self.viewModel?.requestDeleteWorkExperienceProject("\(model.id ?? 0)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.getData()
})
}
}
func showDeleteAlert(_ model: YHWorkExperienceFileModel) {
YHCommonAlertView.show("", "确定要删除吗?", "取消", "确认") {[weak self] in
guard let self = self else { return }
for i in 0..<(self.fileDataSource?.count ?? 0) {
let data = self.fileDataSource?[i]
if data?.fileName == model.fileName {
self.fileDataSource?.remove(at: i)
self.tableView.reloadData()
self.viewModel.mainModel.file = self.fileDataSource ?? []
}
}
}
}
deinit { deinit {
NotificationCenter.default.removeObserver(self) NotificationCenter.default.removeObserver(self)
} }
...@@ -323,10 +347,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -323,10 +347,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
} }
cell.deleteBlock = {[weak self] model in cell.deleteBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
self.viewModel?.requestDeleteWorkExperienceProject("\(model.id ?? 0)", callBackBlock: {[weak self] success, error in self.showDeleteAlert(model)
guard let self = self else { return }
self.getData()
})
} }
cell.isMoreBlock = {[weak self] isMore in cell.isMoreBlock = {[weak self] isMore in
guard let self = self else { return } guard let self = self else { return }
...@@ -380,15 +401,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -380,15 +401,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
cell.experienceListBlock = {[weak self] model, type in cell.experienceListBlock = {[weak self] model, type in
guard let self = self else { return } guard let self = self else { return }
if type == .delete { if type == .delete {
for i in 0..<(self.fileDataSource?.count ?? 0) { self.showDeleteAlert(model)
let data = self.fileDataSource?[i]
if data?.fileName == model.fileName {
self.fileDataSource?.remove(at: i)
self.tableView.reloadData()
self.viewModel.mainModel.file = self.fileDataSource ?? []
return
}
}
} else { } else {
let vc = YHImageViewController() let vc = YHImageViewController()
vc.imgString = model.fileUrl vc.imgString = model.fileUrl
...@@ -435,15 +448,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo ...@@ -435,15 +448,7 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
cell.experienceListBlock = {[weak self] model, type in cell.experienceListBlock = {[weak self] model, type in
guard let self = self else { return } guard let self = self else { return }
if type == .delete { if type == .delete {
for i in 0..<(self.fileDataSource?.count ?? 0) { self.showDeleteAlert(model)
let data = self.fileDataSource?[i]
if data?.fileName == model.fileName {
self.fileDataSource?.remove(at: i)
self.tableView.reloadData()
self.viewModel.mainModel.file = self.fileDataSource ?? []
return
}
}
} else { } else {
let vc = YHImageViewController() let vc = YHImageViewController()
vc.imgString = model.fileUrl vc.imgString = model.fileUrl
......
...@@ -100,7 +100,7 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -100,7 +100,7 @@ class YHWorkIntroductionViewController: YHBaseViewController {
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52) make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52)
make.left.equalTo(117) make.left.equalTo(117)
make.height.equalTo(51) make.height.equalTo(51)
make.width.equalTo(80) make.width.equalTo(90)
} }
let startButton = { let startButton = {
...@@ -113,7 +113,7 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -113,7 +113,7 @@ class YHWorkIntroductionViewController: YHBaseViewController {
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52) make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52)
make.left.equalTo(117) make.left.equalTo(117)
make.height.equalTo(51) make.height.equalTo(51)
make.width.equalTo(80) make.width.equalTo(90)
} }
endTextField = { endTextField = {
...@@ -130,7 +130,7 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -130,7 +130,7 @@ class YHWorkIntroductionViewController: YHBaseViewController {
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52) make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52)
make.right.equalTo(-18) make.right.equalTo(-18)
make.height.equalTo(51) make.height.equalTo(51)
make.width.equalTo(80) make.width.equalTo(90)
} }
let endButton = { let endButton = {
...@@ -143,7 +143,7 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -143,7 +143,7 @@ class YHWorkIntroductionViewController: YHBaseViewController {
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52) make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 52)
make.right.equalTo(-18) make.right.equalTo(-18)
make.height.equalTo(51) make.height.equalTo(51)
make.width.equalTo(80) make.width.equalTo(90)
} }
let lineView = UIView() let lineView = UIView()
...@@ -276,17 +276,21 @@ class YHWorkIntroductionViewController: YHBaseViewController { ...@@ -276,17 +276,21 @@ class YHWorkIntroductionViewController: YHBaseViewController {
} }
viewModel?.saveWorkProjectDetail(workModel ?? YHWorkExperienceDetailModel(), projectModel: dataSource, callBackBlock: {[weak self] success, error in viewModel?.saveWorkProjectDetail(workModel ?? YHWorkExperienceDetailModel(), projectModel: dataSource, callBackBlock: {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if let block = self.saveBlock { if success {
block() if let block = self.saveBlock {
block()
}
self.navigationController?.popViewController(animated: true)
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
} }
self.navigationController?.popViewController(animated: true)
}) })
} }
@objc func startClick() { @objc func startClick() {
view.endEditing(true) view.endEditing(true)
YHDatePickView.show(type: .yyyymmdd, title: "请选择开始时间") { date in YHDatePickView.show(type: .yyyymmdd, title: "请选择开始时间") { date in
if date > self.dataSource.project_end_time ?? "" { if date > self.dataSource.project_end_time ?? "" && self.dataSource.project_end_time?.count ?? 0 > 0 {
self.startTextField.text = "" self.startTextField.text = ""
self.dataSource.project_start_time = "" self.dataSource.project_start_time = ""
YHHUD.flash(message: "开始时间不能晚于结束时间") YHHUD.flash(message: "开始时间不能晚于结束时间")
......
...@@ -45,7 +45,7 @@ class YHWorkIntroductionItemView: UIView { ...@@ -45,7 +45,7 @@ class YHWorkIntroductionItemView: UIView {
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview() make.left.equalToSuperview()
make.top.equalTo(16) make.top.equalTo(16)
make.width.equalTo(200) make.right.equalTo(-30)
make.height.equalTo(20) make.height.equalTo(20)
} }
......
...@@ -26,7 +26,11 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -26,7 +26,11 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
var string = "" var string = ""
let array = mainModel.location.area let array = mainModel.location.area
for item in array { for item in array {
string = string + item if string.count != 0 {
string = string + "/" + item
} else {
string = string + item
}
} }
let item5 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "工作城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区") let item5 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "工作城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
let item55 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "工作城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.location.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入工作国家/地区") let item55 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "工作城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.location.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入工作国家/地区")
...@@ -84,7 +88,7 @@ class YHWorkExperienceViewModel: YHBaseViewModel { ...@@ -84,7 +88,7 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
case .id8: // 职位 case .id8: // 职位
mainModel.position = item.message ?? "" mainModel.position = item.message ?? ""
case .id9: // 入职年月 case .id9: // 入职年月
if item.message ?? "" > mainModel.departure_time { if item.message ?? "" > mainModel.departure_time && mainModel.departure_time.count != 0 {
mainModel.entry_time = "" mainModel.entry_time = ""
if item.message != "" { if item.message != "" {
YHHUD.flash(message: "入职日期不能晚于离职日期") YHHUD.flash(message: "入职日期不能晚于离职日期")
......
...@@ -39,7 +39,7 @@ class YHWorkIntroductionViewModel: YHBaseViewModel { ...@@ -39,7 +39,7 @@ class YHWorkIntroductionViewModel: YHBaseViewModel {
} }
// 0保存 1下一步 // 0保存 1下一步
func saveWorkProjectDetail(_ workModel: YHWorkExperienceDetailModel, projectModel: YHWorkExperienceProjectModel, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) { func saveWorkProjectDetail(_ workModel: YHWorkExperienceDetailModel, projectModel: YHWorkExperienceProjectModel, callBackBlock:@escaping (_ success: Bool, _ error:YHErrorModel?)->()) {
let params: [String : Any] = ["id": projectModel.id ?? 0, let params: [String : Any] = ["id": projectModel.id ?? 0,
"order_id": workModel.order_id, "order_id": workModel.order_id,
"work_id": workModel.id, "work_id": workModel.id,
......
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