cloud-web-corejs 1.0.54-dev.745 → 1.0.54-dev.746
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 +192 -192
- package/src/App.vue +73 -71
- package/src/components/baseArea/index.vue +1628 -1628
- package/src/components/fileLibrary/categoryMoveDialog.vue +109 -109
- package/src/components/fileLibrary/fileObjAuthDialog.vue +297 -297
- package/src/components/fileLibrary/index.vue +1109 -1109
- package/src/components/fileLibrary/propertiesDialog.vue +190 -190
- package/src/components/fileLibrary/recycleBinDialog.vue +237 -237
- package/src/components/wf/mixins/setCandidateDialog.js +217 -217
- package/src/components/wf/mixins/setCandidateDialog2.js +252 -252
- package/src/components/xform/docs//345/257/271/346/257/224/345/212/237/350/203/275/350/220/275/345/234/260/346/226/271/346/241/210.md +986 -986
- package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +272 -272
- package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +216 -216
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +928 -928
- package/src/components/xform/form-designer/index.vue +195 -195
- package/src/components/xform/form-designer/indexMixin.js +848 -848
- package/src/components/xform/form-designer/setting-panel/index.vue +313 -313
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +124 -124
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +369 -369
- package/src/components/xform/form-designer/widget-panel/index.vue +389 -389
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +343 -343
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +4531 -4531
- package/src/components/xform/form-render/container-item/data-table-mixin.js +4748 -4576
- package/src/components/xform/form-render/container-item/tab-item.vue +125 -125
- package/src/components/xform/form-render/indexMixin.js +5061 -5078
- package/src/components/xform/lang/en-US.js +457 -457
- package/src/components/xform/lang/zh-CN.js +628 -628
- package/src/components/xform/utils/util.js +1585 -1554
- package/src/index.js +344 -230
- package/src/layout/components/AppMain.vue +122 -125
- package/src/layout/components/extractedCode/viewDialog.vue +207 -207
- package/src/layout/components/langTool.vue +128 -123
- package/src/layout/defaultLayout.vue +164 -158
- package/src/permission.js +185 -135
- package/src/store/config/index.js +667 -669
- package/src/store/modules/micro.js +46 -0
- package/src/store/modules/permission.js +461 -373
- package/src/store/modules/user.js +419 -415
- package/src/utils/auth.js +27 -1
- package/src/utils/index.js +579 -6
- package/src/utils/keepAlive.js +4 -0
- package/src/utils/menuAdapter.js +183 -0
- package/src/utils/request.js +417 -28
- package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +483 -483
- package/src/views/bd/setting/form_script/form_list.vue +174 -174
- package/src/views/bd/setting/form_script/mixins/form_list.js +330 -330
- package/src/views/bd/setting/form_template/formDesignerDialog.vue +171 -171
- package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +253 -253
- package/src/views/user/menuFallback/index.vue +123 -0
- package/src/views/user/wf/wfReport/index.vue +625 -625
|
@@ -1,928 +1,928 @@
|
|
|
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
|
|
13
|
-
class="field-wrapper"
|
|
14
|
-
:class="{ 'design-time-bottom-margin': !!this.designer }"
|
|
15
|
-
v-show="!field.options.hidden || designState === true"
|
|
16
|
-
>
|
|
17
|
-
<div>
|
|
18
|
-
<template v-if="formItemProp === 'false'">
|
|
19
|
-
<template v-if="!field.options.hidden">
|
|
20
|
-
<template v-if="isShowWidget()">
|
|
21
|
-
<compareView
|
|
22
|
-
v-if="isCompareOn"
|
|
23
|
-
:isCompare="isCompareOn"
|
|
24
|
-
:isDiff="compareIsDiff"
|
|
25
|
-
:oldVal="compareOldDisplay"
|
|
26
|
-
:newVal="getShowValue()"
|
|
27
|
-
>
|
|
28
|
-
<slot></slot>
|
|
29
|
-
</compareView>
|
|
30
|
-
<slot v-else></slot>
|
|
31
|
-
</template>
|
|
32
|
-
<template
|
|
33
|
-
v-else-if="
|
|
34
|
-
field.options.widgetTextFlag === 3 &&
|
|
35
|
-
field.options.widgetTextLinkConfig
|
|
36
|
-
"
|
|
37
|
-
>
|
|
38
|
-
<div class="ellipsis">
|
|
39
|
-
<a
|
|
40
|
-
class="a-link"
|
|
41
|
-
:class="getWidgetClass()"
|
|
42
|
-
@click.native="handleClick"
|
|
43
|
-
>
|
|
44
|
-
<span>
|
|
45
|
-
<i
|
|
46
|
-
:class="
|
|
47
|
-
field.options.widgetTextLinkConfig.options.prefixIcon
|
|
48
|
-
"
|
|
49
|
-
v-if="
|
|
50
|
-
!!field.options.widgetTextLinkConfig.options.prefixIcon
|
|
51
|
-
"
|
|
52
|
-
></i>
|
|
53
|
-
<span>{{ getWidgetValue() }}</span>
|
|
54
|
-
<i
|
|
55
|
-
:class="
|
|
56
|
-
field.options.widgetTextLinkConfig.options.suffixIcon
|
|
57
|
-
"
|
|
58
|
-
v-if="
|
|
59
|
-
!!field.options.widgetTextLinkConfig.options.suffixIcon
|
|
60
|
-
"
|
|
61
|
-
></i>
|
|
62
|
-
</span>
|
|
63
|
-
</a>
|
|
64
|
-
</div>
|
|
65
|
-
</template>
|
|
66
|
-
<template v-else>
|
|
67
|
-
<compareView
|
|
68
|
-
v-if="isCompareOn"
|
|
69
|
-
:isCompare="isCompareOn"
|
|
70
|
-
:isDiff="compareIsDiff"
|
|
71
|
-
:oldVal="compareOldDisplay"
|
|
72
|
-
:newVal="getShowValue()"
|
|
73
|
-
>
|
|
74
|
-
<span>{{ getShowValue() }}</span>
|
|
75
|
-
</compareView>
|
|
76
|
-
<span v-else>{{ getShowValue() }}</span>
|
|
77
|
-
</template>
|
|
78
|
-
</template>
|
|
79
|
-
</template>
|
|
80
|
-
<template v-else>
|
|
81
|
-
<el-form-item
|
|
82
|
-
v-if="
|
|
83
|
-
!!field.formItemFlag &&
|
|
84
|
-
(!field.options.hidden || designState === true)
|
|
85
|
-
"
|
|
86
|
-
:label="label"
|
|
87
|
-
:label-width="labelWidth"
|
|
88
|
-
:rules="getRules()"
|
|
89
|
-
:prop="getPropName()"
|
|
90
|
-
:class="[
|
|
91
|
-
selected ? 'selected' : '',
|
|
92
|
-
labelAlign,
|
|
93
|
-
customClass,
|
|
94
|
-
field.options.required ? 'required' : '',
|
|
95
|
-
]"
|
|
96
|
-
@click.native.stop="selectField(field)"
|
|
97
|
-
>
|
|
98
|
-
<span
|
|
99
|
-
v-if="!!field.options.labelIconClass"
|
|
100
|
-
slot="label"
|
|
101
|
-
class="custom-label"
|
|
102
|
-
>
|
|
103
|
-
<template v-if="field.options.labelIconPosition === 'front'">
|
|
104
|
-
<template v-if="!!field.options.labelTooltip">
|
|
105
|
-
<el-tooltip
|
|
106
|
-
:content="field.options.labelTooltip"
|
|
107
|
-
effect="dark"
|
|
108
|
-
popper-class="label-tooltip-pre-line"
|
|
109
|
-
>
|
|
110
|
-
<i :class="field.options.labelIconClass"></i></el-tooltip
|
|
111
|
-
><span :style="{ color: field.options.labelColor }">{{
|
|
112
|
-
label
|
|
113
|
-
}}</span></template
|
|
114
|
-
>
|
|
115
|
-
<template v-else>
|
|
116
|
-
<i :class="field.options.labelIconClass"></i
|
|
117
|
-
><span :style="{ color: field.options.labelColor }">{{
|
|
118
|
-
label
|
|
119
|
-
}}</span></template
|
|
120
|
-
>
|
|
121
|
-
</template>
|
|
122
|
-
<template v-else-if="field.options.labelIconPosition === 'rear'">
|
|
123
|
-
<template v-if="!!field.options.labelTooltip">
|
|
124
|
-
<span :style="{ color: field.options.labelColor }">{{
|
|
125
|
-
label
|
|
126
|
-
}}</span
|
|
127
|
-
><el-tooltip
|
|
128
|
-
:content="field.options.labelTooltip"
|
|
129
|
-
effect="dark"
|
|
130
|
-
popper-class="label-tooltip-pre-line"
|
|
131
|
-
>
|
|
132
|
-
<i :class="field.options.labelIconClass"></i></el-tooltip
|
|
133
|
-
></template>
|
|
134
|
-
<template v-else>
|
|
135
|
-
<span :style="{ color: field.options.labelColor }">{{
|
|
136
|
-
label
|
|
137
|
-
}}</span
|
|
138
|
-
><i :class="field.options.labelIconClass"></i
|
|
139
|
-
></template>
|
|
140
|
-
</template>
|
|
141
|
-
</span>
|
|
142
|
-
<span
|
|
143
|
-
v-else-if="!!field.options.labelColor"
|
|
144
|
-
slot="label"
|
|
145
|
-
:style="{ color: field.options.labelColor }"
|
|
146
|
-
>
|
|
147
|
-
{{ label }}
|
|
148
|
-
</span>
|
|
149
|
-
<template v-if="isShowWidget()">
|
|
150
|
-
<compareView
|
|
151
|
-
v-if="isCompareOn"
|
|
152
|
-
:isCompare="isCompareOn"
|
|
153
|
-
:isDiff="compareIsDiff"
|
|
154
|
-
:oldVal="compareOldDisplay"
|
|
155
|
-
:newVal="getShowValue()"
|
|
156
|
-
>
|
|
157
|
-
<slot></slot>
|
|
158
|
-
</compareView>
|
|
159
|
-
<slot v-else></slot>
|
|
160
|
-
</template>
|
|
161
|
-
<template
|
|
162
|
-
v-else-if="
|
|
163
|
-
field.options.widgetTextFlag === 3 &&
|
|
164
|
-
field.options.widgetTextLinkConfig
|
|
165
|
-
"
|
|
166
|
-
>
|
|
167
|
-
<div class="ellipsis">
|
|
168
|
-
<a class="a-link" :class="getWidgetClass()" @click="handleClick">
|
|
169
|
-
<span>
|
|
170
|
-
<i
|
|
171
|
-
:class="
|
|
172
|
-
field.options.widgetTextLinkConfig.options.prefixIcon
|
|
173
|
-
"
|
|
174
|
-
v-if="
|
|
175
|
-
!!field.options.widgetTextLinkConfig.options.prefixIcon
|
|
176
|
-
"
|
|
177
|
-
></i>
|
|
178
|
-
<span>{{ getWidgetValue() }}</span>
|
|
179
|
-
<i
|
|
180
|
-
:class="
|
|
181
|
-
field.options.widgetTextLinkConfig.options.suffixIcon
|
|
182
|
-
"
|
|
183
|
-
v-if="
|
|
184
|
-
!!field.options.widgetTextLinkConfig.options.suffixIcon
|
|
185
|
-
"
|
|
186
|
-
></i>
|
|
187
|
-
</span>
|
|
188
|
-
</a>
|
|
189
|
-
</div>
|
|
190
|
-
</template>
|
|
191
|
-
<template v-else>
|
|
192
|
-
<compareView
|
|
193
|
-
v-if="isCompareOn"
|
|
194
|
-
:isCompare="isCompareOn"
|
|
195
|
-
:isDiff="compareIsDiff"
|
|
196
|
-
:oldVal="compareOldDisplay"
|
|
197
|
-
:newVal="getShowValue()"
|
|
198
|
-
>
|
|
199
|
-
<span>{{ getShowValue() }}</span>
|
|
200
|
-
</compareView>
|
|
201
|
-
<span v-else>{{ getShowValue() }}</span>
|
|
202
|
-
</template>
|
|
203
|
-
</el-form-item>
|
|
204
|
-
</template>
|
|
205
|
-
</div>
|
|
206
|
-
<template v-if="!!this.designer">
|
|
207
|
-
<div class="field-action" v-if="designer.selectedId === field.id">
|
|
208
|
-
<i
|
|
209
|
-
class="el-icon-back"
|
|
210
|
-
:title="i18nt('designer.hint.selectParentWidget')"
|
|
211
|
-
@click.stop="selectParentWidget(field)"
|
|
212
|
-
></i>
|
|
213
|
-
<i
|
|
214
|
-
class="el-icon-top"
|
|
215
|
-
v-if="!!parentList && parentList.length > 1"
|
|
216
|
-
:title="i18nt('designer.hint.moveUpWidget')"
|
|
217
|
-
@click.stop="moveUpWidget(field)"
|
|
218
|
-
></i>
|
|
219
|
-
<i
|
|
220
|
-
class="el-icon-bottom"
|
|
221
|
-
v-if="!!parentList && parentList.length > 1"
|
|
222
|
-
:title="i18nt('designer.hint.moveDownWidget')"
|
|
223
|
-
@click.stop="moveDownWidget(field)"
|
|
224
|
-
></i>
|
|
225
|
-
<i
|
|
226
|
-
class="el-icon-delete"
|
|
227
|
-
:title="i18nt('designer.hint.remove')"
|
|
228
|
-
@click.stop="removeFieldWidget"
|
|
229
|
-
></i>
|
|
230
|
-
</div>
|
|
231
|
-
|
|
232
|
-
<div
|
|
233
|
-
class="drag-handler background-opacity"
|
|
234
|
-
v-if="designer.selectedId === field.id"
|
|
235
|
-
>
|
|
236
|
-
<i class="el-icon-rank" :title="i18nt('designer.hint.dragHandler')"></i>
|
|
237
|
-
<i>{{
|
|
238
|
-
i18n2t(
|
|
239
|
-
`designer.widgetLabel.${field.type}`,
|
|
240
|
-
`extension.widgetLabel.${field.type}`
|
|
241
|
-
)
|
|
242
|
-
}}</i>
|
|
243
|
-
<i v-if="field.options.hidden === true" class="iconfont icon-hide"></i>
|
|
244
|
-
</div>
|
|
245
|
-
</template>
|
|
246
|
-
</div>
|
|
247
|
-
</template>
|
|
248
|
-
|
|
249
|
-
<script>
|
|
250
|
-
import i18n from "../../../../../components/xform/utils/i18n";
|
|
251
|
-
import {
|
|
252
|
-
getSubFormNameByFieldId,
|
|
253
|
-
isVabsearchMultiWidget,
|
|
254
|
-
} from "../../../../../components/xform/utils/util";
|
|
255
|
-
import compareView from "../../../../../components/xform/form-render/compareView.vue";
|
|
256
|
-
|
|
257
|
-
export default {
|
|
258
|
-
name: "form-item-wrapper",
|
|
259
|
-
mixins: [i18n],
|
|
260
|
-
components: { compareView },
|
|
261
|
-
props: {
|
|
262
|
-
field: Object,
|
|
263
|
-
designer: Object,
|
|
264
|
-
parentWidget: Object,
|
|
265
|
-
parentList: Array,
|
|
266
|
-
indexOfParentList: Number,
|
|
267
|
-
|
|
268
|
-
designState: {
|
|
269
|
-
type: Boolean,
|
|
270
|
-
default: false,
|
|
271
|
-
},
|
|
272
|
-
subFormRowIndex: {
|
|
273
|
-
/* 子表单组件行索引,从0开始计数 */ type: Number,
|
|
274
|
-
default: -1,
|
|
275
|
-
},
|
|
276
|
-
subFormColIndex: {
|
|
277
|
-
/* 子表单组件列索引,从0开始计数 */ type: Number,
|
|
278
|
-
default: -1,
|
|
279
|
-
},
|
|
280
|
-
subFormRowId: {
|
|
281
|
-
/* 子表单组件行Id,唯一id且不可变 */ type: String,
|
|
282
|
-
default: "",
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
rules: Array,
|
|
286
|
-
},
|
|
287
|
-
inject: {
|
|
288
|
-
getFormConfig: { default: () => () => ({}) },
|
|
289
|
-
getSubFormFieldFlag: { default: () => () => false },
|
|
290
|
-
getSubFormName: { default: () => () => "" },
|
|
291
|
-
tableParam: { default: null },
|
|
292
|
-
formItemProp: { default: null },
|
|
293
|
-
getObjectFieldFlag: { default: () => () => false },
|
|
294
|
-
getObjectName: { default: () => () => "" },
|
|
295
|
-
// 表单对比:非对比渲染场景(如设计器)给默认值,避免注入警告
|
|
296
|
-
getIsCompare: { default: () => () => false },
|
|
297
|
-
getOldFormData: { default: () => () => ({}) },
|
|
298
|
-
getCompareRowKey: { default: () => () => "uuid" },
|
|
299
|
-
getCompareExcludeTypes: { default: () => () => [] },
|
|
300
|
-
isCompareExcludeField: { default: () => () => false },
|
|
301
|
-
},
|
|
302
|
-
data() {
|
|
303
|
-
return {
|
|
304
|
-
encryptFormula: null,
|
|
305
|
-
};
|
|
306
|
-
},
|
|
307
|
-
computed: {
|
|
308
|
-
formConfig: function () {
|
|
309
|
-
return this.getFormConfig();
|
|
310
|
-
},
|
|
311
|
-
selected() {
|
|
312
|
-
return !!this.designer && this.field.id === this.designer.selectedId;
|
|
313
|
-
},
|
|
314
|
-
|
|
315
|
-
label() {
|
|
316
|
-
if (this.shouldHideFieldLabel()) {
|
|
317
|
-
return "";
|
|
318
|
-
}
|
|
319
|
-
return this.getI18nLabel(this.field.options.label);
|
|
320
|
-
// let label = this.field.options.label
|
|
321
|
-
// return label ? this.$t2(label) : label;
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
labelWidth() {
|
|
325
|
-
if (this.shouldHideFieldLabel()) {
|
|
326
|
-
return (!!this.designState ? 5 : 0) + "px"; //设计期间标签最小宽度5像素,以便于鼠标点击可选中组件!!
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
if (!!this.field.options.labelWidth) {
|
|
330
|
-
return this.field.options.labelWidth + "px !important";
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if (!!this.designer) {
|
|
334
|
-
return this.designer.formConfig.labelWidth + "px";
|
|
335
|
-
} else {
|
|
336
|
-
return this.formConfig.labelWidth + "px";
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
|
|
340
|
-
labelAlign() {
|
|
341
|
-
if (!this?.field?.options?.labelAlign) {
|
|
342
|
-
return "";
|
|
343
|
-
}
|
|
344
|
-
if (!!this.field.options.labelAlign) {
|
|
345
|
-
return this.field.options.labelAlign;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (!!this.designer) {
|
|
349
|
-
return this.designer.formConfig.labelAlign || "label-left-align";
|
|
350
|
-
} else {
|
|
351
|
-
return this.formConfig.labelAlign || "label-left-align";
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
customClass() {
|
|
356
|
-
return !!this.field.options.customClass
|
|
357
|
-
? this.field.options.customClass.join(" ")
|
|
358
|
-
: "";
|
|
359
|
-
},
|
|
360
|
-
|
|
361
|
-
subFormName() {
|
|
362
|
-
return !!this.parentWidget ? this.parentWidget.options.name : "";
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
subFormItemFlag() {
|
|
366
|
-
return (
|
|
367
|
-
this.isSubFormItem() ||
|
|
368
|
-
(!!this.parentWidget ? this.parentWidget.type === "sub-form" : false)
|
|
369
|
-
);
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
-
// ===================== 表单对比 =====================
|
|
373
|
-
// 所在明细表的属性名(keyName);主表字段为空。用于按表取黑/白名单
|
|
374
|
-
compareSubName() {
|
|
375
|
-
if (!this.tableParam || !this.tableParam.row) return "";
|
|
376
|
-
let opts = this.parentWidget && this.parentWidget.options;
|
|
377
|
-
if (!opts) return "";
|
|
378
|
-
return (opts.keyNameEnabled && opts.keyName) || opts.name || "";
|
|
379
|
-
},
|
|
380
|
-
compareExcluded() {
|
|
381
|
-
// 按类型排除
|
|
382
|
-
let types = this.getCompareExcludeTypes() || [];
|
|
383
|
-
if (types.indexOf(this.field.type) !== -1) return true;
|
|
384
|
-
// 按字段名排除(系统字段 + 主表黑白名单 + 所在明细表的黑白名单)
|
|
385
|
-
let fieldKeyName =
|
|
386
|
-
(this.field.options.keyNameEnabled && this.field.options.keyName) ||
|
|
387
|
-
this.field.options.name;
|
|
388
|
-
return !!this.isCompareExcludeField(fieldKeyName, this.compareSubName);
|
|
389
|
-
},
|
|
390
|
-
isCompareOn() {
|
|
391
|
-
return !this.designer && !this.compareExcluded && !!this.getIsCompare();
|
|
392
|
-
},
|
|
393
|
-
// 原单的行/主表对象(供关联类组件取伴随 label 字段)
|
|
394
|
-
compareOldRow() {
|
|
395
|
-
// 表格/子表单行内字段:取该行 hData 快照
|
|
396
|
-
if (this.tableParam && this.tableParam.row) {
|
|
397
|
-
return this.tableParam.row.hData || null;
|
|
398
|
-
}
|
|
399
|
-
// 主表字段
|
|
400
|
-
return this.getOldFormData() || null;
|
|
401
|
-
},
|
|
402
|
-
compareOldRaw() {
|
|
403
|
-
let property =
|
|
404
|
-
(this.field.options.keyNameEnabled && this.field.options.keyName) ||
|
|
405
|
-
this.field.options.name;
|
|
406
|
-
let row = this.compareOldRow;
|
|
407
|
-
return row ? row[property] : null;
|
|
408
|
-
},
|
|
409
|
-
compareNewRaw() {
|
|
410
|
-
return this.$parent ? this.$parent.fieldModel : null;
|
|
411
|
-
},
|
|
412
|
-
// 表格新增行(无原单匹配,hData 为空或缺失):整行标识,不逐单元格显示感叹号
|
|
413
|
-
compareRowIsNew() {
|
|
414
|
-
if (!this.tableParam || !this.tableParam.row) return false;
|
|
415
|
-
let hData = this.tableParam.row.hData;
|
|
416
|
-
return !hData || Object.keys(hData).length === 0;
|
|
417
|
-
},
|
|
418
|
-
compareIsDiff() {
|
|
419
|
-
if (!this.isCompareOn) return false;
|
|
420
|
-
if (this.compareRowIsNew) return false;
|
|
421
|
-
let eq =
|
|
422
|
-
this.$parent && this.$parent.compareEquals
|
|
423
|
-
? this.$parent.compareEquals(this.compareOldRaw, this.compareNewRaw)
|
|
424
|
-
: this.compareOldRaw === this.compareNewRaw;
|
|
425
|
-
return !eq;
|
|
426
|
-
},
|
|
427
|
-
compareOldDisplay() {
|
|
428
|
-
// 优先用 resolveCompareOldDisplay(可从 oldRow 取关联类的伴随 label 字段)
|
|
429
|
-
if (this.$parent && this.$parent.resolveCompareOldDisplay) {
|
|
430
|
-
return this.$parent.resolveCompareOldDisplay(this.compareOldRow);
|
|
431
|
-
}
|
|
432
|
-
if (this.$parent && this.$parent.resolveDisplayValue) {
|
|
433
|
-
return this.$parent.resolveDisplayValue(this.compareOldRaw);
|
|
434
|
-
}
|
|
435
|
-
return this.compareOldRaw;
|
|
436
|
-
},
|
|
437
|
-
},
|
|
438
|
-
created() {
|
|
439
|
-
//
|
|
440
|
-
this.initShowType();
|
|
441
|
-
},
|
|
442
|
-
methods: {
|
|
443
|
-
shouldHideFieldLabel() {
|
|
444
|
-
if (!!this.field.options.labelHidden) {
|
|
445
|
-
return true;
|
|
446
|
-
}
|
|
447
|
-
// 仅 VXE 数据表格列内字段隐藏标签(表头已展示列名);table2/table 等仍显示标签
|
|
448
|
-
return this.isDataTableColumnItem();
|
|
449
|
-
},
|
|
450
|
-
isDataTableColumnItem() {
|
|
451
|
-
return !!this.tableParam?.$table?.$parent?.$parent;
|
|
452
|
-
},
|
|
453
|
-
isSubFormItem() {
|
|
454
|
-
return !!this.tableParam;
|
|
455
|
-
},
|
|
456
|
-
selectField(field) {
|
|
457
|
-
if (!!this.designer) {
|
|
458
|
-
this.designer.setSelected(field);
|
|
459
|
-
this.designer.emitEvent("field-selected", this.parentWidget); //发送选中组件的父组件对象
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
|
|
463
|
-
selectParentWidget() {
|
|
464
|
-
if (this.parentWidget) {
|
|
465
|
-
this.designer.setSelected(this.parentWidget);
|
|
466
|
-
} else {
|
|
467
|
-
this.designer.clearSelected();
|
|
468
|
-
}
|
|
469
|
-
},
|
|
470
|
-
|
|
471
|
-
moveUpWidget() {
|
|
472
|
-
this.designer.moveUpWidget(this.parentList, this.indexOfParentList);
|
|
473
|
-
this.designer.emitHistoryChange();
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
moveDownWidget() {
|
|
477
|
-
this.designer.moveDownWidget(this.parentList, this.indexOfParentList);
|
|
478
|
-
this.designer.emitHistoryChange();
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
removeFieldWidget() {
|
|
482
|
-
if (!!this.parentList) {
|
|
483
|
-
const selectedWidgetName = this.designer.selectedWidgetName;
|
|
484
|
-
let selectedId = this.designer.selectedId;
|
|
485
|
-
let nextSelected = null;
|
|
486
|
-
if (this.parentList.length === 1) {
|
|
487
|
-
if (!!this.parentWidget) {
|
|
488
|
-
nextSelected = this.parentWidget;
|
|
489
|
-
}
|
|
490
|
-
} else if (this.parentList.length === 1 + this.indexOfParentList) {
|
|
491
|
-
nextSelected = this.parentList[this.indexOfParentList - 1];
|
|
492
|
-
} else {
|
|
493
|
-
nextSelected = this.parentList[this.indexOfParentList + 1];
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
this.$nextTick(() => {
|
|
497
|
-
const l = getSubFormNameByFieldId(
|
|
498
|
-
this.designer.widgetList,
|
|
499
|
-
selectedId
|
|
500
|
-
);
|
|
501
|
-
this.parentList.splice(this.indexOfParentList, 1);
|
|
502
|
-
//if (!!nextSelected) {
|
|
503
|
-
this.designer.setSelected(nextSelected);
|
|
504
|
-
//}
|
|
505
|
-
this.designer.formWidget.deleteWidgetRef(selectedWidgetName, l);
|
|
506
|
-
this.designer.emitHistoryChange();
|
|
507
|
-
this.designer.emitEvent("canvas-remove-field", selectedWidgetName);
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
},
|
|
511
|
-
getRules() {
|
|
512
|
-
return this.rules;
|
|
513
|
-
},
|
|
514
|
-
getPropName() {
|
|
515
|
-
if (this.formItemProp === "false") {
|
|
516
|
-
return null;
|
|
517
|
-
}
|
|
518
|
-
// if (this.formItemProp) {
|
|
519
|
-
// return this.formItemProp;
|
|
520
|
-
// }
|
|
521
|
-
if (this.tableParam && !this.tableParam.$table?.$parent?.$parent) {
|
|
522
|
-
if (this.formItemProp) {
|
|
523
|
-
return this.formItemProp;
|
|
524
|
-
}
|
|
525
|
-
return null;
|
|
526
|
-
}
|
|
527
|
-
if (this.tableParam && !!this.tableParam.$table?.$parent?.$parent) {
|
|
528
|
-
return this.getColumnProp(this.field, this.tableParam);
|
|
529
|
-
}
|
|
530
|
-
let o = this.field.options.name;
|
|
531
|
-
let propName =
|
|
532
|
-
((o =
|
|
533
|
-
(this.field.options.keyNameEnabled && this.field.options.keyName) ||
|
|
534
|
-
o),
|
|
535
|
-
this.subFormItemFlag && !this.designState
|
|
536
|
-
? this.subFormName + "." + this.subFormRowIndex + "." + o
|
|
537
|
-
: this.getObjectFieldFlag() && !this.designState
|
|
538
|
-
? this.getObjectName() + "." + o
|
|
539
|
-
: o);
|
|
540
|
-
|
|
541
|
-
return propName;
|
|
542
|
-
},
|
|
543
|
-
getFieldKeyName(widget) {
|
|
544
|
-
let o = widget.options.name;
|
|
545
|
-
return (widget.options.keyNameEnabled && widget.options.keyName) || o;
|
|
546
|
-
},
|
|
547
|
-
isVabsearchFlagWidget(widget) {
|
|
548
|
-
let type = widget?.type;
|
|
549
|
-
return (
|
|
550
|
-
type === "vabsearch" ||
|
|
551
|
-
type === "singerSearch" ||
|
|
552
|
-
type === "multiSearch"
|
|
553
|
-
);
|
|
554
|
-
},
|
|
555
|
-
getColumnProp(rowWidget, obj) {
|
|
556
|
-
let required = rowWidget.options.required || false;
|
|
557
|
-
|
|
558
|
-
let tableRef = obj.$table.$parent.$parent;
|
|
559
|
-
let tableWidget = tableRef.widget;
|
|
560
|
-
let fieldKeyName = this.getFieldKeyName(tableWidget);
|
|
561
|
-
let property = this.getFieldKeyName(rowWidget);
|
|
562
|
-
if (
|
|
563
|
-
this.isVabsearchFlagWidget(rowWidget) &&
|
|
564
|
-
!isVabsearchMultiWidget(rowWidget)
|
|
565
|
-
) {
|
|
566
|
-
property = rowWidget.options.vabSearchName || property;
|
|
567
|
-
}
|
|
568
|
-
let rowIndex = Math.max(obj.rowIndex, 0);
|
|
569
|
-
|
|
570
|
-
let isTreeTable = tableWidget.options.isTreeTable || false;
|
|
571
|
-
if (isTreeTable) {
|
|
572
|
-
rowIndex = tableRef
|
|
573
|
-
.getValue()
|
|
574
|
-
.findIndex((item) => item._X_ROW_KEY === obj.row._X_ROW_KEY);
|
|
575
|
-
if (rowIndex < 0) {
|
|
576
|
-
return "false";
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
let propName = fieldKeyName + "." + rowIndex + "." + property;
|
|
581
|
-
if (!required) {
|
|
582
|
-
propName = "false";
|
|
583
|
-
}
|
|
584
|
-
return propName;
|
|
585
|
-
},
|
|
586
|
-
getI18nLabel(label, path, param) {
|
|
587
|
-
return !this.designState && label ? this.$t2(label, path, param) : label;
|
|
588
|
-
},
|
|
589
|
-
getProcessText(text, pattern) {
|
|
590
|
-
if (pattern == "" || pattern === null || pattern === undefined) {
|
|
591
|
-
return text;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
let result = "";
|
|
595
|
-
|
|
596
|
-
// 处理固定模式
|
|
597
|
-
if (pattern === "-") {
|
|
598
|
-
result = "-";
|
|
599
|
-
} else if (pattern === "*") {
|
|
600
|
-
result = "*****";
|
|
601
|
-
}
|
|
602
|
-
// 处理自定义模式
|
|
603
|
-
else if (pattern.includes("*")) {
|
|
604
|
-
text = text ?? "";
|
|
605
|
-
const parts = pattern.split("*");
|
|
606
|
-
|
|
607
|
-
// 处理 A*B 模式
|
|
608
|
-
if (parts.length === 2 && parts[0] && parts[1]) {
|
|
609
|
-
const a = parseInt(parts[0]);
|
|
610
|
-
const b = parseInt(parts[1]);
|
|
611
|
-
|
|
612
|
-
if (!isNaN(a) && !isNaN(b) && a >= 0 && b >= 0) {
|
|
613
|
-
if (text.length >= a + b) {
|
|
614
|
-
const prefix = text.substring(0, a);
|
|
615
|
-
const suffix = text.substring(text.length - b);
|
|
616
|
-
const stars = "*".repeat(text.length - a - b);
|
|
617
|
-
result = prefix + stars + suffix;
|
|
618
|
-
} else {
|
|
619
|
-
result = "*****";
|
|
620
|
-
}
|
|
621
|
-
} else {
|
|
622
|
-
// result = '无效模式:A和B必须是数字';
|
|
623
|
-
result = text;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
// 处理 A* 模式
|
|
627
|
-
else if (parts.length === 2 && parts[0] && !parts[1]) {
|
|
628
|
-
const a = parseInt(parts[0]);
|
|
629
|
-
|
|
630
|
-
if (!isNaN(a) && a >= 0) {
|
|
631
|
-
if (text.length >= a) {
|
|
632
|
-
const prefix = text.substring(0, a);
|
|
633
|
-
const stars = "*".repeat(text.length - a);
|
|
634
|
-
result = prefix + stars;
|
|
635
|
-
} else {
|
|
636
|
-
result = "*****";
|
|
637
|
-
}
|
|
638
|
-
} else {
|
|
639
|
-
// result = '无效模式:A必须是数字';
|
|
640
|
-
result = text;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
// 处理 *B 模式
|
|
644
|
-
else if (parts.length === 2 && !parts[0] && parts[1]) {
|
|
645
|
-
const b = parseInt(parts[1]);
|
|
646
|
-
|
|
647
|
-
if (!isNaN(b) && b >= 0) {
|
|
648
|
-
if (text.length >= b) {
|
|
649
|
-
const suffix = text.substring(text.length - b);
|
|
650
|
-
const stars = "*".repeat(text.length - b);
|
|
651
|
-
result = stars + suffix;
|
|
652
|
-
} else {
|
|
653
|
-
result = "*****";
|
|
654
|
-
}
|
|
655
|
-
} else {
|
|
656
|
-
// result = '无效模式:B必须是数字';
|
|
657
|
-
result = text;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
// 处理无效模式
|
|
661
|
-
else {
|
|
662
|
-
result = "*****";
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
// 处理其他无效模式
|
|
666
|
-
else {
|
|
667
|
-
result = "*****";
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
return result;
|
|
671
|
-
},
|
|
672
|
-
initShowType() {
|
|
673
|
-
if (!!this.designer) return;
|
|
674
|
-
let that = this.$parent;
|
|
675
|
-
let formRef = that.getFormRef ? that.getFormRef() : that;
|
|
676
|
-
|
|
677
|
-
if (!formRef) return;
|
|
678
|
-
//详情页,新增页面不加密
|
|
679
|
-
let fJson = formRef.formJson;
|
|
680
|
-
let formConfig = fJson.formConfig;
|
|
681
|
-
if (formConfig.isLoadEntity && !formRef.dataId) return;
|
|
682
|
-
|
|
683
|
-
let bdService = formRef.bdService;
|
|
684
|
-
let companyCode = this.$store.getters.companyCode;
|
|
685
|
-
let loginAccount = this.$store.getters.loginAccount;
|
|
686
|
-
|
|
687
|
-
let userSaleOrgDTOs = formRef.userSaleOrgDTOs;
|
|
688
|
-
let userRoleDTOs = formRef.userRoleDTOs;
|
|
689
|
-
|
|
690
|
-
let saleOrgCodeList = userSaleOrgDTOs.map((item) => item.sn);
|
|
691
|
-
let roleCodeList = userRoleDTOs.map((item) => item.roleCode);
|
|
692
|
-
|
|
693
|
-
let optionModel = this.field.options;
|
|
694
|
-
|
|
695
|
-
let flag = 0; //0 原本组件,1明文文本,2密文文本
|
|
696
|
-
/*if (optionModel.showTextEnabled) {
|
|
697
|
-
flag = 1;
|
|
698
|
-
} else if (optionModel.showEncryptTextEnabled) {
|
|
699
|
-
flag = 2;
|
|
700
|
-
} else if (optionModel.showLinkTextEnabled) {
|
|
701
|
-
flag = 3;
|
|
702
|
-
}*/
|
|
703
|
-
if (optionModel.userTextRuleEnabled) {
|
|
704
|
-
let userTextRuleConfig = optionModel.userTextRuleConfig || [];
|
|
705
|
-
userTextRuleConfig.forEach((item) => {
|
|
706
|
-
let type = item.type ?? null;
|
|
707
|
-
if (type !== null && type !== "") {
|
|
708
|
-
let companyCodeStr = item.companyCodes;
|
|
709
|
-
let companyCodes = companyCodeStr
|
|
710
|
-
? companyCodeStr.split(",").filter((item) => !!item)
|
|
711
|
-
: [];
|
|
712
|
-
/*
|
|
713
|
-
|
|
714
|
-
let loginAccountStr = item.loginAccounts;
|
|
715
|
-
let loginAccounts = loginAccountStr ? loginAccountStr.split(",").filter(item => !!item) : [];
|
|
716
|
-
|
|
717
|
-
let saleOrgCodeStr = item.saleOrgCodes;
|
|
718
|
-
let saleOrgCodes = saleOrgCodeStr ? saleOrgCodeStr.split(",").filter(item => !!item) : [];
|
|
719
|
-
*/
|
|
720
|
-
|
|
721
|
-
let roleCodeStr = item.roleCodes;
|
|
722
|
-
let roleCodes = roleCodeStr
|
|
723
|
-
? roleCodeStr.split(",").filter((item) => !!item)
|
|
724
|
-
: [];
|
|
725
|
-
|
|
726
|
-
let flag1 = !item.serveName || item.serveName == bdService;
|
|
727
|
-
let flag2 =
|
|
728
|
-
!companyCodes.length || companyCodes.includes(companyCode);
|
|
729
|
-
// let flag3 = !loginAccounts.length || loginAccounts.includes(loginAccount)
|
|
730
|
-
// let flag4 = this.compareToList(saleOrgCodes, saleOrgCodeList)
|
|
731
|
-
if (flag1 && flag2) {
|
|
732
|
-
this.encryptFormula = item.encryptFormula;
|
|
733
|
-
let flag5 = this.compareToList(roleCodes, roleCodeList);
|
|
734
|
-
if (flag5) {
|
|
735
|
-
//匹配角色
|
|
736
|
-
if (type == 2) flag = 2; //type=2时加密
|
|
737
|
-
} else {
|
|
738
|
-
//角色不匹配
|
|
739
|
-
if (type == 1) flag = 2;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
this.field.options.widgetTextFlag = flag;
|
|
746
|
-
// this.showType = flag;
|
|
747
|
-
},
|
|
748
|
-
compareToList(list1, list2) {
|
|
749
|
-
if (!list1.length) {
|
|
750
|
-
return true;
|
|
751
|
-
}
|
|
752
|
-
if (!list2.length) {
|
|
753
|
-
return false;
|
|
754
|
-
}
|
|
755
|
-
return list1.some((item) => {
|
|
756
|
-
return list2.some((item2) => item == item2);
|
|
757
|
-
});
|
|
758
|
-
},
|
|
759
|
-
isShowWidget() {
|
|
760
|
-
let widgetTextFlag = this.field.options.widgetTextFlag;
|
|
761
|
-
return (
|
|
762
|
-
widgetTextFlag === undefined ||
|
|
763
|
-
widgetTextFlag === null ||
|
|
764
|
-
widgetTextFlag === 0
|
|
765
|
-
);
|
|
766
|
-
},
|
|
767
|
-
getShowValue() {
|
|
768
|
-
let widgetTextFlag = this.field.options.widgetTextFlag;
|
|
769
|
-
let fieldModel = this.$parent.fieldModel;
|
|
770
|
-
if (this.$parent.fieldModelLabel)
|
|
771
|
-
fieldModel = this.$parent.fieldModelLabel();
|
|
772
|
-
let showValue = fieldModel;
|
|
773
|
-
if (widgetTextFlag == 2) {
|
|
774
|
-
showValue = this.getProcessText(showValue, this.encryptFormula);
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
return showValue;
|
|
778
|
-
},
|
|
779
|
-
getWidgetClass() {
|
|
780
|
-
let list = [];
|
|
781
|
-
let optionModel = this.field.options.widgetTextLinkConfig?.options || {};
|
|
782
|
-
if (optionModel.colorClass) list.push(optionModel.colorClass);
|
|
783
|
-
if (optionModel.underline) list.push("underLine");
|
|
784
|
-
if (this.field.options.disabled) list.push("is-disabled");
|
|
785
|
-
return list;
|
|
786
|
-
},
|
|
787
|
-
handleClick(event) {
|
|
788
|
-
if (this.field.options.disabled) return;
|
|
789
|
-
this.$parent.handleButtonWidgetClick(event, true);
|
|
790
|
-
if (
|
|
791
|
-
!this.designState &&
|
|
792
|
-
this.field.options.widgetTextLinkConfig?.options.href
|
|
793
|
-
) {
|
|
794
|
-
window.open(this.field.options.widgetTextLinkConfig?.options.href);
|
|
795
|
-
}
|
|
796
|
-
},
|
|
797
|
-
getWidgetValue() {
|
|
798
|
-
let fieldModel = this.$parent.fieldModel;
|
|
799
|
-
if (this.$parent.fieldModelLabel)
|
|
800
|
-
fieldModel = this.$parent.fieldModelLabel();
|
|
801
|
-
return fieldModel;
|
|
802
|
-
},
|
|
803
|
-
},
|
|
804
|
-
};
|
|
805
|
-
</script>
|
|
806
|
-
|
|
807
|
-
<style lang="scss" scoped>
|
|
808
|
-
@import "~@/styles/global.scss";
|
|
809
|
-
|
|
810
|
-
.design-time-bottom-margin {
|
|
811
|
-
margin-bottom: 5px;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
.field-wrapper {
|
|
815
|
-
position: relative;
|
|
816
|
-
|
|
817
|
-
.field-action {
|
|
818
|
-
position: absolute;
|
|
819
|
-
//bottom: -24px;
|
|
820
|
-
bottom: 0;
|
|
821
|
-
right: -1px;
|
|
822
|
-
height: 22px;
|
|
823
|
-
line-height: 22px;
|
|
824
|
-
background: $--color-primary;
|
|
825
|
-
z-index: 9;
|
|
826
|
-
|
|
827
|
-
i {
|
|
828
|
-
font-size: 14px;
|
|
829
|
-
color: #fff;
|
|
830
|
-
margin: 0 5px;
|
|
831
|
-
cursor: pointer;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
.drag-handler {
|
|
836
|
-
position: absolute;
|
|
837
|
-
top: 0;
|
|
838
|
-
//bottom: -22px; /* 拖拽手柄位于组件下方,有时无法正常拖动,原因未明?? */
|
|
839
|
-
left: -1px;
|
|
840
|
-
height: 20px;
|
|
841
|
-
line-height: 18px;
|
|
842
|
-
//background: $--color-primary;
|
|
843
|
-
z-index: 9;
|
|
844
|
-
|
|
845
|
-
i {
|
|
846
|
-
font-size: 12px;
|
|
847
|
-
font-style: normal;
|
|
848
|
-
color: #fff;
|
|
849
|
-
margin: 4px;
|
|
850
|
-
cursor: move;
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
&:hover {
|
|
854
|
-
//opacity: 1;
|
|
855
|
-
background: $--color-primary;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
.el-form-item {
|
|
861
|
-
//margin-bottom: 0 !important;
|
|
862
|
-
//margin-bottom: 6px;
|
|
863
|
-
|
|
864
|
-
//margin-top: 2px;
|
|
865
|
-
position: relative;
|
|
866
|
-
|
|
867
|
-
::v-deep .el-form-item__label {
|
|
868
|
-
white-space: nowrap;
|
|
869
|
-
text-overflow: ellipsis;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
::v-deep .el-form-item__content {
|
|
873
|
-
//position: unset; /* TODO: 忘了这个样式设置是为了解决什么问题?? */
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
span.custom-label i {
|
|
877
|
-
margin: 0 3px;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
/* 隐藏Chrome浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
881
|
-
::v-deep .hide-spin-button input::-webkit-outer-spin-button,
|
|
882
|
-
::v-deep .hide-spin-button input::-webkit-inner-spin-button {
|
|
883
|
-
-webkit-appearance: none !important;
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
/* 隐藏Firefox浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
887
|
-
::v-deep .hide-spin-button input[type="number"] {
|
|
888
|
-
-moz-appearance: textfield;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
.required ::v-deep .el-form-item__label::before {
|
|
893
|
-
content: "*";
|
|
894
|
-
color: #f56c6c;
|
|
895
|
-
margin-right: 4px;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
.static-content-item {
|
|
899
|
-
min-height: 20px;
|
|
900
|
-
display: flex; /* 垂直居中 */
|
|
901
|
-
align-items: center; /* 垂直居中 */
|
|
902
|
-
|
|
903
|
-
::v-deep .el-divider--horizontal {
|
|
904
|
-
margin: 0;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
.el-form-item.selected,
|
|
909
|
-
.static-content-item.selected {
|
|
910
|
-
outline: 2px solid $--color-primary;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
::v-deep .label-left-align .el-form-item__label {
|
|
914
|
-
text-align: left;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
::v-deep .label-center-align .el-form-item__label {
|
|
918
|
-
text-align: center;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
::v-deep .label-right-align .el-form-item__label {
|
|
922
|
-
text-align: right;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
.a-link.is-disabled {
|
|
926
|
-
cursor: no-drop;
|
|
927
|
-
}
|
|
928
|
-
</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
|
|
13
|
+
class="field-wrapper"
|
|
14
|
+
:class="{ 'design-time-bottom-margin': !!this.designer }"
|
|
15
|
+
v-show="!field.options.hidden || designState === true"
|
|
16
|
+
>
|
|
17
|
+
<div>
|
|
18
|
+
<template v-if="formItemProp === 'false'">
|
|
19
|
+
<template v-if="!field.options.hidden">
|
|
20
|
+
<template v-if="isShowWidget()">
|
|
21
|
+
<compareView
|
|
22
|
+
v-if="isCompareOn"
|
|
23
|
+
:isCompare="isCompareOn"
|
|
24
|
+
:isDiff="compareIsDiff"
|
|
25
|
+
:oldVal="compareOldDisplay"
|
|
26
|
+
:newVal="getShowValue()"
|
|
27
|
+
>
|
|
28
|
+
<slot></slot>
|
|
29
|
+
</compareView>
|
|
30
|
+
<slot v-else></slot>
|
|
31
|
+
</template>
|
|
32
|
+
<template
|
|
33
|
+
v-else-if="
|
|
34
|
+
field.options.widgetTextFlag === 3 &&
|
|
35
|
+
field.options.widgetTextLinkConfig
|
|
36
|
+
"
|
|
37
|
+
>
|
|
38
|
+
<div class="ellipsis">
|
|
39
|
+
<a
|
|
40
|
+
class="a-link"
|
|
41
|
+
:class="getWidgetClass()"
|
|
42
|
+
@click.native="handleClick"
|
|
43
|
+
>
|
|
44
|
+
<span>
|
|
45
|
+
<i
|
|
46
|
+
:class="
|
|
47
|
+
field.options.widgetTextLinkConfig.options.prefixIcon
|
|
48
|
+
"
|
|
49
|
+
v-if="
|
|
50
|
+
!!field.options.widgetTextLinkConfig.options.prefixIcon
|
|
51
|
+
"
|
|
52
|
+
></i>
|
|
53
|
+
<span>{{ getWidgetValue() }}</span>
|
|
54
|
+
<i
|
|
55
|
+
:class="
|
|
56
|
+
field.options.widgetTextLinkConfig.options.suffixIcon
|
|
57
|
+
"
|
|
58
|
+
v-if="
|
|
59
|
+
!!field.options.widgetTextLinkConfig.options.suffixIcon
|
|
60
|
+
"
|
|
61
|
+
></i>
|
|
62
|
+
</span>
|
|
63
|
+
</a>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
<template v-else>
|
|
67
|
+
<compareView
|
|
68
|
+
v-if="isCompareOn"
|
|
69
|
+
:isCompare="isCompareOn"
|
|
70
|
+
:isDiff="compareIsDiff"
|
|
71
|
+
:oldVal="compareOldDisplay"
|
|
72
|
+
:newVal="getShowValue()"
|
|
73
|
+
>
|
|
74
|
+
<span>{{ getShowValue() }}</span>
|
|
75
|
+
</compareView>
|
|
76
|
+
<span v-else>{{ getShowValue() }}</span>
|
|
77
|
+
</template>
|
|
78
|
+
</template>
|
|
79
|
+
</template>
|
|
80
|
+
<template v-else>
|
|
81
|
+
<el-form-item
|
|
82
|
+
v-if="
|
|
83
|
+
!!field.formItemFlag &&
|
|
84
|
+
(!field.options.hidden || designState === true)
|
|
85
|
+
"
|
|
86
|
+
:label="label"
|
|
87
|
+
:label-width="labelWidth"
|
|
88
|
+
:rules="getRules()"
|
|
89
|
+
:prop="getPropName()"
|
|
90
|
+
:class="[
|
|
91
|
+
selected ? 'selected' : '',
|
|
92
|
+
labelAlign,
|
|
93
|
+
customClass,
|
|
94
|
+
field.options.required ? 'required' : '',
|
|
95
|
+
]"
|
|
96
|
+
@click.native.stop="selectField(field)"
|
|
97
|
+
>
|
|
98
|
+
<span
|
|
99
|
+
v-if="!!field.options.labelIconClass"
|
|
100
|
+
slot="label"
|
|
101
|
+
class="custom-label"
|
|
102
|
+
>
|
|
103
|
+
<template v-if="field.options.labelIconPosition === 'front'">
|
|
104
|
+
<template v-if="!!field.options.labelTooltip">
|
|
105
|
+
<el-tooltip
|
|
106
|
+
:content="field.options.labelTooltip"
|
|
107
|
+
effect="dark"
|
|
108
|
+
popper-class="label-tooltip-pre-line"
|
|
109
|
+
>
|
|
110
|
+
<i :class="field.options.labelIconClass"></i></el-tooltip
|
|
111
|
+
><span :style="{ color: field.options.labelColor }">{{
|
|
112
|
+
label
|
|
113
|
+
}}</span></template
|
|
114
|
+
>
|
|
115
|
+
<template v-else>
|
|
116
|
+
<i :class="field.options.labelIconClass"></i
|
|
117
|
+
><span :style="{ color: field.options.labelColor }">{{
|
|
118
|
+
label
|
|
119
|
+
}}</span></template
|
|
120
|
+
>
|
|
121
|
+
</template>
|
|
122
|
+
<template v-else-if="field.options.labelIconPosition === 'rear'">
|
|
123
|
+
<template v-if="!!field.options.labelTooltip">
|
|
124
|
+
<span :style="{ color: field.options.labelColor }">{{
|
|
125
|
+
label
|
|
126
|
+
}}</span
|
|
127
|
+
><el-tooltip
|
|
128
|
+
:content="field.options.labelTooltip"
|
|
129
|
+
effect="dark"
|
|
130
|
+
popper-class="label-tooltip-pre-line"
|
|
131
|
+
>
|
|
132
|
+
<i :class="field.options.labelIconClass"></i></el-tooltip
|
|
133
|
+
></template>
|
|
134
|
+
<template v-else>
|
|
135
|
+
<span :style="{ color: field.options.labelColor }">{{
|
|
136
|
+
label
|
|
137
|
+
}}</span
|
|
138
|
+
><i :class="field.options.labelIconClass"></i
|
|
139
|
+
></template>
|
|
140
|
+
</template>
|
|
141
|
+
</span>
|
|
142
|
+
<span
|
|
143
|
+
v-else-if="!!field.options.labelColor"
|
|
144
|
+
slot="label"
|
|
145
|
+
:style="{ color: field.options.labelColor }"
|
|
146
|
+
>
|
|
147
|
+
{{ label }}
|
|
148
|
+
</span>
|
|
149
|
+
<template v-if="isShowWidget()">
|
|
150
|
+
<compareView
|
|
151
|
+
v-if="isCompareOn"
|
|
152
|
+
:isCompare="isCompareOn"
|
|
153
|
+
:isDiff="compareIsDiff"
|
|
154
|
+
:oldVal="compareOldDisplay"
|
|
155
|
+
:newVal="getShowValue()"
|
|
156
|
+
>
|
|
157
|
+
<slot></slot>
|
|
158
|
+
</compareView>
|
|
159
|
+
<slot v-else></slot>
|
|
160
|
+
</template>
|
|
161
|
+
<template
|
|
162
|
+
v-else-if="
|
|
163
|
+
field.options.widgetTextFlag === 3 &&
|
|
164
|
+
field.options.widgetTextLinkConfig
|
|
165
|
+
"
|
|
166
|
+
>
|
|
167
|
+
<div class="ellipsis">
|
|
168
|
+
<a class="a-link" :class="getWidgetClass()" @click="handleClick">
|
|
169
|
+
<span>
|
|
170
|
+
<i
|
|
171
|
+
:class="
|
|
172
|
+
field.options.widgetTextLinkConfig.options.prefixIcon
|
|
173
|
+
"
|
|
174
|
+
v-if="
|
|
175
|
+
!!field.options.widgetTextLinkConfig.options.prefixIcon
|
|
176
|
+
"
|
|
177
|
+
></i>
|
|
178
|
+
<span>{{ getWidgetValue() }}</span>
|
|
179
|
+
<i
|
|
180
|
+
:class="
|
|
181
|
+
field.options.widgetTextLinkConfig.options.suffixIcon
|
|
182
|
+
"
|
|
183
|
+
v-if="
|
|
184
|
+
!!field.options.widgetTextLinkConfig.options.suffixIcon
|
|
185
|
+
"
|
|
186
|
+
></i>
|
|
187
|
+
</span>
|
|
188
|
+
</a>
|
|
189
|
+
</div>
|
|
190
|
+
</template>
|
|
191
|
+
<template v-else>
|
|
192
|
+
<compareView
|
|
193
|
+
v-if="isCompareOn"
|
|
194
|
+
:isCompare="isCompareOn"
|
|
195
|
+
:isDiff="compareIsDiff"
|
|
196
|
+
:oldVal="compareOldDisplay"
|
|
197
|
+
:newVal="getShowValue()"
|
|
198
|
+
>
|
|
199
|
+
<span>{{ getShowValue() }}</span>
|
|
200
|
+
</compareView>
|
|
201
|
+
<span v-else>{{ getShowValue() }}</span>
|
|
202
|
+
</template>
|
|
203
|
+
</el-form-item>
|
|
204
|
+
</template>
|
|
205
|
+
</div>
|
|
206
|
+
<template v-if="!!this.designer">
|
|
207
|
+
<div class="field-action" v-if="designer.selectedId === field.id">
|
|
208
|
+
<i
|
|
209
|
+
class="el-icon-back"
|
|
210
|
+
:title="i18nt('designer.hint.selectParentWidget')"
|
|
211
|
+
@click.stop="selectParentWidget(field)"
|
|
212
|
+
></i>
|
|
213
|
+
<i
|
|
214
|
+
class="el-icon-top"
|
|
215
|
+
v-if="!!parentList && parentList.length > 1"
|
|
216
|
+
:title="i18nt('designer.hint.moveUpWidget')"
|
|
217
|
+
@click.stop="moveUpWidget(field)"
|
|
218
|
+
></i>
|
|
219
|
+
<i
|
|
220
|
+
class="el-icon-bottom"
|
|
221
|
+
v-if="!!parentList && parentList.length > 1"
|
|
222
|
+
:title="i18nt('designer.hint.moveDownWidget')"
|
|
223
|
+
@click.stop="moveDownWidget(field)"
|
|
224
|
+
></i>
|
|
225
|
+
<i
|
|
226
|
+
class="el-icon-delete"
|
|
227
|
+
:title="i18nt('designer.hint.remove')"
|
|
228
|
+
@click.stop="removeFieldWidget"
|
|
229
|
+
></i>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<div
|
|
233
|
+
class="drag-handler background-opacity"
|
|
234
|
+
v-if="designer.selectedId === field.id"
|
|
235
|
+
>
|
|
236
|
+
<i class="el-icon-rank" :title="i18nt('designer.hint.dragHandler')"></i>
|
|
237
|
+
<i>{{
|
|
238
|
+
i18n2t(
|
|
239
|
+
`designer.widgetLabel.${field.type}`,
|
|
240
|
+
`extension.widgetLabel.${field.type}`
|
|
241
|
+
)
|
|
242
|
+
}}</i>
|
|
243
|
+
<i v-if="field.options.hidden === true" class="iconfont icon-hide"></i>
|
|
244
|
+
</div>
|
|
245
|
+
</template>
|
|
246
|
+
</div>
|
|
247
|
+
</template>
|
|
248
|
+
|
|
249
|
+
<script>
|
|
250
|
+
import i18n from "../../../../../components/xform/utils/i18n";
|
|
251
|
+
import {
|
|
252
|
+
getSubFormNameByFieldId,
|
|
253
|
+
isVabsearchMultiWidget,
|
|
254
|
+
} from "../../../../../components/xform/utils/util";
|
|
255
|
+
import compareView from "../../../../../components/xform/form-render/compareView.vue";
|
|
256
|
+
|
|
257
|
+
export default {
|
|
258
|
+
name: "form-item-wrapper",
|
|
259
|
+
mixins: [i18n],
|
|
260
|
+
components: { compareView },
|
|
261
|
+
props: {
|
|
262
|
+
field: Object,
|
|
263
|
+
designer: Object,
|
|
264
|
+
parentWidget: Object,
|
|
265
|
+
parentList: Array,
|
|
266
|
+
indexOfParentList: Number,
|
|
267
|
+
|
|
268
|
+
designState: {
|
|
269
|
+
type: Boolean,
|
|
270
|
+
default: false,
|
|
271
|
+
},
|
|
272
|
+
subFormRowIndex: {
|
|
273
|
+
/* 子表单组件行索引,从0开始计数 */ type: Number,
|
|
274
|
+
default: -1,
|
|
275
|
+
},
|
|
276
|
+
subFormColIndex: {
|
|
277
|
+
/* 子表单组件列索引,从0开始计数 */ type: Number,
|
|
278
|
+
default: -1,
|
|
279
|
+
},
|
|
280
|
+
subFormRowId: {
|
|
281
|
+
/* 子表单组件行Id,唯一id且不可变 */ type: String,
|
|
282
|
+
default: "",
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
rules: Array,
|
|
286
|
+
},
|
|
287
|
+
inject: {
|
|
288
|
+
getFormConfig: { default: () => () => ({}) },
|
|
289
|
+
getSubFormFieldFlag: { default: () => () => false },
|
|
290
|
+
getSubFormName: { default: () => () => "" },
|
|
291
|
+
tableParam: { default: null },
|
|
292
|
+
formItemProp: { default: null },
|
|
293
|
+
getObjectFieldFlag: { default: () => () => false },
|
|
294
|
+
getObjectName: { default: () => () => "" },
|
|
295
|
+
// 表单对比:非对比渲染场景(如设计器)给默认值,避免注入警告
|
|
296
|
+
getIsCompare: { default: () => () => false },
|
|
297
|
+
getOldFormData: { default: () => () => ({}) },
|
|
298
|
+
getCompareRowKey: { default: () => () => "uuid" },
|
|
299
|
+
getCompareExcludeTypes: { default: () => () => [] },
|
|
300
|
+
isCompareExcludeField: { default: () => () => false },
|
|
301
|
+
},
|
|
302
|
+
data() {
|
|
303
|
+
return {
|
|
304
|
+
encryptFormula: null,
|
|
305
|
+
};
|
|
306
|
+
},
|
|
307
|
+
computed: {
|
|
308
|
+
formConfig: function () {
|
|
309
|
+
return this.getFormConfig();
|
|
310
|
+
},
|
|
311
|
+
selected() {
|
|
312
|
+
return !!this.designer && this.field.id === this.designer.selectedId;
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
label() {
|
|
316
|
+
if (this.shouldHideFieldLabel()) {
|
|
317
|
+
return "";
|
|
318
|
+
}
|
|
319
|
+
return this.getI18nLabel(this.field.options.label);
|
|
320
|
+
// let label = this.field.options.label
|
|
321
|
+
// return label ? this.$t2(label) : label;
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
labelWidth() {
|
|
325
|
+
if (this.shouldHideFieldLabel()) {
|
|
326
|
+
return (!!this.designState ? 5 : 0) + "px"; //设计期间标签最小宽度5像素,以便于鼠标点击可选中组件!!
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (!!this.field.options.labelWidth) {
|
|
330
|
+
return this.field.options.labelWidth + "px !important";
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (!!this.designer) {
|
|
334
|
+
return this.designer.formConfig.labelWidth + "px";
|
|
335
|
+
} else {
|
|
336
|
+
return this.formConfig.labelWidth + "px";
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
labelAlign() {
|
|
341
|
+
if (!this?.field?.options?.labelAlign) {
|
|
342
|
+
return "";
|
|
343
|
+
}
|
|
344
|
+
if (!!this.field.options.labelAlign) {
|
|
345
|
+
return this.field.options.labelAlign;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (!!this.designer) {
|
|
349
|
+
return this.designer.formConfig.labelAlign || "label-left-align";
|
|
350
|
+
} else {
|
|
351
|
+
return this.formConfig.labelAlign || "label-left-align";
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
customClass() {
|
|
356
|
+
return !!this.field.options.customClass
|
|
357
|
+
? this.field.options.customClass.join(" ")
|
|
358
|
+
: "";
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
subFormName() {
|
|
362
|
+
return !!this.parentWidget ? this.parentWidget.options.name : "";
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
subFormItemFlag() {
|
|
366
|
+
return (
|
|
367
|
+
this.isSubFormItem() ||
|
|
368
|
+
(!!this.parentWidget ? this.parentWidget.type === "sub-form" : false)
|
|
369
|
+
);
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
// ===================== 表单对比 =====================
|
|
373
|
+
// 所在明细表的属性名(keyName);主表字段为空。用于按表取黑/白名单
|
|
374
|
+
compareSubName() {
|
|
375
|
+
if (!this.tableParam || !this.tableParam.row) return "";
|
|
376
|
+
let opts = this.parentWidget && this.parentWidget.options;
|
|
377
|
+
if (!opts) return "";
|
|
378
|
+
return (opts.keyNameEnabled && opts.keyName) || opts.name || "";
|
|
379
|
+
},
|
|
380
|
+
compareExcluded() {
|
|
381
|
+
// 按类型排除
|
|
382
|
+
let types = this.getCompareExcludeTypes() || [];
|
|
383
|
+
if (types.indexOf(this.field.type) !== -1) return true;
|
|
384
|
+
// 按字段名排除(系统字段 + 主表黑白名单 + 所在明细表的黑白名单)
|
|
385
|
+
let fieldKeyName =
|
|
386
|
+
(this.field.options.keyNameEnabled && this.field.options.keyName) ||
|
|
387
|
+
this.field.options.name;
|
|
388
|
+
return !!this.isCompareExcludeField(fieldKeyName, this.compareSubName);
|
|
389
|
+
},
|
|
390
|
+
isCompareOn() {
|
|
391
|
+
return !this.designer && !this.compareExcluded && !!this.getIsCompare();
|
|
392
|
+
},
|
|
393
|
+
// 原单的行/主表对象(供关联类组件取伴随 label 字段)
|
|
394
|
+
compareOldRow() {
|
|
395
|
+
// 表格/子表单行内字段:取该行 hData 快照
|
|
396
|
+
if (this.tableParam && this.tableParam.row) {
|
|
397
|
+
return this.tableParam.row.hData || null;
|
|
398
|
+
}
|
|
399
|
+
// 主表字段
|
|
400
|
+
return this.getOldFormData() || null;
|
|
401
|
+
},
|
|
402
|
+
compareOldRaw() {
|
|
403
|
+
let property =
|
|
404
|
+
(this.field.options.keyNameEnabled && this.field.options.keyName) ||
|
|
405
|
+
this.field.options.name;
|
|
406
|
+
let row = this.compareOldRow;
|
|
407
|
+
return row ? row[property] : null;
|
|
408
|
+
},
|
|
409
|
+
compareNewRaw() {
|
|
410
|
+
return this.$parent ? this.$parent.fieldModel : null;
|
|
411
|
+
},
|
|
412
|
+
// 表格新增行(无原单匹配,hData 为空或缺失):整行标识,不逐单元格显示感叹号
|
|
413
|
+
compareRowIsNew() {
|
|
414
|
+
if (!this.tableParam || !this.tableParam.row) return false;
|
|
415
|
+
let hData = this.tableParam.row.hData;
|
|
416
|
+
return !hData || Object.keys(hData).length === 0;
|
|
417
|
+
},
|
|
418
|
+
compareIsDiff() {
|
|
419
|
+
if (!this.isCompareOn) return false;
|
|
420
|
+
if (this.compareRowIsNew) return false;
|
|
421
|
+
let eq =
|
|
422
|
+
this.$parent && this.$parent.compareEquals
|
|
423
|
+
? this.$parent.compareEquals(this.compareOldRaw, this.compareNewRaw)
|
|
424
|
+
: this.compareOldRaw === this.compareNewRaw;
|
|
425
|
+
return !eq;
|
|
426
|
+
},
|
|
427
|
+
compareOldDisplay() {
|
|
428
|
+
// 优先用 resolveCompareOldDisplay(可从 oldRow 取关联类的伴随 label 字段)
|
|
429
|
+
if (this.$parent && this.$parent.resolveCompareOldDisplay) {
|
|
430
|
+
return this.$parent.resolveCompareOldDisplay(this.compareOldRow);
|
|
431
|
+
}
|
|
432
|
+
if (this.$parent && this.$parent.resolveDisplayValue) {
|
|
433
|
+
return this.$parent.resolveDisplayValue(this.compareOldRaw);
|
|
434
|
+
}
|
|
435
|
+
return this.compareOldRaw;
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
created() {
|
|
439
|
+
//
|
|
440
|
+
this.initShowType();
|
|
441
|
+
},
|
|
442
|
+
methods: {
|
|
443
|
+
shouldHideFieldLabel() {
|
|
444
|
+
if (!!this.field.options.labelHidden) {
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
// 仅 VXE 数据表格列内字段隐藏标签(表头已展示列名);table2/table 等仍显示标签
|
|
448
|
+
return this.isDataTableColumnItem();
|
|
449
|
+
},
|
|
450
|
+
isDataTableColumnItem() {
|
|
451
|
+
return !!this.tableParam?.$table?.$parent?.$parent;
|
|
452
|
+
},
|
|
453
|
+
isSubFormItem() {
|
|
454
|
+
return !!this.tableParam;
|
|
455
|
+
},
|
|
456
|
+
selectField(field) {
|
|
457
|
+
if (!!this.designer) {
|
|
458
|
+
this.designer.setSelected(field);
|
|
459
|
+
this.designer.emitEvent("field-selected", this.parentWidget); //发送选中组件的父组件对象
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
|
|
463
|
+
selectParentWidget() {
|
|
464
|
+
if (this.parentWidget) {
|
|
465
|
+
this.designer.setSelected(this.parentWidget);
|
|
466
|
+
} else {
|
|
467
|
+
this.designer.clearSelected();
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
moveUpWidget() {
|
|
472
|
+
this.designer.moveUpWidget(this.parentList, this.indexOfParentList);
|
|
473
|
+
this.designer.emitHistoryChange();
|
|
474
|
+
},
|
|
475
|
+
|
|
476
|
+
moveDownWidget() {
|
|
477
|
+
this.designer.moveDownWidget(this.parentList, this.indexOfParentList);
|
|
478
|
+
this.designer.emitHistoryChange();
|
|
479
|
+
},
|
|
480
|
+
|
|
481
|
+
removeFieldWidget() {
|
|
482
|
+
if (!!this.parentList) {
|
|
483
|
+
const selectedWidgetName = this.designer.selectedWidgetName;
|
|
484
|
+
let selectedId = this.designer.selectedId;
|
|
485
|
+
let nextSelected = null;
|
|
486
|
+
if (this.parentList.length === 1) {
|
|
487
|
+
if (!!this.parentWidget) {
|
|
488
|
+
nextSelected = this.parentWidget;
|
|
489
|
+
}
|
|
490
|
+
} else if (this.parentList.length === 1 + this.indexOfParentList) {
|
|
491
|
+
nextSelected = this.parentList[this.indexOfParentList - 1];
|
|
492
|
+
} else {
|
|
493
|
+
nextSelected = this.parentList[this.indexOfParentList + 1];
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
this.$nextTick(() => {
|
|
497
|
+
const l = getSubFormNameByFieldId(
|
|
498
|
+
this.designer.widgetList,
|
|
499
|
+
selectedId
|
|
500
|
+
);
|
|
501
|
+
this.parentList.splice(this.indexOfParentList, 1);
|
|
502
|
+
//if (!!nextSelected) {
|
|
503
|
+
this.designer.setSelected(nextSelected);
|
|
504
|
+
//}
|
|
505
|
+
this.designer.formWidget.deleteWidgetRef(selectedWidgetName, l);
|
|
506
|
+
this.designer.emitHistoryChange();
|
|
507
|
+
this.designer.emitEvent("canvas-remove-field", selectedWidgetName);
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
getRules() {
|
|
512
|
+
return this.rules;
|
|
513
|
+
},
|
|
514
|
+
getPropName() {
|
|
515
|
+
if (this.formItemProp === "false") {
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
// if (this.formItemProp) {
|
|
519
|
+
// return this.formItemProp;
|
|
520
|
+
// }
|
|
521
|
+
if (this.tableParam && !this.tableParam.$table?.$parent?.$parent) {
|
|
522
|
+
if (this.formItemProp) {
|
|
523
|
+
return this.formItemProp;
|
|
524
|
+
}
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
if (this.tableParam && !!this.tableParam.$table?.$parent?.$parent) {
|
|
528
|
+
return this.getColumnProp(this.field, this.tableParam);
|
|
529
|
+
}
|
|
530
|
+
let o = this.field.options.name;
|
|
531
|
+
let propName =
|
|
532
|
+
((o =
|
|
533
|
+
(this.field.options.keyNameEnabled && this.field.options.keyName) ||
|
|
534
|
+
o),
|
|
535
|
+
this.subFormItemFlag && !this.designState
|
|
536
|
+
? this.subFormName + "." + this.subFormRowIndex + "." + o
|
|
537
|
+
: this.getObjectFieldFlag() && !this.designState
|
|
538
|
+
? this.getObjectName() + "." + o
|
|
539
|
+
: o);
|
|
540
|
+
|
|
541
|
+
return propName;
|
|
542
|
+
},
|
|
543
|
+
getFieldKeyName(widget) {
|
|
544
|
+
let o = widget.options.name;
|
|
545
|
+
return (widget.options.keyNameEnabled && widget.options.keyName) || o;
|
|
546
|
+
},
|
|
547
|
+
isVabsearchFlagWidget(widget) {
|
|
548
|
+
let type = widget?.type;
|
|
549
|
+
return (
|
|
550
|
+
type === "vabsearch" ||
|
|
551
|
+
type === "singerSearch" ||
|
|
552
|
+
type === "multiSearch"
|
|
553
|
+
);
|
|
554
|
+
},
|
|
555
|
+
getColumnProp(rowWidget, obj) {
|
|
556
|
+
let required = rowWidget.options.required || false;
|
|
557
|
+
|
|
558
|
+
let tableRef = obj.$table.$parent.$parent;
|
|
559
|
+
let tableWidget = tableRef.widget;
|
|
560
|
+
let fieldKeyName = this.getFieldKeyName(tableWidget);
|
|
561
|
+
let property = this.getFieldKeyName(rowWidget);
|
|
562
|
+
if (
|
|
563
|
+
this.isVabsearchFlagWidget(rowWidget) &&
|
|
564
|
+
!isVabsearchMultiWidget(rowWidget)
|
|
565
|
+
) {
|
|
566
|
+
property = rowWidget.options.vabSearchName || property;
|
|
567
|
+
}
|
|
568
|
+
let rowIndex = Math.max(obj.rowIndex, 0);
|
|
569
|
+
|
|
570
|
+
let isTreeTable = tableWidget.options.isTreeTable || false;
|
|
571
|
+
if (isTreeTable) {
|
|
572
|
+
rowIndex = tableRef
|
|
573
|
+
.getValue()
|
|
574
|
+
.findIndex((item) => item._X_ROW_KEY === obj.row._X_ROW_KEY);
|
|
575
|
+
if (rowIndex < 0) {
|
|
576
|
+
return "false";
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
let propName = fieldKeyName + "." + rowIndex + "." + property;
|
|
581
|
+
if (!required) {
|
|
582
|
+
propName = "false";
|
|
583
|
+
}
|
|
584
|
+
return propName;
|
|
585
|
+
},
|
|
586
|
+
getI18nLabel(label, path, param) {
|
|
587
|
+
return !this.designState && label ? this.$t2(label, path, param) : label;
|
|
588
|
+
},
|
|
589
|
+
getProcessText(text, pattern) {
|
|
590
|
+
if (pattern == "" || pattern === null || pattern === undefined) {
|
|
591
|
+
return text;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
let result = "";
|
|
595
|
+
|
|
596
|
+
// 处理固定模式
|
|
597
|
+
if (pattern === "-") {
|
|
598
|
+
result = "-";
|
|
599
|
+
} else if (pattern === "*") {
|
|
600
|
+
result = "*****";
|
|
601
|
+
}
|
|
602
|
+
// 处理自定义模式
|
|
603
|
+
else if (pattern.includes("*")) {
|
|
604
|
+
text = text ?? "";
|
|
605
|
+
const parts = pattern.split("*");
|
|
606
|
+
|
|
607
|
+
// 处理 A*B 模式
|
|
608
|
+
if (parts.length === 2 && parts[0] && parts[1]) {
|
|
609
|
+
const a = parseInt(parts[0]);
|
|
610
|
+
const b = parseInt(parts[1]);
|
|
611
|
+
|
|
612
|
+
if (!isNaN(a) && !isNaN(b) && a >= 0 && b >= 0) {
|
|
613
|
+
if (text.length >= a + b) {
|
|
614
|
+
const prefix = text.substring(0, a);
|
|
615
|
+
const suffix = text.substring(text.length - b);
|
|
616
|
+
const stars = "*".repeat(text.length - a - b);
|
|
617
|
+
result = prefix + stars + suffix;
|
|
618
|
+
} else {
|
|
619
|
+
result = "*****";
|
|
620
|
+
}
|
|
621
|
+
} else {
|
|
622
|
+
// result = '无效模式:A和B必须是数字';
|
|
623
|
+
result = text;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
// 处理 A* 模式
|
|
627
|
+
else if (parts.length === 2 && parts[0] && !parts[1]) {
|
|
628
|
+
const a = parseInt(parts[0]);
|
|
629
|
+
|
|
630
|
+
if (!isNaN(a) && a >= 0) {
|
|
631
|
+
if (text.length >= a) {
|
|
632
|
+
const prefix = text.substring(0, a);
|
|
633
|
+
const stars = "*".repeat(text.length - a);
|
|
634
|
+
result = prefix + stars;
|
|
635
|
+
} else {
|
|
636
|
+
result = "*****";
|
|
637
|
+
}
|
|
638
|
+
} else {
|
|
639
|
+
// result = '无效模式:A必须是数字';
|
|
640
|
+
result = text;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
// 处理 *B 模式
|
|
644
|
+
else if (parts.length === 2 && !parts[0] && parts[1]) {
|
|
645
|
+
const b = parseInt(parts[1]);
|
|
646
|
+
|
|
647
|
+
if (!isNaN(b) && b >= 0) {
|
|
648
|
+
if (text.length >= b) {
|
|
649
|
+
const suffix = text.substring(text.length - b);
|
|
650
|
+
const stars = "*".repeat(text.length - b);
|
|
651
|
+
result = stars + suffix;
|
|
652
|
+
} else {
|
|
653
|
+
result = "*****";
|
|
654
|
+
}
|
|
655
|
+
} else {
|
|
656
|
+
// result = '无效模式:B必须是数字';
|
|
657
|
+
result = text;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
// 处理无效模式
|
|
661
|
+
else {
|
|
662
|
+
result = "*****";
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
// 处理其他无效模式
|
|
666
|
+
else {
|
|
667
|
+
result = "*****";
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
return result;
|
|
671
|
+
},
|
|
672
|
+
initShowType() {
|
|
673
|
+
if (!!this.designer) return;
|
|
674
|
+
let that = this.$parent;
|
|
675
|
+
let formRef = that.getFormRef ? that.getFormRef() : that;
|
|
676
|
+
|
|
677
|
+
if (!formRef) return;
|
|
678
|
+
//详情页,新增页面不加密
|
|
679
|
+
let fJson = formRef.formJson;
|
|
680
|
+
let formConfig = fJson.formConfig;
|
|
681
|
+
if (formConfig.isLoadEntity && !formRef.dataId) return;
|
|
682
|
+
|
|
683
|
+
let bdService = formRef.bdService;
|
|
684
|
+
let companyCode = this.$store.getters.companyCode;
|
|
685
|
+
let loginAccount = this.$store.getters.loginAccount;
|
|
686
|
+
|
|
687
|
+
let userSaleOrgDTOs = formRef.userSaleOrgDTOs;
|
|
688
|
+
let userRoleDTOs = formRef.userRoleDTOs;
|
|
689
|
+
|
|
690
|
+
let saleOrgCodeList = userSaleOrgDTOs.map((item) => item.sn);
|
|
691
|
+
let roleCodeList = userRoleDTOs.map((item) => item.roleCode);
|
|
692
|
+
|
|
693
|
+
let optionModel = this.field.options;
|
|
694
|
+
|
|
695
|
+
let flag = 0; //0 原本组件,1明文文本,2密文文本
|
|
696
|
+
/*if (optionModel.showTextEnabled) {
|
|
697
|
+
flag = 1;
|
|
698
|
+
} else if (optionModel.showEncryptTextEnabled) {
|
|
699
|
+
flag = 2;
|
|
700
|
+
} else if (optionModel.showLinkTextEnabled) {
|
|
701
|
+
flag = 3;
|
|
702
|
+
}*/
|
|
703
|
+
if (optionModel.userTextRuleEnabled) {
|
|
704
|
+
let userTextRuleConfig = optionModel.userTextRuleConfig || [];
|
|
705
|
+
userTextRuleConfig.forEach((item) => {
|
|
706
|
+
let type = item.type ?? null;
|
|
707
|
+
if (type !== null && type !== "") {
|
|
708
|
+
let companyCodeStr = item.companyCodes;
|
|
709
|
+
let companyCodes = companyCodeStr
|
|
710
|
+
? companyCodeStr.split(",").filter((item) => !!item)
|
|
711
|
+
: [];
|
|
712
|
+
/*
|
|
713
|
+
|
|
714
|
+
let loginAccountStr = item.loginAccounts;
|
|
715
|
+
let loginAccounts = loginAccountStr ? loginAccountStr.split(",").filter(item => !!item) : [];
|
|
716
|
+
|
|
717
|
+
let saleOrgCodeStr = item.saleOrgCodes;
|
|
718
|
+
let saleOrgCodes = saleOrgCodeStr ? saleOrgCodeStr.split(",").filter(item => !!item) : [];
|
|
719
|
+
*/
|
|
720
|
+
|
|
721
|
+
let roleCodeStr = item.roleCodes;
|
|
722
|
+
let roleCodes = roleCodeStr
|
|
723
|
+
? roleCodeStr.split(",").filter((item) => !!item)
|
|
724
|
+
: [];
|
|
725
|
+
|
|
726
|
+
let flag1 = !item.serveName || item.serveName == bdService;
|
|
727
|
+
let flag2 =
|
|
728
|
+
!companyCodes.length || companyCodes.includes(companyCode);
|
|
729
|
+
// let flag3 = !loginAccounts.length || loginAccounts.includes(loginAccount)
|
|
730
|
+
// let flag4 = this.compareToList(saleOrgCodes, saleOrgCodeList)
|
|
731
|
+
if (flag1 && flag2) {
|
|
732
|
+
this.encryptFormula = item.encryptFormula;
|
|
733
|
+
let flag5 = this.compareToList(roleCodes, roleCodeList);
|
|
734
|
+
if (flag5) {
|
|
735
|
+
//匹配角色
|
|
736
|
+
if (type == 2) flag = 2; //type=2时加密
|
|
737
|
+
} else {
|
|
738
|
+
//角色不匹配
|
|
739
|
+
if (type == 1) flag = 2;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
this.field.options.widgetTextFlag = flag;
|
|
746
|
+
// this.showType = flag;
|
|
747
|
+
},
|
|
748
|
+
compareToList(list1, list2) {
|
|
749
|
+
if (!list1.length) {
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
if (!list2.length) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
return list1.some((item) => {
|
|
756
|
+
return list2.some((item2) => item == item2);
|
|
757
|
+
});
|
|
758
|
+
},
|
|
759
|
+
isShowWidget() {
|
|
760
|
+
let widgetTextFlag = this.field.options.widgetTextFlag;
|
|
761
|
+
return (
|
|
762
|
+
widgetTextFlag === undefined ||
|
|
763
|
+
widgetTextFlag === null ||
|
|
764
|
+
widgetTextFlag === 0
|
|
765
|
+
);
|
|
766
|
+
},
|
|
767
|
+
getShowValue() {
|
|
768
|
+
let widgetTextFlag = this.field.options.widgetTextFlag;
|
|
769
|
+
let fieldModel = this.$parent.fieldModel;
|
|
770
|
+
if (this.$parent.fieldModelLabel)
|
|
771
|
+
fieldModel = this.$parent.fieldModelLabel();
|
|
772
|
+
let showValue = fieldModel;
|
|
773
|
+
if (widgetTextFlag == 2) {
|
|
774
|
+
showValue = this.getProcessText(showValue, this.encryptFormula);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
return showValue;
|
|
778
|
+
},
|
|
779
|
+
getWidgetClass() {
|
|
780
|
+
let list = [];
|
|
781
|
+
let optionModel = this.field.options.widgetTextLinkConfig?.options || {};
|
|
782
|
+
if (optionModel.colorClass) list.push(optionModel.colorClass);
|
|
783
|
+
if (optionModel.underline) list.push("underLine");
|
|
784
|
+
if (this.field.options.disabled) list.push("is-disabled");
|
|
785
|
+
return list;
|
|
786
|
+
},
|
|
787
|
+
handleClick(event) {
|
|
788
|
+
if (this.field.options.disabled) return;
|
|
789
|
+
this.$parent.handleButtonWidgetClick(event, true);
|
|
790
|
+
if (
|
|
791
|
+
!this.designState &&
|
|
792
|
+
this.field.options.widgetTextLinkConfig?.options.href
|
|
793
|
+
) {
|
|
794
|
+
window.open(this.field.options.widgetTextLinkConfig?.options.href);
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
getWidgetValue() {
|
|
798
|
+
let fieldModel = this.$parent.fieldModel;
|
|
799
|
+
if (this.$parent.fieldModelLabel)
|
|
800
|
+
fieldModel = this.$parent.fieldModelLabel();
|
|
801
|
+
return fieldModel;
|
|
802
|
+
},
|
|
803
|
+
},
|
|
804
|
+
};
|
|
805
|
+
</script>
|
|
806
|
+
|
|
807
|
+
<style lang="scss" scoped>
|
|
808
|
+
@import "~@/styles/global.scss";
|
|
809
|
+
|
|
810
|
+
.design-time-bottom-margin {
|
|
811
|
+
margin-bottom: 5px;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
.field-wrapper {
|
|
815
|
+
position: relative;
|
|
816
|
+
|
|
817
|
+
.field-action {
|
|
818
|
+
position: absolute;
|
|
819
|
+
//bottom: -24px;
|
|
820
|
+
bottom: 0;
|
|
821
|
+
right: -1px;
|
|
822
|
+
height: 22px;
|
|
823
|
+
line-height: 22px;
|
|
824
|
+
background: $--color-primary;
|
|
825
|
+
z-index: 9;
|
|
826
|
+
|
|
827
|
+
i {
|
|
828
|
+
font-size: 14px;
|
|
829
|
+
color: #fff;
|
|
830
|
+
margin: 0 5px;
|
|
831
|
+
cursor: pointer;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
.drag-handler {
|
|
836
|
+
position: absolute;
|
|
837
|
+
top: 0;
|
|
838
|
+
//bottom: -22px; /* 拖拽手柄位于组件下方,有时无法正常拖动,原因未明?? */
|
|
839
|
+
left: -1px;
|
|
840
|
+
height: 20px;
|
|
841
|
+
line-height: 18px;
|
|
842
|
+
//background: $--color-primary;
|
|
843
|
+
z-index: 9;
|
|
844
|
+
|
|
845
|
+
i {
|
|
846
|
+
font-size: 12px;
|
|
847
|
+
font-style: normal;
|
|
848
|
+
color: #fff;
|
|
849
|
+
margin: 4px;
|
|
850
|
+
cursor: move;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
&:hover {
|
|
854
|
+
//opacity: 1;
|
|
855
|
+
background: $--color-primary;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
.el-form-item {
|
|
861
|
+
//margin-bottom: 0 !important;
|
|
862
|
+
//margin-bottom: 6px;
|
|
863
|
+
|
|
864
|
+
//margin-top: 2px;
|
|
865
|
+
position: relative;
|
|
866
|
+
|
|
867
|
+
::v-deep .el-form-item__label {
|
|
868
|
+
white-space: nowrap;
|
|
869
|
+
text-overflow: ellipsis;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
::v-deep .el-form-item__content {
|
|
873
|
+
//position: unset; /* TODO: 忘了这个样式设置是为了解决什么问题?? */
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
span.custom-label i {
|
|
877
|
+
margin: 0 3px;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/* 隐藏Chrome浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
881
|
+
::v-deep .hide-spin-button input::-webkit-outer-spin-button,
|
|
882
|
+
::v-deep .hide-spin-button input::-webkit-inner-spin-button {
|
|
883
|
+
-webkit-appearance: none !important;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/* 隐藏Firefox浏览器中el-input数字输入框右侧的上下调整小箭头 */
|
|
887
|
+
::v-deep .hide-spin-button input[type="number"] {
|
|
888
|
+
-moz-appearance: textfield;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.required ::v-deep .el-form-item__label::before {
|
|
893
|
+
content: "*";
|
|
894
|
+
color: #f56c6c;
|
|
895
|
+
margin-right: 4px;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
.static-content-item {
|
|
899
|
+
min-height: 20px;
|
|
900
|
+
display: flex; /* 垂直居中 */
|
|
901
|
+
align-items: center; /* 垂直居中 */
|
|
902
|
+
|
|
903
|
+
::v-deep .el-divider--horizontal {
|
|
904
|
+
margin: 0;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
.el-form-item.selected,
|
|
909
|
+
.static-content-item.selected {
|
|
910
|
+
outline: 2px solid $--color-primary;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
::v-deep .label-left-align .el-form-item__label {
|
|
914
|
+
text-align: left;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
::v-deep .label-center-align .el-form-item__label {
|
|
918
|
+
text-align: center;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
::v-deep .label-right-align .el-form-item__label {
|
|
922
|
+
text-align: right;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
.a-link.is-disabled {
|
|
926
|
+
cursor: no-drop;
|
|
927
|
+
}
|
|
928
|
+
</style>
|