@wg-npm/survey-response 0.3.22713 → 0.3.22750
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 +74 -15
- package/package.json +5 -5
- package/src/components/question/type/multi-selection.vue +71 -2
- package/src/components/question/type/single-selection.vue +61 -1
- package/src/components/survey-response.vue +18 -3
- package/src/locale/lang/en-US.ts +3 -0
- package/src/locale/lang/zh-CN.ts +2 -0
- package/src/locale/lang/zh-TW.ts +2 -0
|
@@ -285,6 +285,7 @@ var script$c = Vue.extend({
|
|
|
285
285
|
Checkbox,
|
|
286
286
|
Row,
|
|
287
287
|
Col,
|
|
288
|
+
Input,
|
|
288
289
|
},
|
|
289
290
|
props: {
|
|
290
291
|
question: {
|
|
@@ -341,6 +342,11 @@ var script$c = Vue.extend({
|
|
|
341
342
|
}
|
|
342
343
|
});
|
|
343
344
|
});
|
|
345
|
+
_.forEach(this.value.inputAnswers, (input) => {
|
|
346
|
+
if (!_.includes(val, input.choiceId)) {
|
|
347
|
+
input.inputText = null;
|
|
348
|
+
}
|
|
349
|
+
});
|
|
344
350
|
this.setCheckboxStatus();
|
|
345
351
|
this.answer.score = score;
|
|
346
352
|
if (this.question.options.starEnabled) {
|
|
@@ -360,19 +366,36 @@ var __vue_render__$c = function () {var _vm=this;var _h=_vm.$createElement;var _
|
|
|
360
366
|
type: 'array',
|
|
361
367
|
min: 1,
|
|
362
368
|
message: _vm.t('survey_response.question.question_required'),
|
|
363
|
-
}}},[_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},[_c('Checkbox',{key:choice.id,attrs:{"label":choice.id,"disabled":_vm.question.options.readonly || choice.readonly}},[_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])])
|
|
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 || choice.readonly}},[_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
|
+
choice.id === inputAnswer.choiceId &&
|
|
371
|
+
_vm.value.answer.includes(choice.id)
|
|
372
|
+
)?_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].inputAnswers[" + inputIndex + "].inputText"),"rules":[
|
|
373
|
+
{
|
|
374
|
+
required: true,
|
|
375
|
+
message: _vm.t('survey_response.question.choice_required'),
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
type: 'string',
|
|
379
|
+
min: _vm.question.options.inputMinLength,
|
|
380
|
+
max: 999,
|
|
381
|
+
message: _vm.t('survey_response.question.input_text_limit', [
|
|
382
|
+
_vm.question.options.inputMinLength ]),
|
|
383
|
+
trigger: 'blur',
|
|
384
|
+
} ]}},[_c('Input',{attrs:{"disabled":_vm.question.options.readonly || choice.readonly},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)};
|
|
364
385
|
var __vue_staticRenderFns__$c = [];
|
|
365
386
|
|
|
366
387
|
/* style */
|
|
367
|
-
const __vue_inject_styles__$c =
|
|
388
|
+
const __vue_inject_styles__$c = function (inject) {
|
|
389
|
+
if (!inject) return
|
|
390
|
+
inject("data-v-4799d14a_0", { source: ".ivu-row-flex-start[data-v-4799d14a]{align-items:center}.ivu-checkbox-group-item[data-v-4799d14a]{display:flex;flex-direction:row;align-items:center}.choice-title[data-v-4799d14a]{margin-left:8px;margin-right:8px}.choice-score[data-v-4799d14a]{margin-right:8px}", map: undefined, media: undefined });
|
|
391
|
+
|
|
392
|
+
};
|
|
368
393
|
/* scoped */
|
|
369
|
-
const __vue_scope_id__$c =
|
|
394
|
+
const __vue_scope_id__$c = "data-v-4799d14a";
|
|
370
395
|
/* module identifier */
|
|
371
396
|
const __vue_module_identifier__$c = undefined;
|
|
372
397
|
/* functional template */
|
|
373
398
|
const __vue_is_functional_template__$c = false;
|
|
374
|
-
/* style inject */
|
|
375
|
-
|
|
376
399
|
/* style inject SSR */
|
|
377
400
|
|
|
378
401
|
/* style inject shadow dom */
|
|
@@ -387,7 +410,7 @@ var __vue_staticRenderFns__$c = [];
|
|
|
387
410
|
__vue_is_functional_template__$c,
|
|
388
411
|
__vue_module_identifier__$c,
|
|
389
412
|
false,
|
|
390
|
-
|
|
413
|
+
createInjector,
|
|
391
414
|
undefined,
|
|
392
415
|
undefined
|
|
393
416
|
);
|
|
@@ -499,6 +522,7 @@ var script$a = Vue.extend({
|
|
|
499
522
|
Row,
|
|
500
523
|
Col,
|
|
501
524
|
Icon,
|
|
525
|
+
Input,
|
|
502
526
|
},
|
|
503
527
|
mixins: [OptionLayoutMixin],
|
|
504
528
|
inject: ["responseStatus", "$rootComponent"],
|
|
@@ -556,6 +580,9 @@ var script$a = Vue.extend({
|
|
|
556
580
|
if (this.responseStatus == this.$consts.STATUS_DRAFT) {
|
|
557
581
|
if (this.value.answer) {
|
|
558
582
|
this.value.answer = null;
|
|
583
|
+
_.forEach(this.value.inputAnswers, (input) => {
|
|
584
|
+
input.inputText = null;
|
|
585
|
+
});
|
|
559
586
|
}
|
|
560
587
|
else {
|
|
561
588
|
this.value.answer = value;
|
|
@@ -572,19 +599,35 @@ const __vue_script__$a = script$a;
|
|
|
572
599
|
var __vue_render__$a = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
573
600
|
required: _vm.question.options.required,
|
|
574
601
|
message: _vm.t('survey_response.question.question_required'),
|
|
575
|
-
}}},[_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},[_c('Radio',{key:choice.id,attrs:{"disabled":_vm.question.options.readonly || choice.readonly,"label":choice.id},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id, choice.readonly)}}},[(_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)))])])
|
|
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 || choice.readonly,"label":choice.id},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id, choice.readonly)}}},[(_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
|
+
choice.id === inputAnswer.choiceId && choice.id === _vm.value.answer
|
|
604
|
+
)?_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].inputAnswers[" + inputIndex + "].inputText"),"rules":[
|
|
605
|
+
{
|
|
606
|
+
required: true,
|
|
607
|
+
message: _vm.t('survey_response.question.choice_required'),
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
type: 'string',
|
|
611
|
+
min: _vm.question.options.inputMinLength,
|
|
612
|
+
max: 999,
|
|
613
|
+
message: _vm.t('survey_response.question.input_text_limit', [
|
|
614
|
+
_vm.question.options.inputMinLength ]),
|
|
615
|
+
trigger: 'blur',
|
|
616
|
+
} ]}},[_c('Input',{attrs:{"disabled":_vm.question.options.readonly || choice.readonly},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)};
|
|
576
617
|
var __vue_staticRenderFns__$a = [];
|
|
577
618
|
|
|
578
619
|
/* style */
|
|
579
|
-
const __vue_inject_styles__$a =
|
|
620
|
+
const __vue_inject_styles__$a = function (inject) {
|
|
621
|
+
if (!inject) return
|
|
622
|
+
inject("data-v-369f494a_0", { source: ".ivu-row-flex-start[data-v-369f494a]{align-items:center}.ivu-radio-group-item[data-v-369f494a]{display:flex;flex-direction:row;align-items:center}.choice-title[data-v-369f494a]{margin-left:8px;margin-right:8px}", map: undefined, media: undefined });
|
|
623
|
+
|
|
624
|
+
};
|
|
580
625
|
/* scoped */
|
|
581
|
-
const __vue_scope_id__$a =
|
|
626
|
+
const __vue_scope_id__$a = "data-v-369f494a";
|
|
582
627
|
/* module identifier */
|
|
583
628
|
const __vue_module_identifier__$a = undefined;
|
|
584
629
|
/* functional template */
|
|
585
630
|
const __vue_is_functional_template__$a = false;
|
|
586
|
-
/* style inject */
|
|
587
|
-
|
|
588
631
|
/* style inject SSR */
|
|
589
632
|
|
|
590
633
|
/* style inject shadow dom */
|
|
@@ -599,7 +642,7 @@ var __vue_staticRenderFns__$a = [];
|
|
|
599
642
|
__vue_is_functional_template__$a,
|
|
600
643
|
__vue_module_identifier__$a,
|
|
601
644
|
false,
|
|
602
|
-
|
|
645
|
+
createInjector,
|
|
603
646
|
undefined,
|
|
604
647
|
undefined
|
|
605
648
|
);
|
|
@@ -870,6 +913,8 @@ var defaultLang = {
|
|
|
870
913
|
question_required: "此题必填",
|
|
871
914
|
survey_confirm_content: "确认要提交问卷?",
|
|
872
915
|
noQuestion: "还未添加题目!",
|
|
916
|
+
input_text_limit: "输入项字数不少于{0}字",
|
|
917
|
+
choice_required: "此项必填",
|
|
873
918
|
},
|
|
874
919
|
},
|
|
875
920
|
};
|
|
@@ -1575,10 +1620,10 @@ var script = Vue.extend({
|
|
|
1575
1620
|
if (Array.isArray(currentSingleQuestion.jumps) &&
|
|
1576
1621
|
currentSingleQuestion.jumps.length > 0) {
|
|
1577
1622
|
let target = currentSingleQuestion.jumps.find((item) => item.choiceId === selected.choiceId);
|
|
1578
|
-
let disabledArr = currentSingleQuestion.jumps
|
|
1579
|
-
.filter((item) => item.choiceId !== selected.choiceId)
|
|
1580
|
-
.filter((item) => target.toQuestionId !== item.toQuestionId);
|
|
1581
1623
|
if (target) {
|
|
1624
|
+
let disabledArr = currentSingleQuestion.jumps
|
|
1625
|
+
.filter((item) => item.choiceId !== selected.choiceId)
|
|
1626
|
+
.filter((item) => target.toQuestionId !== item.toQuestionId);
|
|
1582
1627
|
if (this.recordQuestionId === selected.questionId) {
|
|
1583
1628
|
let resetItem = this.sortQuestions.find((item) => item.id === target.toQuestionId);
|
|
1584
1629
|
this.setDisabled(resetItem, false);
|
|
@@ -1638,7 +1683,20 @@ var script = Vue.extend({
|
|
|
1638
1683
|
});
|
|
1639
1684
|
_.set(this.response, "answers", []);
|
|
1640
1685
|
_.each(this.sortQuestions, (question) => {
|
|
1686
|
+
let input_answers = [];
|
|
1687
|
+
let questionInputtedEnabled = question.options.inputtedEnabled;
|
|
1641
1688
|
let answer = _.get(this.answers, question.id);
|
|
1689
|
+
if (!answer) {
|
|
1690
|
+
_.forEach(question.choices, (choice) => {
|
|
1691
|
+
let choiceInputEnabled = choice.options.inputEnabled;
|
|
1692
|
+
if (questionInputtedEnabled && choiceInputEnabled) {
|
|
1693
|
+
input_answers.push({
|
|
1694
|
+
choiceId: choice.id,
|
|
1695
|
+
inputText: null,
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1642
1700
|
answer = answer
|
|
1643
1701
|
? answer
|
|
1644
1702
|
: {
|
|
@@ -1647,6 +1705,7 @@ var script = Vue.extend({
|
|
|
1647
1705
|
question_type: question.type,
|
|
1648
1706
|
score: null,
|
|
1649
1707
|
star: null,
|
|
1708
|
+
inputAnswers: input_answers,
|
|
1650
1709
|
};
|
|
1651
1710
|
this.response.answers.push(answer);
|
|
1652
1711
|
});
|
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.22750",
|
|
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.22750",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.22750",
|
|
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.22750",
|
|
38
|
+
"@wg-npm/survey-service-api": "0.3.22750",
|
|
39
39
|
"acorn": "^7.3.1",
|
|
40
40
|
"axios": "^0.19.2",
|
|
41
41
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
v-for="choice in question.choices"
|
|
15
15
|
:key="choice.id"
|
|
16
16
|
:class="optionLayout"
|
|
17
|
+
style="display: flex"
|
|
17
18
|
>
|
|
18
19
|
<Checkbox
|
|
19
20
|
:label="choice.id"
|
|
@@ -22,6 +23,39 @@
|
|
|
22
23
|
>
|
|
23
24
|
<span>{{ i18nText(choice.text) }}</span>
|
|
24
25
|
</Checkbox>
|
|
26
|
+
|
|
27
|
+
<div
|
|
28
|
+
v-for="(inputAnswer, inputIndex) in value.inputAnswers"
|
|
29
|
+
:key="inputIndex"
|
|
30
|
+
>
|
|
31
|
+
<FormItem
|
|
32
|
+
v-if="
|
|
33
|
+
choice.id === inputAnswer.choiceId &&
|
|
34
|
+
value.answer.includes(choice.id)
|
|
35
|
+
"
|
|
36
|
+
:prop="`answers[${index}].inputAnswers[${inputIndex}].inputText`"
|
|
37
|
+
:rules="[
|
|
38
|
+
{
|
|
39
|
+
required: true,
|
|
40
|
+
message: t('survey_response.question.choice_required'),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'string',
|
|
44
|
+
min: question.options.inputMinLength,
|
|
45
|
+
max: 999,
|
|
46
|
+
message: t('survey_response.question.input_text_limit', [
|
|
47
|
+
question.options.inputMinLength,
|
|
48
|
+
]),
|
|
49
|
+
trigger: 'blur',
|
|
50
|
+
},
|
|
51
|
+
]"
|
|
52
|
+
>
|
|
53
|
+
<Input
|
|
54
|
+
:disabled="question.options.readonly || choice.readonly"
|
|
55
|
+
v-model.trim="inputAnswer.inputText"
|
|
56
|
+
/>
|
|
57
|
+
</FormItem>
|
|
58
|
+
</div>
|
|
25
59
|
</Col>
|
|
26
60
|
</Row>
|
|
27
61
|
</CheckboxGroup>
|
|
@@ -31,7 +65,14 @@
|
|
|
31
65
|
import Vue from "vue";
|
|
32
66
|
import _ from "lodash";
|
|
33
67
|
import OptionLayoutMixin from "../../../mixins/option-layout-mixin";
|
|
34
|
-
import {
|
|
68
|
+
import {
|
|
69
|
+
FormItem,
|
|
70
|
+
CheckboxGroup,
|
|
71
|
+
Checkbox,
|
|
72
|
+
Row,
|
|
73
|
+
Col,
|
|
74
|
+
Input,
|
|
75
|
+
} from "view-design";
|
|
35
76
|
|
|
36
77
|
export default Vue.extend({
|
|
37
78
|
name: "multi-selection",
|
|
@@ -43,6 +84,7 @@ export default Vue.extend({
|
|
|
43
84
|
Checkbox,
|
|
44
85
|
Row,
|
|
45
86
|
Col,
|
|
87
|
+
Input,
|
|
46
88
|
},
|
|
47
89
|
props: {
|
|
48
90
|
question: {
|
|
@@ -56,7 +98,7 @@ export default Vue.extend({
|
|
|
56
98
|
},
|
|
57
99
|
},
|
|
58
100
|
data() {
|
|
59
|
-
return {
|
|
101
|
+
return {
|
|
60
102
|
value: this.answer,
|
|
61
103
|
};
|
|
62
104
|
},
|
|
@@ -103,6 +145,13 @@ export default Vue.extend({
|
|
|
103
145
|
}
|
|
104
146
|
});
|
|
105
147
|
});
|
|
148
|
+
|
|
149
|
+
//处理输入题
|
|
150
|
+
_.forEach(this.value.inputAnswers, (input) => {
|
|
151
|
+
if (!_.includes(val, input.choiceId)) {
|
|
152
|
+
input.inputText = null;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
106
155
|
this.setCheckboxStatus();
|
|
107
156
|
|
|
108
157
|
// @ts-ignore
|
|
@@ -115,3 +164,23 @@ export default Vue.extend({
|
|
|
115
164
|
},
|
|
116
165
|
});
|
|
117
166
|
</script>
|
|
167
|
+
|
|
168
|
+
<style lang="less" scoped>
|
|
169
|
+
.ivu-row-flex-start {
|
|
170
|
+
align-items: center;
|
|
171
|
+
}
|
|
172
|
+
.ivu-checkbox-group-item {
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: row;
|
|
175
|
+
align-items: center;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.choice-title {
|
|
179
|
+
margin-left: 8px;
|
|
180
|
+
margin-right: 8px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.choice-score {
|
|
184
|
+
margin-right: 8px;
|
|
185
|
+
}
|
|
186
|
+
</style>
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
v-for="choice in question.choices"
|
|
17
17
|
:key="choice.id"
|
|
18
18
|
:class="optionLayout"
|
|
19
|
+
style="display: flex"
|
|
19
20
|
>
|
|
20
21
|
<Radio
|
|
21
22
|
:disabled="question.options.readonly || choice.readonly"
|
|
@@ -28,6 +29,37 @@
|
|
|
28
29
|
</span>
|
|
29
30
|
<span>{{ i18nText(choice.text) }}</span>
|
|
30
31
|
</Radio>
|
|
32
|
+
<div
|
|
33
|
+
v-for="(inputAnswer, inputIndex) in value.inputAnswers"
|
|
34
|
+
:key="inputIndex"
|
|
35
|
+
>
|
|
36
|
+
<FormItem
|
|
37
|
+
v-if="
|
|
38
|
+
choice.id === inputAnswer.choiceId && choice.id === value.answer
|
|
39
|
+
"
|
|
40
|
+
:prop="`answers[${index}].inputAnswers[${inputIndex}].inputText`"
|
|
41
|
+
:rules="[
|
|
42
|
+
{
|
|
43
|
+
required: true,
|
|
44
|
+
message: t('survey_response.question.choice_required'),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'string',
|
|
48
|
+
min: question.options.inputMinLength,
|
|
49
|
+
max: 999,
|
|
50
|
+
message: t('survey_response.question.input_text_limit', [
|
|
51
|
+
question.options.inputMinLength,
|
|
52
|
+
]),
|
|
53
|
+
trigger: 'blur',
|
|
54
|
+
},
|
|
55
|
+
]"
|
|
56
|
+
>
|
|
57
|
+
<Input
|
|
58
|
+
:disabled="question.options.readonly || choice.readonly"
|
|
59
|
+
v-model.trim="inputAnswer.inputText"
|
|
60
|
+
/>
|
|
61
|
+
</FormItem>
|
|
62
|
+
</div>
|
|
31
63
|
</Col>
|
|
32
64
|
</Row>
|
|
33
65
|
</RadioGroup>
|
|
@@ -37,7 +69,15 @@
|
|
|
37
69
|
<script lang="ts">
|
|
38
70
|
import Vue from "vue";
|
|
39
71
|
import OptionLayoutMixin from "../../../mixins/option-layout-mixin";
|
|
40
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
Col,
|
|
74
|
+
FormItem,
|
|
75
|
+
Icon,
|
|
76
|
+
Radio,
|
|
77
|
+
RadioGroup,
|
|
78
|
+
Row,
|
|
79
|
+
Input,
|
|
80
|
+
} from "view-design";
|
|
41
81
|
import _ from "lodash";
|
|
42
82
|
import { SurveyLayout } from "@wg-npm/survey-core";
|
|
43
83
|
|
|
@@ -50,6 +90,7 @@ export default Vue.extend({
|
|
|
50
90
|
Row,
|
|
51
91
|
Col,
|
|
52
92
|
Icon,
|
|
93
|
+
Input,
|
|
53
94
|
},
|
|
54
95
|
mixins: [OptionLayoutMixin],
|
|
55
96
|
inject: ["responseStatus", "$rootComponent"],
|
|
@@ -112,6 +153,9 @@ export default Vue.extend({
|
|
|
112
153
|
if (this.responseStatus == this.$consts.STATUS_DRAFT) {
|
|
113
154
|
if (this.value.answer) {
|
|
114
155
|
this.value.answer = null;
|
|
156
|
+
_.forEach(this.value.inputAnswers, (input) => {
|
|
157
|
+
input.inputText = null;
|
|
158
|
+
});
|
|
115
159
|
} else {
|
|
116
160
|
this.value.answer = value;
|
|
117
161
|
}
|
|
@@ -120,3 +164,19 @@ export default Vue.extend({
|
|
|
120
164
|
},
|
|
121
165
|
});
|
|
122
166
|
</script>
|
|
167
|
+
|
|
168
|
+
<style lang="less" scoped>
|
|
169
|
+
.ivu-row-flex-start {
|
|
170
|
+
align-items: center;
|
|
171
|
+
}
|
|
172
|
+
.ivu-radio-group-item {
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: row;
|
|
175
|
+
align-items: center;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.choice-title {
|
|
179
|
+
margin-left: 8px;
|
|
180
|
+
margin-right: 8px;
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -146,10 +146,10 @@ export default Vue.extend({
|
|
|
146
146
|
let target = currentSingleQuestion.jumps.find(
|
|
147
147
|
(item) => item.choiceId === selected.choiceId
|
|
148
148
|
);
|
|
149
|
-
let disabledArr = currentSingleQuestion.jumps
|
|
150
|
-
.filter((item) => item.choiceId !== selected.choiceId)
|
|
151
|
-
.filter((item) => target.toQuestionId !== item.toQuestionId);
|
|
152
149
|
if (target) {
|
|
150
|
+
let disabledArr = currentSingleQuestion.jumps
|
|
151
|
+
.filter((item) => item.choiceId !== selected.choiceId)
|
|
152
|
+
.filter((item) => target.toQuestionId !== item.toQuestionId);
|
|
153
153
|
if (this.recordQuestionId === selected.questionId) {
|
|
154
154
|
let resetItem = this.sortQuestions.find(
|
|
155
155
|
(item) => item.id === target.toQuestionId
|
|
@@ -234,7 +234,21 @@ export default Vue.extend({
|
|
|
234
234
|
});
|
|
235
235
|
_.set(this.response, "answers", []);
|
|
236
236
|
_.each(this.sortQuestions, (question) => {
|
|
237
|
+
let input_answers: any = [];
|
|
238
|
+
let questionInputtedEnabled = question.options.inputtedEnabled;
|
|
239
|
+
|
|
237
240
|
let answer: any = _.get(this.answers, question.id);
|
|
241
|
+
if (!answer) {
|
|
242
|
+
_.forEach(question.choices, (choice) => {
|
|
243
|
+
let choiceInputEnabled = choice.options.inputEnabled;
|
|
244
|
+
if (questionInputtedEnabled && choiceInputEnabled) {
|
|
245
|
+
input_answers.push({
|
|
246
|
+
choiceId: choice.id,
|
|
247
|
+
inputText: null,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
238
252
|
answer = answer
|
|
239
253
|
? answer
|
|
240
254
|
: {
|
|
@@ -243,6 +257,7 @@ export default Vue.extend({
|
|
|
243
257
|
question_type: question.type,
|
|
244
258
|
score: null,
|
|
245
259
|
star: null,
|
|
260
|
+
inputAnswers: input_answers,
|
|
246
261
|
};
|
|
247
262
|
this.response.answers.push(answer);
|
|
248
263
|
});
|
package/src/locale/lang/en-US.ts
CHANGED
|
@@ -17,6 +17,9 @@ export default {
|
|
|
17
17
|
question_required: "Can Not Blank",
|
|
18
18
|
survey_confirm_content: "Confirm Submit Survey?",
|
|
19
19
|
noQuestion: "No Question!",
|
|
20
|
+
input_text_limit:
|
|
21
|
+
"The number of characters in the entry should not be less than{0}",
|
|
22
|
+
choice_required: "This item is required",
|
|
20
23
|
},
|
|
21
24
|
},
|
|
22
25
|
};
|
package/src/locale/lang/zh-CN.ts
CHANGED