@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,750 @@
|
|
|
1
|
+
import { DesForm } from "../domain/DesForm";
|
|
2
|
+
import { DesFormLayout } from "../domain/DesFormLayout";
|
|
3
|
+
import { FormFieldClass } from "../constants/enum/form-field-class.enum";
|
|
4
|
+
import { FormFieldType } from "../constants/enum/form-field-type.enum";
|
|
5
|
+
import { Switch } from "../constants/enum/switch.enum";
|
|
6
|
+
import { formTreeNodeConvertService } from "./form-tree-node-convert.service";
|
|
7
|
+
import { formBeanUtilsService } from "./form-bean-utils.service";
|
|
8
|
+
import { apiService } from "./api.service";
|
|
9
|
+
import { formStore } from "../store/form.store";
|
|
10
|
+
import { DynamicOptionType } from "../constants/enum/dynamic-option-type.enum";
|
|
11
|
+
import { dictStore } from "../store";
|
|
12
|
+
import { DEFAULT_DICT_URL, DEFAULT_FORM_FILE_NAME } from "../constants/config/form.config";
|
|
13
|
+
import { CacheType } from "../constants/enum/cache-type.enum";
|
|
14
|
+
import { routerService } from "./router.service";
|
|
15
|
+
import { formValidateService } from "./form-validate.service";
|
|
16
|
+
class FormToolsService {
|
|
17
|
+
static LOAD_SUCCESS = { code: 1, msg: "加载成功" }; // 操作成功提示
|
|
18
|
+
static LOAD_FAIL = { code: 1, msg: "加载失败" }; // 操作失败提示
|
|
19
|
+
static IS_FIRST_LOADED = false; // 是否经过首次初始化
|
|
20
|
+
nodeContrast = { id: "layoutId", parentId: "parentLayoutId", children: "subDesFormLayout" };
|
|
21
|
+
dictDetailsContrast = { id: "dicEntryPk", parentId: "suprDicPk", children: "children" };
|
|
22
|
+
nzDictDetailsContrastContrast = { key: "dicEntryPk", title: "dicValue", children: "children", value: "dicKey" };
|
|
23
|
+
dictTreeDetailsContrast = { id: "dicEntryPk", parentId: "suprDicPk", children: "children" };
|
|
24
|
+
nzDictTreeDetailsContrastContrast = { key: "dicEntryPk", title: "dicValue", children: "children", value: "dicKey" };
|
|
25
|
+
desForms = []; // 表单配置缓存
|
|
26
|
+
sysDictDetailOptions = [];
|
|
27
|
+
sysDictTreeDetailOptions = [];
|
|
28
|
+
mapSysDictDetailOptions;
|
|
29
|
+
mapSysDictTreeDetailOptions;
|
|
30
|
+
supHoliday = false; // 节假日支持
|
|
31
|
+
constructor() { }
|
|
32
|
+
get formConfig() {
|
|
33
|
+
if (window.$app.config.globalProperties.$qlForm != null) {
|
|
34
|
+
return window.$app.config.globalProperties.$qlForm;
|
|
35
|
+
}
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
setSupHoliday(bool) {
|
|
39
|
+
this.supHoliday = bool;
|
|
40
|
+
}
|
|
41
|
+
setFormDisabledColor(color = "#f0f0f0") {
|
|
42
|
+
document.body.style.setProperty("--lo-form-disabled", color);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @description: 检查是否经过首次初始化并初始化
|
|
46
|
+
* @author ChenRui
|
|
47
|
+
* @date 2021/1/5 23:04
|
|
48
|
+
*/
|
|
49
|
+
checkFirstLoadAndInitDesign() {
|
|
50
|
+
if (FormToolsService.IS_FIRST_LOADED) {
|
|
51
|
+
return Promise.resolve({
|
|
52
|
+
code: 1,
|
|
53
|
+
msg: "检查到已经过首次加载,不在执行加载逻辑",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return this.init().then((res) => {
|
|
58
|
+
FormToolsService.IS_FIRST_LOADED = true;
|
|
59
|
+
return res;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @description: 初始化
|
|
65
|
+
* @author ChenRui
|
|
66
|
+
* @date 2021/3/12 11:02
|
|
67
|
+
*/
|
|
68
|
+
init() {
|
|
69
|
+
return Promise.all([this.initDesign(), this.initDict(), this.selectHolidays()]).then(([designRes, dictRes]) => {
|
|
70
|
+
const code = designRes.code === 1 && dictRes.code === 1 ? 1 : 0;
|
|
71
|
+
return { code, msg: designRes.msg + "; " + dictRes.msg };
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @Description 初始化节假日数据
|
|
76
|
+
* @Author JiangTao
|
|
77
|
+
* @Date 2024-04-16 下午 04:11
|
|
78
|
+
*/
|
|
79
|
+
selectHolidays() {
|
|
80
|
+
if (this.formConfig.url && this.supHoliday) {
|
|
81
|
+
const url = this.formConfig.url + this.formConfig.contextPath + "/api/v1/basic-form-weekday/query-all-by-year";
|
|
82
|
+
return this.fetch(url, {}, undefined, "POST").then((res) => {
|
|
83
|
+
if (res != null && (res.code === 1 || String(res.code) === String(200))) {
|
|
84
|
+
if (res.data != null) {
|
|
85
|
+
localStorage.setItem("traddayList", JSON.stringify(res.data.traddayList)); // 交易日集合
|
|
86
|
+
localStorage.setItem("weekdayList", JSON.stringify(res.data.weekdayList)); // 节假日集合
|
|
87
|
+
localStorage.setItem("workdayList", JSON.stringify(res.data.workdayList)); // 工作日集合
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return Promise.resolve(FormToolsService.LOAD_SUCCESS);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return Promise.resolve(FormToolsService.LOAD_SUCCESS);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @description: 初始化表单设计
|
|
97
|
+
* @author ChenRui
|
|
98
|
+
* @date 2020/11/20 10:55
|
|
99
|
+
*/
|
|
100
|
+
initDesign() {
|
|
101
|
+
return Promise.all([formStore.getForms(), formStore.getVersion()]).then(([forms, formVersion]) => {
|
|
102
|
+
if (this.formConfig.loadMode === "static") {
|
|
103
|
+
if (forms != null) {
|
|
104
|
+
this.desForms = forms;
|
|
105
|
+
return Promise.resolve(FormToolsService.LOAD_SUCCESS);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return this.loadDesign([this.formConfig.url || DEFAULT_FORM_FILE_NAME]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else if (this.formConfig.loadMode === "dynamic") {
|
|
112
|
+
if (this.formConfig.appId != null && this.formConfig.appId !== "") {
|
|
113
|
+
const query = {
|
|
114
|
+
appId: this.formConfig.appId,
|
|
115
|
+
cacheType: CacheType.FORM.code,
|
|
116
|
+
};
|
|
117
|
+
const url = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/query-cacheversion-by-appid-cachetype";
|
|
118
|
+
return this.fetch(url, query).then((res) => {
|
|
119
|
+
if (res != null && res.code === 1) {
|
|
120
|
+
if (res.data != null && res.data.desCacheVersion != null) {
|
|
121
|
+
if (String(formVersion) !== String(res.data.desCacheVersion.cacheVersionNumber)) {
|
|
122
|
+
const formUrl = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/download?storageAddress=" + res.data.desCacheVersion.storageAddress;
|
|
123
|
+
return this.loadDesign([formUrl]).then((resEx) => {
|
|
124
|
+
if (resEx.code === 1) {
|
|
125
|
+
formStore.setVersion(res.data.desCacheVersion.cacheVersionNumber);
|
|
126
|
+
}
|
|
127
|
+
return resEx;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
if (forms != null) {
|
|
132
|
+
this.desForms = forms;
|
|
133
|
+
}
|
|
134
|
+
console.log(this.desForms);
|
|
135
|
+
return Promise.resolve(FormToolsService.LOAD_SUCCESS);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
return Promise.resolve({ code: 1, msg: "暂无版本数据" });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return Promise.resolve(FormToolsService.LOAD_FAIL);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return Promise.resolve({
|
|
149
|
+
code: 0,
|
|
150
|
+
msg: "动态加载需指定当前系统编号(appId)",
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if (this.formConfig.loadMode === "merge") {
|
|
155
|
+
if (this.formConfig.urls) {
|
|
156
|
+
return new Promise((resolve) => {
|
|
157
|
+
this.loadDesign(this.formConfig.urls || []).then(() => {
|
|
158
|
+
resolve(FormToolsService.LOAD_SUCCESS);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return this.mergeUrlByType(CacheType.FORM.code).then((response) => {
|
|
164
|
+
if (formVersion === response.cacheVersionNumber) {
|
|
165
|
+
if (forms) {
|
|
166
|
+
this.desForms = forms;
|
|
167
|
+
}
|
|
168
|
+
return Promise.resolve(FormToolsService.LOAD_SUCCESS);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
return new Promise((resolve) => {
|
|
172
|
+
this.loadDesign(response.storageAddress).then(() => {
|
|
173
|
+
formStore.setVersion(response.cacheVersionNumber);
|
|
174
|
+
resolve(FormToolsService.LOAD_SUCCESS);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else if (this.formConfig.loadMode === "merge_cacheId") {
|
|
182
|
+
// 按照缓存编号查询表单数据,2024年8月15日14:03:24
|
|
183
|
+
return this.mergeUrlByCacheId(CacheType.FORM.code).then((response) => {
|
|
184
|
+
if (formVersion === response.cacheVersionNumber) {
|
|
185
|
+
if (forms) {
|
|
186
|
+
this.desForms = forms;
|
|
187
|
+
}
|
|
188
|
+
return Promise.resolve(FormToolsService.LOAD_SUCCESS);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
return new Promise((resolve) => {
|
|
192
|
+
this.loadDesign(response.storageAddress).then(() => {
|
|
193
|
+
formStore.setVersion(response.cacheVersionNumber);
|
|
194
|
+
resolve(FormToolsService.LOAD_SUCCESS);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return Promise.resolve(FormToolsService.LOAD_FAIL);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @description: 获取表单或字典数据地址
|
|
205
|
+
* @author ZPFly
|
|
206
|
+
* @date 2022/10/18 20:43
|
|
207
|
+
*/
|
|
208
|
+
mergeUrlByType(type) {
|
|
209
|
+
const url = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/query-batch-appids-cachetype";
|
|
210
|
+
const downloadUrl = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/download?storageAddress=";
|
|
211
|
+
const query = {
|
|
212
|
+
appIds: this.formConfig.appId,
|
|
213
|
+
cacheType: type,
|
|
214
|
+
};
|
|
215
|
+
return this.fetch(url, query).then((resp) => {
|
|
216
|
+
const response = {};
|
|
217
|
+
const address = [];
|
|
218
|
+
const cacheVersionNumber = [];
|
|
219
|
+
const cacheVersionMap = {};
|
|
220
|
+
resp?.data?.forEach((item) => {
|
|
221
|
+
// 数据下载地址
|
|
222
|
+
if (item.cacheType == type && item.desCacheVersion?.storageAddress && query.appIds && query.appIds.indexOf(item.appId) > -1) {
|
|
223
|
+
cacheVersionMap[item.appId] = item.desCacheVersion.cacheVersionNumber;
|
|
224
|
+
address.push(downloadUrl + item.desCacheVersion.storageAddress);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
query.appIds?.split(",").forEach((appId) => {
|
|
228
|
+
cacheVersionNumber.push(cacheVersionMap[appId]);
|
|
229
|
+
});
|
|
230
|
+
response.cacheVersionNumber = cacheVersionNumber.join(",");
|
|
231
|
+
response.storageAddress = address;
|
|
232
|
+
return response;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* @description: 获取表单或字典数据地址-按照缓存版本号查询字典/表单
|
|
237
|
+
* @author ZPFly
|
|
238
|
+
* @date 2022/10/18 20:43
|
|
239
|
+
*/
|
|
240
|
+
mergeUrlByCacheId(type) {
|
|
241
|
+
const url = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/query-batch-appids-cachetype";
|
|
242
|
+
const downloadUrl = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/downloadById?cacheVersionId=";
|
|
243
|
+
const query = {
|
|
244
|
+
appIds: this.formConfig.appId,
|
|
245
|
+
cacheType: type,
|
|
246
|
+
};
|
|
247
|
+
const appIds = query.appIds?.split(",") || [];
|
|
248
|
+
return this.fetch(url, query).then((resp) => {
|
|
249
|
+
const response = {};
|
|
250
|
+
const address = [];
|
|
251
|
+
const cacheVersionNumber = [];
|
|
252
|
+
const cacheVersionMap = {};
|
|
253
|
+
resp?.data?.forEach((item) => {
|
|
254
|
+
// 数据下载地址
|
|
255
|
+
if (item.cacheType == type && item.desCacheVersion?.cacheVersionId && query.appIds && appIds.indexOf(item.appId) > -1) {
|
|
256
|
+
cacheVersionMap[item.appId] = item.desCacheVersion.cacheVersionNumber;
|
|
257
|
+
address.push(downloadUrl + item.desCacheVersion.cacheVersionId + "&appId=" + item.appId + "&cacheType=" + type);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
query.appIds?.split(",").forEach((appId) => {
|
|
261
|
+
cacheVersionNumber.push(cacheVersionMap[appId]);
|
|
262
|
+
});
|
|
263
|
+
response.cacheVersionNumber = cacheVersionNumber.join(",");
|
|
264
|
+
response.storageAddress = address;
|
|
265
|
+
return response;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* @description: 加载远程表单配置
|
|
270
|
+
* @author ChenRui
|
|
271
|
+
* @date 2020/11/20 17:30
|
|
272
|
+
*/
|
|
273
|
+
loadDesign(urls) {
|
|
274
|
+
return this.mergeFetchDesign(urls).then((desForms) => {
|
|
275
|
+
const newDesForms = [];
|
|
276
|
+
if (desForms != null && desForms.length > 0) {
|
|
277
|
+
desForms
|
|
278
|
+
.filter((item) => item.desFormLayouts != null && item.desFormLayouts.length > 0)
|
|
279
|
+
.forEach((item) => {
|
|
280
|
+
const newDesForm = this.formatDesForm(item);
|
|
281
|
+
if (newDesForm != null) {
|
|
282
|
+
newDesForms.push(newDesForm);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
this.desForms = newDesForms;
|
|
287
|
+
formStore.setForms(this.desForms);
|
|
288
|
+
return FormToolsService.LOAD_SUCCESS;
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @description: 合并多个应用表单
|
|
293
|
+
* @author ZPFly
|
|
294
|
+
* @date 2022/10/17 15:39
|
|
295
|
+
*/
|
|
296
|
+
mergeFetchDesign(urls) {
|
|
297
|
+
const onlySimpleLoadConfig = !!this.formConfig.onlySimpleLoadConfig;
|
|
298
|
+
const headers = this.createFileDownloadAuthorizationHeader();
|
|
299
|
+
const fetches = [];
|
|
300
|
+
urls.forEach((url) => {
|
|
301
|
+
fetches.push(this.fetch(url, {}, undefined, "GET", headers, onlySimpleLoadConfig));
|
|
302
|
+
});
|
|
303
|
+
return Promise.all(fetches).then((desForms) => {
|
|
304
|
+
let newDesForms = [];
|
|
305
|
+
desForms?.forEach((desForm) => {
|
|
306
|
+
newDesForms = newDesForms.concat(desForm);
|
|
307
|
+
});
|
|
308
|
+
return newDesForms;
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* @description: 初始化字典
|
|
313
|
+
* @author ChenRui
|
|
314
|
+
* @date 2021/3/11 14:32
|
|
315
|
+
*/
|
|
316
|
+
initDict() {
|
|
317
|
+
return Promise.all([dictStore.getDicts(), dictStore.getTreeDicts(), dictStore.getMapDicts(), dictStore.getMapTreeDicts(), dictStore.getVersion()]).then(([dicts, treeDicts, mapDicts, mapTreeDicts, dictVersion]) => {
|
|
318
|
+
if (this.formConfig.loadMode === "static") {
|
|
319
|
+
const url = this.formConfig.dictUrl ? this.formConfig.dictUrl : DEFAULT_DICT_URL;
|
|
320
|
+
if (dicts != null || treeDicts != null) {
|
|
321
|
+
this.sysDictDetailOptions = dicts;
|
|
322
|
+
this.sysDictTreeDetailOptions = treeDicts;
|
|
323
|
+
this.mapSysDictDetailOptions = mapDicts;
|
|
324
|
+
this.mapSysDictTreeDetailOptions = mapTreeDicts;
|
|
325
|
+
return FormToolsService.LOAD_SUCCESS;
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
return this.loadDict([url]);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
else if (this.formConfig.loadMode === "dynamic") {
|
|
332
|
+
if (this.formConfig.appId) {
|
|
333
|
+
const url1 = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/query-cacheversion-by-appid-cachetype";
|
|
334
|
+
const url = this.formConfig.dictUrl ? this.formConfig.dictUrl : url1 || "";
|
|
335
|
+
const path = routerService.getPathFromUrl(url);
|
|
336
|
+
let query = routerService.getParamsFromUrl(url) || {};
|
|
337
|
+
query.appId = query.appId ? query.appId : this.formConfig.appId;
|
|
338
|
+
query.cacheType = query.cacheType ? query.cacheType : CacheType.DICT.code;
|
|
339
|
+
query = this.formConfig.dictRestLoadOnlyBody ? {} : query;
|
|
340
|
+
const body = (this.formConfig.dictRestLoadMode || "GET").toLocaleUpperCase() === "GET" ? undefined : this.formConfig.dictRestLoadBody;
|
|
341
|
+
let headers = this.formConfig.dictRestLoadHeaders;
|
|
342
|
+
if (headers != null && typeof headers === "function") {
|
|
343
|
+
headers = headers();
|
|
344
|
+
}
|
|
345
|
+
return this.fetch(path, query, body, this.formConfig.dictRestLoadMode, headers).then((res) => {
|
|
346
|
+
if (res != null && (res.code === 1 || String(res.code) === String(200))) {
|
|
347
|
+
if (res.data != null) {
|
|
348
|
+
let desCacheVersion = res.data.desCacheVersion;
|
|
349
|
+
if (res.data && res.data instanceof Array && res.data.length > 0) {
|
|
350
|
+
desCacheVersion = res.data[0].desCacheVersion;
|
|
351
|
+
}
|
|
352
|
+
const distUrl = this.formConfig.url + this.formConfig.contextPath + "/api/v1/des-cache-info/permit_endpoint/download?storageAddress=" + desCacheVersion.storageAddress;
|
|
353
|
+
if (String(dictVersion) !== String(desCacheVersion.cacheVersionNumber)) {
|
|
354
|
+
return this.loadDict([distUrl]).then((resEx) => {
|
|
355
|
+
if (resEx.code === 1) {
|
|
356
|
+
dictStore.setVersion(desCacheVersion.cacheVersionNumber);
|
|
357
|
+
}
|
|
358
|
+
return resEx;
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
if (dicts != null || treeDicts != null) {
|
|
363
|
+
this.sysDictDetailOptions = dicts;
|
|
364
|
+
this.sysDictTreeDetailOptions = treeDicts;
|
|
365
|
+
this.mapSysDictDetailOptions = mapDicts;
|
|
366
|
+
this.mapSysDictTreeDetailOptions = mapTreeDicts;
|
|
367
|
+
}
|
|
368
|
+
return FormToolsService.LOAD_SUCCESS;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
return { code: 1, msg: "暂无版本数据" };
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
return FormToolsService.LOAD_FAIL;
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
return { code: 0, msg: "动态加载需指定当前系统编号(appId)" };
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else if (this.formConfig.loadMode === "merge") {
|
|
385
|
+
return this.mergeUrlByType(CacheType.DICT.code).then((response) => {
|
|
386
|
+
if (dictVersion === response.cacheVersionNumber) {
|
|
387
|
+
if (dicts != null || treeDicts != null) {
|
|
388
|
+
this.sysDictDetailOptions = dicts;
|
|
389
|
+
this.sysDictTreeDetailOptions = treeDicts;
|
|
390
|
+
this.mapSysDictDetailOptions = mapDicts;
|
|
391
|
+
this.mapSysDictTreeDetailOptions = mapTreeDicts;
|
|
392
|
+
}
|
|
393
|
+
return FormToolsService.LOAD_SUCCESS;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
return new Promise((resolve) => {
|
|
397
|
+
this.loadDict(response.storageAddress).then(() => {
|
|
398
|
+
dictStore.setVersion(response.cacheVersionNumber);
|
|
399
|
+
resolve(FormToolsService.LOAD_SUCCESS);
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
else if (this.formConfig.loadMode === "merge_cacheId") {
|
|
406
|
+
// 按照缓存编号查询表单数据,2024年8月15日14:03:24
|
|
407
|
+
return this.mergeUrlByCacheId(CacheType.DICT.code).then((response) => {
|
|
408
|
+
if (dictVersion === response.cacheVersionNumber) {
|
|
409
|
+
if (dicts != null || treeDicts != null) {
|
|
410
|
+
this.sysDictDetailOptions = dicts;
|
|
411
|
+
this.sysDictTreeDetailOptions = treeDicts;
|
|
412
|
+
this.mapSysDictDetailOptions = mapDicts;
|
|
413
|
+
this.mapSysDictTreeDetailOptions = mapTreeDicts;
|
|
414
|
+
}
|
|
415
|
+
return FormToolsService.LOAD_SUCCESS;
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
return new Promise((resolve) => {
|
|
419
|
+
this.loadDict(response.storageAddress).then(() => {
|
|
420
|
+
dictStore.setVersion(response.cacheVersionNumber);
|
|
421
|
+
resolve(FormToolsService.LOAD_SUCCESS);
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
return FormToolsService.LOAD_FAIL;
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* @description: 加载远程字典配置
|
|
432
|
+
* @author ChenRui
|
|
433
|
+
* @date 2020/11/20 17:30
|
|
434
|
+
*/
|
|
435
|
+
loadDict(urls) {
|
|
436
|
+
return this.mergeFetchDict(urls).then((sysDictInfos) => {
|
|
437
|
+
if (sysDictInfos != null) {
|
|
438
|
+
// 数据格式化
|
|
439
|
+
const dictionaryFormatCollection = this.inidDictOptions(sysDictInfos);
|
|
440
|
+
this.sysDictDetailOptions = dictionaryFormatCollection.sysDictDetailOptions || [];
|
|
441
|
+
this.sysDictTreeDetailOptions = dictionaryFormatCollection.sysDictTreeDetailOptions || [];
|
|
442
|
+
this.mapSysDictDetailOptions = dictionaryFormatCollection.mapSysDictDetailOptions;
|
|
443
|
+
this.mapSysDictTreeDetailOptions = dictionaryFormatCollection.mapSysDictTreeDetailOptions;
|
|
444
|
+
// 字典本地存储
|
|
445
|
+
if (dictionaryFormatCollection.sysDictDetailOptions && dictionaryFormatCollection.sysDictDetailOptions.length > 0) {
|
|
446
|
+
dictStore.setDicts(dictionaryFormatCollection.sysDictDetailOptions);
|
|
447
|
+
}
|
|
448
|
+
if (dictionaryFormatCollection.sysDictTreeDetailOptions && dictionaryFormatCollection.sysDictTreeDetailOptions.length > 0) {
|
|
449
|
+
dictStore.setTreeDicts(dictionaryFormatCollection.sysDictTreeDetailOptions);
|
|
450
|
+
}
|
|
451
|
+
dictStore.setMapDicts(dictionaryFormatCollection.mapSysDictDetailOptions || null);
|
|
452
|
+
dictStore.setMapTreeDicts(dictionaryFormatCollection.mapSysDictTreeDetailOptions || null);
|
|
453
|
+
}
|
|
454
|
+
return FormToolsService.LOAD_SUCCESS;
|
|
455
|
+
});
|
|
456
|
+
// const onlySimpleLoadConfig = !!this.formConfig.onlySimpleLoadConfig;
|
|
457
|
+
// let sysDictInfos: SysDictInfo[] = [];
|
|
458
|
+
// if (loadMode === "dynamic") {
|
|
459
|
+
// const headers = this.createFileDownloadAuthorizationHeader();
|
|
460
|
+
// url = this.formConfig.url + "/ms-loong/api/v1/des-cache-info/permit_endpoint/download?storageAddress=" + url;
|
|
461
|
+
// return this.fetch(url, {}, undefined, "GET", headers, onlySimpleLoadConfig).then((res: any) => {
|
|
462
|
+
// sysDictInfos = res;
|
|
463
|
+
// if (sysDictInfos != null && sysDictInfos.length > 0) {
|
|
464
|
+
// // 数据格式化
|
|
465
|
+
// const dictionaryFormatCollection: DictionaryFormatCollection = this.inidDictOptions(sysDictInfos);
|
|
466
|
+
// this.sysDictDetailOptions = dictionaryFormatCollection.sysDictDetailOptions || [];
|
|
467
|
+
// this.sysDictTreeDetailOptions = dictionaryFormatCollection.sysDictTreeDetailOptions || [];
|
|
468
|
+
// this.mapSysDictDetailOptions = dictionaryFormatCollection.mapSysDictDetailOptions;
|
|
469
|
+
// this.mapSysDictTreeDetailOptions = dictionaryFormatCollection.mapSysDictTreeDetailOptions;
|
|
470
|
+
// // 字典本地存储
|
|
471
|
+
// if (dictionaryFormatCollection.sysDictDetailOptions && dictionaryFormatCollection.sysDictDetailOptions.length > 0) {
|
|
472
|
+
// dictStore.setDicts(dictionaryFormatCollection.sysDictDetailOptions);
|
|
473
|
+
// }
|
|
474
|
+
// if (dictionaryFormatCollection.sysDictTreeDetailOptions && dictionaryFormatCollection.sysDictTreeDetailOptions.length > 0) {
|
|
475
|
+
// dictStore.setTreeDicts(dictionaryFormatCollection.sysDictTreeDetailOptions);
|
|
476
|
+
// }
|
|
477
|
+
// dictStore.setMapDicts(dictionaryFormatCollection.mapSysDictDetailOptions || null);
|
|
478
|
+
// dictStore.setMapTreeDicts(dictionaryFormatCollection.mapSysDictTreeDetailOptions || null);
|
|
479
|
+
// }
|
|
480
|
+
// return FormToolsService.LOAD_SUCCESS;
|
|
481
|
+
// });
|
|
482
|
+
// }
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* @description: 合并多个应用字典
|
|
486
|
+
* @author ZPFly
|
|
487
|
+
* @date 2022/10/17 15:39
|
|
488
|
+
*/
|
|
489
|
+
mergeFetchDict(dictUrl) {
|
|
490
|
+
const fetchDicts = [];
|
|
491
|
+
dictUrl.forEach((url) => {
|
|
492
|
+
fetchDicts.push(this.fetch(url, {}, undefined, "GET", undefined, !!this.formConfig.onlySimpleLoadConfig));
|
|
493
|
+
});
|
|
494
|
+
return Promise.all(fetchDicts).then((dictInfos) => {
|
|
495
|
+
let newDictInfos = [];
|
|
496
|
+
const empObj = {};
|
|
497
|
+
const filterDist = [];
|
|
498
|
+
dictInfos?.forEach((desForm) => {
|
|
499
|
+
newDictInfos = newDictInfos.concat(desForm);
|
|
500
|
+
});
|
|
501
|
+
// 去除重复字典
|
|
502
|
+
newDictInfos.forEach((item) => {
|
|
503
|
+
if (!empObj[item.dictId]) {
|
|
504
|
+
filterDist.push(item);
|
|
505
|
+
empObj[item.dictId] = true;
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
return filterDist;
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* @description: 初始化字典可选项
|
|
513
|
+
* @author ChenRui
|
|
514
|
+
* @date 2020/11/10 20:38
|
|
515
|
+
*/
|
|
516
|
+
inidDictOptions(sysDictInfos) {
|
|
517
|
+
const sysDictDetailOptions = [];
|
|
518
|
+
const sysDictTreeDetailOptions = [];
|
|
519
|
+
sysDictInfos.forEach((sysDictInfo) => {
|
|
520
|
+
const node = {
|
|
521
|
+
key: sysDictInfo.dictId,
|
|
522
|
+
value: sysDictInfo.dictCd,
|
|
523
|
+
title: sysDictInfo.dictNm,
|
|
524
|
+
isLeaf: true,
|
|
525
|
+
expanded: false,
|
|
526
|
+
children: [],
|
|
527
|
+
};
|
|
528
|
+
if (sysDictInfo.dictTp === DynamicOptionType.GeneralDictionary.code) {
|
|
529
|
+
node.isLeaf = false;
|
|
530
|
+
node.children = formTreeNodeConvertService.arrayConvertToNzTreeNode(sysDictInfo.comDictKeyValues.filter((it) => !!it.dictId), this.dictDetailsContrast, this.nzDictDetailsContrastContrast, true);
|
|
531
|
+
sysDictDetailOptions.push(node);
|
|
532
|
+
}
|
|
533
|
+
else if (sysDictInfo.dictTp === DynamicOptionType.TreeDictionary.code) {
|
|
534
|
+
if (sysDictInfo.treeDictKeyValues != null && sysDictInfo.treeDictKeyValues.length > 0) {
|
|
535
|
+
node.isLeaf = false;
|
|
536
|
+
sysDictInfo.treeDictKeyValues.forEach((item) => {
|
|
537
|
+
if (item.suprDicPk === "0") {
|
|
538
|
+
item.suprDicPk = "";
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
node.children = formTreeNodeConvertService.arrayConvertToNzTreeNode(sysDictInfo.treeDictKeyValues.filter((it) => !!it.dictId), this.dictTreeDetailsContrast, this.nzDictTreeDetailsContrastContrast, true);
|
|
542
|
+
}
|
|
543
|
+
sysDictTreeDetailOptions.push(node);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
const mapNodeOptions = formTreeNodeConvertService.nzTreeNodeConvertToMap(sysDictDetailOptions);
|
|
547
|
+
const mapTreeNodeOptions = formTreeNodeConvertService.nzTreeNodeConvertToMap(sysDictTreeDetailOptions);
|
|
548
|
+
return {
|
|
549
|
+
sysDictDetailOptions: sysDictDetailOptions,
|
|
550
|
+
sysDictTreeDetailOptions: sysDictTreeDetailOptions,
|
|
551
|
+
mapSysDictDetailOptions: mapNodeOptions,
|
|
552
|
+
mapSysDictTreeDetailOptions: mapTreeNodeOptions,
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* @description: 格式化表单
|
|
557
|
+
* @author ChenRui
|
|
558
|
+
* @date 2020/11/30 15:48
|
|
559
|
+
*/
|
|
560
|
+
formatDesForm(sourceDesForm) {
|
|
561
|
+
if (sourceDesForm != null) {
|
|
562
|
+
const newDesForm = new DesForm(sourceDesForm);
|
|
563
|
+
const desFormLayouts = formTreeNodeConvertService.arrayConvertToTreeNode(sourceDesForm.desFormLayouts, this.nodeContrast);
|
|
564
|
+
const controls = this.recursionFormatForm([], desFormLayouts);
|
|
565
|
+
this.sortControls(controls);
|
|
566
|
+
newDesForm.desFormLayouts = [];
|
|
567
|
+
newDesForm.controls = controls;
|
|
568
|
+
return newDesForm;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* @description: 递归格式化
|
|
573
|
+
* @author ChenRui
|
|
574
|
+
* @date 2020/11/17 10:16
|
|
575
|
+
*/
|
|
576
|
+
recursionFormatForm(desFormControls, desFormLayouts) {
|
|
577
|
+
const controls = [];
|
|
578
|
+
if (desFormControls != null && desFormControls.length > 0) {
|
|
579
|
+
desFormControls
|
|
580
|
+
.filter((item) => !!item.formFieldId)
|
|
581
|
+
.forEach((desFormControl) => {
|
|
582
|
+
const control = {
|
|
583
|
+
code: desFormControl.controlType,
|
|
584
|
+
name: (Object.values(FormFieldType).find((item) => item.code === desFormControl.controlType) || {}).name || "",
|
|
585
|
+
type: Number(desFormControl.controlType) < 50 ? FormFieldClass.Base.code : FormFieldClass.Senior.code,
|
|
586
|
+
active: false,
|
|
587
|
+
subControls: undefined,
|
|
588
|
+
controlAttr: desFormControl,
|
|
589
|
+
};
|
|
590
|
+
const controlAttr = control.controlAttr;
|
|
591
|
+
controlAttr.isBoldTitle = desFormControl.isBoldTitle === Switch.Enable.code;
|
|
592
|
+
controlAttr.isHideTitle = desFormControl.isHideTitle === Switch.Enable.code;
|
|
593
|
+
controlAttr.isNotEdit = desFormControl.isNotEdit === Switch.Enable.code;
|
|
594
|
+
controlAttr.isShowHoliday = desFormControl.isShowHoliday === Switch.Enable.code;
|
|
595
|
+
controlAttr.isHideControl = desFormControl.isHideControl === Switch.Enable.code;
|
|
596
|
+
controlAttr.isPasswordBox = desFormControl.isPasswordBox === Switch.Enable.code;
|
|
597
|
+
controlAttr.enableAutoComplete = desFormControl.enableAutoComplete === Switch.Enable.code;
|
|
598
|
+
controlAttr.isFixedRowHeight = desFormControl.isFixedRowHeight === Switch.Enable.code;
|
|
599
|
+
controlAttr.thousandthPercentileFormat = desFormControl.thousandthPercentileFormat === Switch.Enable.code;
|
|
600
|
+
controlAttr.isShowCapitalization = desFormControl.isShowCapitalization === Switch.Enable.code;
|
|
601
|
+
controlAttr.isLineFeedDisplay = desFormControl.isLineFeedDisplay === Switch.Enable.code;
|
|
602
|
+
controlAttr.optionConfig = formBeanUtilsService.parse(desFormControl.optionConfig);
|
|
603
|
+
controlAttr.generalDictionaryOptions = formBeanUtilsService.parse(desFormControl.generalDictionaryOptions);
|
|
604
|
+
controlAttr.treeShapeOptions = formBeanUtilsService.parse(desFormControl.treeShapeOptions);
|
|
605
|
+
controlAttr.isSupportMultiple = desFormControl.isSupportMultiple === Switch.Enable.code;
|
|
606
|
+
if (Array.isArray(desFormControl.customUploadType) && desFormControl.customUploadType.length > 0) {
|
|
607
|
+
controlAttr.customUploadType = desFormControl.customUploadType.join(",");
|
|
608
|
+
}
|
|
609
|
+
controlAttr.isMultipleChoice = desFormControl.isMultipleChoice === Switch.Enable.code;
|
|
610
|
+
controlAttr.isSearchable = desFormControl.isSearchable === Switch.Enable.code;
|
|
611
|
+
controlAttr.canAddEntry = desFormControl.canAddEntry === Switch.Enable.code;
|
|
612
|
+
controlAttr.isClearButton = desFormControl.isClearButton === Switch.Enable.code;
|
|
613
|
+
controlAttr.hiddenDropdown = desFormControl.hiddenDropdown === Switch.Enable.code;
|
|
614
|
+
controlAttr.textFold = desFormControl.textFold === Switch.Enable.code;
|
|
615
|
+
controlAttr.verificationRules = formBeanUtilsService.parse(desFormControl.verificationRules);
|
|
616
|
+
controlAttr.isDesensitize = desFormControl.isDesensitize === Switch.Enable.code; // 是否脱敏2026年5月13日 15:43:17
|
|
617
|
+
controls.push(control);
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
if (desFormLayouts != null && desFormLayouts.length > 0) {
|
|
621
|
+
desFormLayouts
|
|
622
|
+
.filter((item) => !!item.layoutId)
|
|
623
|
+
.forEach((desFormLayout) => {
|
|
624
|
+
const layoutControl = {
|
|
625
|
+
code: desFormLayout.layoutType,
|
|
626
|
+
name: (Object.values(FormFieldType).find((item) => item.code === desFormLayout.layoutType) || {}).name || "",
|
|
627
|
+
type: FormFieldClass.Layout.code,
|
|
628
|
+
active: false,
|
|
629
|
+
subControls: [],
|
|
630
|
+
controlAttr: new DesFormLayout(desFormLayout),
|
|
631
|
+
};
|
|
632
|
+
const controlAttr = layoutControl.controlAttr;
|
|
633
|
+
controlAttr.gridColumnConfig = formBeanUtilsService.parse(desFormLayout.gridColumnConfig);
|
|
634
|
+
controlAttr.desFormControls = [];
|
|
635
|
+
controlAttr.subDesFormLayout = [];
|
|
636
|
+
if ((desFormLayout.subDesFormLayout != null && desFormLayout.subDesFormLayout.length > 0) || (desFormLayout.desFormControls != null && desFormLayout.desFormControls.length > 0)) {
|
|
637
|
+
layoutControl.subControls = this.recursionFormatForm(desFormLayout.desFormControls, desFormLayout.subDesFormLayout);
|
|
638
|
+
}
|
|
639
|
+
controls.push(layoutControl);
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
return controls;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* @description: 控件排序
|
|
646
|
+
* @author ChenRui
|
|
647
|
+
* @date 2020/11/17 11:59
|
|
648
|
+
*/
|
|
649
|
+
sortControls(controls) {
|
|
650
|
+
controls.sort((controlA, controlB) => {
|
|
651
|
+
let x = 0;
|
|
652
|
+
let y = 0;
|
|
653
|
+
if (controlA.type === FormFieldClass.Layout.code) {
|
|
654
|
+
x = Number(controlA.controlAttr.layoutOrder);
|
|
655
|
+
}
|
|
656
|
+
else {
|
|
657
|
+
x = Number(controlA.controlAttr.tableFieldOrder);
|
|
658
|
+
}
|
|
659
|
+
if (controlB.type === FormFieldClass.Layout.code) {
|
|
660
|
+
y = Number(controlB.controlAttr.layoutOrder);
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
y = Number(controlB.controlAttr.tableFieldOrder);
|
|
664
|
+
}
|
|
665
|
+
return x - y;
|
|
666
|
+
});
|
|
667
|
+
controls.forEach((item) => {
|
|
668
|
+
if (item.subControls != null && item.subControls.length > 0) {
|
|
669
|
+
this.sortControls(item.subControls);
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* @description: 加载资源
|
|
675
|
+
* @author ChenRui
|
|
676
|
+
* @date 2020/11/23 11:00
|
|
677
|
+
*/
|
|
678
|
+
loadResource(formId) {
|
|
679
|
+
const desForm = this.desForms.find((item) => item.formId === formId);
|
|
680
|
+
if (desForm != null) {
|
|
681
|
+
return formBeanUtilsService.copy(desForm);
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
return new DesForm({ formId: formId });
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
initResource(formId) {
|
|
688
|
+
if (this.desForms.length === 0) {
|
|
689
|
+
return new Promise((resolve, reject) => {
|
|
690
|
+
Promise.all([dictStore.getDicts(), dictStore.getTreeDicts(), dictStore.getMapDicts(), dictStore.getMapTreeDicts(), formStore.getForms()]).then(([dicts, treeDicts, mapDicts, mapTreeDicts, forms]) => {
|
|
691
|
+
this.desForms = forms;
|
|
692
|
+
this.sysDictDetailOptions = dicts;
|
|
693
|
+
this.sysDictTreeDetailOptions = treeDicts;
|
|
694
|
+
this.mapSysDictDetailOptions = mapDicts;
|
|
695
|
+
this.mapSysDictTreeDetailOptions = mapTreeDicts;
|
|
696
|
+
const desForm = this.desForms.find((item) => item.formId === formId);
|
|
697
|
+
if (desForm != null) {
|
|
698
|
+
resolve(formBeanUtilsService.copy(desForm));
|
|
699
|
+
return formBeanUtilsService.copy(desForm);
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
reject(new DesForm({ formId: formId }));
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
else {
|
|
708
|
+
const desForm = this.desForms.find((item) => item.formId === formId);
|
|
709
|
+
if (desForm != null) {
|
|
710
|
+
return Promise.resolve(formBeanUtilsService.copy(desForm));
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
return Promise.reject(new DesForm({ formId: formId }));
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* @description: rest客户端
|
|
719
|
+
* @author ChenRui
|
|
720
|
+
* @date 2020/11/19 21:02
|
|
721
|
+
*/
|
|
722
|
+
fetch(path, params, body, method = "GET", headers, simple = false) {
|
|
723
|
+
headers = headers ? headers : apiService.createBasicHeaders();
|
|
724
|
+
return simple ? fetch(path).then((response) => response.json()) : apiService.fetch(path, params, body, method, headers);
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* @description: 校验提示
|
|
728
|
+
* @author ChenRui
|
|
729
|
+
* @date 2021/8/18 17:14
|
|
730
|
+
*/
|
|
731
|
+
validateTips(formApis, scrollView) {
|
|
732
|
+
return formValidateService.validateTips(formApis, scrollView);
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* @description: 创建认证下载消息头
|
|
736
|
+
* @author ChenRui
|
|
737
|
+
* @date 2020/8/28 15:18
|
|
738
|
+
*/
|
|
739
|
+
createFileDownloadAuthorizationHeader() {
|
|
740
|
+
return {
|
|
741
|
+
headers: {
|
|
742
|
+
"Content-Type": "application/json",
|
|
743
|
+
},
|
|
744
|
+
responseType: "blob",
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
const formToolsService = new FormToolsService();
|
|
749
|
+
export { formToolsService, FormToolsService };
|
|
750
|
+
//# sourceMappingURL=form-tools.service.js.map
|