Commit 8b8288e7 authored by Steven杜宇's avatar Steven杜宇

// 家庭成员

parent 2145b69b
......@@ -270,19 +270,19 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
guard let self = self else { return }
if detailItem.type == .childName {
self.child?.subsetName = text
self.child?.subsetName = text ?? ""
} else if detailItem.type == .everName {
self.child?.usedName = text
self.child?.usedName = text ?? ""
} else if detailItem.type == .befourMarryFirstName {
self.child?.surname = text
self.child?.surname = text ?? ""
} else if detailItem.type == .birthCity {
self.child?.birthPlace?.foreign = text
} else if detailItem.type == .occupationName {
self.child?.occupationName = text
self.child?.occupationName = text ?? ""
} else if detailItem.type == .hkIdentityCardNumber {
self.child?.hkIdentityCard = text
......
......@@ -147,8 +147,8 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var arr2:[YHFormItemProtocol] = [title2, item20]
if spouse.isHaveDegree() { // 选择了有学位
if let degreeArr = spouse.hasDegreeJson, !degreeArr.isEmpty {
for degreeInfo in degreeArr {
if !spouse.hasDegreeJson.isEmpty {
for degreeInfo in spouse.hasDegreeJson {
let item = YHFormDetailItem(type: .degreeDetailInfo)
arr2.append(item)
}
......@@ -233,8 +233,8 @@ class YHSpouseBasicInfoVC: YHBaseViewController, YHFamilyMemberProtol {
}
if spouse.isHaveDegree() { // 选择了有学位
if let degreeArr = spouse.hasDegreeJson, !degreeArr.isEmpty {
for degreeInfo in degreeArr {
if !spouse.hasDegreeJson.isEmpty {
for degreeInfo in spouse.hasDegreeJson {
if isEmptyString(degreeInfo.degree) || isEmptyString(degreeInfo.address) {
return false
}
......@@ -348,7 +348,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] in
guard let self = self else { return }
let newDegree = YHHasDegreeJson()
self.spouse?.hasDegreeJson?.append(newDegree)
self.spouse?.hasDegreeJson.append(newDegree)
self.loadBasicInfo()
}
return cell
......@@ -380,15 +380,15 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .spouseName {
self.spouse?.subsetName = text
self.spouse?.subsetName = text ?? ""
} else if detailItem.type == .everName {
self.spouse?.usedName = text
self.spouse?.usedName = text ?? ""
} else if detailItem.type == .befourMarryFirstName {
self.spouse?.surname = text
self.spouse?.surname = text ?? ""
} else if detailItem.type == .birthCity {
self.spouse?.birthPlace?.foreign = text
} else if detailItem.type == .occupationName {
self.spouse?.occupationName = text
self.spouse?.occupationName = text ?? ""
} else if detailItem.type == .hkIdentityCardNumber {
self.spouse?.hkIdentityCard = text
}
......@@ -516,7 +516,7 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.deleteBlock = {
[weak self] in
guard let self = self else { return }
self.spouse?.hasDegreeJson?.remove(at: indexPath.row-2)
self.spouse?.hasDegreeJson.remove(at: indexPath.row-2)
self.loadBasicInfo()
}
}
......
......@@ -173,38 +173,51 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
}
extension YHSpouseInfoContainerVC {
func saveInfo() {
func saveInfo(isSubmit:Bool, callBack:((Bool, String?)->Void)?) {
guard let spouse = spouse else { return }
guard let info = spouse.toDictionary() else { return }
let dict:[String: Any] = ["orderId":spouse.orderId,
"relation":spouse.relationType.rawValue,
let dict:[String: Any] = ["order_id":spouse.orderId,
"relation":spouse.relation,
"step":spouse.step,
"next":false,
"next":isSubmit,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { [weak self] success, error in
guard let self = self else { return }
if success {
if let callBack = callBack {
callBack(success, error?.errorMsg)
}
}
}
func saveInfo() {
saveInfo(isSubmit: false, callBack:nil)
}
func submit() {
if let targetVC = getCurrentStepViewController() {
if targetVC.nextStep() {
// 当前步骤已是最后一步
if let vc = stepVCs.last, vc.step == currentStep {
YHHUD.flash(message: "已经是最后一步!")
return
}
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
saveInfo(isSubmit: true) {
[weak self] success, tips in
guard let self = self else { return }
if success {
// 当前步骤已是最后一步
if let vc = stepVCs.last, vc.step == currentStep {
YHHUD.flash(message: "已经是最后一步!")
return
}
if let cur = getArrayIndexOfCurrentStep(), let item = stepVCs[safe:cur+1] {
currentStep = item.step
}
print("currentIndex:\(currentStep)")
}
}
print("currentIndex:\(currentStep)")
}
}
}
......
......@@ -237,13 +237,13 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .brotherName {
self.brotherInfo?.subsetName = text
self.brotherInfo?.subsetName = text ?? ""
} else if detailItem.type == .birthCity {
self.brotherInfo?.birthPlace?.foreign = text
} else if detailItem.type == .occupationName {
self.brotherInfo?.occupationName = text
self.brotherInfo?.occupationName = text ?? ""
} else if detailItem.type == .hkIdentityCardNumber {
self.brotherInfo?.hkIdentityCard = text
......
......@@ -401,8 +401,8 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
if (indexPath.row-1 >= childCount) { return }
guard let child = self.familyMemberInfo?.child?[indexPath.row-1] else { return }
var name = String(format: "子女%d", indexPath.row)
if let subsetName = detailItem.subsetName, !subsetName.isEmpty {
name += "(\(subsetName))"
if !detailItem.subsetName.isEmpty {
name += "(\(detailItem.subsetName))"
}
let msg = String(format: "确定要删除%@吗?".local, name)
......@@ -429,8 +429,8 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
if (indexPath.row-1 >= brotherCount) { return }
guard let brother = self.familyMemberInfo?.brother?[indexPath.row-1] else { return }
var name = String(format: "兄弟姐妹%d", indexPath.row)
if let subsetName = detailItem.subsetName, !subsetName.isEmpty {
name += "(\(subsetName))"
if !detailItem.subsetName.isEmpty {
name += "(\(detailItem.subsetName))"
}
let msg = String(format: "确定要删除%@吗?".local, name)
......
......@@ -297,13 +297,13 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
if detailItem.type == .fatherName || detailItem.type == .motherName {
self.parentInfo?.subsetName = text
self.parentInfo?.subsetName = text ?? ""
} else if detailItem.type == .birthCity {
self.parentInfo?.birthPlace?.foreign = text
} else if detailItem.type == .occupationName {
self.parentInfo?.occupationName = text
self.parentInfo?.occupationName = text ?? ""
} else if detailItem.type == .hkIdentityCardNumber {
self.parentInfo?.hkIdentityCard = text
......
......@@ -882,43 +882,43 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
var id: Int = 0
var deceased: Int = 0
var custody: Int = 0
var nationality: String?
var nationality: String = ""
var orderId: Int = 0
var relation: String?
var hasDegree: String?
var hasDegreeJson: [YHHasDegreeJson]?
var relation: String = ""
var hasDegree: String = ""
var hasDegreeJson: [YHHasDegreeJson] = []
var follow: Int = 0
var statement: Int = 0
var subsetName: String?
var subsetNamePinyin: YHSubsetNamePinyin?
var birthday: String?
var subsetName: String = ""
var subsetNamePinyin: YHSubsetNamePinyin = YHSubsetNamePinyin()
var birthday: String = ""
var birthPlaceAboard: Int = 0
var birthPlace: YHAddress? = YHAddress()
var occupation: String?
var occupationName: String?
var operatorName: String?
var occupation: String = ""
var occupationName: String = ""
var operatorName: String = ""
var childHasHkId: YHChildStepchildClass = YHChildStepchildClass()
var hkIdentityCard: String?
var sex: Int = 0
var married: String?
var married: String = ""
var nows: Int = 0
var address: YHAddress?
var childStepchild: YHChildStepchildClass = YHChildStepchildClass()
var childInHk: YHChildStepchildClass = YHChildStepchildClass()
var countryIdentity: YHChildStepchildClass?
var hkIdentity: String?
var liveCountry: String?
var countryIdentity: YHChildStepchildClass = YHChildStepchildClass()
var hkIdentity: String = ""
var liveCountry: String = ""
var finishFollow: Int = 0
var step: Int = 0
var isHandled: Int = 0
var notFillNumber: Int = 0
var certificates: YHCertificates?
var usedName: String?
var hkIdentityOther: String?
var usedName: String = ""
var hkIdentityOther: String = ""
var isHkHandled: Int = 0
var isInHk: Int = 0
var isLiveOverseaYear: Int = 0
var surname: String?
var surname: String = ""
enum CodingKeys: String, CodingKey {
case id = "id"
......
......@@ -7,7 +7,24 @@
//
import UIKit
import SmartCodable
class TestOne: SmartCodable {
var one: TestTwo = TestTwo()
var next:Int = 0
required init() {
}
}
class TestTwo: SmartCodable {
var id:Int = 1
var name:String = "dy"
required init() {
}
}
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