rb-document-form-constructor 0.8.47 → 0.8.49
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.
|
@@ -5014,6 +5014,12 @@ var fcInputs = {
|
|
|
5014
5014
|
default: null,
|
|
5015
5015
|
label: 'Надпись внутри',
|
|
5016
5016
|
visible: true
|
|
5017
|
+
},
|
|
5018
|
+
max: {
|
|
5019
|
+
type: 'number',
|
|
5020
|
+
default: 30,
|
|
5021
|
+
label: 'Максимальное значение',
|
|
5022
|
+
visible: true
|
|
5017
5023
|
}
|
|
5018
5024
|
},
|
|
5019
5025
|
propsData: {},
|
|
@@ -11259,6 +11265,15 @@ var _typeof = function(object) {
|
|
|
11259
11265
|
|
|
11260
11266
|
return false;
|
|
11261
11267
|
},
|
|
11268
|
+
isValueLessThanMax: function isValueLessThanMax(fieldname, max) {
|
|
11269
|
+
if (this.doc[fieldname] && max) {
|
|
11270
|
+
var _this$doc$fieldname;
|
|
11271
|
+
|
|
11272
|
+
return ((_this$doc$fieldname = this.doc[fieldname]) === null || _this$doc$fieldname === void 0 ? void 0 : _this$doc$fieldname.length) > parseInt(max);
|
|
11273
|
+
}
|
|
11274
|
+
|
|
11275
|
+
return false;
|
|
11276
|
+
},
|
|
11262
11277
|
isValueLessThanMin: function isValueLessThanMin(fieldname, min) {
|
|
11263
11278
|
if (this.doc[fieldname] && min) {
|
|
11264
11279
|
return parseInt(this.doc[fieldname]) < parseInt(min);
|
|
@@ -11272,6 +11287,9 @@ var _typeof = function(object) {
|
|
|
11272
11287
|
this.formConfig.sections.forEach(function (s) {
|
|
11273
11288
|
s.columns.forEach(function (c) {
|
|
11274
11289
|
c.fields.forEach(function (f) {
|
|
11290
|
+
var _f$input$propsData, _f$input$propsData2;
|
|
11291
|
+
|
|
11292
|
+
console.log(f.type);
|
|
11275
11293
|
var feedback = '';
|
|
11276
11294
|
|
|
11277
11295
|
if (f.required && _this3.isValueEmpty(f.name)) {
|
|
@@ -11282,6 +11300,14 @@ var _typeof = function(object) {
|
|
|
11282
11300
|
feedback += "\n\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043B\u044F ".concat(f.input.propsData.min);
|
|
11283
11301
|
}
|
|
11284
11302
|
|
|
11303
|
+
console.log((_f$input$propsData = f.input.propsData) === null || _f$input$propsData === void 0 ? void 0 : _f$input$propsData.max);
|
|
11304
|
+
|
|
11305
|
+
if (f.type === 'memo' && _this3.isValueLessThanMax(f.name, (_f$input$propsData2 = f.input.propsData) === null || _f$input$propsData2 === void 0 ? void 0 : _f$input$propsData2.max)) {
|
|
11306
|
+
var _f$input$propsData3;
|
|
11307
|
+
|
|
11308
|
+
feedback += "\n\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u043F\u043E\u043B\u044F ".concat((_f$input$propsData3 = f.input.propsData) === null || _f$input$propsData3 === void 0 ? void 0 : _f$input$propsData3.max);
|
|
11309
|
+
}
|
|
11310
|
+
|
|
11285
11311
|
if (feedback) {
|
|
11286
11312
|
Vue__default["default"].set(_this3.validationState, f.name, false);
|
|
11287
11313
|
Vue__default["default"].set(_this3.validationState, "".concat(f.name, "__feedback"), feedback);
|
|
@@ -11482,7 +11508,7 @@ var __vue_inject_styles__$3 = undefined;
|
|
|
11482
11508
|
var __vue_scope_id__$3 = undefined;
|
|
11483
11509
|
/* module identifier */
|
|
11484
11510
|
|
|
11485
|
-
var __vue_module_identifier__$3 = "data-v-
|
|
11511
|
+
var __vue_module_identifier__$3 = "data-v-c14954ac";
|
|
11486
11512
|
/* functional template */
|
|
11487
11513
|
|
|
11488
11514
|
var __vue_is_functional_template__$3 = false;
|
|
@@ -12518,7 +12544,7 @@ var DocTemplateFieldSidebar = __vue_component__$2;var script = {
|
|
|
12518
12544
|
var field = event.item._underlying_vm_;
|
|
12519
12545
|
|
|
12520
12546
|
if (!field.hasOwnProperty('defaultValue')) {
|
|
12521
|
-
field
|
|
12547
|
+
this.$set(field, 'defaultValue', undefined);
|
|
12522
12548
|
}
|
|
12523
12549
|
|
|
12524
12550
|
var found = this.multipleFieldAreOnFormConfig(field);
|
|
@@ -12648,7 +12674,7 @@ var __vue_render__ = function __vue_render__() {
|
|
|
12648
12674
|
return _vm.editSection(section);
|
|
12649
12675
|
}
|
|
12650
12676
|
}
|
|
12651
|
-
}, [_vm._v("\n
|
|
12677
|
+
}, [_vm._v("\n " + _vm._s(section.labelRu) + "\n ")]), _vm._v(" "), _c('span', {
|
|
12652
12678
|
staticClass: "rb-actions"
|
|
12653
12679
|
}, [_c('rb-icon', {
|
|
12654
12680
|
staticClass: "cursor-pointer",
|
|
@@ -12787,7 +12813,7 @@ var __vue_inject_styles__ = undefined;
|
|
|
12787
12813
|
var __vue_scope_id__ = undefined;
|
|
12788
12814
|
/* module identifier */
|
|
12789
12815
|
|
|
12790
|
-
var __vue_module_identifier__ = "data-v-
|
|
12816
|
+
var __vue_module_identifier__ = "data-v-1d0e94ea";
|
|
12791
12817
|
/* functional template */
|
|
12792
12818
|
|
|
12793
12819
|
var __vue_is_functional_template__ = false;
|
package/package.json
CHANGED
|
@@ -173,6 +173,12 @@ export default {
|
|
|
173
173
|
}
|
|
174
174
|
return false;
|
|
175
175
|
},
|
|
176
|
+
isValueLessThanMax(fieldname, max) {
|
|
177
|
+
if (this.doc[fieldname] && max) {
|
|
178
|
+
return this.doc[fieldname]?.length > parseInt(max);
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
},
|
|
176
182
|
isValueLessThanMin(fieldname, min) {
|
|
177
183
|
if (this.doc[fieldname] && min) {
|
|
178
184
|
return parseInt(this.doc[fieldname]) < parseInt(min);
|
|
@@ -184,6 +190,8 @@ export default {
|
|
|
184
190
|
this.formConfig.sections.forEach((s) => {
|
|
185
191
|
s.columns.forEach((c) => {
|
|
186
192
|
c.fields.forEach((f) => {
|
|
193
|
+
console.log(f.type)
|
|
194
|
+
|
|
187
195
|
let feedback = '';
|
|
188
196
|
|
|
189
197
|
if (f.required && this.isValueEmpty(f.name)) {
|
|
@@ -193,6 +201,10 @@ export default {
|
|
|
193
201
|
if (f.type === 'integer' && this.isValueLessThanMin(f.name, f.input.propsData.min)) {
|
|
194
202
|
feedback += `\nМинимальное значение для этого поля ${f.input.propsData.min}`;
|
|
195
203
|
}
|
|
204
|
+
console.log(f.input.propsData?.max)
|
|
205
|
+
if (f.type === 'memo' && this.isValueLessThanMax(f.name, f.input.propsData?.max)) {
|
|
206
|
+
feedback += `\nМаксимальное значение для этого поля ${f.input.propsData?.max}`;
|
|
207
|
+
}
|
|
196
208
|
|
|
197
209
|
if (feedback) {
|
|
198
210
|
Vue.set(this.validationState, f.name, false);
|
|
@@ -1,254 +1,254 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<div class="rb-doc-template-constructor d-flex">
|
|
3
|
+
<doc-template-facet-list @fieldMoveEnd="onFieldMoveEnd" :facets="facets"></doc-template-facet-list>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
<div class="rb-form-constructor flex-fill">
|
|
6
|
+
<div class="rb-constructor-toolbar d-flex flex-row">
|
|
7
|
+
<h4>Добавить секцию: </h4>
|
|
8
|
+
<div class="rb-layout-buttons">
|
|
9
|
+
<b-button pill variant="outline-gray" @click="addSection(1)">
|
|
10
|
+
<rb-text>Секция с 1 колонкой</rb-text>
|
|
11
|
+
<rb-icon :icon="iconAdd"></rb-icon>
|
|
12
|
+
</b-button>
|
|
13
|
+
<b-button pill variant="outline-gray" @click="addSection(2)">
|
|
14
|
+
<rb-text>Секция с 2 колонками</rb-text>
|
|
15
|
+
<rb-icon :icon="iconAdd"></rb-icon>
|
|
16
|
+
</b-button>
|
|
17
|
+
<b-button pill variant="outline-gray" @click="addSection(3)">
|
|
18
|
+
<rb-text>Секция с 3 колонками</rb-text>
|
|
19
|
+
<rb-icon :icon="iconAdd"></rb-icon>
|
|
20
|
+
</b-button>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
<div class="rb-constructor-body">
|
|
25
|
+
<draggable v-model="formConfig.section"
|
|
26
|
+
:animation="200"
|
|
27
|
+
group="section"
|
|
28
|
+
ghost-class="rb-form-card-moving"
|
|
29
|
+
handle=".rb-row-drag-handle">
|
|
30
|
+
<b-card v-for="(section, index) in formConfig.sections" :key="section.labelRu"
|
|
31
|
+
class="rb-form-card" :data-hash="hash">
|
|
32
|
+
<template #header>
|
|
33
|
+
<rb-icon :icon="iconDrag"
|
|
34
|
+
class="cursor-pointer rb-row-drag-handle"></rb-icon>
|
|
35
|
+
<rb-text class="flex-fill" @click="editSection(section)">
|
|
36
|
+
{{ section.labelRu }}
|
|
37
|
+
</rb-text>
|
|
38
|
+
<span class="rb-actions">
|
|
39
39
|
<rb-icon :icon="iconEdit" class="cursor-pointer"
|
|
40
40
|
@click="editSection(section)"></rb-icon>
|
|
41
41
|
<rb-icon :icon="iconDelete" class="cursor-pointer"
|
|
42
42
|
@click="removeSection(section, index)"></rb-icon>
|
|
43
43
|
</span>
|
|
44
|
-
|
|
44
|
+
</template>
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</div>
|
|
81
|
-
</b-card>
|
|
82
|
-
</draggable>
|
|
46
|
+
<div class="d-flex flex-row">
|
|
47
|
+
<draggable tag="b-form"
|
|
48
|
+
class="rb-form-column"
|
|
49
|
+
v-for="column in section.columns"
|
|
50
|
+
:key="column.index"
|
|
51
|
+
:class="{'rb-single-column': section.columnCount === 1}"
|
|
52
|
+
v-model="column.fields"
|
|
53
|
+
@add="onFieldAddedToColumn($event, column, section)"
|
|
54
|
+
:animation="200"
|
|
55
|
+
group="fields"
|
|
56
|
+
ghost-class="rb-moving-item"
|
|
57
|
+
handle=".rb-field-drag-handle">
|
|
58
|
+
<b-form-row v-for="field in column.fields" :key="field.name"
|
|
59
|
+
class="cursor-pointer" @click="showProperties(field, $event)">
|
|
60
|
+
<b-col lg="12">
|
|
61
|
+
<b-form-group :label="field.labelRu">
|
|
62
|
+
<template #label>
|
|
63
|
+
<rb-icon :icon="iconDrag" class="rb-field-drag-handle"></rb-icon>
|
|
64
|
+
<rb-text>{{ field.labelRu }}</rb-text>
|
|
65
|
+
<rb-icon :icon="iconDelete" class="rb-remove-field"
|
|
66
|
+
@click.prevent="onRemoveField($event, field, column)">
|
|
67
|
+
</rb-icon>
|
|
68
|
+
</template>
|
|
69
|
+
<component v-bind:is="field.input.type"
|
|
70
|
+
:id="field.name"
|
|
71
|
+
v-if="field.input"
|
|
72
|
+
v-bind="getFieldExtendedPropsData(field)"
|
|
73
|
+
disabled
|
|
74
|
+
class="cursor-pointer">
|
|
75
|
+
</component>
|
|
76
|
+
</b-form-group>
|
|
77
|
+
</b-col>
|
|
78
|
+
</b-form-row>
|
|
79
|
+
</draggable>
|
|
83
80
|
</div>
|
|
81
|
+
</b-card>
|
|
82
|
+
</draggable>
|
|
83
|
+
</div>
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
<doc-template-field-sidebar v-model="sidebarField"
|
|
86
|
+
:visible="sidebarVisible"
|
|
87
|
+
:form-config="formConfig"
|
|
88
|
+
@hide="sidebarVisible=false">
|
|
89
|
+
</doc-template-field-sidebar>
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</div>
|
|
91
|
+
<doc-template-section-modal :mode="sectionModalCfg.mode"
|
|
92
|
+
:section="sectionModalCfg.section"
|
|
93
|
+
:on-after-ok="sectionModalCfg.onAfterOk">
|
|
94
|
+
</doc-template-section-modal>
|
|
96
95
|
</div>
|
|
96
|
+
</div>
|
|
97
97
|
</template>
|
|
98
98
|
|
|
99
99
|
<script>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
import DocTemplateFacetList from "@/components/DocTemplateFacetList";
|
|
101
|
+
import DocTemplateFieldSidebar from "@/components/DocTemplateFieldSidebar";
|
|
102
|
+
import DocTemplateSectionModal from "@/components/DocTemplateSectionModal";
|
|
103
|
+
import draggable from 'vuedraggable';
|
|
104
|
+
import {UtFormConfig} from "../utils/UtFormConfig";
|
|
105
|
+
import {UtFormConstructor} from "../utils/UtFormConstructor";
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
107
|
+
export default {
|
|
108
|
+
name: 'DocTemplateConstructor',
|
|
109
|
+
components: {DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, draggable},
|
|
110
|
+
props: {
|
|
111
|
+
formConfig: {
|
|
112
|
+
type: Object, default: () => {
|
|
113
|
+
return {sections: []}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
facets: {type: Array, default: () => []}
|
|
117
|
+
},
|
|
118
|
+
data() {
|
|
119
|
+
return {
|
|
120
|
+
sidebarVisible: false,
|
|
121
|
+
sidebarField: null,
|
|
122
|
+
columnTo: false,
|
|
123
|
+
hash: '',
|
|
124
|
+
sectionModalCfg: {
|
|
125
|
+
id: 'rb-doc-template-section-modal',
|
|
126
|
+
mode: 'ins',
|
|
127
|
+
section: null,
|
|
128
|
+
onAfterOk() {
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
computed: {
|
|
134
|
+
iconAdd() {
|
|
135
|
+
return UtFormConstructor.config.icons.iconAdd;
|
|
136
|
+
},
|
|
137
|
+
iconEdit() {
|
|
138
|
+
return UtFormConstructor.config.icons.iconEdit;
|
|
139
|
+
},
|
|
140
|
+
iconDelete() {
|
|
141
|
+
return UtFormConstructor.config.icons.iconDelete;
|
|
142
|
+
},
|
|
143
|
+
iconDrag() {
|
|
144
|
+
return UtFormConstructor.config.icons.iconDrag;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
methods: {
|
|
148
|
+
showProperties(field, event) {
|
|
149
|
+
if (event.target.classList
|
|
150
|
+
&& event.target.classList.contains('rb-remove-field')) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
154
|
+
this.sidebarVisible = true;
|
|
155
|
+
this.sidebarField = field;
|
|
156
|
+
},
|
|
157
|
+
addSection(columnCount) {
|
|
158
|
+
let section = {labelRu: null, columnCount: columnCount};
|
|
159
|
+
this.sectionModalCfg.mode = 'ins';
|
|
160
|
+
this.sectionModalCfg.section = section;
|
|
161
|
+
this.sectionModalCfg.onAfterOk = () => {
|
|
162
|
+
section.columns = [];
|
|
163
|
+
for (let i = 0; i < columnCount; i++) {
|
|
164
|
+
section.columns.push({
|
|
165
|
+
index: i,
|
|
166
|
+
fields: []
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
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
|
-
|
|
170
|
+
this.formConfig.sections.push(section)
|
|
171
|
+
}
|
|
172
|
+
this.$bvModal.show(this.sectionModalCfg.id);
|
|
173
|
+
},
|
|
174
|
+
editSection(section) {
|
|
175
|
+
this.sectionModalCfg.mode = 'update';
|
|
176
|
+
this.sectionModalCfg.section = section;
|
|
177
|
+
this.sectionModalCfg.onAfterOk = () => {
|
|
178
|
+
}
|
|
179
|
+
this.$bvModal.show(this.sectionModalCfg.id);
|
|
180
|
+
},
|
|
181
|
+
removeSection(section, index) {
|
|
182
|
+
this.formConfig.sections.splice(index, 1);
|
|
183
|
+
/*UtModal.showYesNoDialog('Вы действительно хотите удалить секцию?', {
|
|
184
|
+
onOk: (event, modal) => {
|
|
185
|
+
this.formConfig.sections.splice(index, 1);
|
|
186
|
+
UtModal.closeModal(modal);
|
|
187
|
+
}
|
|
188
|
+
});*/
|
|
189
|
+
},
|
|
190
|
+
multipleFieldAreOnFormConfig(field) {
|
|
191
|
+
let count = 0;
|
|
192
|
+
this.formConfig.sections.forEach(s => {
|
|
193
|
+
s.columns.forEach(c => {
|
|
194
|
+
c.fields.forEach(f => {
|
|
195
|
+
if (f.name === field.name) {
|
|
196
|
+
count++;
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
return count > 1;
|
|
202
|
+
},
|
|
203
|
+
removeFieldFromColumn(field, column, newIndex) {
|
|
204
|
+
let index = newIndex != null ? newIndex : -1;
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
if (index < 0) {
|
|
207
|
+
index = column.fields.findIndex(f => field.name === f.name);
|
|
208
|
+
}
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
210
|
+
if (index >= 0) {
|
|
211
|
+
column.fields.splice(index, 1);
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
onRemoveField(event, field, column) {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
this.removeFieldFromColumn(field, column)
|
|
217
|
+
},
|
|
218
|
+
onFieldAddedToColumn(event, column, section) {
|
|
219
|
+
this.columnTo = column;
|
|
220
|
+
},
|
|
221
|
+
onFieldMoveEnd(event) {
|
|
222
|
+
const {newIndex} = event;
|
|
223
|
+
let field = event.item._underlying_vm_;
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
if (!field.hasOwnProperty('defaultValue')) {
|
|
226
|
+
this.$set(field, 'defaultValue', undefined);
|
|
227
|
+
}
|
|
228
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
|
-
|
|
229
|
+
let found = this.multipleFieldAreOnFormConfig(field);
|
|
230
|
+
if (found) {
|
|
231
|
+
this.removeFieldFromColumn(field, this.columnTo, newIndex);
|
|
232
|
+
this.resetDragVariables();
|
|
233
|
+
this.$bvModal.msgBoxOk('На форме уже есть это поле', {
|
|
234
|
+
title: 'Ошибка',
|
|
235
|
+
headerClass: 'rb-error-msg-box__header',
|
|
236
|
+
bodyClass: 'rb-error-msg-box__body',
|
|
237
|
+
footerClass: 'rb-error-msg-box__footer',
|
|
238
|
+
centered: true,
|
|
239
|
+
noCloseOnBackdrop: true,
|
|
240
|
+
noCloseOnEsc: true
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
this.resetDragVariables();
|
|
244
|
+
this.hash = (Math.random() + 1).toString(36).substring(7);
|
|
245
|
+
},
|
|
246
|
+
getFieldExtendedPropsData(field) {
|
|
247
|
+
return {...field.input.propsData, placeholder: field.tag, disabled: true};
|
|
248
|
+
},
|
|
249
|
+
resetDragVariables() {
|
|
250
|
+
this.columnTo = null;
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
}
|
|
254
254
|
</script>
|