cloud-web-corejs 1.0.31 → 1.0.32
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/package.json +1 -1
- package/src/components/statusTag/index.vue +14 -14
- package/src/components/statusTag/mixins.js +5 -5
- package/src/components/table/index.js +10 -10
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +379 -379
- package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +125 -125
- package/src/components/xform/form-render/container-item/data-table-mixin.js +18 -18
- package/src/views/bd/setting/bd_attach_setting/dialog.vue +4 -2
- package/src/views/bd/setting/bd_attach_setting/edit.vue +7 -6
- package/src/views/bd/setting/bd_attach_setting/list.vue +2 -2
- package/src/views/bd/setting/bd_attach_setting/mixins/dialog.js +5 -5
- package/src/views/bd/setting/bd_attach_setting/mixins/list.js +15 -23
- package/src/views/bd/setting/form_script/dialog.vue +8 -7
- package/src/views/bd/setting/form_script/edit.vue +9 -9
- package/src/views/bd/setting/form_script/edit1.vue +20 -18
- package/src/views/bd/setting/form_script/form_list.vue +5 -5
- package/src/views/bd/setting/form_script/list1.vue +8 -6
- package/src/views/bd/setting/form_script/mixins/dialog.js +15 -23
- package/src/views/bd/setting/form_script/mixins/form_list.js +52 -36
- package/src/views/bd/setting/form_script/mixins/list.js +19 -27
- package/src/views/bd/setting/form_script/mixins/list1.js +28 -36
- package/src/views/bd/setting/form_template/dialog.vue +6 -6
- package/src/views/bd/setting/form_template/edit.vue +30 -37
- package/src/views/bd/setting/form_template/editWfObjConfigDialog.vue +3 -3
- package/src/views/bd/setting/form_template/ftHistoryDialog.vue +5 -4
- package/src/views/bd/setting/form_template/itemEdit.vue +29 -25
- package/src/views/bd/setting/form_template/itemList.vue +1 -1
- package/src/views/bd/setting/form_template/list.vue +15 -13
- package/src/views/bd/setting/form_template/mixins/dialog.js +7 -14
- package/src/views/bd/setting/form_template/mixins/ftHistoryDialog.js +4 -4
- package/src/views/bd/setting/form_template/mixins/itemList.js +43 -57
- package/src/views/bd/setting/form_template/mixins/list.js +40 -77
- package/src/views/bd/setting/form_template/preformDialog.vue +1 -1
- package/src/views/bd/setting/menu_kind/authDialog.vue +7 -2
- package/src/views/bd/setting/menu_kind/dialog.vue +2 -2
- package/src/views/bd/setting/menu_kind/list.vue +7 -10
- package/src/views/bd/setting/menu_kind/mixins/authDialog.js +14 -33
- package/src/views/bd/setting/menu_kind/mixins/dialog.js +14 -18
- package/src/views/bd/setting/menu_kind/mixins/list.js +17 -24
- package/src/views/bd/setting/table_model/dialog.vue +8 -6
- package/src/views/bd/setting/table_model/edit.vue +79 -41
- package/src/views/bd/setting/table_model/list.vue +8 -11
- package/src/views/bd/setting/table_model/mixins/dialog.js +6 -6
- package/src/views/bd/setting/table_model/mixins/edit.js +54 -84
- package/src/views/bd/setting/table_model/mixins/list.js +26 -58
- package/src/views/bd/setting/table_model/mixins/zdDialog.js +14 -16
- package/src/views/bd/setting/table_model/zdDialog.vue +8 -6
- package/src/views/bd/setting/utils/index.js +60 -0
|
@@ -1,379 +1,379 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
/**
|
|
3
|
-
* author: vformAdmin
|
|
4
|
-
* email: vdpadmin@163.com
|
|
5
|
-
* website: https://www.vform666.com
|
|
6
|
-
* date: 2021.08.18
|
|
7
|
-
* remark: 如果要分发VForm源码,需在本文件顶部保留此文件头信息!!
|
|
8
|
-
*/
|
|
9
|
-
-->
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<div class="field-wrapper" :class="{'design-time-bottom-margin': !!this.designer}">
|
|
13
|
-
<div>
|
|
14
|
-
<template v-if="formItemProp=='false'">
|
|
15
|
-
<slot></slot>
|
|
16
|
-
</template>
|
|
17
|
-
<template v-else>
|
|
18
|
-
<el-form-item v-if="!!field.formItemFlag && (!field.options.hidden || (designState === true))"
|
|
19
|
-
:label="label" :label-width="labelWidth + 'px'"
|
|
20
|
-
:title="field.options.labelTooltip"
|
|
21
|
-
:rules="rules" :prop="getPropName()"
|
|
22
|
-
:class="[selected ? 'selected' : '', labelAlign, customClass, field.options.required ? 'required' : '']"
|
|
23
|
-
@click.native.stop="selectField(field)">
|
|
24
|
-
|
|
25
|
-
<span v-if="!!field.options.labelIconClass" slot="label" class="custom-label" :style="{'color':field.options.labelColor}">
|
|
26
|
-
<template v-if="field.options.labelIconPosition === 'front'">
|
|
27
|
-
<template v-if="!!field.options.labelTooltip">
|
|
28
|
-
<el-tooltip :content="field.options.labelTooltip" effect="light">
|
|
29
|
-
<i :class="field.options.labelIconClass"></i></el-tooltip>{{ label }}</template>
|
|
30
|
-
<template v-else>
|
|
31
|
-
<i :class="field.options.labelIconClass"></i>{{ label }}</template>
|
|
32
|
-
</template>
|
|
33
|
-
<template v-else-if="field.options.labelIconPosition === 'rear'">
|
|
34
|
-
<template v-if="!!field.options.labelTooltip">
|
|
35
|
-
{{ label }}<el-tooltip :content="field.options.labelTooltip" effect="light">
|
|
36
|
-
<i :class="field.options.labelIconClass"></i></el-tooltip></template>
|
|
37
|
-
<template v-else>
|
|
38
|
-
{{ label }}<i :class="field.options.labelIconClass"></i></template>
|
|
39
|
-
</template>
|
|
40
|
-
</span>
|
|
41
|
-
<span v-if="!!field.options.labelColor" slot="label" :style="{'color':field.options.labelColor}">
|
|
42
|
-
{{ label }}
|
|
43
|
-
</span>
|
|
44
|
-
<slot></slot>
|
|
45
|
-
</el-form-item>
|
|
46
|
-
</template>
|
|
47
|
-
</div>
|
|
48
|
-
<template v-if="!!this.designer">
|
|
49
|
-
<div class="field-action" v-if="designer.selectedId === field.id">
|
|
50
|
-
<i class="el-icon-back" :title="i18nt('designer.hint.selectParentWidget')"
|
|
51
|
-
@click.stop="selectParentWidget(field)"></i>
|
|
52
|
-
<i class="el-icon-top" v-if="!!parentList && (parentList.length > 1)"
|
|
53
|
-
:title="i18nt('designer.hint.moveUpWidget')"
|
|
54
|
-
@click.stop="moveUpWidget(field)"></i>
|
|
55
|
-
<i class="el-icon-bottom" v-if="!!parentList && (parentList.length > 1)"
|
|
56
|
-
:title="i18nt('designer.hint.moveDownWidget')"
|
|
57
|
-
@click.stop="moveDownWidget(field)"></i>
|
|
58
|
-
<i class="el-icon-delete" :title="i18nt('designer.hint.remove')" @click.stop="removeFieldWidget"></i>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<div class="drag-handler background-opacity" v-if="designer.selectedId === field.id">
|
|
62
|
-
<i class="el-icon-rank" :title="i18nt('designer.hint.dragHandler')"></i>
|
|
63
|
-
<i>{{ i18n2t(`designer.widgetLabel.${field.type}`, `extension.widgetLabel.${field.type}`) }}</i>
|
|
64
|
-
<i v-if="field.options.hidden === true" class="iconfont icon-hide"></i>
|
|
65
|
-
</div>
|
|
66
|
-
</template>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
69
|
-
|
|
70
|
-
<script>
|
|
71
|
-
import i18n from "../../../../../components/xform/utils/i18n";
|
|
72
|
-
import {getSubFormNameByFieldId} from "../../../../../components/xform/utils/util";
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
export default {
|
|
76
|
-
name: "form-item-wrapper",
|
|
77
|
-
mixins: [i18n],
|
|
78
|
-
props: {
|
|
79
|
-
field: Object,
|
|
80
|
-
designer: Object,
|
|
81
|
-
parentWidget: Object,
|
|
82
|
-
parentList: Array,
|
|
83
|
-
indexOfParentList: Number,
|
|
84
|
-
|
|
85
|
-
designState: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: false
|
|
88
|
-
},
|
|
89
|
-
subFormRowIndex: { /* 子表单组件行索引,从0开始计数 */
|
|
90
|
-
type: Number,
|
|
91
|
-
default: -1
|
|
92
|
-
},
|
|
93
|
-
subFormColIndex: { /* 子表单组件列索引,从0开始计数 */
|
|
94
|
-
type: Number,
|
|
95
|
-
default: -1
|
|
96
|
-
},
|
|
97
|
-
subFormRowId: { /* 子表单组件行Id,唯一id且不可变 */
|
|
98
|
-
type: String,
|
|
99
|
-
default: ''
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
rules: Array,
|
|
103
|
-
},
|
|
104
|
-
inject: ["getFormConfig", "getSubFormFieldFlag", "getSubFormName", "tableParam", "formItemProp", "getObjectFieldFlag", "getObjectName"],
|
|
105
|
-
computed: {
|
|
106
|
-
formConfig: function () {
|
|
107
|
-
return this.getFormConfig()
|
|
108
|
-
},
|
|
109
|
-
selected() {
|
|
110
|
-
return !!this.designer && this.field.id === this.designer.selectedId
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
label() {
|
|
114
|
-
if (!!this.field.options.labelHidden) {
|
|
115
|
-
return ''
|
|
116
|
-
}
|
|
117
|
-
return this.getI18nLabel(this.field.options.label)
|
|
118
|
-
// let label = this.field.options.label
|
|
119
|
-
// return label ? this.$t2(label) : label;
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
labelWidth() {
|
|
123
|
-
if (!!this.field.options.labelHidden) {
|
|
124
|
-
return !!this.designState ? 5 : 0 //设计期间标签最小宽度5像素,以便于鼠标点击可选中组件!!
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (!!this.field.options.labelWidth) {
|
|
128
|
-
return this.field.options.labelWidth
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (!!this.designer) {
|
|
132
|
-
return this.designer.formConfig.labelWidth
|
|
133
|
-
} else {
|
|
134
|
-
return this.formConfig.labelWidth
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
labelAlign() {
|
|
139
|
-
if (!!this.field.options.labelAlign) {
|
|
140
|
-
return this.field.options.labelAlign
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (!!this.designer) {
|
|
144
|
-
return this.designer.formConfig.labelAlign || 'label-left-align'
|
|
145
|
-
} else {
|
|
146
|
-
return this.formConfig.labelAlign || 'label-left-align'
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
customClass() {
|
|
151
|
-
return !!this.field.options.customClass ? this.field.options.customClass.join(' ') : ''
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
subFormName() {
|
|
155
|
-
return !!this.parentWidget ? this.parentWidget.options.name : ''
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
subFormItemFlag() {
|
|
159
|
-
return this.isSubFormItem() || (!!this.parentWidget ? this.parentWidget.type === 'sub-form' : false)
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
created() {
|
|
164
|
-
//
|
|
165
|
-
},
|
|
166
|
-
methods: {
|
|
167
|
-
isSubFormItem() {
|
|
168
|
-
return !!this.tableParam;
|
|
169
|
-
},
|
|
170
|
-
selectField(field) {
|
|
171
|
-
if (!!this.designer) {
|
|
172
|
-
this.designer.setSelected(field)
|
|
173
|
-
this.designer.emitEvent('field-selected', this.parentWidget) //发送选中组件的父组件对象
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
selectParentWidget() {
|
|
178
|
-
if (this.parentWidget) {
|
|
179
|
-
this.designer.setSelected(this.parentWidget)
|
|
180
|
-
} else {
|
|
181
|
-
this.designer.clearSelected()
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
moveUpWidget() {
|
|
186
|
-
this.designer.moveUpWidget(this.parentList, this.indexOfParentList)
|
|
187
|
-
this.designer.emitHistoryChange()
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
moveDownWidget() {
|
|
191
|
-
this.designer.moveDownWidget(this.parentList, this.indexOfParentList)
|
|
192
|
-
this.designer.emitHistoryChange()
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
removeFieldWidget() {
|
|
196
|
-
if (!!this.parentList) {
|
|
197
|
-
const selectedWidgetName = this.designer.selectedWidgetName;
|
|
198
|
-
let selectedId = this.designer.selectedId;
|
|
199
|
-
let nextSelected = null
|
|
200
|
-
if (this.parentList.length === 1) {
|
|
201
|
-
if (!!this.parentWidget) {
|
|
202
|
-
nextSelected = this.parentWidget
|
|
203
|
-
}
|
|
204
|
-
} else if (this.parentList.length === (1 + this.indexOfParentList)) {
|
|
205
|
-
nextSelected = this.parentList[this.indexOfParentList - 1]
|
|
206
|
-
} else {
|
|
207
|
-
nextSelected = this.parentList[this.indexOfParentList + 1]
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
this.$nextTick(() => {
|
|
211
|
-
const l = getSubFormNameByFieldId(
|
|
212
|
-
this.designer.widgetList,
|
|
213
|
-
selectedId
|
|
214
|
-
);
|
|
215
|
-
this.parentList.splice(this.indexOfParentList, 1)
|
|
216
|
-
//if (!!nextSelected) {
|
|
217
|
-
this.designer.setSelected(nextSelected)
|
|
218
|
-
//}
|
|
219
|
-
this.designer.formWidget.deleteWidgetRef(
|
|
220
|
-
selectedWidgetName,
|
|
221
|
-
l
|
|
222
|
-
);
|
|
223
|
-
this.designer.emitHistoryChange()
|
|
224
|
-
this.designer.emitEvent(
|
|
225
|
-
"canvas-remove-field",
|
|
226
|
-
selectedWidgetName
|
|
227
|
-
);
|
|
228
|
-
})
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
getPropName() {
|
|
233
|
-
if (this.formItemProp) {
|
|
234
|
-
return this.formItemProp;
|
|
235
|
-
}
|
|
236
|
-
let o = this.field.options.name;
|
|
237
|
-
return (
|
|
238
|
-
(o
|
|
239
|
-
= (this.field.options.keyNameEnabled
|
|
240
|
-
&& this.field.options.keyName)
|
|
241
|
-
|| o),
|
|
242
|
-
this.subFormItemFlag && !this.designState
|
|
243
|
-
? this.subFormName
|
|
244
|
-
+ "."
|
|
245
|
-
+ this.subFormRowIndex
|
|
246
|
-
+ "."
|
|
247
|
-
+ o
|
|
248
|
-
: this.getObjectFieldFlag() && !this.designState
|
|
249
|
-
? this.getObjectName() + "." + o
|
|
250
|
-
: o
|
|
251
|
-
);
|
|
252
|
-
},
|
|
253
|
-
getI18nLabel(label, path, param) {
|
|
254
|
-
return !this.designState && label ? this.$t2(label, path, param) : label;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
</script>
|
|
260
|
-
|
|
261
|
-
<style lang="scss" scoped>
|
|
262
|
-
@import "~@/styles/global.scss";
|
|
263
|
-
|
|
264
|
-
.design-time-bottom-margin {
|
|
265
|
-
margin-bottom: 5px;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.field-wrapper {
|
|
269
|
-
position: relative;
|
|
270
|
-
|
|
271
|
-
.field-action {
|
|
272
|
-
position: absolute;
|
|
273
|
-
//bottom: -24px;
|
|
274
|
-
bottom: 0;
|
|
275
|
-
right: -1px;
|
|
276
|
-
height: 22px;
|
|
277
|
-
line-height: 22px;
|
|
278
|
-
background: $--color-primary;
|
|
279
|
-
z-index: 9;
|
|
280
|
-
|
|
281
|
-
i {
|
|
282
|
-
font-size: 14px;
|
|
283
|
-
color: #fff;
|
|
284
|
-
margin: 0 5px;
|
|
285
|
-
cursor: pointer;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.drag-handler {
|
|
290
|
-
position: absolute;
|
|
291
|
-
top: 0;
|
|
292
|
-
//bottom: -22px; /* 拖拽手柄位于组件下方,有时无法正常拖动,原因未明?? */
|
|
293
|
-
left: -1px;
|
|
294
|
-
height: 20px;
|
|
295
|
-
line-height: 18px;
|
|
296
|
-
//background: $--color-primary;
|
|
297
|
-
z-index: 9;
|
|
298
|
-
|
|
299
|
-
i {
|
|
300
|
-
font-size: 12px;
|
|
301
|
-
font-style: normal;
|
|
302
|
-
color: #fff;
|
|
303
|
-
margin: 4px;
|
|
304
|
-
cursor: move;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
&:hover {
|
|
308
|
-
//opacity: 1;
|
|
309
|
-
background: $--color-primary;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.el-form-item {
|
|
315
|
-
//margin-bottom: 0 !important;
|
|
316
|
-
//margin-bottom: 6px;
|
|
317
|
-
|
|
318
|
-
//margin-top: 2px;
|
|
319
|
-
position: relative;
|
|
320
|
-
|
|
321
|
-
::v-deep .el-form-item__label {
|
|
322
|
-
white-space: nowrap;
|
|
323
|
-
text-overflow: ellipsis;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
::v-deep .el-form-item__content {
|
|
327
|
-
//position: unset; /* TODO: 忘了这个样式设置是为了解决什么问题?? */
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
span.custom-label i {
|
|
331
|
-
margin: 0 3px;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/* 隐藏Chrome浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
335
|
-
::v-deep .hide-spin-button input::-webkit-outer-spin-button,
|
|
336
|
-
::v-deep .hide-spin-button input::-webkit-inner-spin-button {
|
|
337
|
-
-webkit-appearance: none !important;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/* 隐藏Firefox浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
341
|
-
::v-deep .hide-spin-button input[type="number"] {
|
|
342
|
-
-moz-appearance: textfield;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.required ::v-deep .el-form-item__label::before {
|
|
347
|
-
content: '*';
|
|
348
|
-
color: #F56C6C;
|
|
349
|
-
margin-right: 4px;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.static-content-item {
|
|
353
|
-
min-height: 20px;
|
|
354
|
-
display: flex; /* 垂直居中 */
|
|
355
|
-
align-items: center; /* 垂直居中 */
|
|
356
|
-
|
|
357
|
-
::v-deep .el-divider--horizontal {
|
|
358
|
-
margin: 0;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.el-form-item.selected, .static-content-item.selected {
|
|
363
|
-
outline: 2px solid $--color-primary;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
::v-deep .label-left-align .el-form-item__label {
|
|
367
|
-
text-align: left;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
::v-deep .label-center-align .el-form-item__label {
|
|
371
|
-
text-align: center;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
::v-deep .label-right-align .el-form-item__label {
|
|
375
|
-
text-align: right;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
</style>
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* author: vformAdmin
|
|
4
|
+
* email: vdpadmin@163.com
|
|
5
|
+
* website: https://www.vform666.com
|
|
6
|
+
* date: 2021.08.18
|
|
7
|
+
* remark: 如果要分发VForm源码,需在本文件顶部保留此文件头信息!!
|
|
8
|
+
*/
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div class="field-wrapper" :class="{'design-time-bottom-margin': !!this.designer}">
|
|
13
|
+
<div>
|
|
14
|
+
<template v-if="formItemProp=='false'">
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</template>
|
|
17
|
+
<template v-else>
|
|
18
|
+
<el-form-item v-if="!!field.formItemFlag && (!field.options.hidden || (designState === true))"
|
|
19
|
+
:label="label" :label-width="labelWidth + 'px'"
|
|
20
|
+
:title="field.options.labelTooltip"
|
|
21
|
+
:rules="rules" :prop="getPropName()"
|
|
22
|
+
:class="[selected ? 'selected' : '', labelAlign, customClass, field.options.required ? 'required' : '']"
|
|
23
|
+
@click.native.stop="selectField(field)">
|
|
24
|
+
|
|
25
|
+
<span v-if="!!field.options.labelIconClass" slot="label" class="custom-label" :style="{'color':field.options.labelColor}">
|
|
26
|
+
<template v-if="field.options.labelIconPosition === 'front'">
|
|
27
|
+
<template v-if="!!field.options.labelTooltip">
|
|
28
|
+
<el-tooltip :content="field.options.labelTooltip" effect="light">
|
|
29
|
+
<i :class="field.options.labelIconClass"></i></el-tooltip>{{ label }}</template>
|
|
30
|
+
<template v-else>
|
|
31
|
+
<i :class="field.options.labelIconClass"></i>{{ label }}</template>
|
|
32
|
+
</template>
|
|
33
|
+
<template v-else-if="field.options.labelIconPosition === 'rear'">
|
|
34
|
+
<template v-if="!!field.options.labelTooltip">
|
|
35
|
+
{{ label }}<el-tooltip :content="field.options.labelTooltip" effect="light">
|
|
36
|
+
<i :class="field.options.labelIconClass"></i></el-tooltip></template>
|
|
37
|
+
<template v-else>
|
|
38
|
+
{{ label }}<i :class="field.options.labelIconClass"></i></template>
|
|
39
|
+
</template>
|
|
40
|
+
</span>
|
|
41
|
+
<span v-if="!!field.options.labelColor" slot="label" :style="{'color':field.options.labelColor}">
|
|
42
|
+
{{ label }}
|
|
43
|
+
</span>
|
|
44
|
+
<slot></slot>
|
|
45
|
+
</el-form-item>
|
|
46
|
+
</template>
|
|
47
|
+
</div>
|
|
48
|
+
<template v-if="!!this.designer">
|
|
49
|
+
<div class="field-action" v-if="designer.selectedId === field.id">
|
|
50
|
+
<i class="el-icon-back" :title="i18nt('designer.hint.selectParentWidget')"
|
|
51
|
+
@click.stop="selectParentWidget(field)"></i>
|
|
52
|
+
<i class="el-icon-top" v-if="!!parentList && (parentList.length > 1)"
|
|
53
|
+
:title="i18nt('designer.hint.moveUpWidget')"
|
|
54
|
+
@click.stop="moveUpWidget(field)"></i>
|
|
55
|
+
<i class="el-icon-bottom" v-if="!!parentList && (parentList.length > 1)"
|
|
56
|
+
:title="i18nt('designer.hint.moveDownWidget')"
|
|
57
|
+
@click.stop="moveDownWidget(field)"></i>
|
|
58
|
+
<i class="el-icon-delete" :title="i18nt('designer.hint.remove')" @click.stop="removeFieldWidget"></i>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="drag-handler background-opacity" v-if="designer.selectedId === field.id">
|
|
62
|
+
<i class="el-icon-rank" :title="i18nt('designer.hint.dragHandler')"></i>
|
|
63
|
+
<i>{{ i18n2t(`designer.widgetLabel.${field.type}`, `extension.widgetLabel.${field.type}`) }}</i>
|
|
64
|
+
<i v-if="field.options.hidden === true" class="iconfont icon-hide"></i>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import i18n from "../../../../../components/xform/utils/i18n";
|
|
72
|
+
import {getSubFormNameByFieldId} from "../../../../../components/xform/utils/util";
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
export default {
|
|
76
|
+
name: "form-item-wrapper",
|
|
77
|
+
mixins: [i18n],
|
|
78
|
+
props: {
|
|
79
|
+
field: Object,
|
|
80
|
+
designer: Object,
|
|
81
|
+
parentWidget: Object,
|
|
82
|
+
parentList: Array,
|
|
83
|
+
indexOfParentList: Number,
|
|
84
|
+
|
|
85
|
+
designState: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
subFormRowIndex: { /* 子表单组件行索引,从0开始计数 */
|
|
90
|
+
type: Number,
|
|
91
|
+
default: -1
|
|
92
|
+
},
|
|
93
|
+
subFormColIndex: { /* 子表单组件列索引,从0开始计数 */
|
|
94
|
+
type: Number,
|
|
95
|
+
default: -1
|
|
96
|
+
},
|
|
97
|
+
subFormRowId: { /* 子表单组件行Id,唯一id且不可变 */
|
|
98
|
+
type: String,
|
|
99
|
+
default: ''
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
rules: Array,
|
|
103
|
+
},
|
|
104
|
+
inject: ["getFormConfig", "getSubFormFieldFlag", "getSubFormName", "tableParam", "formItemProp", "getObjectFieldFlag", "getObjectName"],
|
|
105
|
+
computed: {
|
|
106
|
+
formConfig: function () {
|
|
107
|
+
return this.getFormConfig()
|
|
108
|
+
},
|
|
109
|
+
selected() {
|
|
110
|
+
return !!this.designer && this.field.id === this.designer.selectedId
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
label() {
|
|
114
|
+
if (!!this.field.options.labelHidden) {
|
|
115
|
+
return ''
|
|
116
|
+
}
|
|
117
|
+
return this.getI18nLabel(this.field.options.label)
|
|
118
|
+
// let label = this.field.options.label
|
|
119
|
+
// return label ? this.$t2(label) : label;
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
labelWidth() {
|
|
123
|
+
if (!!this.field.options.labelHidden) {
|
|
124
|
+
return !!this.designState ? 5 : 0 //设计期间标签最小宽度5像素,以便于鼠标点击可选中组件!!
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!!this.field.options.labelWidth) {
|
|
128
|
+
return this.field.options.labelWidth
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!!this.designer) {
|
|
132
|
+
return this.designer.formConfig.labelWidth
|
|
133
|
+
} else {
|
|
134
|
+
return this.formConfig.labelWidth
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
labelAlign() {
|
|
139
|
+
if (!!this.field.options.labelAlign) {
|
|
140
|
+
return this.field.options.labelAlign
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!!this.designer) {
|
|
144
|
+
return this.designer.formConfig.labelAlign || 'label-left-align'
|
|
145
|
+
} else {
|
|
146
|
+
return this.formConfig.labelAlign || 'label-left-align'
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
customClass() {
|
|
151
|
+
return !!this.field.options.customClass ? this.field.options.customClass.join(' ') : ''
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
subFormName() {
|
|
155
|
+
return !!this.parentWidget ? this.parentWidget.options.name : ''
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
subFormItemFlag() {
|
|
159
|
+
return this.isSubFormItem() || (!!this.parentWidget ? this.parentWidget.type === 'sub-form' : false)
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
},
|
|
163
|
+
created() {
|
|
164
|
+
//
|
|
165
|
+
},
|
|
166
|
+
methods: {
|
|
167
|
+
isSubFormItem() {
|
|
168
|
+
return !!this.tableParam;
|
|
169
|
+
},
|
|
170
|
+
selectField(field) {
|
|
171
|
+
if (!!this.designer) {
|
|
172
|
+
this.designer.setSelected(field)
|
|
173
|
+
this.designer.emitEvent('field-selected', this.parentWidget) //发送选中组件的父组件对象
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
selectParentWidget() {
|
|
178
|
+
if (this.parentWidget) {
|
|
179
|
+
this.designer.setSelected(this.parentWidget)
|
|
180
|
+
} else {
|
|
181
|
+
this.designer.clearSelected()
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
moveUpWidget() {
|
|
186
|
+
this.designer.moveUpWidget(this.parentList, this.indexOfParentList)
|
|
187
|
+
this.designer.emitHistoryChange()
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
moveDownWidget() {
|
|
191
|
+
this.designer.moveDownWidget(this.parentList, this.indexOfParentList)
|
|
192
|
+
this.designer.emitHistoryChange()
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
removeFieldWidget() {
|
|
196
|
+
if (!!this.parentList) {
|
|
197
|
+
const selectedWidgetName = this.designer.selectedWidgetName;
|
|
198
|
+
let selectedId = this.designer.selectedId;
|
|
199
|
+
let nextSelected = null
|
|
200
|
+
if (this.parentList.length === 1) {
|
|
201
|
+
if (!!this.parentWidget) {
|
|
202
|
+
nextSelected = this.parentWidget
|
|
203
|
+
}
|
|
204
|
+
} else if (this.parentList.length === (1 + this.indexOfParentList)) {
|
|
205
|
+
nextSelected = this.parentList[this.indexOfParentList - 1]
|
|
206
|
+
} else {
|
|
207
|
+
nextSelected = this.parentList[this.indexOfParentList + 1]
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.$nextTick(() => {
|
|
211
|
+
const l = getSubFormNameByFieldId(
|
|
212
|
+
this.designer.widgetList,
|
|
213
|
+
selectedId
|
|
214
|
+
);
|
|
215
|
+
this.parentList.splice(this.indexOfParentList, 1)
|
|
216
|
+
//if (!!nextSelected) {
|
|
217
|
+
this.designer.setSelected(nextSelected)
|
|
218
|
+
//}
|
|
219
|
+
this.designer.formWidget.deleteWidgetRef(
|
|
220
|
+
selectedWidgetName,
|
|
221
|
+
l
|
|
222
|
+
);
|
|
223
|
+
this.designer.emitHistoryChange()
|
|
224
|
+
this.designer.emitEvent(
|
|
225
|
+
"canvas-remove-field",
|
|
226
|
+
selectedWidgetName
|
|
227
|
+
);
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
getPropName() {
|
|
233
|
+
if (this.formItemProp) {
|
|
234
|
+
return this.formItemProp;
|
|
235
|
+
}
|
|
236
|
+
let o = this.field.options.name;
|
|
237
|
+
return (
|
|
238
|
+
(o
|
|
239
|
+
= (this.field.options.keyNameEnabled
|
|
240
|
+
&& this.field.options.keyName)
|
|
241
|
+
|| o),
|
|
242
|
+
this.subFormItemFlag && !this.designState
|
|
243
|
+
? this.subFormName
|
|
244
|
+
+ "."
|
|
245
|
+
+ this.subFormRowIndex
|
|
246
|
+
+ "."
|
|
247
|
+
+ o
|
|
248
|
+
: this.getObjectFieldFlag() && !this.designState
|
|
249
|
+
? this.getObjectName() + "." + o
|
|
250
|
+
: o
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
getI18nLabel(label, path, param) {
|
|
254
|
+
return !this.designState && label ? this.$t2(label, path, param) : label;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
</script>
|
|
260
|
+
|
|
261
|
+
<style lang="scss" scoped>
|
|
262
|
+
@import "~@/styles/global.scss";
|
|
263
|
+
|
|
264
|
+
.design-time-bottom-margin {
|
|
265
|
+
margin-bottom: 5px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.field-wrapper {
|
|
269
|
+
position: relative;
|
|
270
|
+
|
|
271
|
+
.field-action {
|
|
272
|
+
position: absolute;
|
|
273
|
+
//bottom: -24px;
|
|
274
|
+
bottom: 0;
|
|
275
|
+
right: -1px;
|
|
276
|
+
height: 22px;
|
|
277
|
+
line-height: 22px;
|
|
278
|
+
background: $--color-primary;
|
|
279
|
+
z-index: 9;
|
|
280
|
+
|
|
281
|
+
i {
|
|
282
|
+
font-size: 14px;
|
|
283
|
+
color: #fff;
|
|
284
|
+
margin: 0 5px;
|
|
285
|
+
cursor: pointer;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.drag-handler {
|
|
290
|
+
position: absolute;
|
|
291
|
+
top: 0;
|
|
292
|
+
//bottom: -22px; /* 拖拽手柄位于组件下方,有时无法正常拖动,原因未明?? */
|
|
293
|
+
left: -1px;
|
|
294
|
+
height: 20px;
|
|
295
|
+
line-height: 18px;
|
|
296
|
+
//background: $--color-primary;
|
|
297
|
+
z-index: 9;
|
|
298
|
+
|
|
299
|
+
i {
|
|
300
|
+
font-size: 12px;
|
|
301
|
+
font-style: normal;
|
|
302
|
+
color: #fff;
|
|
303
|
+
margin: 4px;
|
|
304
|
+
cursor: move;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
&:hover {
|
|
308
|
+
//opacity: 1;
|
|
309
|
+
background: $--color-primary;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.el-form-item {
|
|
315
|
+
//margin-bottom: 0 !important;
|
|
316
|
+
//margin-bottom: 6px;
|
|
317
|
+
|
|
318
|
+
//margin-top: 2px;
|
|
319
|
+
position: relative;
|
|
320
|
+
|
|
321
|
+
::v-deep .el-form-item__label {
|
|
322
|
+
white-space: nowrap;
|
|
323
|
+
text-overflow: ellipsis;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
::v-deep .el-form-item__content {
|
|
327
|
+
//position: unset; /* TODO: 忘了这个样式设置是为了解决什么问题?? */
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
span.custom-label i {
|
|
331
|
+
margin: 0 3px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/* 隐藏Chrome浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
335
|
+
::v-deep .hide-spin-button input::-webkit-outer-spin-button,
|
|
336
|
+
::v-deep .hide-spin-button input::-webkit-inner-spin-button {
|
|
337
|
+
-webkit-appearance: none !important;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* 隐藏Firefox浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
341
|
+
::v-deep .hide-spin-button input[type="number"] {
|
|
342
|
+
-moz-appearance: textfield;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.required ::v-deep .el-form-item__label::before {
|
|
347
|
+
content: '*';
|
|
348
|
+
color: #F56C6C;
|
|
349
|
+
margin-right: 4px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.static-content-item {
|
|
353
|
+
min-height: 20px;
|
|
354
|
+
display: flex; /* 垂直居中 */
|
|
355
|
+
align-items: center; /* 垂直居中 */
|
|
356
|
+
|
|
357
|
+
::v-deep .el-divider--horizontal {
|
|
358
|
+
margin: 0;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.el-form-item.selected, .static-content-item.selected {
|
|
363
|
+
outline: 2px solid $--color-primary;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
::v-deep .label-left-align .el-form-item__label {
|
|
367
|
+
text-align: left;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
::v-deep .label-center-align .el-form-item__label {
|
|
371
|
+
text-align: center;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
::v-deep .label-right-align .el-form-item__label {
|
|
375
|
+
text-align: right;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
</style>
|