@dhccmobile/vue3-lo-form 2.1.2 → 2.1.3
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/README.md +4 -5
- package/dist/vue3-lo-form.common.js +27 -27
- package/dist/vue3-lo-form.common.js.map +1 -1
- package/dist/vue3-lo-form.css +1 -1
- package/dist/vue3-lo-form.umd.js +27 -27
- package/dist/vue3-lo-form.umd.js.map +1 -1
- package/dist/vue3-lo-form.umd.min.js +1 -1
- package/dist/vue3-lo-form.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/App.vue +115 -121
- package/src/UserInfoForm.vue +177 -0
- package/src/components/form/DvFormLayout.vue +1 -2
- package/src/components/index.js +4 -0
- package/src/components/index.js.map +1 -0
- package/src/constants/config/form-template.config.js +33 -0
- package/src/constants/config/form-template.config.js.map +1 -0
- package/src/constants/config/form.config.js +5 -0
- package/src/constants/config/form.config.js.map +1 -0
- package/src/constants/config/storage.config.js +5 -0
- package/src/constants/config/storage.config.js.map +1 -0
- package/src/constants/encode-assets/icons.js +2 -0
- package/src/constants/encode-assets/icons.js.map +1 -0
- package/src/constants/encode-assets/svg.js +8 -0
- package/src/constants/encode-assets/svg.js.map +1 -0
- package/src/constants/enum/builtIn-label.enum.js +6 -0
- package/src/constants/enum/builtIn-label.enum.js.map +1 -0
- package/src/constants/enum/cache-type.enum.js +8 -0
- package/src/constants/enum/cache-type.enum.js.map +1 -0
- package/src/constants/enum/control-format-type.enum.js +10 -0
- package/src/constants/enum/control-format-type.enum.js.map +1 -0
- package/src/constants/enum/dynamic-option-type.enum.js +7 -0
- package/src/constants/enum/dynamic-option-type.enum.js.map +1 -0
- package/src/constants/enum/form-bus-attr.enum.js +9 -0
- package/src/constants/enum/form-bus-attr.enum.js.map +1 -0
- package/src/constants/enum/form-field-class.enum.js +8 -0
- package/src/constants/enum/form-field-class.enum.js.map +1 -0
- package/src/constants/enum/form-field-type.enum.js +24 -0
- package/src/constants/enum/form-field-type.enum.js.map +1 -0
- package/src/constants/enum/form-type.enum.js +6 -0
- package/src/constants/enum/form-type.enum.js.map +1 -0
- package/src/constants/enum/index.js +20 -0
- package/src/constants/enum/index.js.map +1 -0
- package/src/constants/enum/lateral-arrangement.enum.js +10 -0
- package/src/constants/enum/lateral-arrangement.enum.js.map +1 -0
- package/src/constants/enum/money-unit.enum.js +7 -0
- package/src/constants/enum/money-unit.enum.js.map +1 -0
- package/src/constants/enum/option-type.enum.js +6 -0
- package/src/constants/enum/option-type.enum.js.map +1 -0
- package/src/constants/enum/submitted-type.enum.js +35 -0
- package/src/constants/enum/submitted-type.enum.js.map +1 -0
- package/src/constants/enum/support-upload-type.enum.js +6 -0
- package/src/constants/enum/support-upload-type.enum.js.map +1 -0
- package/src/constants/enum/switch.enum.js +6 -0
- package/src/constants/enum/switch.enum.js.map +1 -0
- package/src/constants/enum/upload-type.enum.js +18 -0
- package/src/constants/enum/upload-type.enum.js.map +1 -0
- package/src/constants/enum/validate-rules.enum.js +26 -0
- package/src/constants/enum/validate-rules.enum.js.map +1 -0
- package/src/constants/enum/validate-status.enum.js +9 -0
- package/src/constants/enum/validate-status.enum.js.map +1 -0
- package/src/constants/enum/vertical-arrangement.enum.js +8 -0
- package/src/constants/enum/vertical-arrangement.enum.js.map +1 -0
- package/src/constants/enum/zoom-type.js +7 -0
- package/src/constants/enum/zoom-type.js.map +1 -0
- package/src/constants/index.js +4 -0
- package/src/constants/index.js.map +1 -0
- package/src/core/FormApi.js +1241 -0
- package/src/core/FormApi.js.map +1 -0
- package/src/core/FormApi.ts +1 -1
- package/src/core/index.js +2 -0
- package/src/core/index.js.map +1 -0
- package/src/domain/AbstractControl.js +4 -0
- package/src/domain/AbstractControl.js.map +1 -0
- package/src/domain/Control.js +2 -0
- package/src/domain/Control.js.map +1 -0
- package/src/domain/CustomFormat.js +2 -0
- package/src/domain/CustomFormat.js.map +1 -0
- package/src/domain/DesForm.js +29 -0
- package/src/domain/DesForm.js.map +1 -0
- package/src/domain/DesFormControl.js +163 -0
- package/src/domain/DesFormControl.js.map +1 -0
- package/src/domain/DesFormLayout.js +33 -0
- package/src/domain/DesFormLayout.js.map +1 -0
- package/src/domain/FieldChangeHistory.js +2 -0
- package/src/domain/FieldChangeHistory.js.map +1 -0
- package/src/domain/FormConfig.js +2 -0
- package/src/domain/FormConfig.js.map +1 -0
- package/src/domain/FormControl.js +102 -0
- package/src/domain/FormControl.js.map +1 -0
- package/src/domain/FormEnum.js +2 -0
- package/src/domain/FormEnum.js.map +1 -0
- package/src/domain/FormGroup.js +38 -0
- package/src/domain/FormGroup.js.map +1 -0
- package/src/domain/FormRestfulResponse.js +2 -0
- package/src/domain/FormRestfulResponse.js.map +1 -0
- package/src/domain/ProvideInjectData.js +2 -0
- package/src/domain/ProvideInjectData.js.map +1 -0
- package/src/domain/SysDictDetail.js +25 -0
- package/src/domain/SysDictDetail.js.map +1 -0
- package/src/domain/SysDictInfo.js +25 -0
- package/src/domain/SysDictInfo.js.map +1 -0
- package/src/domain/SysDictTreeDetail.js +35 -0
- package/src/domain/SysDictTreeDetail.js.map +1 -0
- package/src/domain/index.js +13 -0
- package/src/domain/index.js.map +1 -0
- package/src/filtres/amount-capitalization.filter.js +150 -0
- package/src/filtres/amount-capitalization.filter.js.map +1 -0
- package/src/filtres/extract-options.filter.js +54 -0
- package/src/filtres/extract-options.filter.js.map +1 -0
- package/src/filtres/generate-grid-column-end.filter.js +18 -0
- package/src/filtres/generate-grid-column-end.filter.js.map +1 -0
- package/src/filtres/generate-grid-template-columns.filter.js +20 -0
- package/src/filtres/generate-grid-template-columns.filter.js.map +1 -0
- package/src/filtres/switch-enum-convert.filter.js +18 -0
- package/src/filtres/switch-enum-convert.filter.js.map +1 -0
- package/src/filtres/zoom-multiple.filter.js +31 -0
- package/src/filtres/zoom-multiple.filter.js.map +1 -0
- package/src/index.js +69 -0
- package/src/index.js.map +1 -0
- package/src/main.js +22 -0
- package/src/main.js.map +1 -0
- package/src/main.ts +2 -2
- package/src/services/api.service.js +74 -0
- package/src/services/api.service.js.map +1 -0
- package/src/services/clean-local-forage.service.js +53 -0
- package/src/services/clean-local-forage.service.js.map +1 -0
- package/src/services/date-format.service.js +76 -0
- package/src/services/date-format.service.js.map +1 -0
- package/src/services/dict-local-forage.service.js +53 -0
- package/src/services/dict-local-forage.service.js.map +1 -0
- package/src/services/form-bean-utils.service.js +39 -0
- package/src/services/form-bean-utils.service.js.map +1 -0
- package/src/services/form-local-forage.service.js +53 -0
- package/src/services/form-local-forage.service.js.map +1 -0
- package/src/services/form-tools.service.js +750 -0
- package/src/services/form-tools.service.js.map +1 -0
- package/src/services/form-tree-node-convert.service.js +174 -0
- package/src/services/form-tree-node-convert.service.js.map +1 -0
- package/src/services/form-validate.service.js +100 -0
- package/src/services/form-validate.service.js.map +1 -0
- package/src/services/index.js +10 -0
- package/src/services/index.js.map +1 -0
- package/src/services/router.service.js +94 -0
- package/src/services/router.service.js.map +1 -0
- package/src/services/validate-generator.service.js +688 -0
- package/src/services/validate-generator.service.js.map +1 -0
- package/src/store/dict.store.js +52 -0
- package/src/store/dict.store.js.map +1 -0
- package/src/store/form.store.js +26 -0
- package/src/store/form.store.js.map +1 -0
- package/src/store/index.js +3 -0
- package/src/store/index.js.map +1 -0
- package/src/styles/theme2.scss +1 -1
- package/src/types/formTheme.js +2 -0
- package/src/types/formTheme.js.map +1 -0
- package/src/types/formTheme.ts +8 -0
- package/src/types/vfForm.js +2 -0
- package/src/types/vfForm.js.map +1 -0
- package/types/core/FormApi.d.ts +1 -1
- package/types/types/formTheme.d.ts +8 -0
|
@@ -0,0 +1,1241 @@
|
|
|
1
|
+
import { FormGroup } from "@/domain";
|
|
2
|
+
import { FormControl } from "../domain/FormControl";
|
|
3
|
+
import DvForm from "../components/form/DvForm.vue";
|
|
4
|
+
import { FormFieldType, OptionType, SubmittedType, ValidateRules, ValidateStatus } from "../constants/enum";
|
|
5
|
+
// import moment from "moment";
|
|
6
|
+
import { ZoomType } from "@/constants";
|
|
7
|
+
import { extractOptions, storageOptions } from "@/filtres/extract-options.filter";
|
|
8
|
+
import { validateGeneratorService } from "../services/validate-generator.service";
|
|
9
|
+
import { formToolsService, formTreeNodeConvertService, formValidateService } from "@/services";
|
|
10
|
+
import { Vue } from "vue-property-decorator";
|
|
11
|
+
import dayjs from "dayjs";
|
|
12
|
+
import { dateFormat } from "@/services/date-format.service";
|
|
13
|
+
export var Attribute;
|
|
14
|
+
(function (Attribute) {
|
|
15
|
+
Attribute["IsHideControl"] = "isHideControl";
|
|
16
|
+
Attribute["IsRequiredValidate"] = "isRequiredValidate";
|
|
17
|
+
Attribute["FormFieldDescribe"] = "formFieldDescribe";
|
|
18
|
+
Attribute["FieldDefaultValue"] = "fieldDefaultValue";
|
|
19
|
+
Attribute["TitleWidth"] = "titleWidth";
|
|
20
|
+
Attribute["IsBoldTitle"] = "isBoldTitle";
|
|
21
|
+
Attribute["IsHideTitle"] = "isHideTitle";
|
|
22
|
+
Attribute["TitleColor"] = "titleColor";
|
|
23
|
+
Attribute["Placeholder"] = "placeholder";
|
|
24
|
+
Attribute["Tips"] = "tips";
|
|
25
|
+
Attribute["IsNotEdit"] = "isNotEdit";
|
|
26
|
+
Attribute["BindingPrefix"] = "bindingPrefix";
|
|
27
|
+
Attribute["BindingSuffix"] = "bindingSuffix";
|
|
28
|
+
Attribute["BuiltInFrontLabel"] = "builtInFrontLabel";
|
|
29
|
+
Attribute["BuiltInPostLabel"] = "builtInPostLabel";
|
|
30
|
+
Attribute["ControlWidth"] = "controlWidth";
|
|
31
|
+
Attribute["IsPasswordBox"] = "isPasswordBox";
|
|
32
|
+
Attribute["InitRowHeight"] = "initRowHeight";
|
|
33
|
+
Attribute["IsFixedRowHeight"] = "isFixedRowHeight";
|
|
34
|
+
Attribute["FormatType"] = "formatType";
|
|
35
|
+
Attribute["MinValue"] = "minValue";
|
|
36
|
+
Attribute["MaxValue"] = "maxValue";
|
|
37
|
+
Attribute["Step"] = "step";
|
|
38
|
+
Attribute["DecimalPlaces"] = "decimalPlaces";
|
|
39
|
+
Attribute["ThousandthPercentileFormat"] = "thousandthPercentileFormat";
|
|
40
|
+
Attribute["Unit"] = "unit";
|
|
41
|
+
Attribute["ZoomType"] = "zoomType";
|
|
42
|
+
Attribute["ZoomMultiple"] = "zoomMultiple";
|
|
43
|
+
Attribute["IsShowCapitalization"] = "isShowCapitalization";
|
|
44
|
+
Attribute["IsLineFeedDisplay"] = "isLineFeedDisplay";
|
|
45
|
+
Attribute["IsOptionType"] = "isOptionType";
|
|
46
|
+
Attribute["OptionConfig"] = "optionConfig";
|
|
47
|
+
Attribute["DateFormat"] = "dateFormat";
|
|
48
|
+
Attribute["TimeFormat"] = "timeFormat";
|
|
49
|
+
Attribute["IsSupportMultiple"] = "isSupportMultiple";
|
|
50
|
+
Attribute["MaxUploadNumber"] = "maxUploadNumber";
|
|
51
|
+
Attribute["LimitSize"] = "limitSize";
|
|
52
|
+
Attribute["SupportUploadType"] = "supportUploadType";
|
|
53
|
+
Attribute["CustomUploadType"] = "customUploadType";
|
|
54
|
+
Attribute["ExtendUploadType"] = "extendUploadType";
|
|
55
|
+
Attribute["AttachmentExtendProperties"] = "attachmentExtendProperties";
|
|
56
|
+
Attribute["IsMultipleChoice"] = "isMultipleChoice";
|
|
57
|
+
Attribute["IsSearchable"] = "isSearchable";
|
|
58
|
+
Attribute["CanAddEntry"] = "canAddEntry";
|
|
59
|
+
Attribute["IsClearButton"] = "isClearButton";
|
|
60
|
+
Attribute["OnOpeningValue"] = "onOpeningValue";
|
|
61
|
+
Attribute["WhenClosedValue"] = "whenClosedValue";
|
|
62
|
+
Attribute["OnOpeningText"] = "onOpeningText";
|
|
63
|
+
Attribute["WhenClosedText"] = "whenClosedText";
|
|
64
|
+
Attribute["CustomFieldName"] = "customFieldName";
|
|
65
|
+
Attribute["TextFold"] = "textFold";
|
|
66
|
+
Attribute["HiddenDropdown"] = "hiddenDropdown";
|
|
67
|
+
Attribute["BusAttr"] = "busAttr";
|
|
68
|
+
Attribute["EnableAutoComplete"] = "enableAutoComplete";
|
|
69
|
+
Attribute["AutoCompleteOptions"] = "autoCompleteOptions";
|
|
70
|
+
Attribute["IsTreeOpen"] = "isTreeOpen";
|
|
71
|
+
Attribute["CheckboxStyle"] = "checkboxStyle";
|
|
72
|
+
Attribute["ItemWidth"] = "itemWidth";
|
|
73
|
+
Attribute["ChangeOnSelect"] = "changeOnSelect";
|
|
74
|
+
Attribute["TextareaRows"] = "textareaRows";
|
|
75
|
+
Attribute["IsShowHoliday"] = "isShowHoliday";
|
|
76
|
+
})(Attribute || (Attribute = {}));
|
|
77
|
+
/**
|
|
78
|
+
* @description: 表单基础类,聚合常用api
|
|
79
|
+
* @author ChenRui
|
|
80
|
+
* @date 2020/11/28 23:27
|
|
81
|
+
*/
|
|
82
|
+
export class FormApi {
|
|
83
|
+
id; // api编号
|
|
84
|
+
dvForm; // form组件实例
|
|
85
|
+
edit; // 编辑状态
|
|
86
|
+
formatType; // 数据格式化模式
|
|
87
|
+
apiMetaRefresh; // api内部刷新标识
|
|
88
|
+
oldVal; // 修改前数据
|
|
89
|
+
srcData; // 表单原始数据
|
|
90
|
+
desParams; // 脱敏参数 包括【业务编号、业务对象类型、表单中文等】
|
|
91
|
+
/**
|
|
92
|
+
* @description: 获取表单对象
|
|
93
|
+
* @author ChenRui
|
|
94
|
+
* @date 2020/11/28 23:29
|
|
95
|
+
*/
|
|
96
|
+
constructor(options = {}) {
|
|
97
|
+
this.id = options.id || this.getUuid();
|
|
98
|
+
this.dvForm = options.dvForm || new Vue(DvForm);
|
|
99
|
+
this.edit = options.edit;
|
|
100
|
+
this.formatType = options.formatType || "default";
|
|
101
|
+
this.desParams = options.desParams || {}; // 脱敏所需参数
|
|
102
|
+
}
|
|
103
|
+
get mathjs() {
|
|
104
|
+
if (window.$app.config.globalProperties.$mathjs) {
|
|
105
|
+
return window.$app.config.globalProperties.$mathjs;
|
|
106
|
+
}
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @description: 获取表单值
|
|
111
|
+
* @author ChenRui
|
|
112
|
+
* @date 2021/2/4 10:36
|
|
113
|
+
*/
|
|
114
|
+
get formData() {
|
|
115
|
+
this.apiMetaRefresh = this.dvForm.metaRefresh;
|
|
116
|
+
if (this.dvForm.desForm && this.dvForm.desForm.formGroup) {
|
|
117
|
+
let obj = this.generateData(this.dvForm.desForm.formGroup);
|
|
118
|
+
if (this.oldVal) {
|
|
119
|
+
obj = this.contrast(this.oldVal, obj);
|
|
120
|
+
if (!Object.keys(obj).length) {
|
|
121
|
+
obj = null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// 追加表单中没有的字段 2026年5月13日 20:39:24 用于处理字段脱敏
|
|
125
|
+
if (this.srcData && obj) {
|
|
126
|
+
for (const key in this.srcData) {
|
|
127
|
+
// 把所有以Enc结尾的字段都追加到obj中,用于处理字段脱敏
|
|
128
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
129
|
+
if (key.endsWith("Enc") && !obj.hasOwnProperty(key)) {
|
|
130
|
+
obj[key] = this.srcData[key];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return obj;
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @Description 获取表单全部值
|
|
140
|
+
* @Author JiangTao
|
|
141
|
+
* @Date 2023-12-22 下午 02:50
|
|
142
|
+
*/
|
|
143
|
+
get formAllData() {
|
|
144
|
+
this.apiMetaRefresh = this.dvForm.metaRefresh;
|
|
145
|
+
if (this.dvForm.desForm && this.dvForm.desForm.formGroup) {
|
|
146
|
+
const obj = this.generateData(this.dvForm.desForm.formGroup);
|
|
147
|
+
return obj;
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* @description: 编码表单对象
|
|
153
|
+
* @author ChenRui
|
|
154
|
+
* @date 2021/4/25 16:41
|
|
155
|
+
*/
|
|
156
|
+
get encodedFormData() {
|
|
157
|
+
this.apiMetaRefresh = this.dvForm.metaRefresh;
|
|
158
|
+
if (this.dvForm.desForm && this.dvForm.desForm.formGroup) {
|
|
159
|
+
const data = this.generateData(this.dvForm.desForm.formGroup);
|
|
160
|
+
return this.jsonToFormData(data);
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @description: 设置表单值
|
|
166
|
+
* @author ChenRui
|
|
167
|
+
* @date 2021/2/4 10:37
|
|
168
|
+
*/
|
|
169
|
+
setFormData(srcData, isDefault = false, validate = false, oldVal) {
|
|
170
|
+
if (this.dvForm.desForm.formGroup) {
|
|
171
|
+
this.setFormDataInner(srcData, isDefault, validate);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
this.setFormDataInner(srcData, isDefault, validate);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (oldVal)
|
|
179
|
+
this.oldVal = oldVal;
|
|
180
|
+
this.srcData = srcData; // 记录赋值时的原始数据,这里面有非表单字段
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* @description: 获取控件对象
|
|
184
|
+
* @author ChenRui
|
|
185
|
+
* @date 2021/1/29 10:08
|
|
186
|
+
*/
|
|
187
|
+
getControl(key, control, showError = true) {
|
|
188
|
+
if (key) {
|
|
189
|
+
if (control == null) {
|
|
190
|
+
if (this.dvForm.desForm.formGroup) {
|
|
191
|
+
control = this.dvForm.desForm.formGroup.controls;
|
|
192
|
+
}
|
|
193
|
+
else if (showError) {
|
|
194
|
+
console.log("表单对象尚未初始化完成...");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (control && Object.keys(control).length > 0) {
|
|
198
|
+
for (const propName of Object.keys(control)) {
|
|
199
|
+
if (propName === key) {
|
|
200
|
+
return control[propName];
|
|
201
|
+
}
|
|
202
|
+
if (control[propName].controls && Object.keys(control[propName].controls).length > 0) {
|
|
203
|
+
const subControl = this.getControl(key, control[propName].controls);
|
|
204
|
+
if (subControl != null) {
|
|
205
|
+
return subControl;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @description: 获取值
|
|
215
|
+
* @author ChenRui
|
|
216
|
+
* @date 2021/1/29 14:57
|
|
217
|
+
*/
|
|
218
|
+
getValue(key) {
|
|
219
|
+
const control = this.getControl(key);
|
|
220
|
+
if (control) {
|
|
221
|
+
// && control instanceof FormControl
|
|
222
|
+
return this.decodeData(control, false);
|
|
223
|
+
}
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* @description: 设置值
|
|
228
|
+
* @author ChenRui
|
|
229
|
+
* @date 2021/1/29 16:23
|
|
230
|
+
*/
|
|
231
|
+
setValue(key, val, isDefault = false, validate = true) {
|
|
232
|
+
let control = this.getControl(key);
|
|
233
|
+
if (control == null) {
|
|
234
|
+
setTimeout(() => {
|
|
235
|
+
control = this.getControl(key);
|
|
236
|
+
this.setControlValue(control, key, val, isDefault, validate);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.setControlValue(control, key, val, isDefault, validate);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @description: 重置表单
|
|
245
|
+
* @author ChenRui
|
|
246
|
+
* @date 2021/2/22 17:40
|
|
247
|
+
*/
|
|
248
|
+
resetValue() {
|
|
249
|
+
this.dvForm.formatDesForm(true);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @description: 获取文本内容
|
|
253
|
+
* @author ChenRui
|
|
254
|
+
* @date 2021/1/29 15:03
|
|
255
|
+
*/
|
|
256
|
+
getText(key) {
|
|
257
|
+
const control = this.getControl(key);
|
|
258
|
+
if (control) {
|
|
259
|
+
//control && control instanceof FormControl
|
|
260
|
+
return control.text();
|
|
261
|
+
}
|
|
262
|
+
return "";
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @description: 获取可选项
|
|
266
|
+
* @author ChenRui
|
|
267
|
+
* @date 2021/1/29 16:11
|
|
268
|
+
*/
|
|
269
|
+
getOptions(key) {
|
|
270
|
+
const control = this.getControl(key);
|
|
271
|
+
if (control && control.controlAttr) {
|
|
272
|
+
//control && control instanceof FormControl && control.controlAttr
|
|
273
|
+
return extractOptions(control.controlAttr);
|
|
274
|
+
}
|
|
275
|
+
return [];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* @description: 设置可选项
|
|
279
|
+
* @author ChenRui
|
|
280
|
+
* @date 2021/1/29 16:15
|
|
281
|
+
*/
|
|
282
|
+
setOptions(key, data, defaultVal) {
|
|
283
|
+
let control = this.getControl(key);
|
|
284
|
+
if (control == null) {
|
|
285
|
+
setTimeout(() => {
|
|
286
|
+
control = this.getControl(key);
|
|
287
|
+
this.setControlOptions(control, key, data, defaultVal);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
this.setControlOptions(control, key, data, defaultVal);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* @description: 获取常规属性
|
|
296
|
+
* @author ChenRui
|
|
297
|
+
* @date 2021/1/29 17:21
|
|
298
|
+
*/
|
|
299
|
+
getAttribute(key, attribute) {
|
|
300
|
+
const control = this.getControl(key);
|
|
301
|
+
if (control && control.controlAttr) {
|
|
302
|
+
//control && control instanceof FormControl && control.controlAttr
|
|
303
|
+
return control.controlAttr[attribute];
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* @description: 设置常规属性
|
|
308
|
+
* @author ChenRui
|
|
309
|
+
* @date 2021/1/29 17:21
|
|
310
|
+
*/
|
|
311
|
+
setAttribute(key, attribute, data) {
|
|
312
|
+
let control = this.getControl(key);
|
|
313
|
+
if (control == null) {
|
|
314
|
+
setTimeout(() => {
|
|
315
|
+
control = this.getControl(key);
|
|
316
|
+
this.setControlAttribute(control, attribute, data);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
this.setControlAttribute(control, attribute, data);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @description: 根据name获取校验
|
|
325
|
+
* @author ChenRui
|
|
326
|
+
* @date 2021/1/30 11:46
|
|
327
|
+
*/
|
|
328
|
+
getValidate(key, name) {
|
|
329
|
+
const control = this.getControl(key);
|
|
330
|
+
if (control) {
|
|
331
|
+
//control && control instanceof FormControl
|
|
332
|
+
return control.getValidate(name);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* @description: 移除校验
|
|
337
|
+
* @author ChenRui
|
|
338
|
+
* @date 2021/4/1 21:30
|
|
339
|
+
*/
|
|
340
|
+
removeValidate(key, validateName) {
|
|
341
|
+
const control = this.getControl(key);
|
|
342
|
+
if (control) {
|
|
343
|
+
//control && control instanceof FormControl
|
|
344
|
+
const validates = control.validates;
|
|
345
|
+
if (validates && validates.length > 0) {
|
|
346
|
+
const index = validates.findIndex((item) => item.name === validateName);
|
|
347
|
+
if (index !== -1) {
|
|
348
|
+
validates.splice(index, 1);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* @description: 移除所有校验
|
|
355
|
+
* @author ChenRui
|
|
356
|
+
* @date 2021/4/1 21:48
|
|
357
|
+
*/
|
|
358
|
+
removeAllValidates(key) {
|
|
359
|
+
const control = this.getControl(key);
|
|
360
|
+
if (control) {
|
|
361
|
+
//control && control instanceof FormControl
|
|
362
|
+
control.validates = [];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* @description: 获取校验集合
|
|
367
|
+
* @author ChenRui
|
|
368
|
+
* @date 2021/1/30 11:40
|
|
369
|
+
*/
|
|
370
|
+
getValidates(key) {
|
|
371
|
+
const control = this.getControl(key);
|
|
372
|
+
if (control) {
|
|
373
|
+
//control && control instanceof FormControl
|
|
374
|
+
return control.validates;
|
|
375
|
+
}
|
|
376
|
+
return [];
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* @Description: 设置必输校验
|
|
380
|
+
* @author GuoXuHui
|
|
381
|
+
* @date 2022-05-25
|
|
382
|
+
* @time 10:09
|
|
383
|
+
*/
|
|
384
|
+
setRequiredValidate(key, data) {
|
|
385
|
+
if (data) {
|
|
386
|
+
this.setValidate(key, { ruleType: ValidateRules.Required.code });
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
this.removeValidate(key, ValidateRules.Required.code); // 清除必填校验
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* @description: 设置校验
|
|
394
|
+
* @author ChenRui
|
|
395
|
+
* @date 2021/1/30 11:54
|
|
396
|
+
*/
|
|
397
|
+
setValidate(key, validate, isCover = false) {
|
|
398
|
+
let control = this.getControl(key);
|
|
399
|
+
if (control == null) {
|
|
400
|
+
setTimeout(() => {
|
|
401
|
+
control = this.getControl(key);
|
|
402
|
+
if (control) {
|
|
403
|
+
//control && control instanceof FormControl
|
|
404
|
+
this.setValidateInner(control, validate, isCover);
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
this.setValidateInner(control, validate, isCover);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* @description: 校验提示
|
|
414
|
+
* @author ChenRui
|
|
415
|
+
* @date 2021/8/18 17:40
|
|
416
|
+
*/
|
|
417
|
+
validateTips(scrollView) {
|
|
418
|
+
return formValidateService.validateTips(this, scrollView);
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* @description: 全局校验报告
|
|
422
|
+
* @author ChenRui
|
|
423
|
+
* @date 2021/2/5 11:48
|
|
424
|
+
*/
|
|
425
|
+
validateReport(formGroup, validateReports, refreshFeedback = true) {
|
|
426
|
+
if (validateReports == null) {
|
|
427
|
+
validateReports = [];
|
|
428
|
+
}
|
|
429
|
+
if (formGroup == null) {
|
|
430
|
+
formGroup = this.dvForm.desForm.formGroup;
|
|
431
|
+
if (refreshFeedback) {
|
|
432
|
+
this.dvForm.refreshCheckFeedbackFlag = new Date().getTime();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (formGroup != null) {
|
|
436
|
+
for (const propName of Object.keys(formGroup.controls)) {
|
|
437
|
+
if (formGroup.controls[propName] instanceof FormGroup) {
|
|
438
|
+
this.validateReport(formGroup.controls[propName], validateReports);
|
|
439
|
+
}
|
|
440
|
+
else if (formGroup.controls[propName] instanceof FormControl && !formGroup.controls[propName].controlAttr.isHideControl) {
|
|
441
|
+
const validateResult = formGroup.controls[propName].validate();
|
|
442
|
+
if (validateResult.validateStatus === ValidateStatus.Error.code) {
|
|
443
|
+
validateReports.push({
|
|
444
|
+
key: formGroup.controls[propName].key,
|
|
445
|
+
name: formGroup.controls[propName].controlAttr.formFieldDescribe,
|
|
446
|
+
errorMsg: validateResult.errorMsg,
|
|
447
|
+
controlType: formGroup.controls[propName].controlAttr.controlType,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return validateReports;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @description: 表单全局校验
|
|
457
|
+
* @author ChenRui
|
|
458
|
+
* @date 2021/2/5 14:11
|
|
459
|
+
*/
|
|
460
|
+
validate(refreshFeedback = true) {
|
|
461
|
+
const validateReports = this.validateReport(undefined, undefined, refreshFeedback);
|
|
462
|
+
return !(validateReports.length > 0);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* @description: 刷新校验
|
|
466
|
+
* @author ChenRui
|
|
467
|
+
* @date 2021/6/4 19:32
|
|
468
|
+
*/
|
|
469
|
+
refreshValidate(key) {
|
|
470
|
+
let control = this.getControl(key);
|
|
471
|
+
if (control == null) {
|
|
472
|
+
setTimeout(() => {
|
|
473
|
+
control = this.getControl(key);
|
|
474
|
+
control["refreshValidate"] = new Date().getTime();
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
control["refreshValidate"] = new Date().getTime();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* @description: 重置表单校验
|
|
483
|
+
* @author ChenRui
|
|
484
|
+
* @date 2022/4/6 11:51
|
|
485
|
+
*/
|
|
486
|
+
resetFormValidateState() {
|
|
487
|
+
this.dvForm.formValidateStateResetMark = new Date().getTime();
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* @description: 设置格式化显示和输出函数
|
|
491
|
+
* @author ChenRui
|
|
492
|
+
* @date 2021/2/4 19:44
|
|
493
|
+
*/
|
|
494
|
+
setFormatDisplayAndOutput(key, customFormat) {
|
|
495
|
+
if (key) {
|
|
496
|
+
this.dvForm.customFormats[key] = customFormat;
|
|
497
|
+
}
|
|
498
|
+
this.refreshAndUpdateData();
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @description: 刷新数据
|
|
502
|
+
* @author ChenRui
|
|
503
|
+
* @date 2021/2/4 20:22
|
|
504
|
+
*/
|
|
505
|
+
refreshAndUpdateData() {
|
|
506
|
+
this.dvForm.onRefreshArgumentsHandler(new Date().getTime());
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* @description: 获取控件dom对象
|
|
510
|
+
* @author ChenRui
|
|
511
|
+
* @date 2021/2/26 17:12
|
|
512
|
+
*/
|
|
513
|
+
getControlEl(key) {
|
|
514
|
+
const control = this.getControl(key);
|
|
515
|
+
if (control != null && control.controlAttr) {
|
|
516
|
+
const els = document.getElementsByClassName("form-model-item-" + control.controlAttr.boundProperty);
|
|
517
|
+
if (els != null && els.length > 0) {
|
|
518
|
+
return els[0];
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* @description: 检查是否包含上传控件
|
|
525
|
+
* @author ChenRui
|
|
526
|
+
* @date 2021/4/23 11:30
|
|
527
|
+
*/
|
|
528
|
+
checkHasUploadControl(abstractControl) {
|
|
529
|
+
if (abstractControl instanceof FormGroup) {
|
|
530
|
+
const formGroup = abstractControl;
|
|
531
|
+
for (const propName of Object.keys(formGroup.controls)) {
|
|
532
|
+
if (formGroup.controls[propName] instanceof FormGroup) {
|
|
533
|
+
const judge = this.checkHasUploadControl(formGroup.controls[propName]);
|
|
534
|
+
if (judge) {
|
|
535
|
+
return judge;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
else if (formGroup.controls[propName] instanceof FormControl) {
|
|
539
|
+
if (formGroup.controls[propName].code === FormFieldType.Upload.code) {
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return false;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* @description: json格式转表单格式
|
|
549
|
+
* @author ChenRui
|
|
550
|
+
* @date 2020/8/28 15:20
|
|
551
|
+
*/
|
|
552
|
+
jsonToFormData(params) {
|
|
553
|
+
const formData = new FormData();
|
|
554
|
+
if (params != null) {
|
|
555
|
+
Object.keys(params).forEach((key) => {
|
|
556
|
+
if (params[key] != null && params[key] instanceof Array && params[key].length > 0 && params[key][0] instanceof File) {
|
|
557
|
+
params[key].forEach((item) => {
|
|
558
|
+
formData.append(key, item);
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
formData.append(key, params[key]);
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
return formData;
|
|
566
|
+
}
|
|
567
|
+
return formData;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* @description: 设置变更历史记录
|
|
571
|
+
* @author ChenRui
|
|
572
|
+
* @date 2021/4/25 15:55
|
|
573
|
+
*/
|
|
574
|
+
setFieldChangeHistory(fieldChangeHistory) {
|
|
575
|
+
fieldChangeHistory = fieldChangeHistory || {};
|
|
576
|
+
for (const propertyName of Object.keys(fieldChangeHistory)) {
|
|
577
|
+
let control = this.getControl(propertyName, undefined, false);
|
|
578
|
+
if (control == null) {
|
|
579
|
+
setTimeout(() => {
|
|
580
|
+
control = this.getControl(propertyName, undefined, false);
|
|
581
|
+
if (control) {
|
|
582
|
+
//control && control instanceof FormControl
|
|
583
|
+
const history = (fieldChangeHistory[propertyName] || []).sort((a, b) => {
|
|
584
|
+
const aTime = new Date(a.time).getTime();
|
|
585
|
+
const bTime = new Date(b.time).getTime();
|
|
586
|
+
return bTime - aTime;
|
|
587
|
+
});
|
|
588
|
+
control.history = history;
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
control = this.getControl(propertyName, undefined, false);
|
|
594
|
+
if (control) {
|
|
595
|
+
//control && control instanceof FormControl
|
|
596
|
+
const history = (fieldChangeHistory[propertyName] || []).sort((a, b) => {
|
|
597
|
+
const aTime = new Date(a.time).getTime();
|
|
598
|
+
const bTime = new Date(b.time).getTime();
|
|
599
|
+
return bTime - aTime;
|
|
600
|
+
});
|
|
601
|
+
control.history = history;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* @description: 隐藏布局
|
|
608
|
+
* @author ChenRui
|
|
609
|
+
* @date 2021/11/16 0:01
|
|
610
|
+
*/
|
|
611
|
+
hideLayout(layoutName, mark = true) {
|
|
612
|
+
if (layoutName) {
|
|
613
|
+
const nodes = document.getElementsByClassName("lo-form-layout-" + layoutName);
|
|
614
|
+
if (nodes && nodes.length > 0) {
|
|
615
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
616
|
+
nodes[i].style.display = mark ? "none" : "grid";
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* @description: 设置表单值
|
|
623
|
+
* @author ChenRui
|
|
624
|
+
* @date 2021/8/16 9:29
|
|
625
|
+
*/
|
|
626
|
+
setFormDataInner(srcData, isDefault, validate) {
|
|
627
|
+
if (srcData) {
|
|
628
|
+
for (const propName of Object.keys(srcData)) {
|
|
629
|
+
if (typeof srcData[propName] === "string" || typeof srcData[propName] === "number") {
|
|
630
|
+
this.setValue(propName, srcData[propName], isDefault, false);
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
this.setFormData(srcData[propName], isDefault, validate);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
if (validate) {
|
|
638
|
+
this.validate();
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* @description: 设置控件值
|
|
643
|
+
* @author ChenRui
|
|
644
|
+
* @date 2021/4/13 12:50
|
|
645
|
+
*/
|
|
646
|
+
setControlValue(control, key, val, isDefault, validate = true) {
|
|
647
|
+
if (control) {
|
|
648
|
+
// && control instanceof FormControl
|
|
649
|
+
switch (control.code) {
|
|
650
|
+
case FormFieldType.InputNumber.code:
|
|
651
|
+
if (val && control.controlAttr.zoomMultiple) {
|
|
652
|
+
if (control.controlAttr.zoomType === ZoomType.enlarge.code) {
|
|
653
|
+
val = this.mathjs.format(this.mathjs.evaluate(`${val} / ${control.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
654
|
+
}
|
|
655
|
+
else if (control.controlAttr.zoomType === ZoomType.narrow.code) {
|
|
656
|
+
val = this.mathjs.format(this.mathjs.evaluate(`${val} * ${control.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (val != undefined) {
|
|
660
|
+
control.value = val;
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
control.value = "";
|
|
664
|
+
}
|
|
665
|
+
break;
|
|
666
|
+
case FormFieldType.Select.code:
|
|
667
|
+
if (control.controlAttr.isMultipleChoice) {
|
|
668
|
+
if (!val) {
|
|
669
|
+
val = [];
|
|
670
|
+
}
|
|
671
|
+
else if (typeof val === "string") {
|
|
672
|
+
val = val.split(",");
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
control.value = val;
|
|
676
|
+
break;
|
|
677
|
+
case FormFieldType.Checkbox.code:
|
|
678
|
+
case FormFieldType.Cascader.code:
|
|
679
|
+
if (val) {
|
|
680
|
+
val = val.split(",");
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
val = [];
|
|
684
|
+
}
|
|
685
|
+
control.value = val;
|
|
686
|
+
break;
|
|
687
|
+
case FormFieldType.Switch.code:
|
|
688
|
+
if (control.controlAttr.onOpeningValue) {
|
|
689
|
+
val = val === true || val === control.controlAttr.onOpeningValue;
|
|
690
|
+
}
|
|
691
|
+
else if (control.controlAttr.whenClosedValue) {
|
|
692
|
+
val = !(val === false || val === control.controlAttr.whenClosedValue);
|
|
693
|
+
}
|
|
694
|
+
control.value = val;
|
|
695
|
+
break;
|
|
696
|
+
case FormFieldType.TimePicker.code:
|
|
697
|
+
if (val) {
|
|
698
|
+
if (typeof val === "string") {
|
|
699
|
+
val = dayjs(new Date(this.nowDateStr() + " " + val));
|
|
700
|
+
}
|
|
701
|
+
else if (val instanceof Date) {
|
|
702
|
+
val = dayjs(val);
|
|
703
|
+
}
|
|
704
|
+
control.value = val;
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
control.value = null;
|
|
708
|
+
}
|
|
709
|
+
break;
|
|
710
|
+
case FormFieldType.DatePicker.code:
|
|
711
|
+
if (val) {
|
|
712
|
+
if (typeof val === "string") {
|
|
713
|
+
val = dayjs(val, control.dateFormat);
|
|
714
|
+
}
|
|
715
|
+
else if (val instanceof Date) {
|
|
716
|
+
val = dayjs(val);
|
|
717
|
+
}
|
|
718
|
+
control.value = val;
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
control.value = null;
|
|
722
|
+
}
|
|
723
|
+
break;
|
|
724
|
+
default: {
|
|
725
|
+
control.value = val;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (isDefault) {
|
|
729
|
+
this.setAttribute(key, Attribute.FieldDefaultValue, JSON.stringify(control.value));
|
|
730
|
+
}
|
|
731
|
+
if (validate) {
|
|
732
|
+
control["refreshValidate"] = new Date().getTime();
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* @description: 设置控件可选项
|
|
738
|
+
* @author ChenRui
|
|
739
|
+
* @date 2021/4/13 15:09
|
|
740
|
+
*/
|
|
741
|
+
setControlOptions(control, key, data, defaultVal) {
|
|
742
|
+
if (control && control.controlAttr) {
|
|
743
|
+
//control && control instanceof FormControl && control.controlAttr)
|
|
744
|
+
storageOptions(control.controlAttr, data);
|
|
745
|
+
this.setAttribute(key, Attribute.IsOptionType, OptionType.Fixed.code);
|
|
746
|
+
this.setAttribute(key, Attribute.OptionConfig, data);
|
|
747
|
+
}
|
|
748
|
+
if (defaultVal) {
|
|
749
|
+
this.setValue(key, defaultVal, true);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* @description: 设置控件常规属性
|
|
754
|
+
* @author ChenRui
|
|
755
|
+
* @date 2021/4/13 15:11
|
|
756
|
+
*/
|
|
757
|
+
setControlAttribute(control, attribute, data) {
|
|
758
|
+
if (control && attribute) {
|
|
759
|
+
//control && control instanceof FormControl && attribute
|
|
760
|
+
control.controlAttr[attribute] = data;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* @description: 设置校验内部函数
|
|
765
|
+
* @author ChenRui
|
|
766
|
+
* @date 2021/7/19 17:51
|
|
767
|
+
*/
|
|
768
|
+
setValidateInner(control, validate, isCover = false) {
|
|
769
|
+
if (validate != null && validate.ruleType) {
|
|
770
|
+
validate = validateGeneratorService.getBuiltInValidationRules(validate, control.controlAttr);
|
|
771
|
+
}
|
|
772
|
+
if (validate != null) {
|
|
773
|
+
if (isCover) {
|
|
774
|
+
control.validates = [];
|
|
775
|
+
}
|
|
776
|
+
control.addValidate(validate);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* @description: 生成数据信息
|
|
781
|
+
* @author ChenRui
|
|
782
|
+
* @date 2021/1/29 10:06
|
|
783
|
+
*/
|
|
784
|
+
generateData(abstractControl, obj = {}) {
|
|
785
|
+
if (abstractControl instanceof FormGroup) {
|
|
786
|
+
const formGroup = abstractControl;
|
|
787
|
+
for (const propName of Object.keys(formGroup.controls)) {
|
|
788
|
+
if (formGroup.controls[propName] instanceof FormGroup) {
|
|
789
|
+
obj[propName] = this.generateData(formGroup.controls[propName], obj[propName]);
|
|
790
|
+
}
|
|
791
|
+
else if (formGroup.controls[propName] instanceof FormControl) {
|
|
792
|
+
obj[propName] = this.decodeData(formGroup.controls[propName]);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
return obj;
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* @description: 数据解码输出
|
|
800
|
+
* @author ChenRui
|
|
801
|
+
* @date 2021/5/29 23:03
|
|
802
|
+
*/
|
|
803
|
+
decodeData(formControl, isFinal = true) {
|
|
804
|
+
let data = formControl.value || "";
|
|
805
|
+
switch (formControl.code) {
|
|
806
|
+
case FormFieldType.InputNumber.code:
|
|
807
|
+
if (data && formControl.controlAttr.zoomMultiple) {
|
|
808
|
+
if (formControl.controlAttr.zoomType === ZoomType.enlarge.code) {
|
|
809
|
+
data = this.mathjs.format(this.mathjs.evaluate(`${data} * ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
810
|
+
}
|
|
811
|
+
else if (formControl.controlAttr.zoomType === ZoomType.narrow.code) {
|
|
812
|
+
data = this.mathjs.format(this.mathjs.evaluate(`${data} / ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
813
|
+
}
|
|
814
|
+
else if (formControl.controlAttr.zoomType === ZoomType.automatic.code) {
|
|
815
|
+
data = this.mathjs.format(this.mathjs.evaluate(`${data} * ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
if (formControl.value === 0) {
|
|
819
|
+
data = 0;
|
|
820
|
+
}
|
|
821
|
+
break;
|
|
822
|
+
case FormFieldType.Select.code:
|
|
823
|
+
if (formControl.controlAttr.isMultipleChoice && data && Array.isArray(data)) {
|
|
824
|
+
data = data.join(",");
|
|
825
|
+
}
|
|
826
|
+
break;
|
|
827
|
+
case FormFieldType.Checkbox.code:
|
|
828
|
+
if (data && isFinal) {
|
|
829
|
+
data = data.join(",");
|
|
830
|
+
}
|
|
831
|
+
break;
|
|
832
|
+
case FormFieldType.TimePicker.code:
|
|
833
|
+
if (data) {
|
|
834
|
+
data = dayjs(data).format(formControl.controlAttr.timeFormat || "LTS");
|
|
835
|
+
}
|
|
836
|
+
break;
|
|
837
|
+
case FormFieldType.DatePicker.code:
|
|
838
|
+
if (data) {
|
|
839
|
+
data = dayjs(data).format(formControl.controlAttr.dateFormat || "YYYY-MM-DD");
|
|
840
|
+
}
|
|
841
|
+
break;
|
|
842
|
+
case FormFieldType.Cascader.code:
|
|
843
|
+
if (data) {
|
|
844
|
+
data = data.join(",");
|
|
845
|
+
}
|
|
846
|
+
break;
|
|
847
|
+
case FormFieldType.Switch.code:
|
|
848
|
+
data = !!data;
|
|
849
|
+
if (formControl.controlAttr) {
|
|
850
|
+
if (data === true && formControl.controlAttr.onOpeningValue != undefined && formControl.controlAttr.onOpeningValue !== "") {
|
|
851
|
+
data = formControl.controlAttr.onOpeningValue;
|
|
852
|
+
}
|
|
853
|
+
else if (data === false && formControl.controlAttr.whenClosedValue != undefined && formControl.controlAttr.whenClosedValue !== "") {
|
|
854
|
+
data = formControl.controlAttr.whenClosedValue;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
break;
|
|
858
|
+
case FormFieldType.Custom.code:
|
|
859
|
+
if (formControl.controlAttr && formControl.controlAttr.customFieldName) {
|
|
860
|
+
const customFormat = this.dvForm.customFormats[formControl.controlAttr.customFieldName];
|
|
861
|
+
if (customFormat && customFormat.output) {
|
|
862
|
+
data = customFormat.output(data, formControl.controlAttr);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return data;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* @description: 获取当前日期字符串
|
|
870
|
+
* @author ChenRui
|
|
871
|
+
* @date 2021/2/4 11:43
|
|
872
|
+
*/
|
|
873
|
+
nowDateStr() {
|
|
874
|
+
const time = new Date();
|
|
875
|
+
const day = ("0" + time.getDate()).slice(-2);
|
|
876
|
+
const month = ("0" + (time.getMonth() + 1)).slice(-2);
|
|
877
|
+
return time.getFullYear() + "/" + month + "/" + day;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* @description: uuid生成器
|
|
881
|
+
* @author ChenRui
|
|
882
|
+
* @date 2021/7/20 11:14
|
|
883
|
+
*/
|
|
884
|
+
getUuid() {
|
|
885
|
+
const s = [];
|
|
886
|
+
const hexDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
887
|
+
for (let i = 0; i < 36; i++) {
|
|
888
|
+
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
889
|
+
}
|
|
890
|
+
s[14] = "4";
|
|
891
|
+
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
|
|
892
|
+
s[8] = s[13] = s[18] = s[23] = "-";
|
|
893
|
+
const uuid = s.join("");
|
|
894
|
+
return uuid;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* @Description: 对比新旧表单值
|
|
898
|
+
* @author lzs
|
|
899
|
+
* @date 2022/9/3
|
|
900
|
+
* @time 21:49
|
|
901
|
+
*/
|
|
902
|
+
contrast(objectA, objectB) {
|
|
903
|
+
const object = {};
|
|
904
|
+
const data = {};
|
|
905
|
+
const fieldInfoArr = [];
|
|
906
|
+
if (!objectB || !objectA) {
|
|
907
|
+
object.changeLog = "必传参数不存在";
|
|
908
|
+
return object;
|
|
909
|
+
}
|
|
910
|
+
const handlerFlag = objectA.handlerFlag;
|
|
911
|
+
// console.log("======", this.dvForm.desForm.formGroup.controls);
|
|
912
|
+
for (const key in this.dvForm.desForm.formGroup.controls) {
|
|
913
|
+
if (!objectA[key] && !objectB[key]) {
|
|
914
|
+
continue;
|
|
915
|
+
}
|
|
916
|
+
const control = this.getControl(key);
|
|
917
|
+
if (!control) {
|
|
918
|
+
continue;
|
|
919
|
+
}
|
|
920
|
+
if (this.getChangedInfo(control, objectA[key], objectB[key])) {
|
|
921
|
+
let oldValue = objectA[key]; // 记录新值
|
|
922
|
+
const newValue = objectB[key]; // 记录旧值
|
|
923
|
+
const fieldInfo = {}; //日志信息
|
|
924
|
+
if (control.code !== FormFieldType.Custom.code) {
|
|
925
|
+
fieldInfo.field_cd = key; //字段英文
|
|
926
|
+
const name = control.controlAttr.formFieldDescribe;
|
|
927
|
+
fieldInfo.field_nm = name; //字段中文
|
|
928
|
+
fieldInfo.field_key = newValue; //当前值
|
|
929
|
+
const newDict = this.translateDictionaries(control, key, newValue); // 新值描述
|
|
930
|
+
fieldInfo.field_value = newDict; //当前值描述
|
|
931
|
+
fieldInfo.is_change = "1"; //是否变动
|
|
932
|
+
fieldInfo.field_old_key = oldValue; //旧值
|
|
933
|
+
const oldDict = this.translateDictionaries(control, key, oldValue); //旧值描述
|
|
934
|
+
fieldInfo.field_old_value = oldDict; //field_old_value
|
|
935
|
+
object[key] = newValue;
|
|
936
|
+
fieldInfoArr.push(fieldInfo);
|
|
937
|
+
if (oldValue === "null" || oldValue === "undefined") {
|
|
938
|
+
oldValue = "";
|
|
939
|
+
}
|
|
940
|
+
const oldName = oldValue ? oldDict : "空";
|
|
941
|
+
const newName = newValue ? newDict : "空";
|
|
942
|
+
//除自定义组件均记录日志
|
|
943
|
+
object.changeLog = object.changeLog ? object.changeLog + "," : "";
|
|
944
|
+
if (handlerFlag === "add") {
|
|
945
|
+
object.changeLog = object.changeLog + "新增【" + name + "】" + "为“" + newName + "”";
|
|
946
|
+
}
|
|
947
|
+
else {
|
|
948
|
+
object.changeLog = object.changeLog + "修改【" + name + "】" + "由“" + oldName + "”修改为“" + newName + "”";
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
object[key] = newValue;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
object.fieldInfoArr = fieldInfoArr;
|
|
957
|
+
return object;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* @Description: 获取表单值更改信息
|
|
961
|
+
* @author lzs
|
|
962
|
+
* @date 2022/10/11
|
|
963
|
+
* @time 09:53
|
|
964
|
+
*/
|
|
965
|
+
getChangedInfo(control, oldValue, newValue) {
|
|
966
|
+
oldValue = oldValue + "";
|
|
967
|
+
newValue = newValue + "";
|
|
968
|
+
if (oldValue === "null" || oldValue === "undefined") {
|
|
969
|
+
return true;
|
|
970
|
+
}
|
|
971
|
+
let flag = true;
|
|
972
|
+
switch (control.code) {
|
|
973
|
+
case FormFieldType.Input.code:
|
|
974
|
+
if (oldValue === newValue)
|
|
975
|
+
flag = false;
|
|
976
|
+
break;
|
|
977
|
+
case FormFieldType.InputNumber.code:
|
|
978
|
+
if (oldValue === newValue)
|
|
979
|
+
flag = false;
|
|
980
|
+
break;
|
|
981
|
+
case FormFieldType.Textarea.code:
|
|
982
|
+
if (oldValue === newValue)
|
|
983
|
+
flag = false;
|
|
984
|
+
break;
|
|
985
|
+
case FormFieldType.Slider.code:
|
|
986
|
+
if (oldValue === newValue)
|
|
987
|
+
flag = false;
|
|
988
|
+
break;
|
|
989
|
+
case FormFieldType.Rate.code:
|
|
990
|
+
if (oldValue === newValue)
|
|
991
|
+
flag = false;
|
|
992
|
+
break;
|
|
993
|
+
case FormFieldType.Select.code:
|
|
994
|
+
if (oldValue === newValue)
|
|
995
|
+
flag = false;
|
|
996
|
+
break;
|
|
997
|
+
case FormFieldType.Checkbox.code:
|
|
998
|
+
if (oldValue === newValue)
|
|
999
|
+
flag = false;
|
|
1000
|
+
break;
|
|
1001
|
+
case FormFieldType.Radio.code:
|
|
1002
|
+
if (oldValue === newValue)
|
|
1003
|
+
flag = false;
|
|
1004
|
+
break;
|
|
1005
|
+
case FormFieldType.TimePicker.code:
|
|
1006
|
+
if (oldValue === newValue)
|
|
1007
|
+
flag = false;
|
|
1008
|
+
break;
|
|
1009
|
+
case FormFieldType.DatePicker.code:
|
|
1010
|
+
oldValue = dateFormat.formatDateTime(oldValue, "YYYY-MM-dd");
|
|
1011
|
+
newValue = dateFormat.formatDateTime(newValue, "YYYY-MM-dd");
|
|
1012
|
+
if (oldValue === newValue)
|
|
1013
|
+
flag = false;
|
|
1014
|
+
break;
|
|
1015
|
+
case FormFieldType.Cascader.code:
|
|
1016
|
+
if (oldValue === newValue)
|
|
1017
|
+
flag = false;
|
|
1018
|
+
break;
|
|
1019
|
+
case FormFieldType.TreeSelect.code:
|
|
1020
|
+
if (oldValue === newValue)
|
|
1021
|
+
flag = false;
|
|
1022
|
+
break;
|
|
1023
|
+
case FormFieldType.Switch.code:
|
|
1024
|
+
if (oldValue === newValue)
|
|
1025
|
+
flag = false;
|
|
1026
|
+
break;
|
|
1027
|
+
case FormFieldType.Custom.code:
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
return flag;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* @Description: 翻译字典项
|
|
1034
|
+
* @author lzs
|
|
1035
|
+
* @date 2022/9/6
|
|
1036
|
+
* @time 11:54
|
|
1037
|
+
*/
|
|
1038
|
+
translateDictionaries(control, key, value) {
|
|
1039
|
+
let str = value;
|
|
1040
|
+
switch (control.code) {
|
|
1041
|
+
case FormFieldType.Input.code:
|
|
1042
|
+
break;
|
|
1043
|
+
case FormFieldType.InputNumber.code:
|
|
1044
|
+
break;
|
|
1045
|
+
case FormFieldType.Textarea.code:
|
|
1046
|
+
break;
|
|
1047
|
+
case FormFieldType.Slider.code:
|
|
1048
|
+
break;
|
|
1049
|
+
case FormFieldType.Rate.code:
|
|
1050
|
+
break;
|
|
1051
|
+
case FormFieldType.Select.code:
|
|
1052
|
+
if (control.controlAttr.generalDictionaryOptions) {
|
|
1053
|
+
control.controlAttr.generalDictionaryOptions.forEach((item) => {
|
|
1054
|
+
if (item.value === value) {
|
|
1055
|
+
str = item.title;
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
control.controlAttr.optionConfig.forEach((item) => {
|
|
1061
|
+
if (item.value === value) {
|
|
1062
|
+
str = item.title;
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
break;
|
|
1067
|
+
case FormFieldType.Checkbox.code:
|
|
1068
|
+
str = "";
|
|
1069
|
+
if (value) {
|
|
1070
|
+
if (control.controlAttr.generalDictionaryOptions) {
|
|
1071
|
+
control.controlAttr.generalDictionaryOptions.forEach((item) => {
|
|
1072
|
+
value.split(",").forEach((index) => {
|
|
1073
|
+
if (item.value === index) {
|
|
1074
|
+
str = str + item.title + ",";
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
else {
|
|
1080
|
+
control.controlAttr.optionConfig.forEach((item) => {
|
|
1081
|
+
value.split(",").forEach((index) => {
|
|
1082
|
+
if (item.value === index) {
|
|
1083
|
+
str = str + item.title + ",";
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
str = str.substring(0, str.length - 1);
|
|
1089
|
+
}
|
|
1090
|
+
break;
|
|
1091
|
+
case FormFieldType.Radio.code:
|
|
1092
|
+
if (control.controlAttr.generalDictionaryOptions) {
|
|
1093
|
+
control.controlAttr.generalDictionaryOptions.forEach((item) => {
|
|
1094
|
+
if (item.value === value) {
|
|
1095
|
+
str = item.title;
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
else {
|
|
1100
|
+
control.controlAttr.optionConfig.forEach((item) => {
|
|
1101
|
+
if (item.value === value) {
|
|
1102
|
+
str = item.title;
|
|
1103
|
+
}
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
break;
|
|
1107
|
+
case FormFieldType.TimePicker.code:
|
|
1108
|
+
break;
|
|
1109
|
+
case FormFieldType.DatePicker.code:
|
|
1110
|
+
str = dateFormat.formatDateTime(value, "YYYY-MM-dd");
|
|
1111
|
+
break;
|
|
1112
|
+
case FormFieldType.Cascader.code:
|
|
1113
|
+
str = "";
|
|
1114
|
+
if (value) {
|
|
1115
|
+
formTreeNodeConvertService.treeNodeConvertToArray(control.controlAttr.treeShapeOptions, [], "children").forEach((item) => {
|
|
1116
|
+
value.split(",").forEach((index) => {
|
|
1117
|
+
if (item.value === index) {
|
|
1118
|
+
str = str + item.title + ",";
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
});
|
|
1122
|
+
str = str.substring(0, str.length - 1);
|
|
1123
|
+
}
|
|
1124
|
+
else {
|
|
1125
|
+
str = "";
|
|
1126
|
+
}
|
|
1127
|
+
break;
|
|
1128
|
+
case FormFieldType.TreeSelect.code:
|
|
1129
|
+
str = "";
|
|
1130
|
+
formTreeNodeConvertService.treeNodeConvertToArray(control.controlAttr.treeShapeOptions, [], "children").forEach((item) => {
|
|
1131
|
+
if (item.value === value) {
|
|
1132
|
+
str = str + item.title;
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
break;
|
|
1136
|
+
case FormFieldType.Switch.code:
|
|
1137
|
+
str = value ? "开" : "关";
|
|
1138
|
+
break;
|
|
1139
|
+
case FormFieldType.Custom.code:
|
|
1140
|
+
break;
|
|
1141
|
+
default:
|
|
1142
|
+
str = value;
|
|
1143
|
+
break;
|
|
1144
|
+
}
|
|
1145
|
+
return str;
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* @Description 根据报送类型返回需要隐藏的表单字段
|
|
1149
|
+
* @Author JiangTao
|
|
1150
|
+
* @Date 2024-01-30 上午 09:33
|
|
1151
|
+
*/
|
|
1152
|
+
getFormSubmittedType(form, code) {
|
|
1153
|
+
const strArr = code && code.length > 0 ? code : [];
|
|
1154
|
+
const list = this.dvForm.desForm.controls[0].subControls;
|
|
1155
|
+
const subControlsList = formToolsService.loadResource(this.dvForm.desForm.formId).controls[0].subControls;
|
|
1156
|
+
const submittedTypeList = [];
|
|
1157
|
+
if (strArr.length > 0) {
|
|
1158
|
+
// 遍历组件实例
|
|
1159
|
+
list.forEach((item, index) => {
|
|
1160
|
+
if (item.formControl) {
|
|
1161
|
+
// 校验当前字段是否已隐藏,已隐藏的字段不做处理
|
|
1162
|
+
if (!form.getAttribute(item.formControl.key, Attribute.IsHideControl)) {
|
|
1163
|
+
// 处理普通表单控件
|
|
1164
|
+
submittedTypeList.push(item.formControl.key);
|
|
1165
|
+
// 初始化字段是否隐藏属性
|
|
1166
|
+
form.setAttribute(item.formControl.key, Attribute.IsHideControl, subControlsList[index].controlAttr.isHideControl);
|
|
1167
|
+
// 筛选报送类型字段数据处理
|
|
1168
|
+
this.handleSubmittedData(submittedTypeList, strArr, item);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
else if (item.subControls) {
|
|
1172
|
+
// 处理栅格中表单控件
|
|
1173
|
+
// 遍历栅格中控件
|
|
1174
|
+
item.subControls.forEach((control, num) => {
|
|
1175
|
+
// 校验当前字段是否已隐藏,已隐藏的字段不做处理
|
|
1176
|
+
if (!form.getAttribute(control.formControl.key, Attribute.IsHideControl)) {
|
|
1177
|
+
submittedTypeList.push(control.formControl.key);
|
|
1178
|
+
// 初始化字段是否隐藏属性
|
|
1179
|
+
form.setAttribute(control.formControl.key, Attribute.IsHideControl, subControlsList[index].subControls[num].controlAttr.isHideControl);
|
|
1180
|
+
// 筛选报送类型字段数据处理
|
|
1181
|
+
this.handleSubmittedData(submittedTypeList, strArr, control);
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
// 隐藏无需展示的表单字段
|
|
1187
|
+
submittedTypeList.forEach((item) => {
|
|
1188
|
+
form.setAttribute(item, Attribute.IsHideControl, true);
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
// 默认展示全部字段
|
|
1193
|
+
list.forEach((item, index) => {
|
|
1194
|
+
if (item.formControl) {
|
|
1195
|
+
form.setAttribute(item.formControl.key, Attribute.IsHideControl, subControlsList[index].controlAttr.isHideControl);
|
|
1196
|
+
}
|
|
1197
|
+
else if (item.subControls) {
|
|
1198
|
+
item.subControls.forEach((control, num) => {
|
|
1199
|
+
form.setAttribute(control.formControl.key, Attribute.IsHideControl, subControlsList[index].subControls[num].controlAttr.isHideControl);
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* @Description 筛选报送类型字段数据处理
|
|
1207
|
+
* @Author JiangTao
|
|
1208
|
+
* @Date 2024-01-30 下午 08:50
|
|
1209
|
+
*/
|
|
1210
|
+
handleSubmittedData(submittedTypeList, codeArr, submittedData) {
|
|
1211
|
+
let submittedType = [];
|
|
1212
|
+
if (JSON.parse(submittedData.formControl.controlAttr.busAttr).submittedType !== "") {
|
|
1213
|
+
// 获取字段报送类型
|
|
1214
|
+
submittedType = JSON.parse(submittedData.formControl.controlAttr.busAttr).submittedType.split(",");
|
|
1215
|
+
// 遍历查询报送类型
|
|
1216
|
+
for (let i = 0; i < codeArr.length; i++) {
|
|
1217
|
+
// 判断是否为查询的报送类型字段
|
|
1218
|
+
if (submittedType.filter((type) => type === codeArr[i]).length > 0 && submittedTypeList.indexOf(submittedData.formControl.key) >= 0) {
|
|
1219
|
+
submittedTypeList.splice(submittedTypeList.indexOf(submittedData.formControl.key), 1);
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* @Description 获取报送类型枚举(数组)
|
|
1227
|
+
* @Author JiangTao
|
|
1228
|
+
* @Date 2024-01-30 下午 03:30
|
|
1229
|
+
*/
|
|
1230
|
+
getSubmittedType() {
|
|
1231
|
+
const list = [];
|
|
1232
|
+
Object.values(SubmittedType).forEach((item) => {
|
|
1233
|
+
list.push({
|
|
1234
|
+
value: item.code,
|
|
1235
|
+
label: item.name,
|
|
1236
|
+
});
|
|
1237
|
+
});
|
|
1238
|
+
return list;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
//# sourceMappingURL=FormApi.js.map
|