Commit b1474863 authored by Steven杜宇's avatar Steven杜宇

// 家庭成员

parent 97e80920
......@@ -12,7 +12,8 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var child:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var isNeedShowError = false
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
lazy var tableView: UITableView = {
......@@ -42,9 +43,8 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女基本信息填写".local
createUI()
loadBasicInfo()
loadInfo()
}
func createUI() {
......@@ -60,7 +60,7 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
}
}
func loadBasicInfo() {
func loadInfo() {
guard let child = child else { return }
items.removeAll()
......@@ -118,8 +118,8 @@ class YHChildBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if child.isNowHaveJob() {
let item11 = YHFormDetailItem(type: .occupationName)
item11.value = child.occupationName
item10.tips = "请请输入职业名称".local
item11.placeHolder = "请输入职业名称".local
item11.tips = "请输入职业名称".local
item11.placeHolder = "请输入职业名称".local
arr1.append(item11)
}
......@@ -262,9 +262,9 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.placeHolder = detailItem.placeHolder
cell.setTips(detailItem.tips, isShow: detailItem.isShowTips)
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -289,7 +289,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
}
if isEditEnd {
self.loadBasicInfo()
self.loadInfo()
save()
}
}
......@@ -302,7 +302,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow: detailItem.isShowTips)
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
}
......@@ -327,7 +327,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let selectItem = answers[index]
self.child?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
self.loadInfo()
save()
}
} else if detailItem.type == .isHaveHkIdentityCard || detailItem.type == .isNowInHK || detailItem.type == .isPreviousMarriageChild { // 是否办理过香港身份证 是否在岗 是否前次婚姻子女
......@@ -351,7 +351,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .isPreviousMarriageChild {
self.child?.setPreviousMarriageChild(option)
}
self.loadBasicInfo()
self.loadInfo()
save()
}
}
......@@ -381,25 +381,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
......@@ -437,7 +419,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else if detailItem.type == .stayHKDate {
self.child?.childInHk.info = date
}
self.loadBasicInfo()
self.loadInfo()
save()
}
......@@ -456,7 +438,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.child?.birthPlace.area = [string2, string3, string4]
self.loadBasicInfo()
self.loadInfo()
save()
}
self.present(vc, animated: true)
......@@ -468,7 +450,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in
guard let self = self else { return }
self.child?.hkIdentity = selectType.title
self.loadBasicInfo()
self.loadInfo()
save()
}
} else if detailItem.type == .occupation { // 职业
......@@ -477,7 +459,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in
guard let self = self else { return }
self.child?.occupation = selectType.title
self.loadBasicInfo()
self.loadInfo()
save()
}
......@@ -490,7 +472,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
let selectMale = (selectType.index == YHFormPickerViewSubType.gender(.male).index)
self.child?.setMale(selectMale)
self.loadBasicInfo()
self.loadInfo()
save()
}
} else if detailItem.type == .marriageState { // 婚姻
......@@ -499,7 +481,7 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] selectType in
guard let self = self else { return }
self.child?.married = selectType.title
self.loadBasicInfo()
self.loadInfo()
save()
}
}
......@@ -527,23 +509,64 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
}
extension YHChildBasicInfoVC {
func nextStep()->Bool {
// let isChecked = checkIntegrity()
// isNeedShowError = !isChecked
//
// self.tableView .reloadData()
//
// if !isChecked {
// YHHUD.flash(message: "资料还未填完")
// return false
// }
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let child = child else { return false}
if isEmptyString(child.subsetName)
|| child.sex == 0
|| isEmptyString(child.married)
|| isEmptyString(child.birthday){
return false
}
if child.isBirthOverSeas() {
if isEmptyString(child.birthPlace.foreign) {
return false
}
} else {
if isEmptyArray(child.birthPlace.area) {
return false
}
}
if isEmptyString(child.occupation) {
return false
}
if child.isNowHaveJob(), isEmptyString(child.occupationName) {
return false
}
if child.isNowInHK() {
if isEmptyString(child.childInHk.info) || isEmptyString(child.hkIdentity) {
return false
}
}
if child.isHaveHKIdentityCard() {
if isEmptyString(child.hkIdentityCard) {
return false
}
if let hkIdentityCard = child.hkIdentityCard, !hkIdentityCard.isHKIdentityCardNumber() {
return false
}
}
return true
}
func loadInfo() {
self.tableView.reloadData()
func nextStep()->Bool {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return false
}
return true
}
}
......@@ -64,6 +64,7 @@ class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女信息填写".local
createUI()
}
......
......@@ -12,7 +12,8 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var child:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
var isNeedShowError = false
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
lazy var tableView: UITableView = {
......@@ -43,7 +44,6 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女信息填写".local
createUI()
loadChildInfo()
}
......@@ -56,35 +56,25 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 随行
let title0 = YHFormTitleItem(type: .accompany)
let item00 = YHFormDetailItem(type: .ownCustody)
item00.value = String(child.isOwnCustody())
let item01 = YHFormDetailItem(type: .birthday)
item01.value = child.birthday
let item02 = YHFormDetailItem(type: .isAccompanyToHK)
item02.value = String(child.isFollow())
let item00 = YHFormDetailItem(type: .ownCustody, value:String(child.isOwnCustody()))
let item01 = YHFormDetailItem(type: .birthday, value:child.birthday, tips:"请选择出生日期".local)
let item02 = YHFormDetailItem(type: .isAccompanyToHK, value:String(child.isFollow()))
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02]
items.append(arr0)
if child.isFollow() { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
let item10 = YHFormDetailItem(type: .nationOrArea)
item10.value = child.nationality
item10.placeHolder = "请选择".local
let item10 = YHFormDetailItem(type: .nationOrArea, value:child.nationality, tips: "请选择国籍".local)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
var arr2 = [YHFormItemProtocol]()
let title2 = YHFormTitleItem(type: .liveInfo)
let item20 = YHFormDetailItem(type: .isLiveTother)
item20.value = String(child.isLiveTother())
arr2.append(title2)
arr2.append(item20)
let item20 = YHFormDetailItem(type: .isLiveTother, value:String(child.isLiveTother()))
var arr2: [YHFormItemProtocol] = [title2, item20]
if !child.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = child.address.country
item21.placeHolder = "请选择".local
let item21 = YHFormDetailItem(type: .nationOrArea, value:child.address.country, tips:"请选择国家/地区".local)
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
......@@ -94,23 +84,20 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = child.address.country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
var value = ""
if !child.address.area.isEmpty {
item22.value = child.address.area.joined(separator: "/")
value = child.address.area.joined(separator: "/")
}
item22.placeHolder = "请选择城市".local
let item22 = YHFormDetailItem(type: .liveCity, value: value, tips: "请选择现居住城市".local)
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
item23.value = child.address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
let placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
let item23 = YHFormDetailItem(type: .detailAddress, value:child.address.details, placeHolder: placeHolder, tips:placeHolder)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(child.isOverSeasOver1Year())
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year, value:String(child.isOverSeasOver1Year()))
arr2.append(item24)
}
}
......@@ -118,8 +105,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
// 港澳通信证
let title3 = YHFormTitleItem(type: .hkAndMacaoPassport)
let item30 = YHFormDetailItem(type: .isHandleHKPassPort)
item30.value = String(child.isNeedHandleHKPassPort())
let item30 = YHFormDetailItem(type: .isHandleHKPassPort, value: String(child.isNeedHandleHKPassPort()))
let arr3:[YHFormItemProtocol] = [title3, item30]
items.append(contentsOf:[arr1, arr2, arr3])
}
......@@ -273,6 +259,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
return cell
} else if cellType == .inputText { // 输入文字cell
......@@ -281,6 +268,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -316,30 +304,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .isLiveTother ||
detailItem.type == .isAccompanyToHK ||
detailItem.type == .isHandleHKPassPort ||
detailItem.type == .ownCustody ||
detailItem.type == .isLiveOverSeasMore1Year
{
return UITableView.automaticDimension
}
}
return 52.0
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
......@@ -441,6 +406,10 @@ extension YHChildPrimaryInfoVC {
return true
}
if isEmptyString(child.birthday) {
return false
}
if isEmptyString(child.nationality) {
return false
}
......@@ -457,15 +426,15 @@ extension YHChildPrimaryInfoVC {
}
func nextStep()->Bool {
// let isChecked = checkIntegrity()
// isNeedShowError = !isChecked
//
// self.tableView .reloadData()
//
// if !isChecked {
// YHHUD.flash(message: "资料还未填完")
// return false
// }
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
return false
}
return true
}
......
......@@ -59,7 +59,6 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "配偶基本信息填写".local
createUI()
loadInfo()
}
......@@ -241,6 +240,21 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
}
}
}
if spouse.isNowInHK() {
if isEmptyString(spouse.childInHk.info) || isEmptyString(spouse.hkIdentity) {
return false
}
}
if spouse.isHaveHKIdentityCard() {
if isEmptyString(spouse.hkIdentityCard) {
return false
}
if let hkIdentityCard = spouse.hkIdentityCard, !hkIdentityCard.isHKIdentityCardNumber() {
return false
}
}
return true
}
......@@ -249,7 +263,7 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
......
......@@ -87,6 +87,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "配偶信息填写".local
createUI()
}
......@@ -94,6 +95,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
guard let spouse = spouse else { return }
primaryInfoVC.delegate = self
certificateVC.delegate = self
basicInfoVC.delegate = self
......
......@@ -42,7 +42,6 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "配偶信息填写".local
createUI()
loadInfo()
}
......@@ -220,10 +219,9 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.placeHolder = detailItem.placeHolder
cell.detail = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell
}
......@@ -231,10 +229,9 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder
cell.setTips(detailItem.tips, isShow:detailItem.isShowTips)
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......@@ -374,7 +371,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let isChecked = checkIntegrity()
isNeedShowError = !isChecked
self.tableView .reloadData()
loadInfo()
if !isChecked {
YHHUD.flash(message: "资料还未填完")
......
......@@ -350,24 +350,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......
......@@ -44,7 +44,6 @@ class YHCertificateInfoController: YHBaseViewController, YHFamilyMemberProtol {
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "证件信息填写".local
createUI()
loadInfo()
}
......@@ -247,20 +246,7 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
......
......@@ -409,24 +409,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0.0 }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
let item = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
return 52.0
}
if item is YHFormAddItem {
return 70.0
}
if item is YHFormDetailItem {
return UITableView.automaticDimension
}
return 52.0
return UITableView.automaticDimension
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......
......@@ -48,12 +48,14 @@ class YHFormItemDegreeInfoCell: UITableViewCell {
var degree:String? {
didSet {
degreeView.detail = degree
degreeView.setTips("请选择学位", isShow: isEmptyString(degree))
}
}
var degreePlace:String? {
didSet {
areaView.detail = degreePlace
areaView.setTips("请选择颁发地区", isShow: isEmptyString(degreePlace))
}
}
......
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