@wg-npm/survey-creator 0.3.7724 → 0.3.7731
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.
|
@@ -3262,8 +3262,7 @@ var script$d = Vue.extend({
|
|
|
3262
3262
|
}
|
|
3263
3263
|
},
|
|
3264
3264
|
disabledScoreOption(value, type) {
|
|
3265
|
-
|
|
3266
|
-
if (this.checkValueInOtherRange(value)) {
|
|
3265
|
+
if (this.checkValueInOtherRange(value, type)) {
|
|
3267
3266
|
return true;
|
|
3268
3267
|
}
|
|
3269
3268
|
let leftScore = _.get(this.value, "minScore", 0);
|
|
@@ -3275,15 +3274,20 @@ var script$d = Vue.extend({
|
|
|
3275
3274
|
return true;
|
|
3276
3275
|
}
|
|
3277
3276
|
},
|
|
3278
|
-
checkValueInOtherRange(value) {
|
|
3277
|
+
checkValueInOtherRange(value, type) {
|
|
3278
|
+
debugger;
|
|
3279
3279
|
let otherRange = _.map(this.otherConditions, (item) => {
|
|
3280
3280
|
return {
|
|
3281
3281
|
min: _.get(item, "payload.minScore", 0),
|
|
3282
3282
|
max: _.get(item, "payload.maxScore", 0),
|
|
3283
3283
|
};
|
|
3284
3284
|
});
|
|
3285
|
+
let currentValue = this.value;
|
|
3286
|
+
let currentTotalScore = this.totalScore;
|
|
3285
3287
|
return _.some(otherRange, function (o) {
|
|
3286
|
-
|
|
3288
|
+
let condition_a = value >= o.min && value <= o.max;
|
|
3289
|
+
let condition_b = type == "left" ? value >= _.get(currentValue, "minScore", 0) : value <= _.get(currentValue, "maxScore", currentTotalScore);
|
|
3290
|
+
return condition_a && condition_b;
|
|
3287
3291
|
});
|
|
3288
3292
|
},
|
|
3289
3293
|
generateExpr() {
|
|
@@ -3298,35 +3302,35 @@ var script$d = Vue.extend({
|
|
|
3298
3302
|
const __vue_script__$d = script$d;
|
|
3299
3303
|
|
|
3300
3304
|
/* template */
|
|
3301
|
-
var __vue_render__$d = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Row',{attrs:{"type":"flex","justify":"start","gutter":6,"align":"middle"}},[_c('Col',{staticClass:"label"},[_vm._v("\n
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3305
|
+
var __vue_render__$d = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Row',{attrs:{"type":"flex","justify":"start","gutter":6,"align":"middle"}},[_c('Col',{staticClass:"label"},[_vm._v("\n "+_vm._s(_vm.t("survey_creator.question.evaluation.condition.score_condition_title"))+"\n ")]),_vm._v(" "),_c('Col',{attrs:{"span":4}},[_c('FormItem',{attrs:{"prop":("evaluationItems[" + _vm.itemIndex + "].conditions[" + _vm.index + "].payload.minScore"),"rules":{
|
|
3306
|
+
required: true,
|
|
3307
|
+
type: 'number',
|
|
3308
|
+
trigger: 'change',
|
|
3309
|
+
message: _vm.t('survey_creator.question.scoreRequiredTip'),
|
|
3310
|
+
}}},[_c('Select',{attrs:{"placeholder":_vm.t('survey_creator.question.selectScore')},model:{value:(_vm.value.minScore),callback:function ($$v) {_vm.$set(_vm.value, "minScore", $$v);},expression:"value.minScore"}},_vm._l((_vm.scores),function(score){return _c('Option',{key:score,attrs:{"value":score,"disabled":_vm.disabledScoreOption(score, 'left')}},[_vm._v("\n "+_vm._s(score)+"\n ")])}),1)],1)],1),_vm._v(" "),_c('Col',{attrs:{"span":3}},[_c('FormItem',{attrs:{"prop":("evaluationItems[" + _vm.itemIndex + "].conditions[" + _vm.index + "].payload.leftOperator"),"rules":{
|
|
3311
|
+
required: true,
|
|
3312
|
+
trigger: 'change',
|
|
3313
|
+
message: _vm.t('survey_creator.question.notEmpty'),
|
|
3314
|
+
}}},[_c('Select',{staticClass:"operator",attrs:{"placeholder":_vm.t('survey_creator.question.evaluation.condition.operator')},model:{value:(_vm.value.leftOperator),callback:function ($$v) {_vm.$set(_vm.value, "leftOperator", $$v);},expression:"value.leftOperator"}},_vm._l((_vm.operators),function(operator,index){return _c('Option',{key:index,attrs:{"value":operator}},[_vm._v("\n "+_vm._s(operator)+"\n ")])}),1)],1)],1),_vm._v(" "),_c('Col',{staticClass:"label"},[_vm._v("\n "+_vm._s(_vm.t("survey_creator.question.totalScores"))+"\n ")]),_vm._v(" "),_c('Col',{attrs:{"span":3}},[_c('FormItem',{attrs:{"prop":("evaluationItems[" + _vm.itemIndex + "].conditions[" + _vm.index + "].payload.rightOperator"),"rules":{
|
|
3315
|
+
required: true,
|
|
3316
|
+
trigger: 'change',
|
|
3317
|
+
message: _vm.t('survey_creator.question.notEmpty'),
|
|
3318
|
+
}}},[_c('Select',{staticClass:"operator",attrs:{"placeholder":_vm.t('survey_creator.question.evaluation.condition.operator')},model:{value:(_vm.value.rightOperator),callback:function ($$v) {_vm.$set(_vm.value, "rightOperator", $$v);},expression:"value.rightOperator"}},_vm._l((_vm.operators),function(operator,index){return _c('Option',{key:index,attrs:{"value":operator}},[_vm._v("\n "+_vm._s(operator)+"\n ")])}),1)],1)],1),_vm._v(" "),_c('Col',{attrs:{"span":4}},[_c('FormItem',{attrs:{"prop":("evaluationItems[" + _vm.itemIndex + "].conditions[" + _vm.index + "].payload.maxScore"),"rules":{
|
|
3319
|
+
required: true,
|
|
3320
|
+
type: 'number',
|
|
3321
|
+
trigger: 'change',
|
|
3322
|
+
message: _vm.t('survey_creator.question.scoreRequiredTip'),
|
|
3323
|
+
}}},[_c('Select',{attrs:{"placeholder":_vm.t('survey_creator.question.selectScore')},model:{value:(_vm.value.maxScore),callback:function ($$v) {_vm.$set(_vm.value, "maxScore", $$v);},expression:"value.maxScore"}},_vm._l((_vm.scores),function(score){return _c('Option',{key:score,attrs:{"value":score,"disabled":_vm.disabledScoreOption(score, 'right')}},[_vm._v("\n "+_vm._s(score)+"\n ")])}),1)],1)],1)],1)};
|
|
3320
3324
|
var __vue_staticRenderFns__$d = [];
|
|
3321
3325
|
|
|
3322
3326
|
/* style */
|
|
3323
3327
|
const __vue_inject_styles__$d = function (inject) {
|
|
3324
3328
|
if (!inject) return
|
|
3325
|
-
inject("data-v-
|
|
3329
|
+
inject("data-v-83ab61b4_0", { source: ".label[data-v-83ab61b4]{text-align:right;margin-bottom:24px}[data-v-83ab61b4] .operator .ivu-select-selected-value{height:28px;line-height:28px}", map: undefined, media: undefined });
|
|
3326
3330
|
|
|
3327
3331
|
};
|
|
3328
3332
|
/* scoped */
|
|
3329
|
-
const __vue_scope_id__$d = "data-v-
|
|
3333
|
+
const __vue_scope_id__$d = "data-v-83ab61b4";
|
|
3330
3334
|
/* module identifier */
|
|
3331
3335
|
const __vue_module_identifier__$d = undefined;
|
|
3332
3336
|
/* functional template */
|
|
@@ -3462,14 +3466,6 @@ var script$b = Vue.extend({
|
|
|
3462
3466
|
required: true,
|
|
3463
3467
|
},
|
|
3464
3468
|
},
|
|
3465
|
-
watch: {
|
|
3466
|
-
"exprConditionType": {
|
|
3467
|
-
handler(newValue, oldValue) {
|
|
3468
|
-
debugger;
|
|
3469
|
-
this.evaluationItems[this.position].conditions = [];
|
|
3470
|
-
}
|
|
3471
|
-
},
|
|
3472
|
-
},
|
|
3473
3469
|
data() {
|
|
3474
3470
|
return {
|
|
3475
3471
|
evaluationItems: this.value,
|
|
@@ -3556,11 +3552,11 @@ var __vue_staticRenderFns__$b = [];
|
|
|
3556
3552
|
/* style */
|
|
3557
3553
|
const __vue_inject_styles__$b = function (inject) {
|
|
3558
3554
|
if (!inject) return
|
|
3559
|
-
inject("data-v-
|
|
3555
|
+
inject("data-v-7d7d66ce_0", { source: ".mt-base[data-v-7d7d66ce]{margin-top:12px}.action[data-v-7d7d66ce]{float:right}.input[data-v-7d7d66ce]{width:100px}.label[data-v-7d7d66ce]{text-align:right;padding-right:4px}.text[data-v-7d7d66ce]{background-color:#ebf7ff;height:32px;padding:8px 18px;font-weight:500;color:#515a6e}[data-v-7d7d66ce] .ivu-card .ivu-form-item{margin-bottom:4px;margin-top:0}[data-v-7d7d66ce] .ivu-card .ivu-form-item-error{margin-bottom:24px;margin-top:0}", map: undefined, media: undefined });
|
|
3560
3556
|
|
|
3561
3557
|
};
|
|
3562
3558
|
/* scoped */
|
|
3563
|
-
const __vue_scope_id__$b = "data-v-
|
|
3559
|
+
const __vue_scope_id__$b = "data-v-7d7d66ce";
|
|
3564
3560
|
/* module identifier */
|
|
3565
3561
|
const __vue_module_identifier__$b = undefined;
|
|
3566
3562
|
/* functional template */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wg-npm/survey-creator",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7731",
|
|
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.7731",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.7731",
|
|
17
17
|
"axios": "^0.19.2",
|
|
18
18
|
"camelcase": "^6.0.0",
|
|
19
19
|
"deepmerge": "^4.2.2",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "^3.6.0",
|
|
39
39
|
"@typescript-eslint/parser": "^3.6.0",
|
|
40
40
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
41
|
-
"@wg-npm/survey-core": "0.3.
|
|
42
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
41
|
+
"@wg-npm/survey-core": "0.3.7731",
|
|
42
|
+
"@wg-npm/survey-service-api": "0.3.7731",
|
|
43
43
|
"acorn": "^7.3.1",
|
|
44
44
|
"axios": "^0.19.2",
|
|
45
45
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -145,14 +145,6 @@
|
|
|
145
145
|
required: true,
|
|
146
146
|
},
|
|
147
147
|
},
|
|
148
|
-
watch: {
|
|
149
|
-
"exprConditionType": {
|
|
150
|
-
handler(newValue, oldValue) {
|
|
151
|
-
debugger
|
|
152
|
-
this.evaluationItems[this.position].conditions = [];
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
148
|
data() {
|
|
157
149
|
return {
|
|
158
150
|
evaluationItems: this.value,
|
|
@@ -1,277 +1,285 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
<Row type="flex" justify="start" :gutter="6" align="middle">
|
|
3
|
+
<Col class="label">
|
|
4
|
+
{{
|
|
5
|
+
t("survey_creator.question.evaluation.condition.score_condition_title")
|
|
6
|
+
}}
|
|
7
|
+
</Col>
|
|
8
|
+
<Col :span="4">
|
|
9
|
+
<FormItem
|
|
10
|
+
:prop="`evaluationItems[${itemIndex}].conditions[${index}].payload.minScore`"
|
|
11
|
+
:rules="{
|
|
12
12
|
required: true,
|
|
13
13
|
type: 'number',
|
|
14
14
|
trigger: 'change',
|
|
15
15
|
message: t('survey_creator.question.scoreRequiredTip'),
|
|
16
16
|
}"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
>
|
|
18
|
+
<Select
|
|
19
|
+
v-model="value.minScore"
|
|
20
|
+
:placeholder="t('survey_creator.question.selectScore')"
|
|
21
|
+
>
|
|
22
|
+
<Option
|
|
23
|
+
v-for="score in scores"
|
|
24
|
+
:value="score"
|
|
25
|
+
:key="score"
|
|
26
|
+
:disabled="disabledScoreOption(score, 'left')"
|
|
27
|
+
>
|
|
28
|
+
{{ score }}
|
|
29
|
+
</Option>
|
|
30
|
+
</Select>
|
|
31
|
+
</FormItem>
|
|
32
|
+
</Col>
|
|
33
|
+
<Col :span="3">
|
|
34
|
+
<FormItem
|
|
35
|
+
:prop="`evaluationItems[${itemIndex}].conditions[${index}].payload.leftOperator`"
|
|
36
|
+
:rules="{
|
|
37
37
|
required: true,
|
|
38
38
|
trigger: 'change',
|
|
39
39
|
message: t('survey_creator.question.notEmpty'),
|
|
40
40
|
}"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
>
|
|
42
|
+
<Select
|
|
43
|
+
class="operator"
|
|
44
|
+
v-model="value.leftOperator"
|
|
45
|
+
:placeholder="
|
|
46
46
|
t('survey_creator.question.evaluation.condition.operator')
|
|
47
47
|
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
>
|
|
49
|
+
<Option
|
|
50
|
+
v-for="(operator, index) in operators"
|
|
51
|
+
:value="operator"
|
|
52
|
+
:key="index"
|
|
53
|
+
>
|
|
54
|
+
{{ operator }}
|
|
55
|
+
</Option>
|
|
56
|
+
</Select>
|
|
57
|
+
</FormItem>
|
|
58
|
+
</Col>
|
|
59
|
+
<Col class="label">
|
|
60
|
+
{{ t("survey_creator.question.totalScores") }}
|
|
61
|
+
</Col>
|
|
62
|
+
<Col :span="3">
|
|
63
|
+
<FormItem
|
|
64
|
+
:prop="`evaluationItems[${itemIndex}].conditions[${index}].payload.rightOperator`"
|
|
65
|
+
:rules="{
|
|
66
66
|
required: true,
|
|
67
67
|
trigger: 'change',
|
|
68
68
|
message: t('survey_creator.question.notEmpty'),
|
|
69
69
|
}"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
>
|
|
71
|
+
<Select
|
|
72
|
+
class="operator"
|
|
73
|
+
v-model="value.rightOperator"
|
|
74
|
+
:placeholder="
|
|
75
75
|
t('survey_creator.question.evaluation.condition.operator')
|
|
76
76
|
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
>
|
|
78
|
+
<Option
|
|
79
|
+
v-for="(operator, index) in operators"
|
|
80
|
+
:value="operator"
|
|
81
|
+
:key="index"
|
|
82
|
+
>
|
|
83
|
+
{{ operator }}
|
|
84
|
+
</Option>
|
|
85
|
+
</Select>
|
|
86
|
+
</FormItem>
|
|
87
|
+
</Col>
|
|
88
|
+
<Col :span="4">
|
|
89
|
+
<FormItem
|
|
90
|
+
:prop="`evaluationItems[${itemIndex}].conditions[${index}].payload.maxScore`"
|
|
91
|
+
:rules="{
|
|
92
92
|
required: true,
|
|
93
93
|
type: 'number',
|
|
94
94
|
trigger: 'change',
|
|
95
95
|
message: t('survey_creator.question.scoreRequiredTip'),
|
|
96
96
|
}"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
97
|
+
>
|
|
98
|
+
<Select
|
|
99
|
+
v-model="value.maxScore"
|
|
100
|
+
:placeholder="t('survey_creator.question.selectScore')"
|
|
101
|
+
>
|
|
102
|
+
<Option
|
|
103
|
+
v-for="score in scores"
|
|
104
|
+
:value="score"
|
|
105
|
+
:key="score"
|
|
106
|
+
:disabled="disabledScoreOption(score, 'right')"
|
|
107
|
+
>
|
|
108
|
+
{{ score }}
|
|
109
|
+
</Option>
|
|
110
|
+
</Select>
|
|
111
|
+
</FormItem>
|
|
112
|
+
</Col>
|
|
113
|
+
</Row>
|
|
114
114
|
</template>
|
|
115
115
|
<script lang="ts">
|
|
116
|
-
import Vue from "vue";
|
|
117
|
-
import {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} from "view-design";
|
|
126
|
-
import _ from "lodash";
|
|
127
|
-
import ExprMixin from "./expr-mixin";
|
|
128
|
-
import LocaleMixin from "../../../../../mixins/locale-mixin";
|
|
129
|
-
import {
|
|
116
|
+
import Vue from "vue";
|
|
117
|
+
import {
|
|
118
|
+
Col,
|
|
119
|
+
FormItem,
|
|
120
|
+
InputNumber,
|
|
121
|
+
Message,
|
|
122
|
+
Option,
|
|
123
|
+
Row,
|
|
124
|
+
Select,
|
|
125
|
+
} from "view-design";
|
|
126
|
+
import _ from "lodash";
|
|
127
|
+
import ExprMixin from "./expr-mixin";
|
|
128
|
+
import LocaleMixin from "../../../../../mixins/locale-mixin";
|
|
129
|
+
import {ExprConditionType} from "@wg-npm/survey-core/src/models";
|
|
130
130
|
|
|
131
|
-
Vue.prototype.$Message = Message;
|
|
131
|
+
Vue.prototype.$Message = Message;
|
|
132
132
|
|
|
133
|
-
export default Vue.extend({
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
133
|
+
export default Vue.extend({
|
|
134
|
+
name: "score",
|
|
135
|
+
mixins: [ExprMixin, LocaleMixin],
|
|
136
|
+
components: {
|
|
137
|
+
Row,
|
|
138
|
+
Col,
|
|
139
|
+
Select,
|
|
140
|
+
Option,
|
|
141
|
+
FormItem,
|
|
142
|
+
InputNumber,
|
|
143
|
+
},
|
|
144
|
+
data() {
|
|
145
|
+
return {
|
|
146
|
+
operators: ["<=", "<"],
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
created() {
|
|
150
|
+
this.value.leftOperator = _.unescape(this.value.leftOperator);
|
|
151
|
+
this.value.rightOperator = _.unescape(this.value.rightOperator);
|
|
152
|
+
},
|
|
153
|
+
computed: {
|
|
154
|
+
totalScore() {
|
|
155
|
+
return this.$rootComponent.currentSurvey.statistics.maxScore;
|
|
156
|
+
},
|
|
157
|
+
scores() {
|
|
158
|
+
return _.range(1, this.totalScore + 1, 1);
|
|
159
|
+
},
|
|
160
|
+
otherConditions() {
|
|
161
|
+
let otherEvaluationItems = _.filter(
|
|
162
|
+
_.map(this.evaluationItems, (item, index) => {
|
|
163
|
+
return _.extend({}, item, {index: index});
|
|
164
|
+
}),
|
|
165
|
+
(item) => item.index != this.itemIndex
|
|
166
|
+
);
|
|
167
|
+
const conditions = _.flatMap(otherEvaluationItems, item => _.get(item, "conditions", []));
|
|
168
|
+
return _.filter(conditions,
|
|
169
|
+
(item) => _.get(item, "type") == ExprConditionType.SCORE
|
|
170
|
+
);
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
methods: {
|
|
174
|
+
getSelectedRangeByValue(value, ranges) {
|
|
175
|
+
let otherRange = _.map(ranges, (item) => {
|
|
176
|
+
return {
|
|
177
|
+
min: _.get(item, "payload.minScore"),
|
|
178
|
+
max: _.get(item, "payload.maxScore"),
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
return _.head(
|
|
182
|
+
_.filter(otherRange, function (o) {
|
|
183
|
+
return value > o.min && value < o.max;
|
|
184
|
+
})
|
|
185
|
+
);
|
|
186
|
+
},
|
|
187
|
+
//todo 此功能暂未启用
|
|
188
|
+
getUsableRanges() {
|
|
189
|
+
let usedRange = _.map(this.otherConditions, (item) => {
|
|
190
|
+
return [item.payload.minScore, item.payload.maxScore];
|
|
191
|
+
});
|
|
192
|
+
let globalMin = 0;
|
|
193
|
+
let globalMax = this.totalScore;
|
|
194
|
+
// arr must sorted asc
|
|
195
|
+
let usableRange = new Array();
|
|
196
|
+
if (usedRange.length == 1) {
|
|
197
|
+
let first = usedRange[0][0] - 1;
|
|
198
|
+
if (usedRange[0][0] !== 0) {
|
|
199
|
+
let item = [0, first];
|
|
200
|
+
usableRange.push(item);
|
|
201
|
+
}
|
|
202
|
+
if (usedRange[length - 1][1] != globalMax) {
|
|
203
|
+
usableRange.push([usedRange[length - 1][1], globalMax]);
|
|
204
|
+
}
|
|
205
|
+
return usableRange;
|
|
206
|
+
} else {
|
|
207
|
+
let other = usedRange.reduce((a, v) => {
|
|
208
|
+
if (typeof a[0] == "number") {
|
|
209
|
+
if (a[0] != globalMin) {
|
|
210
|
+
return [
|
|
211
|
+
[0, a[0]],
|
|
212
|
+
[a[1], v[0]],
|
|
213
|
+
[v[1], v[1]],
|
|
214
|
+
];
|
|
215
|
+
} else {
|
|
216
|
+
return [
|
|
217
|
+
[a[1], v[0]],
|
|
218
|
+
[v[1], v[1]],
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
} else {
|
|
222
|
+
a[a.length - 1][1] = v[0];
|
|
223
|
+
if (a.length != usedRange.length) a.push([v[1], v[1]]);
|
|
224
|
+
}
|
|
225
|
+
return a;
|
|
226
|
+
});
|
|
227
|
+
if (usedRange[length - 1][1] != globalMax) {
|
|
228
|
+
other.push([usedRange[length - 1][1], globalMax]);
|
|
229
|
+
}
|
|
230
|
+
return other;
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
disabledScoreOption(value, type) {
|
|
234
|
+
if (this.checkValueInOtherRange(value, type)) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
let leftScore = _.get(this.value, "minScore", 0);
|
|
238
|
+
let rightScore = _.get(this.value, "maxScore", this.totalScore);
|
|
239
|
+
if (leftScore != null && type == "left" && value >= rightScore) {
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
if (rightScore != null && type == "right" && value <= leftScore) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
checkValueInOtherRange(value, type) {
|
|
247
|
+
debugger
|
|
248
|
+
let otherRange = _.map(this.otherConditions, (item) => {
|
|
249
|
+
return {
|
|
250
|
+
min: _.get(item, "payload.minScore", 0),
|
|
251
|
+
max: _.get(item, "payload.maxScore", 0),
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
let currentValue = this.value;
|
|
256
|
+
let currentTotalScore = this.totalScore;
|
|
257
|
+
|
|
258
|
+
return _.some(otherRange, function (o) {
|
|
259
|
+
let condition_a = value >= o.min && value <= o.max;
|
|
260
|
+
let condition_b = type == "left" ? value >= _.get(currentValue, "minScore", 0) : value <= _.get(currentValue, "maxScore", currentTotalScore)
|
|
261
|
+
|
|
262
|
+
return condition_a && condition_b;
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
generateExpr() {
|
|
266
|
+
let minScore = this.value.minScore;
|
|
267
|
+
let maxScore = this.value.maxScore;
|
|
268
|
+
return `${minScore} ${this.value.leftOperator} score and score ${this.value.rightOperator} ${maxScore}`;
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
});
|
|
265
272
|
</script>
|
|
266
273
|
<style scoped lang="less">
|
|
267
|
-
.label {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
274
|
+
.label {
|
|
275
|
+
text-align: right;
|
|
276
|
+
margin-bottom: 24px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/deep/ .operator {
|
|
280
|
+
.ivu-select-selected-value {
|
|
281
|
+
height: 28px;
|
|
282
|
+
line-height: 28px;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
277
285
|
</style>
|