@wg-npm/survey-response 0.3.22801 → 0.3.22809
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/survey-response.esm.js +37 -37
- package/package.json +5 -5
- package/src/components/question/type/fill-blank.vue +1 -1
- package/src/components/question/type/matrix.vue +4 -2
- package/src/components/question/type/multi-selection.vue +6 -2
- package/src/components/question/type/short-answer.vue +1 -1
- package/src/components/question/type/single-selection.vue +13 -11
- package/src/components/survey-response.vue +12 -14
|
@@ -362,11 +362,13 @@ const __vue_script__$d = script$d;
|
|
|
362
362
|
|
|
363
363
|
/* template */
|
|
364
364
|
var __vue_render__$d = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
365
|
-
required: _vm.question.options.required,
|
|
365
|
+
required: _vm.question.options.required && !_vm.question.options.disabled,
|
|
366
366
|
type: 'array',
|
|
367
367
|
min: 1,
|
|
368
368
|
message: _vm.t('survey_response.question.question_required'),
|
|
369
|
-
}}},[_c('CheckboxGroup',{on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", $$v);},expression:"value.answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout,staticStyle:{"display":"flex"}},[_c('Checkbox',{key:choice.id,attrs:{"label":choice.id,"disabled":_vm.question.options.readonly ||
|
|
369
|
+
}}},[_c('CheckboxGroup',{on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", $$v);},expression:"value.answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout,staticStyle:{"display":"flex"}},[_c('Checkbox',{key:choice.id,attrs:{"label":choice.id,"disabled":_vm.question.options.readonly ||
|
|
370
|
+
choice.readonly ||
|
|
371
|
+
_vm.question.options.disabled}},[_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])]),_vm._v(" "),_vm._l((_vm.value.inputAnswers),function(inputAnswer,inputIndex){return _c('div',{key:inputIndex},[(
|
|
370
372
|
choice.id === inputAnswer.choiceId &&
|
|
371
373
|
_vm.value.answer.includes(choice.id)
|
|
372
374
|
)?_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].inputAnswers[" + inputIndex + "].inputText"),"rules":[
|
|
@@ -387,11 +389,11 @@ var __vue_staticRenderFns__$d = [];
|
|
|
387
389
|
/* style */
|
|
388
390
|
const __vue_inject_styles__$d = function (inject) {
|
|
389
391
|
if (!inject) return
|
|
390
|
-
inject("data-v-
|
|
392
|
+
inject("data-v-7d217d7a_0", { source: ".ivu-row-flex-start[data-v-7d217d7a]{align-items:center}.ivu-checkbox-group-item[data-v-7d217d7a]{display:flex;flex-direction:row;align-items:center}.choice-title[data-v-7d217d7a]{margin-left:8px;margin-right:8px}.choice-score[data-v-7d217d7a]{margin-right:8px}", map: undefined, media: undefined });
|
|
391
393
|
|
|
392
394
|
};
|
|
393
395
|
/* scoped */
|
|
394
|
-
const __vue_scope_id__$d = "data-v-
|
|
396
|
+
const __vue_scope_id__$d = "data-v-7d217d7a";
|
|
395
397
|
/* module identifier */
|
|
396
398
|
const __vue_module_identifier__$d = undefined;
|
|
397
399
|
/* functional template */
|
|
@@ -474,7 +476,7 @@ var script$c = Vue.extend({
|
|
|
474
476
|
const __vue_script__$c = script$c;
|
|
475
477
|
|
|
476
478
|
/* template */
|
|
477
|
-
var __vue_render__$c = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.readonly)?_c('div',{staticClass:"processed-answer",domProps:{"innerHTML":_vm._s(_vm.decodeHTML(_vm.value))}}):_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
479
|
+
var __vue_render__$c = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.readonly || _vm.question.options.disabled)?_c('div',{staticClass:"processed-answer",domProps:{"innerHTML":_vm._s(_vm.decodeHTML(_vm.value))}}):_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
478
480
|
required: _vm.question.options.required,
|
|
479
481
|
message: _vm.t('survey_response.question.question_required'),
|
|
480
482
|
}}},[(_vm.question.options && _vm.question.options.wordLimit)?_c('Input',{attrs:{"type":"textarea","rows":4,"show-word-limit":"","placeholder":_vm.placeholder,"maxlength":_vm.question.options.wordLimit,"disabled":_vm.question.options.readonly},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", (typeof $$v === 'string'? $$v.trim(): $$v));},expression:"value.answer"}}):_c('Input',{attrs:{"type":"textarea","rows":4,"placeholder":_vm.placeholder,"disabled":_vm.question.options.readonly},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", (typeof $$v === 'string'? $$v.trim(): $$v));},expression:"value.answer"}})],1)],1)};
|
|
@@ -483,11 +485,11 @@ var __vue_staticRenderFns__$c = [];
|
|
|
483
485
|
/* style */
|
|
484
486
|
const __vue_inject_styles__$c = function (inject) {
|
|
485
487
|
if (!inject) return
|
|
486
|
-
inject("data-v-
|
|
488
|
+
inject("data-v-1939e710_0", { source: ".processed-answer[data-v-1939e710]{background-color:#f3f3f3;opacity:1;cursor:not-allowed;color:#ccc;width:100%;min-height:94px;border:1px solid #dcdee2;border-radius:4px;padding:4px 8px;line-height:1.5}", map: undefined, media: undefined });
|
|
487
489
|
|
|
488
490
|
};
|
|
489
491
|
/* scoped */
|
|
490
|
-
const __vue_scope_id__$c = "data-v-
|
|
492
|
+
const __vue_scope_id__$c = "data-v-1939e710";
|
|
491
493
|
/* module identifier */
|
|
492
494
|
const __vue_module_identifier__$c = undefined;
|
|
493
495
|
/* functional template */
|
|
@@ -569,16 +571,12 @@ var script$b = Vue.extend({
|
|
|
569
571
|
haveStar(choice) {
|
|
570
572
|
return choice.options?.star ?? false;
|
|
571
573
|
},
|
|
572
|
-
toggleAnswer(value,
|
|
573
|
-
if (this.question.options.readonly ||
|
|
574
|
+
toggleAnswer(value, disabled) {
|
|
575
|
+
if (this.question.options.readonly || disabled) {
|
|
574
576
|
return;
|
|
575
577
|
}
|
|
576
|
-
this.$emit("singleQuestion", {
|
|
577
|
-
questionId: this.question.id,
|
|
578
|
-
choiceId: value,
|
|
579
|
-
});
|
|
580
578
|
if (this.responseStatus == this.$consts.STATUS_DRAFT) {
|
|
581
|
-
if (this.value.answer) {
|
|
579
|
+
if (this.value.answer && this.value.answer === value) {
|
|
582
580
|
this.value.answer = null;
|
|
583
581
|
_.forEach(this.value.inputAnswers, (input) => {
|
|
584
582
|
input.inputText = null;
|
|
@@ -588,6 +586,10 @@ var script$b = Vue.extend({
|
|
|
588
586
|
this.value.answer = value;
|
|
589
587
|
}
|
|
590
588
|
}
|
|
589
|
+
this.$emit("singleQuestion", {
|
|
590
|
+
questionId: this.question.id,
|
|
591
|
+
choiceId: this.value.answer,
|
|
592
|
+
});
|
|
591
593
|
},
|
|
592
594
|
},
|
|
593
595
|
});
|
|
@@ -597,9 +599,9 @@ const __vue_script__$b = script$b;
|
|
|
597
599
|
|
|
598
600
|
/* template */
|
|
599
601
|
var __vue_render__$b = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
600
|
-
required: _vm.question.options.required,
|
|
602
|
+
required: _vm.question.options.required && !_vm.question.options.disabled,
|
|
601
603
|
message: _vm.t('survey_response.question.question_required'),
|
|
602
|
-
}}},[_c('RadioGroup',{staticClass:"question-choice",on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", $$v);},expression:"value.answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout,staticStyle:{"display":"flex"}},[_c('Radio',{key:choice.id,attrs:{"disabled":_vm.question.options.readonly ||
|
|
604
|
+
}}},[_c('RadioGroup',{staticClass:"question-choice",on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", $$v);},expression:"value.answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout,staticStyle:{"display":"flex"}},[_c('Radio',{key:choice.id,attrs:{"disabled":_vm.question.options.readonly || _vm.question.options.disabled,"label":choice.id},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id, _vm.question.options.disabled)}}},[(_vm.haveStar(choice))?_c('span',[_c('Icon',{attrs:{"type":"md-star","color":"orange","size":16}})],1):_vm._e(),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])]),_vm._v(" "),_vm._l((_vm.value.inputAnswers),function(inputAnswer,inputIndex){return _c('div',{key:inputIndex},[(
|
|
603
605
|
choice.id === inputAnswer.choiceId && choice.id === _vm.value.answer
|
|
604
606
|
)?_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].inputAnswers[" + inputIndex + "].inputText"),"rules":[
|
|
605
607
|
{
|
|
@@ -613,17 +615,17 @@ var __vue_render__$b = function () {var _vm=this;var _h=_vm.$createElement;var _
|
|
|
613
615
|
message: _vm.t('survey_response.question.input_text_limit', [
|
|
614
616
|
_vm.question.options.inputMinLength ]),
|
|
615
617
|
trigger: 'blur',
|
|
616
|
-
} ]}},[_c('Input',{attrs:{"disabled":_vm.question.options.readonly ||
|
|
618
|
+
} ]}},[_c('Input',{attrs:{"disabled":_vm.question.options.readonly || _vm.question.options.disabled},model:{value:(inputAnswer.inputText),callback:function ($$v) {_vm.$set(inputAnswer, "inputText", (typeof $$v === 'string'? $$v.trim(): $$v));},expression:"inputAnswer.inputText"}})],1):_vm._e()],1)})],2)}),1)],1)],1)};
|
|
617
619
|
var __vue_staticRenderFns__$b = [];
|
|
618
620
|
|
|
619
621
|
/* style */
|
|
620
622
|
const __vue_inject_styles__$b = function (inject) {
|
|
621
623
|
if (!inject) return
|
|
622
|
-
inject("data-v-
|
|
624
|
+
inject("data-v-2969068d_0", { source: ".ivu-row-flex-start[data-v-2969068d]{align-items:center}.ivu-radio-group-item[data-v-2969068d]{display:flex;flex-direction:row;align-items:center}.choice-title[data-v-2969068d]{margin-left:8px;margin-right:8px}", map: undefined, media: undefined });
|
|
623
625
|
|
|
624
626
|
};
|
|
625
627
|
/* scoped */
|
|
626
|
-
const __vue_scope_id__$b = "data-v-
|
|
628
|
+
const __vue_scope_id__$b = "data-v-2969068d";
|
|
627
629
|
/* module identifier */
|
|
628
630
|
const __vue_module_identifier__$b = undefined;
|
|
629
631
|
/* functional template */
|
|
@@ -722,9 +724,9 @@ const __vue_script__$a = script$a;
|
|
|
722
724
|
|
|
723
725
|
/* template */
|
|
724
726
|
var __vue_render__$a = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._l((_vm.question.subQuestions),function(subQuestion,subIndex){return _c('div',{key:subIndex,staticClass:"sub-question"},[_c('span',{staticClass:"number"},[_vm._v("\n "+_vm._s(_vm.question.header.number)+"-"+_vm._s(subQuestion.number)+".")]),_vm._v(" "),_c('span',{staticClass:"title"},[_vm._v(" "+_vm._s(_vm.i18nText(subQuestion.text))+" ")]),_vm._v(" "),_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer[" + subIndex + "].answer"),"rules":{
|
|
725
|
-
required: _vm.question.options.required,
|
|
727
|
+
required: _vm.question.options.required && !_vm.question.options.disabled,
|
|
726
728
|
message: _vm.t('survey_response.question.question_required'),
|
|
727
|
-
}}},[_c('RadioGroup',{on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer[subIndex].answer),callback:function ($$v) {_vm.$set(_vm.value.answer[subIndex], "answer", $$v);},expression:"value.answer[subIndex].answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout},[_c('Radio',{key:choice.id,attrs:{"label":choice.id,"disabled":subQuestion.options.readonly},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id, subIndex)}}},[_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])])],1)}),1)],1)],1)],1)}),0)};
|
|
729
|
+
}}},[_c('RadioGroup',{on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer[subIndex].answer),callback:function ($$v) {_vm.$set(_vm.value.answer[subIndex], "answer", $$v);},expression:"value.answer[subIndex].answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout},[_c('Radio',{key:choice.id,attrs:{"label":choice.id,"disabled":subQuestion.options.readonly || _vm.question.options.disabled},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id, subIndex)}}},[_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])])],1)}),1)],1)],1)],1)}),0)};
|
|
728
730
|
var __vue_staticRenderFns__$a = [];
|
|
729
731
|
|
|
730
732
|
/* style */
|
|
@@ -855,7 +857,7 @@ var script$8 = Vue.extend({
|
|
|
855
857
|
const __vue_script__$8 = script$8;
|
|
856
858
|
|
|
857
859
|
/* template */
|
|
858
|
-
var __vue_render__$8 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.readonly)?_c('div',{staticClass:"processed-answer",domProps:{"innerHTML":_vm._s(_vm.decodeHTML(_vm.value))}}):_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
860
|
+
var __vue_render__$8 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.readonly || _vm.question.options.disabled)?_c('div',{staticClass:"processed-answer",domProps:{"innerHTML":_vm._s(_vm.decodeHTML(_vm.value))}}):_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
859
861
|
required: _vm.question.options.required,
|
|
860
862
|
message: _vm.t('survey_response.question.question_required'),
|
|
861
863
|
}}},[_c('Input',{attrs:{"placeholder":_vm.placeholder,"disabled":_vm.question.options.readonly},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", (typeof $$v === 'string'? $$v.trim(): $$v));},expression:"value.answer"}})],1)],1)};
|
|
@@ -864,11 +866,11 @@ var __vue_staticRenderFns__$8 = [];
|
|
|
864
866
|
/* style */
|
|
865
867
|
const __vue_inject_styles__$8 = function (inject) {
|
|
866
868
|
if (!inject) return
|
|
867
|
-
inject("data-v-
|
|
869
|
+
inject("data-v-6475e3d0_0", { source: ".processed-answer[data-v-6475e3d0]{background-color:#f3f3f3;opacity:1;cursor:not-allowed;color:#ccc;width:100%;height:32px;border:1px solid #dcdee2;border-radius:4px;padding:4px 8px;line-height:1.5}", map: undefined, media: undefined });
|
|
868
870
|
|
|
869
871
|
};
|
|
870
872
|
/* scoped */
|
|
871
|
-
const __vue_scope_id__$8 = "data-v-
|
|
873
|
+
const __vue_scope_id__$8 = "data-v-6475e3d0";
|
|
872
874
|
/* module identifier */
|
|
873
875
|
const __vue_module_identifier__$8 = undefined;
|
|
874
876
|
/* functional template */
|
|
@@ -1698,17 +1700,8 @@ var script = Vue.extend({
|
|
|
1698
1700
|
this.sortQuestions = tmp;
|
|
1699
1701
|
}
|
|
1700
1702
|
},
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
item.type === "MULTI_SELECTION") {
|
|
1704
|
-
item.choices.forEach((_item) => {
|
|
1705
|
-
this.$set(_item, "readonly", disabled);
|
|
1706
|
-
});
|
|
1707
|
-
this.$set(item.options, "required", !disabled);
|
|
1708
|
-
}
|
|
1709
|
-
else {
|
|
1710
|
-
this.$set(item.options, "readonly", disabled);
|
|
1711
|
-
}
|
|
1703
|
+
setQuestionDisabled(item, disabled) {
|
|
1704
|
+
this.$set(item.options, "disabled", disabled);
|
|
1712
1705
|
},
|
|
1713
1706
|
cleanData(question) {
|
|
1714
1707
|
let input_answers = [];
|
|
@@ -1749,7 +1742,7 @@ var script = Vue.extend({
|
|
|
1749
1742
|
.filter((item) => target.toQuestionId !== item.toQuestionId);
|
|
1750
1743
|
if (this.recordQuestionId === selected.questionId) {
|
|
1751
1744
|
let resetItem = this.sortQuestions.find((item) => item.id === target.toQuestionId);
|
|
1752
|
-
this.
|
|
1745
|
+
this.setQuestionDisabled(resetItem, false);
|
|
1753
1746
|
}
|
|
1754
1747
|
let nextQuestion = this.sortQuestions.find((item) => item.id === target.toQuestionId);
|
|
1755
1748
|
let selectedIndex = this.sortQuestions.findIndex((item) => item.id === selected.questionId);
|
|
@@ -1763,7 +1756,7 @@ var script = Vue.extend({
|
|
|
1763
1756
|
disabledArr.forEach((_item) => {
|
|
1764
1757
|
let disabledQuestion = this.sortQuestions.find((item) => item.id === _item.toQuestionId);
|
|
1765
1758
|
this.cleanData(disabledQuestion);
|
|
1766
|
-
this.
|
|
1759
|
+
this.setQuestionDisabled(disabledQuestion, true);
|
|
1767
1760
|
});
|
|
1768
1761
|
}
|
|
1769
1762
|
tmp = startArr;
|
|
@@ -1771,6 +1764,13 @@ var script = Vue.extend({
|
|
|
1771
1764
|
tmp = tmp.concat(endArr);
|
|
1772
1765
|
this.sortQuestions = tmp;
|
|
1773
1766
|
}
|
|
1767
|
+
else {
|
|
1768
|
+
currentSingleQuestion.jumps.forEach((_item) => {
|
|
1769
|
+
let enabledQuestion = this.sortQuestions.find((item) => item.id === _item.toQuestionId);
|
|
1770
|
+
this.cleanData(enabledQuestion);
|
|
1771
|
+
this.setQuestionDisabled(enabledQuestion, false);
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
1774
|
}
|
|
1775
1775
|
this.recordQuestionId = selected.questionId;
|
|
1776
1776
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wg-npm/survey-response",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.22809",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"lint-fix": "eslint \"**/*.ts\" \"**/*.vue\" --fix --no-error-on-unmatched-pattern"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@wg-npm/survey-core": "0.3.
|
|
16
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
15
|
+
"@wg-npm/survey-core": "0.3.22809",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.22809",
|
|
17
17
|
"axios": "^0.19.2",
|
|
18
18
|
"deepmerge": "^4.2.2",
|
|
19
19
|
"lodash": "^4.17.15",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@typescript-eslint/parser": "^3.6.0",
|
|
35
35
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
36
36
|
"@vue/eslint-config-typescript": "^5.0.2",
|
|
37
|
-
"@wg-npm/survey-core": "0.3.
|
|
38
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
37
|
+
"@wg-npm/survey-core": "0.3.22809",
|
|
38
|
+
"@wg-npm/survey-service-api": "0.3.22809",
|
|
39
39
|
"acorn": "^7.3.1",
|
|
40
40
|
"axios": "^0.19.2",
|
|
41
41
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<FormItem
|
|
13
13
|
:prop="`answers[${index}].answer[${subIndex}].answer`"
|
|
14
14
|
:rules="{
|
|
15
|
-
required: question.options.required,
|
|
15
|
+
required: question.options.required && !question.options.disabled,
|
|
16
16
|
message: t('survey_response.question.question_required'),
|
|
17
17
|
}"
|
|
18
18
|
>
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
:label="choice.id"
|
|
31
31
|
:key="choice.id"
|
|
32
32
|
@click.native="toggleAnswer(choice.id, subIndex)"
|
|
33
|
-
:disabled="
|
|
33
|
+
:disabled="
|
|
34
|
+
subQuestion.options.readonly || question.options.disabled
|
|
35
|
+
"
|
|
34
36
|
>
|
|
35
37
|
<span>{{ i18nText(choice.text) }}</span>
|
|
36
38
|
</Radio>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<FormItem
|
|
3
3
|
:prop="`answers[${index}].answer`"
|
|
4
4
|
:rules="{
|
|
5
|
-
required: question.options.required,
|
|
5
|
+
required: question.options.required && !question.options.disabled,
|
|
6
6
|
type: 'array',
|
|
7
7
|
min: 1,
|
|
8
8
|
message: t('survey_response.question.question_required'),
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
<Checkbox
|
|
20
20
|
:label="choice.id"
|
|
21
21
|
:key="choice.id"
|
|
22
|
-
:disabled="
|
|
22
|
+
:disabled="
|
|
23
|
+
question.options.readonly ||
|
|
24
|
+
choice.readonly ||
|
|
25
|
+
question.options.disabled
|
|
26
|
+
"
|
|
23
27
|
>
|
|
24
28
|
<span>{{ i18nText(choice.text) }}</span>
|
|
25
29
|
</Checkbox>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<FormItem
|
|
3
3
|
:prop="`answers[${index}].answer`"
|
|
4
4
|
:rules="{
|
|
5
|
-
required: question.options.required,
|
|
5
|
+
required: question.options.required && !question.options.disabled,
|
|
6
6
|
message: t('survey_response.question.question_required'),
|
|
7
7
|
}"
|
|
8
8
|
>
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
style="display: flex"
|
|
20
20
|
>
|
|
21
21
|
<Radio
|
|
22
|
-
:disabled="question.options.readonly ||
|
|
22
|
+
:disabled="question.options.readonly || question.options.disabled"
|
|
23
23
|
:label="choice.id"
|
|
24
24
|
:key="choice.id"
|
|
25
|
-
@click.native="toggleAnswer(choice.id,
|
|
25
|
+
@click.native="toggleAnswer(choice.id, question.options.disabled)"
|
|
26
26
|
>
|
|
27
27
|
<span v-if="haveStar(choice)">
|
|
28
28
|
<Icon type="md-star" color="orange" :size="16" />
|
|
@@ -55,7 +55,9 @@
|
|
|
55
55
|
]"
|
|
56
56
|
>
|
|
57
57
|
<Input
|
|
58
|
-
:disabled="
|
|
58
|
+
:disabled="
|
|
59
|
+
question.options.readonly || question.options.disabled
|
|
60
|
+
"
|
|
59
61
|
v-model.trim="inputAnswer.inputText"
|
|
60
62
|
/>
|
|
61
63
|
</FormItem>
|
|
@@ -142,16 +144,12 @@ export default Vue.extend({
|
|
|
142
144
|
haveStar(choice) {
|
|
143
145
|
return choice.options?.star ?? false;
|
|
144
146
|
},
|
|
145
|
-
toggleAnswer(value,
|
|
146
|
-
if (this.question.options.readonly ||
|
|
147
|
+
toggleAnswer(value, disabled) {
|
|
148
|
+
if (this.question.options.readonly || disabled) {
|
|
147
149
|
return;
|
|
148
150
|
}
|
|
149
|
-
this.$emit("singleQuestion", {
|
|
150
|
-
questionId: this.question.id,
|
|
151
|
-
choiceId: value,
|
|
152
|
-
});
|
|
153
151
|
if (this.responseStatus == this.$consts.STATUS_DRAFT) {
|
|
154
|
-
if (this.value.answer) {
|
|
152
|
+
if (this.value.answer && this.value.answer === value) {
|
|
155
153
|
this.value.answer = null;
|
|
156
154
|
_.forEach(this.value.inputAnswers, (input) => {
|
|
157
155
|
input.inputText = null;
|
|
@@ -160,6 +158,10 @@ export default Vue.extend({
|
|
|
160
158
|
this.value.answer = value;
|
|
161
159
|
}
|
|
162
160
|
}
|
|
161
|
+
this.$emit("singleQuestion", {
|
|
162
|
+
questionId: this.question.id,
|
|
163
|
+
choiceId: this.value.answer,
|
|
164
|
+
});
|
|
163
165
|
},
|
|
164
166
|
},
|
|
165
167
|
});
|
|
@@ -107,18 +107,8 @@ export default Vue.extend({
|
|
|
107
107
|
this.sortQuestions = tmp;
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
item.type === QuestionType.SINGLE_SELECTION ||
|
|
113
|
-
item.type === QuestionType.MULTI_SELECTION
|
|
114
|
-
) {
|
|
115
|
-
item.choices.forEach((_item) => {
|
|
116
|
-
this.$set(_item, "readonly", disabled);
|
|
117
|
-
});
|
|
118
|
-
this.$set(item.options, "required", !disabled);
|
|
119
|
-
} else {
|
|
120
|
-
this.$set(item.options, "readonly", disabled);
|
|
121
|
-
}
|
|
110
|
+
setQuestionDisabled(item, disabled) {
|
|
111
|
+
this.$set(item.options, "disabled", disabled);
|
|
122
112
|
},
|
|
123
113
|
cleanData(question) {
|
|
124
114
|
let input_answers: any = [];
|
|
@@ -169,7 +159,7 @@ export default Vue.extend({
|
|
|
169
159
|
let resetItem = this.sortQuestions.find(
|
|
170
160
|
(item) => item.id === target.toQuestionId
|
|
171
161
|
);
|
|
172
|
-
this.
|
|
162
|
+
this.setQuestionDisabled(resetItem, false);
|
|
173
163
|
}
|
|
174
164
|
|
|
175
165
|
let nextQuestion = this.sortQuestions.find(
|
|
@@ -192,13 +182,21 @@ export default Vue.extend({
|
|
|
192
182
|
(item) => item.id === _item.toQuestionId
|
|
193
183
|
);
|
|
194
184
|
this.cleanData(disabledQuestion);
|
|
195
|
-
this.
|
|
185
|
+
this.setQuestionDisabled(disabledQuestion, true);
|
|
196
186
|
});
|
|
197
187
|
}
|
|
198
188
|
tmp = startArr;
|
|
199
189
|
tmp.push(nextQuestion);
|
|
200
190
|
tmp = tmp.concat(endArr);
|
|
201
191
|
this.sortQuestions = tmp;
|
|
192
|
+
} else {
|
|
193
|
+
currentSingleQuestion.jumps.forEach((_item) => {
|
|
194
|
+
let enabledQuestion = this.sortQuestions.find(
|
|
195
|
+
(item) => item.id === _item.toQuestionId
|
|
196
|
+
);
|
|
197
|
+
this.cleanData(enabledQuestion);
|
|
198
|
+
this.setQuestionDisabled(enabledQuestion, false);
|
|
199
|
+
});
|
|
202
200
|
}
|
|
203
201
|
}
|
|
204
202
|
this.recordQuestionId = selected.questionId;
|