@wg-npm/survey-creator 0.3.7687 → 0.3.7720
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,6 +3262,7 @@ var script$d = Vue.extend({
|
|
|
3262
3262
|
}
|
|
3263
3263
|
},
|
|
3264
3264
|
disabledScoreOption(value, type) {
|
|
3265
|
+
debugger;
|
|
3265
3266
|
if (this.checkValueInOtherRange(value)) {
|
|
3266
3267
|
return true;
|
|
3267
3268
|
}
|
|
@@ -3321,11 +3322,11 @@ var __vue_staticRenderFns__$d = [];
|
|
|
3321
3322
|
/* style */
|
|
3322
3323
|
const __vue_inject_styles__$d = function (inject) {
|
|
3323
3324
|
if (!inject) return
|
|
3324
|
-
inject("data-v-
|
|
3325
|
+
inject("data-v-1411052e_0", { source: ".label[data-v-1411052e]{text-align:right;margin-bottom:24px}[data-v-1411052e] .operator .ivu-select-selected-value{height:28px;line-height:28px}", map: undefined, media: undefined });
|
|
3325
3326
|
|
|
3326
3327
|
};
|
|
3327
3328
|
/* scoped */
|
|
3328
|
-
const __vue_scope_id__$d = "data-v-
|
|
3329
|
+
const __vue_scope_id__$d = "data-v-1411052e";
|
|
3329
3330
|
/* module identifier */
|
|
3330
3331
|
const __vue_module_identifier__$d = undefined;
|
|
3331
3332
|
/* functional template */
|
|
@@ -3461,6 +3462,13 @@ var script$b = Vue.extend({
|
|
|
3461
3462
|
required: true,
|
|
3462
3463
|
},
|
|
3463
3464
|
},
|
|
3465
|
+
watch: {
|
|
3466
|
+
"exprConditionType"() {
|
|
3467
|
+
{
|
|
3468
|
+
this.evaluationItems = [];
|
|
3469
|
+
}
|
|
3470
|
+
},
|
|
3471
|
+
},
|
|
3464
3472
|
data() {
|
|
3465
3473
|
return {
|
|
3466
3474
|
evaluationItems: this.value,
|
|
@@ -3536,22 +3544,22 @@ var script$b = Vue.extend({
|
|
|
3536
3544
|
const __vue_script__$b = script$b;
|
|
3537
3545
|
|
|
3538
3546
|
/* template */
|
|
3539
|
-
var __vue_render__$b = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Card',{attrs:{"dis-hover":""}},[_c('Row',{attrs:{"slot":"title","type":"flex","gutter":6},slot:"title"},[_c('Col',[_c('div',{staticClass:"text"},[_vm._v("\n
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3547
|
+
var __vue_render__$b = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Card',{attrs:{"dis-hover":""}},[_c('Row',{attrs:{"slot":"title","type":"flex","gutter":6},slot:"title"},[_c('Col',[_c('div',{staticClass:"text"},[_vm._v("\n "+_vm._s(_vm.t("survey_creator.question.evaluation.condition.if"))+"\n ")])]),_vm._v(" "),_c('Col',[_c('Button',{attrs:{"type":"primary","icon":"md-add"},on:{"click":_vm.onAdd}},[_vm._v("\n "+_vm._s(_vm.t("survey_creator.question.evaluation.condition.add_if_template"))+"\n ")])],1)],1),_vm._v(" "),_c('a',{directives:[{name:"show",rawName:"v-show",value:(_vm.deletable),expression:"deletable"}],attrs:{"slot":"extra","href":"#"},on:{"click":function($event){$event.preventDefault();return _vm.onDelete.apply(null, arguments)}},slot:"extra"},[_vm._v("\n "+_vm._s(_vm.t("survey_creator.common.delete"))+"\n ")]),_vm._v(" "),_c('Row',{attrs:{"type":"flex","justify":"start","align":"middle"}},[_c('Col',{attrs:{"span":22}},[_c('Row',{attrs:{"type":"flex","justify":"start","align":"middle"}},[_c('Col',{staticClass:"label"},[_c('Icon',{attrs:{"type":"ios-arrow-forward","color":"#2d8cf0"}}),_vm._v("\n "+_vm._s(_vm.t("survey_creator.question.evaluation.condition.requirements"))+"\n ")],1),_vm._v(" "),_c('Col',{attrs:{"span":16}},[_c('Select',{model:{value:(_vm.exprConditionType),callback:function ($$v) {_vm.exprConditionType=$$v;},expression:"exprConditionType"}},_vm._l((_vm.exprConditionTypes),function(type){return _c('Option',{key:type,attrs:{"value":type}},[_vm._v("\n "+_vm._s(_vm.t(("survey_creator.question.evaluation.condition.type." + type)))+"\n ")])}),1)],1)],1)],1),_vm._v(" "),_c('Col',{attrs:{"span":2}},[_c('Button',{staticClass:"action",attrs:{"icon":"md-add","disabled":_vm.disableAddConditionBtn},on:{"click":_vm.addCondition}})],1)],1),_vm._v(" "),_vm._l((_vm.evaluationItems[_vm.position].conditions),function(condition,index){return _c('Row',{key:index,staticClass:"mt-base",attrs:{"type":"flex","justify":"space-between","align":"middle"}},[_c('Col',{attrs:{"span":22}},[_c('condition',{key:index,attrs:{"index":index,"type":condition.type,"question":_vm.question,"evaluation-items":_vm.evaluationItems,"item-index":_vm.position},on:{"expr":_vm.expr},model:{value:(condition.payload),callback:function ($$v) {_vm.$set(condition, "payload", $$v);},expression:"condition.payload"}})],1),_vm._v(" "),_c('Col',{attrs:{"span":2}},[_c('Button',{staticClass:"action",staticStyle:{"margin-bottom":"24px"},attrs:{"icon":"md-remove"},on:{"click":function($event){return _vm.removeCondition(index)}}})],1)],1)}),_vm._v(" "),_c('Row',{staticClass:"mt-base",attrs:{"type":"flex","justify":"end","align":"middle"}},[_c('Col',[_c('FormItem',{attrs:{"prop":'evaluationItems[' + _vm.position + '].text.' + _vm.primaryLanguage,"rules":{
|
|
3548
|
+
required: true,
|
|
3549
|
+
message: _vm.t(
|
|
3550
|
+
'survey_creator.question.evaluation.condition.evaluation_require_tip'
|
|
3551
|
+
),
|
|
3552
|
+
}}},[_vm._v(_vm._s(_vm.t("survey_creator.question.evaluation.condition.evaluation_label"))+"\n "),_c('Input',{staticClass:"input",model:{value:(_vm.evaluationItems[_vm.position].text[_vm.primaryLanguage]),callback:function ($$v) {_vm.$set(_vm.evaluationItems[_vm.position].text, _vm.primaryLanguage, (typeof $$v === 'string'? $$v.trim(): $$v));},expression:"evaluationItems[position].text[primaryLanguage]"}})],1)],1)],1)],2)};
|
|
3545
3553
|
var __vue_staticRenderFns__$b = [];
|
|
3546
3554
|
|
|
3547
3555
|
/* style */
|
|
3548
3556
|
const __vue_inject_styles__$b = function (inject) {
|
|
3549
3557
|
if (!inject) return
|
|
3550
|
-
inject("data-v-
|
|
3558
|
+
inject("data-v-cb7e5044_0", { source: ".mt-base[data-v-cb7e5044]{margin-top:12px}.action[data-v-cb7e5044]{float:right}.input[data-v-cb7e5044]{width:100px}.label[data-v-cb7e5044]{text-align:right;padding-right:4px}.text[data-v-cb7e5044]{background-color:#ebf7ff;height:32px;padding:8px 18px;font-weight:500;color:#515a6e}[data-v-cb7e5044] .ivu-card .ivu-form-item{margin-bottom:4px;margin-top:0}[data-v-cb7e5044] .ivu-card .ivu-form-item-error{margin-bottom:24px;margin-top:0}", map: undefined, media: undefined });
|
|
3551
3559
|
|
|
3552
3560
|
};
|
|
3553
3561
|
/* scoped */
|
|
3554
|
-
const __vue_scope_id__$b = "data-v-
|
|
3562
|
+
const __vue_scope_id__$b = "data-v-cb7e5044";
|
|
3555
3563
|
/* module identifier */
|
|
3556
3564
|
const __vue_module_identifier__$b = undefined;
|
|
3557
3565
|
/* 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.7720",
|
|
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.7720",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.7720",
|
|
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.7720",
|
|
42
|
+
"@wg-npm/survey-service-api": "0.3.7720",
|
|
43
43
|
"acorn": "^7.3.1",
|
|
44
44
|
"axios": "^0.19.2",
|
|
45
45
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -1,269 +1,277 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<Row type="flex" justify="start" align="middle">
|
|
21
|
-
<Col :span="22">
|
|
2
|
+
<Card dis-hover>
|
|
3
|
+
<Row type="flex" :gutter="6" slot="title">
|
|
4
|
+
<Col>
|
|
5
|
+
<div class="text">
|
|
6
|
+
{{ t("survey_creator.question.evaluation.condition.if") }}
|
|
7
|
+
</div>
|
|
8
|
+
</Col>
|
|
9
|
+
<Col>
|
|
10
|
+
<Button type="primary" icon="md-add" @click="onAdd">
|
|
11
|
+
{{
|
|
12
|
+
t("survey_creator.question.evaluation.condition.add_if_template")
|
|
13
|
+
}}
|
|
14
|
+
</Button>
|
|
15
|
+
</Col>
|
|
16
|
+
</Row>
|
|
17
|
+
<a href="#" slot="extra" @click.prevent="onDelete" v-show="deletable">
|
|
18
|
+
{{ t("survey_creator.common.delete") }}
|
|
19
|
+
</a>
|
|
22
20
|
<Row type="flex" justify="start" align="middle">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
<Col :span="22">
|
|
22
|
+
<Row type="flex" justify="start" align="middle">
|
|
23
|
+
<Col class="label">
|
|
24
|
+
<Icon type="ios-arrow-forward" color="#2d8cf0"/>
|
|
25
|
+
{{ t("survey_creator.question.evaluation.condition.requirements") }}
|
|
26
|
+
</Col>
|
|
27
|
+
<Col :span="16">
|
|
28
|
+
<Select v-model="exprConditionType">
|
|
29
|
+
<Option
|
|
30
|
+
v-for="type in exprConditionTypes"
|
|
31
|
+
:value="type"
|
|
32
|
+
:key="type"
|
|
33
|
+
>
|
|
34
|
+
{{
|
|
35
|
+
t(`survey_creator.question.evaluation.condition.type.${type}`)
|
|
36
|
+
}}
|
|
37
|
+
</Option>
|
|
38
|
+
</Select>
|
|
39
|
+
</Col>
|
|
40
|
+
</Row>
|
|
41
|
+
</Col>
|
|
42
|
+
<Col :span="2">
|
|
43
|
+
<Button
|
|
44
|
+
icon="md-add"
|
|
45
|
+
:disabled="disableAddConditionBtn"
|
|
46
|
+
class="action"
|
|
47
|
+
@click="addCondition"
|
|
48
|
+
></Button>
|
|
49
|
+
</Col>
|
|
50
|
+
</Row>
|
|
51
|
+
<Row
|
|
52
|
+
type="flex"
|
|
53
|
+
justify="space-between"
|
|
54
|
+
align="middle"
|
|
55
|
+
v-for="(condition, index) in evaluationItems[position].conditions"
|
|
56
|
+
:key="index"
|
|
57
|
+
class="mt-base"
|
|
58
|
+
>
|
|
59
|
+
<Col :span="22">
|
|
60
|
+
<condition
|
|
61
|
+
:key="index"
|
|
62
|
+
:index="index"
|
|
63
|
+
:type="condition.type"
|
|
64
|
+
v-model="condition.payload"
|
|
65
|
+
@expr="expr"
|
|
66
|
+
:question="question"
|
|
67
|
+
:evaluation-items="evaluationItems"
|
|
68
|
+
:item-index="position"
|
|
69
|
+
/>
|
|
70
|
+
</Col>
|
|
71
|
+
<Col :span="2">
|
|
72
|
+
<Button
|
|
73
|
+
icon="md-remove"
|
|
74
|
+
class="action"
|
|
75
|
+
style="margin-bottom: 24px"
|
|
76
|
+
@click="removeCondition(index)"
|
|
77
|
+
></Button>
|
|
78
|
+
</Col>
|
|
40
79
|
</Row>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class="action"
|
|
47
|
-
@click="addCondition"
|
|
48
|
-
></Button>
|
|
49
|
-
</Col>
|
|
50
|
-
</Row>
|
|
51
|
-
<Row
|
|
52
|
-
type="flex"
|
|
53
|
-
justify="space-between"
|
|
54
|
-
align="middle"
|
|
55
|
-
v-for="(condition, index) in evaluationItems[position].conditions"
|
|
56
|
-
:key="index"
|
|
57
|
-
class="mt-base"
|
|
58
|
-
>
|
|
59
|
-
<Col :span="22">
|
|
60
|
-
<condition
|
|
61
|
-
:key="index"
|
|
62
|
-
:index="index"
|
|
63
|
-
:type="condition.type"
|
|
64
|
-
v-model="condition.payload"
|
|
65
|
-
@expr="expr"
|
|
66
|
-
:question="question"
|
|
67
|
-
:evaluation-items="evaluationItems"
|
|
68
|
-
:item-index="position"
|
|
69
|
-
/>
|
|
70
|
-
</Col>
|
|
71
|
-
<Col :span="2">
|
|
72
|
-
<Button
|
|
73
|
-
icon="md-remove"
|
|
74
|
-
class="action"
|
|
75
|
-
style="margin-bottom: 24px"
|
|
76
|
-
@click="removeCondition(index)"
|
|
77
|
-
></Button>
|
|
78
|
-
</Col>
|
|
79
|
-
</Row>
|
|
80
|
-
<Row type="flex" justify="end" align="middle" class="mt-base">
|
|
81
|
-
<Col>
|
|
82
|
-
<FormItem
|
|
83
|
-
:prop="'evaluationItems[' + position + '].text.' + primaryLanguage"
|
|
84
|
-
:rules="{
|
|
80
|
+
<Row type="flex" justify="end" align="middle" class="mt-base">
|
|
81
|
+
<Col>
|
|
82
|
+
<FormItem
|
|
83
|
+
:prop="'evaluationItems[' + position + '].text.' + primaryLanguage"
|
|
84
|
+
:rules="{
|
|
85
85
|
required: true,
|
|
86
86
|
message: t(
|
|
87
87
|
'survey_creator.question.evaluation.condition.evaluation_require_tip'
|
|
88
88
|
),
|
|
89
89
|
}"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
>{{
|
|
91
|
+
t("survey_creator.question.evaluation.condition.evaluation_label")
|
|
92
|
+
}}
|
|
93
|
+
<Input
|
|
94
|
+
class="input"
|
|
95
|
+
v-model.trim="evaluationItems[position].text[primaryLanguage]"
|
|
96
|
+
/>
|
|
97
|
+
</FormItem>
|
|
98
|
+
</Col>
|
|
99
|
+
</Row>
|
|
100
|
+
</Card>
|
|
101
101
|
</template>
|
|
102
102
|
<script lang="ts">
|
|
103
|
-
import Vue from "vue";
|
|
104
|
-
import QuestionFormMixin from "../../../../../mixins/question-form-mixin";
|
|
105
|
-
import {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
} from "@wg-npm/survey-core/src/models";
|
|
109
|
-
import {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
} from "view-design";
|
|
120
|
-
import Condition from "./condition.vue";
|
|
121
|
-
import _ from "lodash";
|
|
103
|
+
import Vue from "vue";
|
|
104
|
+
import QuestionFormMixin from "../../../../../mixins/question-form-mixin";
|
|
105
|
+
import {
|
|
106
|
+
ExprConditionType,
|
|
107
|
+
ExprEvaluationItemType,
|
|
108
|
+
} from "@wg-npm/survey-core/src/models";
|
|
109
|
+
import {
|
|
110
|
+
Card,
|
|
111
|
+
Row,
|
|
112
|
+
Col,
|
|
113
|
+
Button,
|
|
114
|
+
Select,
|
|
115
|
+
Option,
|
|
116
|
+
Icon,
|
|
117
|
+
FormItem,
|
|
118
|
+
Input,
|
|
119
|
+
} from "view-design";
|
|
120
|
+
import Condition from "./condition.vue";
|
|
121
|
+
import _ from "lodash";
|
|
122
122
|
|
|
123
|
-
export default Vue.extend({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
123
|
+
export default Vue.extend({
|
|
124
|
+
name: "if",
|
|
125
|
+
mixins: [QuestionFormMixin],
|
|
126
|
+
components: {
|
|
127
|
+
Card,
|
|
128
|
+
Row,
|
|
129
|
+
Col,
|
|
130
|
+
Select,
|
|
131
|
+
Option,
|
|
132
|
+
Button,
|
|
133
|
+
Icon,
|
|
134
|
+
Condition,
|
|
135
|
+
FormItem,
|
|
136
|
+
Input,
|
|
137
|
+
},
|
|
138
|
+
props: {
|
|
139
|
+
value: {
|
|
140
|
+
type: Array,
|
|
141
|
+
required: true,
|
|
142
|
+
},
|
|
143
|
+
position: {
|
|
144
|
+
type: Number,
|
|
145
|
+
required: true,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
watch: {
|
|
149
|
+
"exprConditionType"() {
|
|
150
|
+
handler: {
|
|
151
|
+
this.evaluationItems = [];
|
|
152
|
+
}
|
|
153
|
+
deep: true;
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
data() {
|
|
157
|
+
return {
|
|
158
|
+
evaluationItems: this.value,
|
|
159
|
+
exprConditionType: ExprConditionType.AUTO,
|
|
160
|
+
exprConditionTypes: [
|
|
161
|
+
ExprConditionType.AUTO,
|
|
162
|
+
ExprConditionType.ASSIGN,
|
|
163
|
+
ExprConditionType.SCORE,
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
computed: {
|
|
168
|
+
totalScore() {
|
|
169
|
+
return this.$rootComponent.currentSurvey.statistics.maxScore;
|
|
170
|
+
},
|
|
171
|
+
deletable() {
|
|
172
|
+
return (
|
|
173
|
+
_.size(
|
|
174
|
+
_.filter(
|
|
175
|
+
this.evaluationItems,
|
|
176
|
+
(item) => item.type == ExprEvaluationItemType.IF
|
|
177
|
+
)
|
|
178
|
+
) > 1
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
disableAddConditionBtn() {
|
|
182
|
+
let conditions = this.evaluationItems[this.position].conditions;
|
|
183
|
+
let scoreConditions = _.size(
|
|
184
|
+
_.filter(conditions, (item) => item.type == ExprConditionType.SCORE)
|
|
185
|
+
);
|
|
186
|
+
return (
|
|
187
|
+
this.exprConditionType == ExprConditionType.SCORE && scoreConditions > 0
|
|
188
|
+
);
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
methods: {
|
|
192
|
+
onAdd() {
|
|
193
|
+
this.evaluationItems.splice(this.position + 1, 0, {
|
|
194
|
+
id: `Evaluation-Item-${_.now()}-${_.random(0, 9999999)}`,
|
|
195
|
+
type: ExprEvaluationItemType.IF,
|
|
196
|
+
text: {
|
|
197
|
+
"zh-CN": "",
|
|
198
|
+
},
|
|
199
|
+
conditions: [],
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
onDelete() {
|
|
203
|
+
this.evaluationItems.splice(this.position, 1);
|
|
204
|
+
},
|
|
205
|
+
addCondition() {
|
|
206
|
+
this.evaluationItems[this.position].conditions ||
|
|
207
|
+
this.$set(this.evaluationItems[this.position], "conditions", []);
|
|
208
|
+
this.evaluationItems[this.position].conditions.push({
|
|
209
|
+
type: this.exprConditionType,
|
|
210
|
+
payload: this.buildPayloadByType(this.exprConditionType),
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
buildPayloadByType(type) {
|
|
214
|
+
if (type == ExprConditionType.SCORE) {
|
|
215
|
+
return {
|
|
216
|
+
minScore: null,
|
|
217
|
+
leftOperator: "<",
|
|
218
|
+
rightOperator: "<",
|
|
219
|
+
maxScore: null,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
scope: [],
|
|
224
|
+
operator: "=",
|
|
225
|
+
values: [],
|
|
226
|
+
size: 0,
|
|
227
|
+
};
|
|
228
|
+
},
|
|
229
|
+
removeCondition(index) {
|
|
230
|
+
this.evaluationItems[this.position].conditions.splice(index, 1);
|
|
231
|
+
},
|
|
232
|
+
expr(index, value) {
|
|
233
|
+
_.set(
|
|
234
|
+
this.evaluationItems[this.position].conditions[index],
|
|
235
|
+
"expr",
|
|
236
|
+
value
|
|
237
|
+
);
|
|
238
|
+
},
|
|
190
239
|
},
|
|
191
|
-
|
|
192
|
-
});
|
|
193
|
-
},
|
|
194
|
-
onDelete() {
|
|
195
|
-
this.evaluationItems.splice(this.position, 1);
|
|
196
|
-
},
|
|
197
|
-
addCondition() {
|
|
198
|
-
this.evaluationItems[this.position].conditions ||
|
|
199
|
-
this.$set(this.evaluationItems[this.position], "conditions", []);
|
|
200
|
-
this.evaluationItems[this.position].conditions.push({
|
|
201
|
-
type: this.exprConditionType,
|
|
202
|
-
payload: this.buildPayloadByType(this.exprConditionType),
|
|
203
|
-
});
|
|
204
|
-
},
|
|
205
|
-
buildPayloadByType(type) {
|
|
206
|
-
if (type == ExprConditionType.SCORE) {
|
|
207
|
-
return {
|
|
208
|
-
minScore: null,
|
|
209
|
-
leftOperator: "<",
|
|
210
|
-
rightOperator: "<",
|
|
211
|
-
maxScore: null,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
scope: [],
|
|
216
|
-
operator: "=",
|
|
217
|
-
values: [],
|
|
218
|
-
size: 0,
|
|
219
|
-
};
|
|
220
|
-
},
|
|
221
|
-
removeCondition(index) {
|
|
222
|
-
this.evaluationItems[this.position].conditions.splice(index, 1);
|
|
223
|
-
},
|
|
224
|
-
expr(index, value) {
|
|
225
|
-
_.set(
|
|
226
|
-
this.evaluationItems[this.position].conditions[index],
|
|
227
|
-
"expr",
|
|
228
|
-
value
|
|
229
|
-
);
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
});
|
|
240
|
+
});
|
|
233
241
|
</script>
|
|
234
242
|
<style scoped lang="less">
|
|
235
|
-
.mt-base {
|
|
236
|
-
|
|
237
|
-
}
|
|
243
|
+
.mt-base {
|
|
244
|
+
margin-top: 12px;
|
|
245
|
+
}
|
|
238
246
|
|
|
239
|
-
.action {
|
|
240
|
-
|
|
241
|
-
}
|
|
247
|
+
.action {
|
|
248
|
+
float: right;
|
|
249
|
+
}
|
|
242
250
|
|
|
243
|
-
.input {
|
|
244
|
-
|
|
245
|
-
}
|
|
251
|
+
.input {
|
|
252
|
+
width: 100px;
|
|
253
|
+
}
|
|
246
254
|
|
|
247
|
-
.label {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
255
|
+
.label {
|
|
256
|
+
text-align: right;
|
|
257
|
+
padding-right: 4px;
|
|
258
|
+
}
|
|
251
259
|
|
|
252
|
-
.text {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
260
|
+
.text {
|
|
261
|
+
background-color: #ebf7ff;
|
|
262
|
+
height: 32px;
|
|
263
|
+
padding: 8px 18px;
|
|
264
|
+
font-weight: 500;
|
|
265
|
+
color: #515a6e;
|
|
266
|
+
}
|
|
259
267
|
|
|
260
|
-
/deep/ .ivu-card .ivu-form-item {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
268
|
+
/deep/ .ivu-card .ivu-form-item {
|
|
269
|
+
margin-bottom: 4px;
|
|
270
|
+
margin-top: 0;
|
|
271
|
+
}
|
|
264
272
|
|
|
265
|
-
/deep/ .ivu-card .ivu-form-item-error {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
273
|
+
/deep/ .ivu-card .ivu-form-item-error {
|
|
274
|
+
margin-bottom: 24px;
|
|
275
|
+
margin-top: 0;
|
|
276
|
+
}
|
|
269
277
|
</style>
|