Commit c26756ba authored by pete谢兆麟's avatar pete谢兆麟
parents 473e6fae 1ed82272
......@@ -254,6 +254,7 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
if let first = questions.first, surveyContainerModel.defaultAnswers.contains(where: { answer in
answer.questionKey == first.businessKey
}) {
/*
for answer in surveyContainerModel.defaultAnswers {
if let question = questions.first(where: { item in
item.businessKey == answer.questionKey
......@@ -268,6 +269,26 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
self.answerDic[question.id] = options
}
}
*/
for (index, answer) in surveyContainerModel.defaultAnswers.enumerated() {
if let question = questions.first(where: { item in
item.businessKey == answer.questionKey
}) {
displayedQuestions.append(question)
let options = answer.optionKey.compactMap { optionKey in
let option = question.options.first { optionItem in
optionItem.businessKey == optionKey
}
return YHSurveyConditionOptionExtra(extra: "", optionId: option?.id ?? "", title: option?.title ?? "", optionKey: answer.questionKey)
}
self.answerDic[question.id] = options
}
if surveyContainerModel.defaultAnswers.count > index + 1, let lastModel = displayedQuestions.last, let nextQuestion = self.findNextQuestion(allQuestions: self.allQuestions, displayedQuestions: self.displayedQuestions, answerDic: self.answerDic, currentIndex: displayedQuestions.count - 1, currentOptionId: lastModel.id), nextQuestion.businessKey != surveyContainerModel.defaultAnswers[index + 1].questionKey {
self.displayedQuestions.append(nextQuestion)
break
}
}
if let lastModel = displayedQuestions.last, let nextQuestion = self.findNextQuestion(allQuestions: self.allQuestions, displayedQuestions: self.displayedQuestions, answerDic: self.answerDic, currentIndex: displayedQuestions.count - 1, currentOptionId: lastModel.id) {
self.displayedQuestions.append(nextQuestion)
......
......@@ -445,8 +445,7 @@ extension YHPlanViewController: UITableViewDelegate, UITableViewDataSource {
return UITableViewCell()
}
cell3.cases = self.caseArr
cell3.clickBlock = {
[weak self] arr, index in
cell3.clickBlock = { [weak self] arr, index in
guard let self = self else { return }
let vc = YHPlanPolicyDetailViewController()
vc.arr = arr
......
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