@wg-npm/survey-creator 0.3.7725 → 0.3.7729
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,7 +3274,8 @@ 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),
|
|
@@ -3283,7 +3283,9 @@ var script$d = Vue.extend({
|
|
|
3283
3283
|
};
|
|
3284
3284
|
});
|
|
3285
3285
|
return _.some(otherRange, function (o) {
|
|
3286
|
-
|
|
3286
|
+
let condition_a = value >= o.min && value <= o.max;
|
|
3287
|
+
let condition_b = type == "left" ? value >= _.get(this.value, "minScore", 0) : value <= _.get(this.value, "maxScore", this.totalScore);
|
|
3288
|
+
return condition_a && condition_b;
|
|
3287
3289
|
});
|
|
3288
3290
|
},
|
|
3289
3291
|
generateExpr() {
|
|
@@ -3298,35 +3300,35 @@ var script$d = Vue.extend({
|
|
|
3298
3300
|
const __vue_script__$d = script$d;
|
|
3299
3301
|
|
|
3300
3302
|
/* 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
|
-
|
|
3303
|
+
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":{
|
|
3304
|
+
required: true,
|
|
3305
|
+
type: 'number',
|
|
3306
|
+
trigger: 'change',
|
|
3307
|
+
message: _vm.t('survey_creator.question.scoreRequiredTip'),
|
|
3308
|
+
}}},[_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":{
|
|
3309
|
+
required: true,
|
|
3310
|
+
trigger: 'change',
|
|
3311
|
+
message: _vm.t('survey_creator.question.notEmpty'),
|
|
3312
|
+
}}},[_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":{
|
|
3313
|
+
required: true,
|
|
3314
|
+
trigger: 'change',
|
|
3315
|
+
message: _vm.t('survey_creator.question.notEmpty'),
|
|
3316
|
+
}}},[_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":{
|
|
3317
|
+
required: true,
|
|
3318
|
+
type: 'number',
|
|
3319
|
+
trigger: 'change',
|
|
3320
|
+
message: _vm.t('survey_creator.question.scoreRequiredTip'),
|
|
3321
|
+
}}},[_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
3322
|
var __vue_staticRenderFns__$d = [];
|
|
3321
3323
|
|
|
3322
3324
|
/* style */
|
|
3323
3325
|
const __vue_inject_styles__$d = function (inject) {
|
|
3324
3326
|
if (!inject) return
|
|
3325
|
-
inject("data-v-
|
|
3327
|
+
inject("data-v-3760b41f_0", { source: ".label[data-v-3760b41f]{text-align:right;margin-bottom:24px}[data-v-3760b41f] .operator .ivu-select-selected-value{height:28px;line-height:28px}", map: undefined, media: undefined });
|
|
3326
3328
|
|
|
3327
3329
|
};
|
|
3328
3330
|
/* scoped */
|
|
3329
|
-
const __vue_scope_id__$d = "data-v-
|
|
3331
|
+
const __vue_scope_id__$d = "data-v-3760b41f";
|
|
3330
3332
|
/* module identifier */
|
|
3331
3333
|
const __vue_module_identifier__$d = undefined;
|
|
3332
3334
|
/* 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.7729",
|
|
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.7729",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.7729",
|
|
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.7729",
|
|
42
|
+
"@wg-npm/survey-service-api": "0.3.7729",
|
|
43
43
|
"acorn": "^7.3.1",
|
|
44
44
|
"axios": "^0.19.2",
|
|
45
45
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -1,277 +1,282 @@
|
|
|
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
|
+
return _.some(otherRange, function (o) {
|
|
256
|
+
let condition_a = value >= o.min && value <= o.max;
|
|
257
|
+
let condition_b = type == "left" ? value >= _.get(this.value, "minScore", 0) : value <= _.get(this.value, "maxScore", this.totalScore)
|
|
258
|
+
|
|
259
|
+
return condition_a && condition_b;
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
generateExpr() {
|
|
263
|
+
let minScore = this.value.minScore;
|
|
264
|
+
let maxScore = this.value.maxScore;
|
|
265
|
+
return `${minScore} ${this.value.leftOperator} score and score ${this.value.rightOperator} ${maxScore}`;
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
});
|
|
265
269
|
</script>
|
|
266
270
|
<style scoped lang="less">
|
|
267
|
-
.label {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
271
|
+
.label {
|
|
272
|
+
text-align: right;
|
|
273
|
+
margin-bottom: 24px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/deep/ .operator {
|
|
277
|
+
.ivu-select-selected-value {
|
|
278
|
+
height: 28px;
|
|
279
|
+
line-height: 28px;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
277
282
|
</style>
|