@jeecg/online 1.0.1
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/AuthButtonConfig.js +140 -0
- package/AuthButtonTree.js +183 -0
- package/AuthDataConfig.js +243 -0
- package/AuthDataTree.js +160 -0
- package/AuthFieldConfig.js +167 -0
- package/AuthFieldTree.js +273 -0
- package/AuthManagerDrawer.js +125 -0
- package/AuthSetterModal.js +317 -0
- package/CgformCopyList.js +253 -0
- package/CgformModal.js +748 -0
- package/CgreportModal.js +673 -0
- package/ChartAutoRender.js +69 -0
- package/ChartDoubleRender.js +154 -0
- package/ChartSingleRender.js +132 -0
- package/ChartTabsRender.js +218 -0
- package/CheckDictTable.js +121 -0
- package/CodeGeneratorModal.js +293 -0
- package/CustomButtonList.js +413 -0
- package/DBAttributeTable.js +278 -0
- package/DbToOnlineModal.js +190 -0
- package/EnhanceJavaModal.js +304 -0
- package/EnhanceJsHistory.js +231 -0
- package/EnhanceJsModal.js +293 -0
- package/EnhanceSqlModal.js +305 -0
- package/ErrorTip.js +21 -0
- package/ExtendConfigModal.js +142 -0
- package/FieldTable.js +185 -0
- package/FileSelectModal.js +102 -0
- package/ForeignKeyTable.js +78 -0
- package/FormSchemaFactory.js +938 -0
- package/GraphreportAutoChart.js +352 -0
- package/GraphreportList.js +239 -0
- package/GraphreportModal.js +559 -0
- package/IndexTable.js +96 -0
- package/JOnlineSearchSelect.js +107 -0
- package/LICENSE +7 -0
- package/LeftDepart.js +96 -0
- package/LeftRole.js +95 -0
- package/LeftUser.js +114 -0
- package/ModalFormDemo.js +84 -0
- package/OnlineAutoList.js +410 -0
- package/OnlineAutoModal.js +265 -0
- package/OnlineAutoTreeList.js +513 -0
- package/OnlineCustomModal.js +269 -0
- package/OnlineForm.js +809 -0
- package/OnlineQueryForm.js +442 -0
- package/OnlineSearchFormItem.js +428 -0
- package/OnlineSelectCascade.js +217 -0
- package/OnlineSubForm.js +200 -0
- package/OnlineSuperQuery.js +912 -0
- package/OnlineSuperQueryValComponent.js +8 -0
- package/OnlineSuperQueryValComponent.vue_vue_type_script_lang.js +172 -0
- package/PageAttributeTable.js +242 -0
- package/ParamsTable.js +71 -0
- package/ProcessOnlineForm.js +183 -0
- package/QueryTable.js +128 -0
- package/README.md +23 -0
- package/_arrayPush.js +276 -0
- package/auth.api.js +43 -0
- package/auth.data.js +144 -0
- package/cgform.data.js +235 -0
- package/cloneDeep.js +475 -0
- package/enhance.api.js +120 -0
- package/enhance.data.js +196 -0
- package/graphreport.api.js +23 -0
- package/index.js +64 -0
- package/index2.js +336 -0
- package/index3.js +799 -0
- package/isArray.js +47 -0
- package/main.index.js +6 -0
- package/package.json +6 -0
- package/pick.js +238 -0
- package/style.css +1 -0
- package/toString.js +31 -0
- package/useAutoForm.js +4274 -0
- package/useCgformList.js +353 -0
- package/useChartRender.js +405 -0
- package/useMessageOnline.js +71 -0
- package/useOnlineTest.js +26866 -0
- package/useSchemas.js +505 -0
- package/useTableColumns.js +1154 -0
- package/useTableSync.js +105 -0
|
@@ -0,0 +1,938 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __async = (__this, __arguments, generator) => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
var fulfilled = (value) => {
|
|
20
|
+
try {
|
|
21
|
+
step(generator.next(value));
|
|
22
|
+
} catch (e) {
|
|
23
|
+
reject(e);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var rejected = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.throw(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
34
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
import { UploadTypeEnum } from "/@/components/Form/src/jeecg/components/JUpload";
|
|
38
|
+
const SUBMIT_FLOW_KEY = "jeecg_submit_form_and_flow";
|
|
39
|
+
const SUBMIT_FLOW_ID = "flow_submit_id";
|
|
40
|
+
const VALIDATE_FAILED = "validate-failed";
|
|
41
|
+
const SETUP = "setup";
|
|
42
|
+
const ENHANCEJS = "EnhanceJS";
|
|
43
|
+
const FORM_VIEW_TO_QUERY_VIEW = {
|
|
44
|
+
"password": "text",
|
|
45
|
+
"file": "text",
|
|
46
|
+
"image": "text",
|
|
47
|
+
"textarea": "text",
|
|
48
|
+
"umeditor": "text",
|
|
49
|
+
"markdown": "text",
|
|
50
|
+
"checkbox": "list_multi",
|
|
51
|
+
"radio": "list"
|
|
52
|
+
};
|
|
53
|
+
const POP_CONTAINER = ".jeecg-online-modal .ant-modal-content";
|
|
54
|
+
class IFormSchema {
|
|
55
|
+
constructor(key, data) {
|
|
56
|
+
this._data = data;
|
|
57
|
+
this.field = key;
|
|
58
|
+
this.label = data.title;
|
|
59
|
+
this.hidden = false;
|
|
60
|
+
this.order = data.order || 999;
|
|
61
|
+
this.required = false;
|
|
62
|
+
this.onlyValidator = "";
|
|
63
|
+
this.setFieldsValue = "";
|
|
64
|
+
this.hasChange = true;
|
|
65
|
+
if (key.indexOf("@") > 0) {
|
|
66
|
+
this.pre = key.substring(0, key.indexOf("@") + 1);
|
|
67
|
+
} else {
|
|
68
|
+
this.pre = "";
|
|
69
|
+
}
|
|
70
|
+
this.schemaProp = {};
|
|
71
|
+
this.searchForm = false;
|
|
72
|
+
this.disabled = false;
|
|
73
|
+
this.handleWidgetAttr(data);
|
|
74
|
+
}
|
|
75
|
+
getFormItemSchema() {
|
|
76
|
+
let schema = this.getItem();
|
|
77
|
+
this.addDefaultChangeEvent(schema);
|
|
78
|
+
return schema;
|
|
79
|
+
}
|
|
80
|
+
getItem() {
|
|
81
|
+
let fs = {
|
|
82
|
+
field: this.field,
|
|
83
|
+
label: this.label,
|
|
84
|
+
component: "Input"
|
|
85
|
+
};
|
|
86
|
+
let rules = this.getRule();
|
|
87
|
+
if (rules.length > 0 && this.onlyValidator) {
|
|
88
|
+
fs["rules"] = rules;
|
|
89
|
+
}
|
|
90
|
+
if (this.hidden === true) {
|
|
91
|
+
fs["show"] = false;
|
|
92
|
+
}
|
|
93
|
+
return fs;
|
|
94
|
+
}
|
|
95
|
+
setFormRef(ref) {
|
|
96
|
+
this.formRef = ref;
|
|
97
|
+
}
|
|
98
|
+
isHidden() {
|
|
99
|
+
this.hidden = true;
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
isRequired(array) {
|
|
103
|
+
if (array && array.length > 0) {
|
|
104
|
+
if (array.indexOf(this.field) >= 0) {
|
|
105
|
+
this.required = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
getExtendData() {
|
|
111
|
+
let extend = {};
|
|
112
|
+
let { fieldExtendJson } = this._data;
|
|
113
|
+
if (fieldExtendJson) {
|
|
114
|
+
if (typeof fieldExtendJson == "string") {
|
|
115
|
+
try {
|
|
116
|
+
let json = JSON.parse(fieldExtendJson);
|
|
117
|
+
extend = __spreadValues({}, json);
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.error(e);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return extend;
|
|
124
|
+
}
|
|
125
|
+
getRelatedHideFields() {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
getPlaceholder() {
|
|
129
|
+
return "\u8BF7\u8F93\u5165" + this.label;
|
|
130
|
+
}
|
|
131
|
+
setOnlyValidateFun(validateFun) {
|
|
132
|
+
if (validateFun) {
|
|
133
|
+
this.onlyValidator = (rule, value) => __async(this, null, function* () {
|
|
134
|
+
let error = yield validateFun(rule, value);
|
|
135
|
+
if (!error) {
|
|
136
|
+
return Promise.resolve();
|
|
137
|
+
} else {
|
|
138
|
+
return Promise.reject(error);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
getRule() {
|
|
144
|
+
let rules = [];
|
|
145
|
+
const { view, errorInfo, pattern, type } = this._data;
|
|
146
|
+
if (this.required === true) {
|
|
147
|
+
let msg = this.getPlaceholder();
|
|
148
|
+
if (errorInfo) {
|
|
149
|
+
msg = errorInfo;
|
|
150
|
+
}
|
|
151
|
+
if (view == "sel_depart" || view == "sel_user") {
|
|
152
|
+
this.schemaProp["required"] = true;
|
|
153
|
+
} else {
|
|
154
|
+
rules.push({ required: true, message: msg });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (view == "sel_user") {
|
|
158
|
+
if (pattern === "only" && this.onlyValidator) {
|
|
159
|
+
rules.push({ validator: this.onlyValidator });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (view === "list" || view === "radio" || view === "markdown" || view === "pca" || view.indexOf("sel") >= 0 || view === "time") {
|
|
163
|
+
return rules;
|
|
164
|
+
}
|
|
165
|
+
if (view.indexOf("upload") >= 0 || view.indexOf("file") >= 0 || view.indexOf("image") >= 0) {
|
|
166
|
+
return rules;
|
|
167
|
+
}
|
|
168
|
+
if (pattern) {
|
|
169
|
+
if (pattern === "only") {
|
|
170
|
+
if (this.onlyValidator) {
|
|
171
|
+
rules.push({ validator: this.onlyValidator });
|
|
172
|
+
}
|
|
173
|
+
} else if (pattern === "z") {
|
|
174
|
+
if (type == "number" || type == "integer")
|
|
175
|
+
;
|
|
176
|
+
else {
|
|
177
|
+
rules.push({ pattern: /^-?\d+$/, message: "\u8BF7\u8F93\u5165\u6574\u6570" });
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
let msg = errorInfo || "\u6B63\u5219\u8868\u8FBE\u5F0F\u4E0D\u6B63\u786E";
|
|
181
|
+
rules.push({ pattern, message: msg });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return rules;
|
|
185
|
+
}
|
|
186
|
+
addDefaultChangeEvent(schema) {
|
|
187
|
+
if (this.hasChange) {
|
|
188
|
+
if (!schema.componentProps) {
|
|
189
|
+
schema.componentProps = {};
|
|
190
|
+
}
|
|
191
|
+
if (this.disabled == true) {
|
|
192
|
+
schema.componentProps.disabled = true;
|
|
193
|
+
}
|
|
194
|
+
if (!schema.componentProps.hasOwnProperty("onChange")) {
|
|
195
|
+
schema.componentProps["onChange"] = (value) => {
|
|
196
|
+
if (value instanceof Event) {
|
|
197
|
+
value = value.target.value;
|
|
198
|
+
}
|
|
199
|
+
if (value instanceof Array) {
|
|
200
|
+
value = value.join(",");
|
|
201
|
+
}
|
|
202
|
+
if (!this.formRef.value.$formValueChange) {
|
|
203
|
+
console.log("\u5F53\u524D\u8868\u5355\u65E0\u6CD5\u89E6\u53D1change\u4E8B\u4EF6,field\uFF1A" + this.field);
|
|
204
|
+
} else {
|
|
205
|
+
this.formRef.value.$formValueChange(this.field, value);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
Object.keys(this.schemaProp).map((k) => {
|
|
211
|
+
schema[k] = this.schemaProp[k];
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
noChange() {
|
|
215
|
+
this.hasChange = false;
|
|
216
|
+
}
|
|
217
|
+
updateField(field) {
|
|
218
|
+
this.field = field;
|
|
219
|
+
}
|
|
220
|
+
setFunctionForFieldValue(func) {
|
|
221
|
+
if (func) {
|
|
222
|
+
this.setFieldsValue = func;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
asSearchForm() {
|
|
226
|
+
this.searchForm = true;
|
|
227
|
+
}
|
|
228
|
+
getModalAsContainer() {
|
|
229
|
+
let ele = this.getPopContainer();
|
|
230
|
+
return document.querySelector(ele);
|
|
231
|
+
}
|
|
232
|
+
getPopContainer() {
|
|
233
|
+
if (this.searchForm === true) {
|
|
234
|
+
return "body";
|
|
235
|
+
} else {
|
|
236
|
+
return POP_CONTAINER;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
handleWidgetAttr(data) {
|
|
240
|
+
if (data.ui) {
|
|
241
|
+
if (data.ui.widgetattrs) {
|
|
242
|
+
if (data.ui.widgetattrs.disabled == true) {
|
|
243
|
+
this.disabled = true;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
class InputWidget extends IFormSchema {
|
|
250
|
+
getItem() {
|
|
251
|
+
let item = super.getItem();
|
|
252
|
+
if (this.hidden === true) {
|
|
253
|
+
item["show"] = false;
|
|
254
|
+
}
|
|
255
|
+
return item;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
var DateFormat = /* @__PURE__ */ ((DateFormat2) => {
|
|
259
|
+
DateFormat2["datetime"] = "YYYY-MM-DD HH:mm:ss";
|
|
260
|
+
DateFormat2["date"] = "YYYY-MM-DD";
|
|
261
|
+
return DateFormat2;
|
|
262
|
+
})(DateFormat || {});
|
|
263
|
+
class DateWidget extends IFormSchema {
|
|
264
|
+
constructor(key, data) {
|
|
265
|
+
super(key, data);
|
|
266
|
+
this.format = DateFormat[data.view];
|
|
267
|
+
this.showTime = data.view == "date" ? false : true;
|
|
268
|
+
}
|
|
269
|
+
getItem() {
|
|
270
|
+
let item = super.getItem();
|
|
271
|
+
return Object.assign({}, item, {
|
|
272
|
+
component: "DatePicker",
|
|
273
|
+
componentProps: {
|
|
274
|
+
placeholder: `\u8BF7\u9009\u62E9${this.label}`,
|
|
275
|
+
showTime: this.showTime,
|
|
276
|
+
valueFormat: this.format,
|
|
277
|
+
style: {
|
|
278
|
+
width: "100%"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
class SelectWidget extends IFormSchema {
|
|
285
|
+
constructor(key, data) {
|
|
286
|
+
super(key, data);
|
|
287
|
+
this.options = this.getOptions(data["enum"]);
|
|
288
|
+
}
|
|
289
|
+
getItem() {
|
|
290
|
+
let item = super.getItem();
|
|
291
|
+
return Object.assign({}, item, {
|
|
292
|
+
component: "Select",
|
|
293
|
+
componentProps: {
|
|
294
|
+
options: this.options,
|
|
295
|
+
allowClear: true,
|
|
296
|
+
style: {
|
|
297
|
+
width: "100%"
|
|
298
|
+
},
|
|
299
|
+
getPopupContainer: (_node) => {
|
|
300
|
+
return this.getModalAsContainer();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
getOptions(array) {
|
|
306
|
+
if (!array || array.length == 0) {
|
|
307
|
+
return [];
|
|
308
|
+
}
|
|
309
|
+
let arr = [];
|
|
310
|
+
for (let item of array) {
|
|
311
|
+
arr.push({
|
|
312
|
+
value: item.value,
|
|
313
|
+
label: item.title
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return arr;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
class PasswordWidget extends IFormSchema {
|
|
320
|
+
getItem() {
|
|
321
|
+
let item = super.getItem();
|
|
322
|
+
return Object.assign({}, item, {
|
|
323
|
+
component: "InputPassword"
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
class FileWidget extends IFormSchema {
|
|
328
|
+
getItem() {
|
|
329
|
+
let item = super.getItem();
|
|
330
|
+
let componentProps = this.getComponentProps();
|
|
331
|
+
return Object.assign({}, item, {
|
|
332
|
+
component: "JUpload",
|
|
333
|
+
componentProps
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
getComponentProps() {
|
|
337
|
+
let json = this.getExtendData();
|
|
338
|
+
if (json && json.uploadnum) {
|
|
339
|
+
return {
|
|
340
|
+
maxCount: Number(json.uploadnum)
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
return {};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
class ImageWidget extends IFormSchema {
|
|
347
|
+
getItem() {
|
|
348
|
+
let item = super.getItem();
|
|
349
|
+
let componentProps = this.getComponentProps();
|
|
350
|
+
return Object.assign({}, item, {
|
|
351
|
+
component: "JUpload",
|
|
352
|
+
componentProps
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
getComponentProps() {
|
|
356
|
+
let props = {
|
|
357
|
+
fileType: UploadTypeEnum.image
|
|
358
|
+
};
|
|
359
|
+
let json = this.getExtendData();
|
|
360
|
+
if (json && json.uploadnum) {
|
|
361
|
+
props["maxCount"] = Number(json.uploadnum);
|
|
362
|
+
}
|
|
363
|
+
return props;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
class TextAreaWidget extends IFormSchema {
|
|
367
|
+
getItem() {
|
|
368
|
+
let item = super.getItem();
|
|
369
|
+
return Object.assign({}, item, {
|
|
370
|
+
component: "InputTextArea"
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
class SelectMultiWidget extends IFormSchema {
|
|
375
|
+
constructor(key, data) {
|
|
376
|
+
super(key, data);
|
|
377
|
+
this.dictTable = data["dictTable"];
|
|
378
|
+
this.dictText = data["dictText"];
|
|
379
|
+
this.dictCode = data["dictCode"];
|
|
380
|
+
}
|
|
381
|
+
getItem() {
|
|
382
|
+
let item = super.getItem();
|
|
383
|
+
let componentProps = this.getComponentProps();
|
|
384
|
+
return Object.assign({}, item, {
|
|
385
|
+
component: "JSelectMultiple",
|
|
386
|
+
componentProps
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
getComponentProps() {
|
|
390
|
+
if (!this.dictTable && !this.dictCode) {
|
|
391
|
+
return {};
|
|
392
|
+
} else {
|
|
393
|
+
let props = {};
|
|
394
|
+
if (!this.dictTable) {
|
|
395
|
+
props["dictCode"] = this.dictCode;
|
|
396
|
+
} else {
|
|
397
|
+
let temp = `${this.dictTable},${this.dictText},${this.dictCode}`;
|
|
398
|
+
props["dictCode"] = encodeURI(temp);
|
|
399
|
+
}
|
|
400
|
+
props["triggerChange"] = true;
|
|
401
|
+
props["popContainer"] = this.getPopContainer();
|
|
402
|
+
return props;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
class SelectSearchWidget extends IFormSchema {
|
|
407
|
+
constructor(key, data) {
|
|
408
|
+
super(key, data);
|
|
409
|
+
this.dict = encodeURI(`${data.dictTable},${data.dictText},${data.dictCode}`);
|
|
410
|
+
}
|
|
411
|
+
getItem() {
|
|
412
|
+
let item = super.getItem();
|
|
413
|
+
let popContainer = this.getPopContainer();
|
|
414
|
+
return Object.assign({}, item, {
|
|
415
|
+
component: "JSearchSelect",
|
|
416
|
+
componentProps: {
|
|
417
|
+
dict: this.dict,
|
|
418
|
+
pageSize: 6,
|
|
419
|
+
async: true,
|
|
420
|
+
popContainer
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
class PopupWidget extends IFormSchema {
|
|
426
|
+
constructor(key, data) {
|
|
427
|
+
super(key, data);
|
|
428
|
+
this.code = data["code"];
|
|
429
|
+
this.multi = data["popupMulti"];
|
|
430
|
+
this.fieldConfig = this.getFieldConfig(data);
|
|
431
|
+
}
|
|
432
|
+
getItem() {
|
|
433
|
+
let item = super.getItem();
|
|
434
|
+
let componentProps = this.getComponentProps();
|
|
435
|
+
return Object.assign({}, item, {
|
|
436
|
+
component: "JPopup",
|
|
437
|
+
componentProps
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
getComponentProps() {
|
|
441
|
+
let props = {
|
|
442
|
+
code: this.code,
|
|
443
|
+
multi: this.multi,
|
|
444
|
+
fieldConfig: this.fieldConfig
|
|
445
|
+
};
|
|
446
|
+
if (this.formRef) {
|
|
447
|
+
props["formElRef"] = this.formRef;
|
|
448
|
+
} else {
|
|
449
|
+
props["setFieldsValue"] = this.setFieldsValue;
|
|
450
|
+
}
|
|
451
|
+
return props;
|
|
452
|
+
}
|
|
453
|
+
getFieldConfig(data) {
|
|
454
|
+
let { destFields, orgFields } = data;
|
|
455
|
+
if (!destFields || destFields.length == 0) {
|
|
456
|
+
return [];
|
|
457
|
+
}
|
|
458
|
+
let arr1 = destFields.split(",");
|
|
459
|
+
let arr2 = orgFields.split(",");
|
|
460
|
+
let config = [];
|
|
461
|
+
const pre = this.pre;
|
|
462
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
463
|
+
config.push({
|
|
464
|
+
target: pre + arr1[i],
|
|
465
|
+
source: arr2[i]
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
return config;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
class TreeCategoryWidget extends IFormSchema {
|
|
472
|
+
constructor(key, data) {
|
|
473
|
+
super(key, data);
|
|
474
|
+
this.multi = false;
|
|
475
|
+
this.pid = data["pidValue"];
|
|
476
|
+
this.textField = data["textField"];
|
|
477
|
+
}
|
|
478
|
+
getItem() {
|
|
479
|
+
let item = super.getItem();
|
|
480
|
+
let componentProps = this.getComponentProps();
|
|
481
|
+
return Object.assign({}, item, {
|
|
482
|
+
componentProps,
|
|
483
|
+
component: "JCategorySelect"
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
getComponentProps() {
|
|
487
|
+
let pidValue = this.pid || "EMPTY_PID";
|
|
488
|
+
if (!this.textField) {
|
|
489
|
+
return {
|
|
490
|
+
multiple: this.multi,
|
|
491
|
+
pid: pidValue
|
|
492
|
+
};
|
|
493
|
+
} else {
|
|
494
|
+
return {
|
|
495
|
+
loadTriggleChange: true,
|
|
496
|
+
multiple: this.multi,
|
|
497
|
+
pid: pidValue,
|
|
498
|
+
back: this.textField,
|
|
499
|
+
onChange: (_val, backVal) => {
|
|
500
|
+
if (this.formRef) {
|
|
501
|
+
this.formRef.value.setFieldsValue(backVal);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
getRelatedHideFields() {
|
|
508
|
+
let arr = [];
|
|
509
|
+
if (this.textField) {
|
|
510
|
+
arr.push(this.textField);
|
|
511
|
+
}
|
|
512
|
+
return arr;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
class SelectDepartWidget extends IFormSchema {
|
|
516
|
+
getItem() {
|
|
517
|
+
let item = super.getItem();
|
|
518
|
+
let componentProps = this.getComponentProps();
|
|
519
|
+
return Object.assign({}, item, {
|
|
520
|
+
component: "JSelectDept",
|
|
521
|
+
componentProps
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
getComponentProps() {
|
|
525
|
+
let extend = this.getExtendData();
|
|
526
|
+
let props = {
|
|
527
|
+
checkStrictly: true,
|
|
528
|
+
showButton: false
|
|
529
|
+
};
|
|
530
|
+
if (extend.text) {
|
|
531
|
+
props["labelKey"] = extend.text;
|
|
532
|
+
}
|
|
533
|
+
if (extend.store) {
|
|
534
|
+
props["rowKey"] = extend.store;
|
|
535
|
+
}
|
|
536
|
+
if (extend.multiSelect === false) {
|
|
537
|
+
props["multiple"] = false;
|
|
538
|
+
}
|
|
539
|
+
return props;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
class SelectUserWidget extends IFormSchema {
|
|
543
|
+
getItem() {
|
|
544
|
+
let item = super.getItem();
|
|
545
|
+
let componentProps = this.getComponentProps();
|
|
546
|
+
return Object.assign({}, item, {
|
|
547
|
+
component: "JSelectUser",
|
|
548
|
+
componentProps
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
getComponentProps() {
|
|
552
|
+
let extend = this.getExtendData();
|
|
553
|
+
let props = {
|
|
554
|
+
showSelected: false,
|
|
555
|
+
allowClear: true,
|
|
556
|
+
isRadioSelection: false
|
|
557
|
+
};
|
|
558
|
+
if (extend.text) {
|
|
559
|
+
props["labelKey"] = extend.text;
|
|
560
|
+
}
|
|
561
|
+
if (extend.store) {
|
|
562
|
+
props["rowKey"] = extend.store;
|
|
563
|
+
}
|
|
564
|
+
if (extend.multiSelect === false) {
|
|
565
|
+
props["isRadioSelection"] = true;
|
|
566
|
+
}
|
|
567
|
+
return props;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
class EditorWidget extends IFormSchema {
|
|
571
|
+
getItem() {
|
|
572
|
+
let item = super.getItem();
|
|
573
|
+
return Object.assign({}, item, {
|
|
574
|
+
component: "JEditor",
|
|
575
|
+
componentProps: {}
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
class MarkdownWidget extends IFormSchema {
|
|
580
|
+
getItem() {
|
|
581
|
+
let item = super.getItem();
|
|
582
|
+
return Object.assign({}, item, {
|
|
583
|
+
component: "JMarkdownEditor",
|
|
584
|
+
componentProps: {}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
class PcaWidget extends IFormSchema {
|
|
589
|
+
getItem() {
|
|
590
|
+
let item = super.getItem();
|
|
591
|
+
return Object.assign({}, item, {
|
|
592
|
+
component: "JAreaSelect"
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
class TreeSelectWidget extends IFormSchema {
|
|
597
|
+
constructor(key, data) {
|
|
598
|
+
super(key, data);
|
|
599
|
+
this.dict = data["dict"];
|
|
600
|
+
this.pidField = data["pidField"];
|
|
601
|
+
this.pidValue = data["pidValue"];
|
|
602
|
+
}
|
|
603
|
+
getItem() {
|
|
604
|
+
let item = super.getItem();
|
|
605
|
+
return Object.assign({}, item, {
|
|
606
|
+
component: "JTreeSelect",
|
|
607
|
+
componentProps: {
|
|
608
|
+
dict: this.dict,
|
|
609
|
+
pidField: this.pidField,
|
|
610
|
+
pidValue: this.pidValue
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
class RadioWidget extends IFormSchema {
|
|
616
|
+
constructor(key, data) {
|
|
617
|
+
super(key, data);
|
|
618
|
+
this.dictTable = data["dictTable"];
|
|
619
|
+
this.dictText = data["dictText"];
|
|
620
|
+
this.dictCode = data["dictCode"];
|
|
621
|
+
}
|
|
622
|
+
getItem() {
|
|
623
|
+
let item = super.getItem();
|
|
624
|
+
let componentProps = this.getComponentProps();
|
|
625
|
+
return Object.assign({}, item, {
|
|
626
|
+
component: "JDictSelectTag",
|
|
627
|
+
componentProps
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
getComponentProps() {
|
|
631
|
+
if (!this.dictTable && !this.dictCode) {
|
|
632
|
+
return {};
|
|
633
|
+
} else {
|
|
634
|
+
if (!this.dictTable) {
|
|
635
|
+
return {
|
|
636
|
+
dictCode: this.dictCode,
|
|
637
|
+
type: "radio"
|
|
638
|
+
};
|
|
639
|
+
} else {
|
|
640
|
+
let temp = `${this.dictTable},${this.dictText},${this.dictCode}`;
|
|
641
|
+
return {
|
|
642
|
+
dictCode: encodeURI(temp),
|
|
643
|
+
type: "radio"
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
class CheckboxWidget extends IFormSchema {
|
|
650
|
+
constructor(key, data) {
|
|
651
|
+
super(key, data);
|
|
652
|
+
this.options = this.getOptions(data["enum"]);
|
|
653
|
+
}
|
|
654
|
+
getItem() {
|
|
655
|
+
let item = super.getItem();
|
|
656
|
+
return Object.assign({}, item, {
|
|
657
|
+
component: "JCheckbox",
|
|
658
|
+
componentProps: {
|
|
659
|
+
options: this.options,
|
|
660
|
+
triggerChange: true
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
getOptions(array) {
|
|
665
|
+
if (!array || array.length == 0) {
|
|
666
|
+
return [];
|
|
667
|
+
}
|
|
668
|
+
let arr = [];
|
|
669
|
+
for (let item of array) {
|
|
670
|
+
arr.push({
|
|
671
|
+
value: item.value,
|
|
672
|
+
label: item.title
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
return arr;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
class SwitchWidget extends IFormSchema {
|
|
679
|
+
constructor(key, data) {
|
|
680
|
+
super(key, data);
|
|
681
|
+
this.hasChange = false;
|
|
682
|
+
}
|
|
683
|
+
getItem() {
|
|
684
|
+
let item = super.getItem();
|
|
685
|
+
let componentProps = this.getComponentProps();
|
|
686
|
+
return Object.assign({}, item, {
|
|
687
|
+
component: "JSwitch",
|
|
688
|
+
componentProps
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
getComponentProps() {
|
|
692
|
+
let { fieldExtendJson } = this._data;
|
|
693
|
+
let options = ["Y", "N"];
|
|
694
|
+
if (fieldExtendJson) {
|
|
695
|
+
if (typeof fieldExtendJson == "string") {
|
|
696
|
+
let arr = JSON.parse(fieldExtendJson);
|
|
697
|
+
if (arr.length == 2) {
|
|
698
|
+
options = arr;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
return {
|
|
703
|
+
options
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
class TimeWidget extends IFormSchema {
|
|
708
|
+
getItem() {
|
|
709
|
+
let item = super.getItem();
|
|
710
|
+
return Object.assign({}, item, {
|
|
711
|
+
component: "TimePicker",
|
|
712
|
+
componentProps: {
|
|
713
|
+
placeholder: `\u8BF7\u9009\u62E9${this.label}`,
|
|
714
|
+
valueFormat: "HH:mm:ss",
|
|
715
|
+
getPopupContainer: (_node) => {
|
|
716
|
+
return this.getModalAsContainer();
|
|
717
|
+
},
|
|
718
|
+
style: {
|
|
719
|
+
width: "100%"
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
class LinkDownWidget extends IFormSchema {
|
|
726
|
+
constructor(key, data) {
|
|
727
|
+
super(key, data);
|
|
728
|
+
const { dictTable, dictText, dictCode, pidField, idField, origin, condition } = data;
|
|
729
|
+
this.table = dictTable;
|
|
730
|
+
this.txt = dictText;
|
|
731
|
+
this.store = dictCode;
|
|
732
|
+
this.idField = idField;
|
|
733
|
+
this.pidField = pidField;
|
|
734
|
+
this.origin = origin;
|
|
735
|
+
this.condition = condition;
|
|
736
|
+
this.options = [];
|
|
737
|
+
this.next = data.next || "";
|
|
738
|
+
this.type = data.type;
|
|
739
|
+
}
|
|
740
|
+
getItem() {
|
|
741
|
+
let item = super.getItem();
|
|
742
|
+
let componentProps = this.getComponentProps();
|
|
743
|
+
return Object.assign({}, item, {
|
|
744
|
+
component: "OnlineSelectCascade",
|
|
745
|
+
componentProps
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
getComponentProps() {
|
|
749
|
+
let baseProp = {
|
|
750
|
+
table: this.table,
|
|
751
|
+
txt: this.txt,
|
|
752
|
+
store: this.store,
|
|
753
|
+
pidField: this.pidField,
|
|
754
|
+
idField: this.idField,
|
|
755
|
+
origin: this.origin,
|
|
756
|
+
pidValue: "-1",
|
|
757
|
+
style: {
|
|
758
|
+
width: "100%"
|
|
759
|
+
},
|
|
760
|
+
onChange: (value) => {
|
|
761
|
+
console.log("\u7EA7\u8054\u7EC4\u4EF6-onChange", value);
|
|
762
|
+
this.valueChange(value);
|
|
763
|
+
},
|
|
764
|
+
onNext: (pidValue) => {
|
|
765
|
+
console.log("\u7EA7\u8054\u7EC4\u4EF6-onNext", pidValue);
|
|
766
|
+
this.nextOptionsChange(pidValue);
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
if (this._data.origin === true) {
|
|
770
|
+
baseProp["condition"] = this.condition;
|
|
771
|
+
}
|
|
772
|
+
return baseProp;
|
|
773
|
+
}
|
|
774
|
+
nextOptionsChange(pidValue) {
|
|
775
|
+
return __async(this, null, function* () {
|
|
776
|
+
if (!this.formRef) {
|
|
777
|
+
console.error("\u8868\u5355\u5F15\u7528\u627E\u4E0D\u5230");
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
if (!this.next) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
let ref = this.formRef.value;
|
|
784
|
+
yield ref.updateSchema({
|
|
785
|
+
field: this.next,
|
|
786
|
+
componentProps: {
|
|
787
|
+
pidValue
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
valueChange(value) {
|
|
793
|
+
return __async(this, null, function* () {
|
|
794
|
+
if (!this.formRef) {
|
|
795
|
+
console.error("\u8868\u5355\u5F15\u7528\u627E\u4E0D\u5230");
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
if (!this.next) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
let ref = this.formRef.value;
|
|
802
|
+
ref.$formValueChange(this.field, value);
|
|
803
|
+
yield ref.setFieldsValue({ [this.next]: "" });
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
class SlotWidget extends IFormSchema {
|
|
808
|
+
constructor(key, data) {
|
|
809
|
+
super(key, data);
|
|
810
|
+
this.slot = "";
|
|
811
|
+
}
|
|
812
|
+
getItem() {
|
|
813
|
+
let item = super.getItem();
|
|
814
|
+
let slot = this.slot;
|
|
815
|
+
return Object.assign({}, item, { slot });
|
|
816
|
+
}
|
|
817
|
+
groupDate() {
|
|
818
|
+
this.slot = "groupDate";
|
|
819
|
+
return this;
|
|
820
|
+
}
|
|
821
|
+
groupDatetime() {
|
|
822
|
+
this.slot = "groupDatetime";
|
|
823
|
+
return this;
|
|
824
|
+
}
|
|
825
|
+
groupNumber() {
|
|
826
|
+
this.slot = "groupNumber";
|
|
827
|
+
return this;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
class NumberWidget extends IFormSchema {
|
|
831
|
+
constructor(key, data) {
|
|
832
|
+
super(key, data);
|
|
833
|
+
this.dbPointLength = data.dbPointLength;
|
|
834
|
+
}
|
|
835
|
+
getItem() {
|
|
836
|
+
let item = super.getItem();
|
|
837
|
+
let componentProps = this.getComponentProps();
|
|
838
|
+
return Object.assign({}, item, {
|
|
839
|
+
component: "InputNumber",
|
|
840
|
+
componentProps
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
getComponentProps() {
|
|
844
|
+
const props = {
|
|
845
|
+
style: {
|
|
846
|
+
width: "100%"
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
if (this.dbPointLength >= 0) {
|
|
850
|
+
props["precision"] = this.dbPointLength;
|
|
851
|
+
}
|
|
852
|
+
return props;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
class FormSchemaFactory {
|
|
856
|
+
static createFormSchema(key, data) {
|
|
857
|
+
let view = data.view;
|
|
858
|
+
switch (view) {
|
|
859
|
+
case "password":
|
|
860
|
+
return new PasswordWidget(key, data);
|
|
861
|
+
case "list":
|
|
862
|
+
return new SelectWidget(key, data);
|
|
863
|
+
case "radio":
|
|
864
|
+
return new RadioWidget(key, data);
|
|
865
|
+
case "checkbox":
|
|
866
|
+
return new CheckboxWidget(key, data);
|
|
867
|
+
case "date":
|
|
868
|
+
case "datetime":
|
|
869
|
+
return new DateWidget(key, data);
|
|
870
|
+
case "time":
|
|
871
|
+
return new TimeWidget(key, data);
|
|
872
|
+
case "file":
|
|
873
|
+
return new FileWidget(key, data);
|
|
874
|
+
case "image":
|
|
875
|
+
return new ImageWidget(key, data);
|
|
876
|
+
case "textarea":
|
|
877
|
+
return new TextAreaWidget(key, data);
|
|
878
|
+
case "list_multi":
|
|
879
|
+
return new SelectMultiWidget(key, data);
|
|
880
|
+
case "sel_search":
|
|
881
|
+
return new SelectSearchWidget(key, data);
|
|
882
|
+
case "popup":
|
|
883
|
+
return new PopupWidget(key, data);
|
|
884
|
+
case "cat_tree":
|
|
885
|
+
return new TreeCategoryWidget(key, data);
|
|
886
|
+
case "sel_depart":
|
|
887
|
+
return new SelectDepartWidget(key, data);
|
|
888
|
+
case "sel_user":
|
|
889
|
+
return new SelectUserWidget(key, data);
|
|
890
|
+
case "umeditor":
|
|
891
|
+
return new EditorWidget(key, data);
|
|
892
|
+
case "markdown":
|
|
893
|
+
return new MarkdownWidget(key, data);
|
|
894
|
+
case "pca":
|
|
895
|
+
return new PcaWidget(key, data);
|
|
896
|
+
case "link_down":
|
|
897
|
+
return new LinkDownWidget(key, data);
|
|
898
|
+
case "sel_tree":
|
|
899
|
+
return new TreeSelectWidget(key, data);
|
|
900
|
+
case "switch":
|
|
901
|
+
return new SwitchWidget(key, data);
|
|
902
|
+
case "slot":
|
|
903
|
+
return new SlotWidget(key, data);
|
|
904
|
+
case "hidden":
|
|
905
|
+
return new InputWidget(key, data).isHidden();
|
|
906
|
+
default:
|
|
907
|
+
if (data.type == "number") {
|
|
908
|
+
return new NumberWidget(key, data);
|
|
909
|
+
} else {
|
|
910
|
+
return new InputWidget(key, data);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
static createSlotFormSchema(key, data) {
|
|
915
|
+
let slotFs = new SlotWidget(key, data);
|
|
916
|
+
let view = data.view;
|
|
917
|
+
if (view == "date") {
|
|
918
|
+
slotFs.groupDate();
|
|
919
|
+
} else if (view == "datetime") {
|
|
920
|
+
slotFs.groupDatetime();
|
|
921
|
+
} else {
|
|
922
|
+
let type = data.type;
|
|
923
|
+
if (type == "number" || type == "integer") {
|
|
924
|
+
slotFs.groupNumber();
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return slotFs;
|
|
928
|
+
}
|
|
929
|
+
static createIdField() {
|
|
930
|
+
return {
|
|
931
|
+
label: "",
|
|
932
|
+
field: "id",
|
|
933
|
+
component: "Input",
|
|
934
|
+
show: false
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
export { ENHANCEJS as E, FormSchemaFactory as F, SUBMIT_FLOW_KEY as S, VALIDATE_FAILED as V, SUBMIT_FLOW_ID as a, FORM_VIEW_TO_QUERY_VIEW as b, SETUP as c };
|