Commit 702df35c by Kim Gyeongeun

#56952 設問設定機能追加(チェックボックス動作バグ修正)

parent 9485d874
...@@ -321,23 +321,41 @@ public class QuestionService extends AbstractService<Question> { ...@@ -321,23 +321,41 @@ public class QuestionService extends AbstractService<Question> {
*/ */
public void setQuestionDisable(List<Question> questionList) { public void setQuestionDisable(List<Question> questionList) {
HashMap<Integer, Integer> requiredQuestionInfo = new HashMap<Integer, Integer>(); HashMap<Integer, Integer> requiredQuestionInfo = new HashMap<Integer, Integer>();
List<Integer> defaultAnswerIdList = new ArrayList<Integer>();
//初期表示情報セット //初期表示情報セット
for (Question question : questionList) { for (Question question : questionList) {
for (Answer answer : question.answerList) { for (Answer answer : question.answerList) {
if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo == 0 && requiredQuestionInfo.get(answer.answerId) == null) { if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo == 0 && requiredQuestionInfo.get(answer.answerId) == null) {
if (answer.defaultFlg == 0 && StringUtil.isBlank(answer.answerIdValue)) {continue;} if (answer.defaultFlg == 0 && StringUtil.isBlank(answer.answerIdValue)) {continue;}
requiredQuestionInfo.put(answer.answerId, 1); //条件付回答設定の選択した値
if (answer.defaultFlg == 0 && StringUtil.isNotBlank(answer.answerIdValue)) {
requiredQuestionInfo.put(answer.answerId, 1);
}
//条件付回答設定のデフォルト値
if (answer.defaultFlg == 1) {
defaultAnswerIdList.add(answer.answerId);
}
} }
} }
} }
//条件付回答設定IDがない場合、デフォルト値の回答IDをセット
if (requiredQuestionInfo.isEmpty() && CollectionUtils.isNotEmpty(defaultAnswerIdList)) {
for (Integer defaultAnswerId : defaultAnswerIdList) {
requiredQuestionInfo.put(defaultAnswerId, 1);
}
}
for (Question question : questionList) { for (Question question : questionList) {
//条件付必須チェック(初期画面表示・非表示セット) //条件付必須チェック(初期画面表示・非表示セット)
if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo != 0 if (question.condRequiredQuestionNo != null && question.condRequiredQuestionNo != 0
&& StringUtils.isNotBlank(question.condRequiredAnswer)) { && StringUtils.isNotBlank(question.condRequiredAnswer)) {
List<String> requiredAnswerIdList = new ArrayList<String>(Arrays.asList(question.condRequiredAnswer.split(","))); List<String> requiredAnswerIdList = new ArrayList<String>(Arrays.asList(question.condRequiredAnswer.split(",")));
for (String requiredAnswerId : requiredAnswerIdList) { for (String requiredAnswerId : requiredAnswerIdList) {
question.questionInitDisable = (requiredQuestionInfo.get(IntegerConversionUtil.toInteger(requiredAnswerId)) == null) ? if (requiredQuestionInfo.get(IntegerConversionUtil.toInteger(requiredAnswerId)) == null) {
SinaburoConstant.initDisable.YES : SinaburoConstant.initDisable.NO; question.questionInitDisable = SinaburoConstant.initDisable.YES;
} else {
question.questionInitDisable = SinaburoConstant.initDisable.NO;
return;
}
} }
} }
} }
......
...@@ -39,7 +39,23 @@ $(function() { ...@@ -39,7 +39,23 @@ $(function() {
if ("${question.controlId}" == "0" || "${question.controlId}" == "1") { if ("${question.controlId}" == "0" || "${question.controlId}" == "1") {
$("#${answer.answerId}").attr("checked", false); $("#${answer.answerId}").attr("checked", false);
$("#${answer.answerId}").attr("disabled", true); $("#${answer.answerId}").attr("disabled", true);
} else if ("${question.controlId}" == "2") { } else if ($(this).attr("type") == "radio" && "${question.controlId}" == "2") {
if ($(this).is(":checked")) {
var array = "${question.condRequiredAnswer}".split(",");
var judgeDisable = true;
for (let i in array) {
if ($("#" + array[i]).is(":checked")) {
judgeDisable = false;
break;
}
}
if (judgeDisable) {
$("#${question.questionId}").val('');
$("#${question.questionId}").attr("disabled", true);
}
} else {
$("#${question.questionId}").attr("disabled", false);
}
} else if ("${question.controlId}" == "3" || "${question.controlId}" == "4" || "${question.controlId}" == "6") { } else if ("${question.controlId}" == "3" || "${question.controlId}" == "4" || "${question.controlId}" == "6") {
$("#${question.questionId}").val(''); $("#${question.questionId}").val('');
$("#${question.questionId}").attr("disabled", true); $("#${question.questionId}").attr("disabled", true);
......
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