zhytech-ui-mobile 1.0.0 → 1.0.2

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.
Files changed (84) hide show
  1. package/.eslintignore +11 -0
  2. package/.eslintrc.cjs +253 -0
  3. package/.prettierignore +0 -0
  4. package/.prettierrc.json +9 -0
  5. package/.vscode/settings.json +131 -0
  6. package/index.html +39 -0
  7. package/package.json +4 -26
  8. package/shims-uni.d.ts +7 -0
  9. package/src/App.vue +24 -0
  10. package/src/components/dynamicForm/componentRenderer.vue +207 -0
  11. package/src/components/dynamicForm/components/advanced/index.ts +13 -0
  12. package/src/components/dynamicForm/components/advanced/upload.vue +108 -0
  13. package/src/components/dynamicForm/components/advanced/uploadImage.vue +107 -0
  14. package/src/components/dynamicForm/components/answerSheetPopup/answerSheetItem.vue +58 -0
  15. package/src/components/dynamicForm/components/answerSheetPopup/index.vue +111 -0
  16. package/src/components/dynamicForm/components/application/employee.vue +140 -0
  17. package/src/components/dynamicForm/components/application/grade.vue +183 -0
  18. package/src/components/dynamicForm/components/application/index.ts +14 -0
  19. package/src/components/dynamicForm/components/application/post.vue +136 -0
  20. package/src/components/dynamicForm/components/base/checkbox.vue +143 -0
  21. package/src/components/dynamicForm/components/base/index.ts +15 -0
  22. package/src/components/dynamicForm/components/base/input.vue +99 -0
  23. package/src/components/dynamicForm/components/base/label.vue +29 -0
  24. package/src/components/dynamicForm/components/base/radio.vue +155 -0
  25. package/src/components/dynamicForm/components/componentType.ts +16 -0
  26. package/src/components/dynamicForm/components/layout/groupLayout.vue +103 -0
  27. package/src/components/dynamicForm/components/layout/index.ts +12 -0
  28. package/src/components/dynamicForm/formRenderer.vue +567 -0
  29. package/src/components/dynamicForm/index.ts +21 -0
  30. package/src/components/dynamicForm/types/componentAttribute/advanced/uploadAttribute.ts +35 -0
  31. package/src/components/dynamicForm/types/componentAttribute/application/employeeAttribute.ts +42 -0
  32. package/src/components/dynamicForm/types/componentAttribute/application/gradeAttribute.ts +54 -0
  33. package/src/components/dynamicForm/types/componentAttribute/application/postAttribute.ts +42 -0
  34. package/src/components/dynamicForm/types/componentAttribute/base/checkboxAttribute.ts +38 -0
  35. package/src/components/dynamicForm/types/componentAttribute/base/inputAttribute.ts +31 -0
  36. package/src/components/dynamicForm/types/componentAttribute/base/radioAttribute.ts +30 -0
  37. package/src/components/dynamicForm/types/componentAttribute/baseAttribute.ts +110 -0
  38. package/src/components/dynamicForm/types/componentAttribute/editAttribute.ts +70 -0
  39. package/src/components/dynamicForm/types/componentAttribute/index.ts +37 -0
  40. package/src/components/dynamicForm/types/componentAttribute/layout/groupLayoutAttribute.ts +39 -0
  41. package/src/components/dynamicForm/types/documentView.ts +110 -0
  42. package/src/components/dynamicForm/types/enum.ts +109 -0
  43. package/src/components/dynamicForm/types/formAttribute.ts +93 -0
  44. package/src/components/dynamicForm/types/uploadOption.ts +31 -0
  45. package/src/env.d.ts +8 -0
  46. package/src/hooks/useMessage.ts +44 -0
  47. package/src/hooks/useToast.ts +29 -0
  48. package/src/hooks/useUtils.ts +201 -0
  49. package/src/index.ts +59 -0
  50. package/src/main.ts +19 -0
  51. package/src/manifest.json +72 -0
  52. package/src/pages/dynamicFormDemo.vue +1260 -0
  53. package/src/pages/dynamicFormExaminationDemo.vue +567 -0
  54. package/src/pages.json +58 -0
  55. package/src/shime-uni.d.ts +6 -0
  56. package/src/uni.scss +76 -0
  57. package/src/unocss/index.ts +20 -0
  58. package/src/unocss/rules.ts +139 -0
  59. package/src/unocss/shortcuts.ts +53 -0
  60. package/src/unocss/theme/index.ts +13 -0
  61. package/src/unocss/theme/themeOption/dark.ts +35 -0
  62. package/src/unocss/theme/themeOption/primary.ts +33 -0
  63. package/src/unocss/variants.ts +110 -0
  64. package/tsconfig.json +19 -0
  65. package/uno.config.ts +63 -0
  66. package/vite.config.ts +83 -0
  67. package/dist/build/h5/style.css +0 -1
  68. package/dist/build/h5/zhytech-ui-mobile.es.js +0 -19661
  69. package/dist/build/h5/zhytech-ui-mobile.umd.js +0 -1
  70. package/dist/dev/true/style.css +0 -455
  71. package/dist/dev/true/zhytech-ui-mobile.es.js +0 -3440
  72. package/dist/dev/true/zhytech-ui-mobile.umd.js +0 -3443
  73. /package/{dist/build/h5 → src}/static/iconfont/iconfont.css +0 -0
  74. /package/{dist/build/h5 → src}/static/iconfont/iconfont.ttf +0 -0
  75. /package/{dist/build/h5 → src}/static/iconfont/iconfont.woff +0 -0
  76. /package/{dist/build/h5 → src}/static/iconfont/iconfont.woff2 +0 -0
  77. /package/{dist/build/h5 → src}/static/scss/actionSheet.scss +0 -0
  78. /package/{dist/build/h5 → src}/static/scss/button.scss +0 -0
  79. /package/{dist/build/h5 → src}/static/scss/checkbox.scss +0 -0
  80. /package/{dist/build/h5 → src}/static/scss/form.scss +0 -0
  81. /package/{dist/build/h5 → src}/static/scss/index.scss +0 -0
  82. /package/{dist/build/h5 → src}/static/scss/input.scss +0 -0
  83. /package/{dist/build/h5 → src}/static/scss/picker.scss +0 -0
  84. /package/{dist/build/h5 → src}/static/scss/radio.scss +0 -0
@@ -1,3440 +0,0 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, inject, toRefs, ref, watch, resolveComponent, createVNode, unref, withCtx, Fragment, renderList, createTextVNode, toDisplayString, createBlock, createCommentVNode, provide, reactive, onMounted, computed, resolveDynamicComponent, useCssVars, isRef, nextTick } from "vue";
2
- const __uno = "";
3
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
4
- __name: "iconfont",
5
- props: {
6
- name: {
7
- type: String,
8
- default: "icon-scheduling-request1"
9
- },
10
- size: {
11
- type: String,
12
- default: "40px"
13
- }
14
- },
15
- setup(__props) {
16
- return (_ctx, _cache) => {
17
- return openBlock(), createElementBlock(
18
- "svg",
19
- {
20
- class: normalizeClass(["iconfont", __props.name]),
21
- "aria-hidden": "true",
22
- style: normalizeStyle({ "font-size": __props.size })
23
- },
24
- [
25
- createElementVNode("use", {
26
- "xlink:href": `#${__props.name}`
27
- }, null, 8, ["xlink:href"])
28
- ],
29
- 6
30
- /* CLASS, STYLE */
31
- );
32
- };
33
- }
34
- });
35
- const _export_sfc = (sfc, props) => {
36
- const target = sfc.__vccOpts || sfc;
37
- for (const [key, val] of props) {
38
- target[key] = val;
39
- }
40
- return target;
41
- };
42
- const iconfont = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/iconfont.vue"]]);
43
- var formTypeEnum = /* @__PURE__ */ ((formTypeEnum2) => {
44
- formTypeEnum2["Form"] = "1";
45
- formTypeEnum2["Examination"] = "2";
46
- return formTypeEnum2;
47
- })(formTypeEnum || {});
48
- var examinationStatusEnum = /* @__PURE__ */ ((examinationStatusEnum2) => {
49
- examinationStatusEnum2[examinationStatusEnum2["NotAnswered"] = 1] = "NotAnswered";
50
- examinationStatusEnum2[examinationStatusEnum2["Correct"] = 2] = "Correct";
51
- examinationStatusEnum2[examinationStatusEnum2["Error"] = 3] = "Error";
52
- return examinationStatusEnum2;
53
- })(examinationStatusEnum || {});
54
- var componentTypeEnum = /* @__PURE__ */ ((componentTypeEnum2) => {
55
- componentTypeEnum2["LABEL"] = "label";
56
- componentTypeEnum2["INPUT"] = "input";
57
- componentTypeEnum2["CHECKBOX"] = "checkbox";
58
- componentTypeEnum2["RADIO"] = "radio";
59
- componentTypeEnum2["INPUT_NUMBER"] = "inputNumber";
60
- componentTypeEnum2["DATE"] = "date";
61
- componentTypeEnum2["TIME"] = "time";
62
- componentTypeEnum2["UPLOAD"] = "upload";
63
- componentTypeEnum2["UPLOAD_IMAGE"] = "uploadImage";
64
- componentTypeEnum2["GRADE"] = "grade";
65
- componentTypeEnum2["EMPLOYEE"] = "employee";
66
- componentTypeEnum2["POST"] = "post";
67
- componentTypeEnum2["GROUP_LAYOUT"] = "groupLayout";
68
- componentTypeEnum2["TABS"] = "tabs";
69
- return componentTypeEnum2;
70
- })(componentTypeEnum || {});
71
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
72
- __name: "checkbox",
73
- props: {
74
- /**
75
- * 是否禁用
76
- */
77
- disabled: {
78
- type: Boolean,
79
- default: false
80
- },
81
- /**
82
- * 组件ID
83
- */
84
- componentID: {
85
- type: [String, Number],
86
- required: true
87
- },
88
- /**
89
- * 表单数据
90
- */
91
- datas: {
92
- type: Object,
93
- required: true
94
- },
95
- /**
96
- * 组件属性
97
- */
98
- componentProps: {
99
- type: Object,
100
- required: true
101
- },
102
- /**
103
- * 是否项目说明/答案解析
104
- */
105
- showDescription: {
106
- type: Boolean,
107
- default: false
108
- }
109
- },
110
- emits: ["update:datas"],
111
- setup(__props, { emit: __emit }) {
112
- const props = __props;
113
- const formType = inject("formType");
114
- const realTimeDisplayAnswerMode = inject("realTimeDisplayAnswerMode");
115
- const everyItemDisplayAnalysisSwitch = inject("everyItemDisplayAnalysisSwitch");
116
- const { datas, componentProps } = toRefs(props);
117
- const emits = __emit;
118
- const displayAnswerDescription = ref(false);
119
- const change = (values) => {
120
- var _a, _b;
121
- if (formType.value === formTypeEnum.Examination && realTimeDisplayAnswerMode && (values == null ? void 0 : values.length) && ((_a = componentProps.value.correctOptions) == null ? void 0 : _a.length)) {
122
- const errorValue = values == null ? void 0 : values.find((value) => {
123
- var _a2;
124
- return !((_a2 = componentProps.value.correctOptions) == null ? void 0 : _a2.includes(value));
125
- });
126
- if (!errorValue && ((_b = componentProps.value.correctOptions) == null ? void 0 : _b.length) === values.length) {
127
- componentProps.value.examinationStatus = examinationStatusEnum.Correct;
128
- componentProps.value.color = "#000000";
129
- displayAnswerDescription.value = false;
130
- } else {
131
- componentProps.value.examinationStatus = examinationStatusEnum.Error;
132
- componentProps.value.color = "#ff0000";
133
- displayAnswerDescription.value = true;
134
- }
135
- }
136
- componentProps.value.options.forEach((option) => {
137
- const inputKey = `${props.componentID}||${option.value}`;
138
- if (!(values ?? []).includes(option.value) && datas.value[inputKey]) {
139
- delete datas.value[inputKey];
140
- }
141
- });
142
- };
143
- watch(
144
- datas,
145
- (newValue) => {
146
- change(newValue == null ? void 0 : newValue[props.componentID]);
147
- emits("update:datas", newValue);
148
- },
149
- { deep: true, immediate: true }
150
- );
151
- return (_ctx, _cache) => {
152
- const _component_wd_checkbox = resolveComponent("wd-checkbox");
153
- const _component_wd_input = resolveComponent("wd-input");
154
- const _component_wd_checkbox_group = resolveComponent("wd-checkbox-group");
155
- return openBlock(), createElementBlock("div", { class: "zhy-form-component-checkbox" }, [
156
- createVNode(_component_wd_checkbox_group, {
157
- "custom-class": "zhy",
158
- modelValue: unref(datas)[__props.componentID],
159
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(datas)[__props.componentID] = $event),
160
- disabled: __props.disabled,
161
- min: unref(componentProps).min,
162
- max: unref(componentProps).max,
163
- inline: !unref(componentProps).newLine
164
- }, {
165
- default: withCtx(() => [
166
- (openBlock(true), createElementBlock(
167
- Fragment,
168
- null,
169
- renderList(unref(componentProps).options, (item, index2) => {
170
- var _a;
171
- return openBlock(), createElementBlock(
172
- Fragment,
173
- { key: index2 },
174
- [
175
- createVNode(_component_wd_checkbox, {
176
- modelValue: item.value,
177
- shape: "square"
178
- }, {
179
- default: withCtx(() => [
180
- createTextVNode(
181
- toDisplayString(item.label),
182
- 1
183
- /* TEXT */
184
- )
185
- ]),
186
- _: 2
187
- /* DYNAMIC */
188
- }, 1032, ["modelValue"]),
189
- item.inputEnable && ((_a = unref(datas)[__props.componentID]) == null ? void 0 : _a.includes(item.value)) ? (openBlock(), createBlock(_component_wd_input, {
190
- key: 0,
191
- "custom-class": "zhy ml-20!",
192
- type: "text",
193
- placeholder: "",
194
- clearable: true,
195
- clearTrigger: "focus",
196
- modelValue: unref(datas)[`${__props.componentID}||${item.value}`],
197
- "onUpdate:modelValue": ($event) => unref(datas)[`${__props.componentID}||${item.value}`] = $event
198
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
199
- ],
200
- 64
201
- /* STABLE_FRAGMENT */
202
- );
203
- }),
204
- 128
205
- /* KEYED_FRAGMENT */
206
- ))
207
- ]),
208
- _: 1
209
- /* STABLE */
210
- }, 8, ["modelValue", "disabled", "min", "max", "inline"]),
211
- unref(displayAnswerDescription) || __props.showDescription && (unref(formType) === unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
212
- key: 0,
213
- class: "description"
214
- }, [
215
- createVNode(iconfont, {
216
- name: "icon-tip",
217
- size: "20px",
218
- onTap: _cache[1] || (_cache[1] = ($event) => displayAnswerDescription.value = false)
219
- }),
220
- createTextVNode(
221
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
222
- 1
223
- /* TEXT */
224
- )
225
- ])) : unref(everyItemDisplayAnalysisSwitch) ? (openBlock(), createBlock(iconfont, {
226
- key: 1,
227
- name: "icon-tip",
228
- size: "20px",
229
- onTap: _cache[2] || (_cache[2] = ($event) => displayAnswerDescription.value = true)
230
- })) : createCommentVNode("v-if", true)
231
- ]);
232
- };
233
- }
234
- });
235
- const checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/base/checkbox.vue"]]);
236
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
237
- __name: "input",
238
- props: {
239
- /**
240
- * 是否禁用
241
- */
242
- disabled: {
243
- type: Boolean,
244
- default: false
245
- },
246
- /**
247
- * 是否只读
248
- */
249
- readonly: {
250
- type: Boolean,
251
- default: false
252
- },
253
- /**
254
- * 组件ID
255
- */
256
- componentID: {
257
- type: [String, Number],
258
- required: true
259
- },
260
- /**
261
- * 表单数据
262
- */
263
- datas: {
264
- type: Object,
265
- required: true
266
- },
267
- /**
268
- * 组件属性
269
- */
270
- componentProps: {
271
- type: Object,
272
- required: true
273
- },
274
- /**
275
- * 是否项目说明/答案解析
276
- */
277
- showDescription: {
278
- type: Boolean,
279
- default: false
280
- }
281
- },
282
- emits: ["update:datas"],
283
- setup(__props, { emit: __emit }) {
284
- const props = __props;
285
- const formType = inject("formType");
286
- const everyItemDisplayAnalysisSwitch = inject("everyItemDisplayAnalysisSwitch");
287
- const displayAnswerDescription = ref(false);
288
- const { datas, componentProps } = toRefs(props);
289
- const emits = __emit;
290
- watch(datas, (newValue) => emits("update:datas", newValue));
291
- return (_ctx, _cache) => {
292
- const _component_wd_input = resolveComponent("wd-input");
293
- return openBlock(), createElementBlock("view", { class: "zhy-form-component-input" }, [
294
- createVNode(_component_wd_input, {
295
- type: unref(componentProps).type,
296
- "custom-class": "zhy",
297
- modelValue: unref(datas)[__props.componentID],
298
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(datas)[__props.componentID] = $event),
299
- placeholder: unref(componentProps).placeholder,
300
- clearable: unref(componentProps).clearable,
301
- disabled: __props.disabled,
302
- readonly: __props.readonly,
303
- clearTrigger: "focus"
304
- }, null, 8, ["type", "modelValue", "placeholder", "clearable", "disabled", "readonly"]),
305
- unref(displayAnswerDescription) || __props.showDescription && (unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
306
- key: 0,
307
- class: "description"
308
- }, [
309
- createVNode(iconfont, {
310
- name: "icon-tip",
311
- size: "20px",
312
- onTap: _cache[1] || (_cache[1] = ($event) => displayAnswerDescription.value = false)
313
- }),
314
- createTextVNode(
315
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
316
- 1
317
- /* TEXT */
318
- )
319
- ])) : unref(everyItemDisplayAnalysisSwitch) ? (openBlock(), createBlock(iconfont, {
320
- key: 1,
321
- name: "icon-tip",
322
- size: "20px",
323
- onTap: _cache[2] || (_cache[2] = ($event) => displayAnswerDescription.value = true)
324
- })) : createCommentVNode("v-if", true)
325
- ]);
326
- };
327
- }
328
- });
329
- const input = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/base/input.vue"]]);
330
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
331
- __name: "label",
332
- props: {
333
- componentProps: {
334
- type: Object,
335
- required: true
336
- }
337
- },
338
- setup(__props) {
339
- return (_ctx, _cache) => {
340
- const _component_wd_text = resolveComponent("wd-text");
341
- return openBlock(), createBlock(_component_wd_text, {
342
- "custom-class": "zhy",
343
- text: __props.componentProps.label,
344
- size: `${__props.componentProps.fontSize > 14 ? __props.componentProps.fontSize : 14}px`,
345
- bold: __props.componentProps.isBold,
346
- color: __props.componentProps.color
347
- }, null, 8, ["text", "size", "bold", "color"]);
348
- };
349
- }
350
- });
351
- const label = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/base/label.vue"]]);
352
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
353
- __name: "radio",
354
- props: {
355
- /**
356
- * 是否禁用
357
- */
358
- disabled: {
359
- type: Boolean,
360
- default: false
361
- },
362
- /**
363
- * 组件ID
364
- */
365
- componentID: {
366
- type: [String, Number],
367
- required: true
368
- },
369
- /**
370
- * 表单数据
371
- */
372
- datas: {
373
- type: Object,
374
- required: true
375
- },
376
- /**
377
- * 组件属性
378
- */
379
- componentProps: {
380
- type: Object,
381
- required: true
382
- },
383
- /**
384
- * 是否项目说明/答案解析
385
- */
386
- showDescription: {
387
- type: Boolean,
388
- default: false
389
- }
390
- },
391
- emits: ["update:datas"],
392
- setup(__props, { emit: __emit }) {
393
- const props = __props;
394
- const formType = inject("formType");
395
- const realTimeDisplayAnswerMode = inject("realTimeDisplayAnswerMode");
396
- const everyItemDisplayAnalysisSwitch = inject("everyItemDisplayAnalysisSwitch");
397
- const { datas, componentProps } = toRefs(props);
398
- const emits = __emit;
399
- watch(datas, (newValue) => emits("update:datas", newValue));
400
- let oldValue = datas.value[props.componentID];
401
- const displayAnswerDescription = ref(false);
402
- const change = (value) => {
403
- var _a, _b;
404
- if (formType.value === formTypeEnum.Examination && realTimeDisplayAnswerMode && value && ((_a = componentProps.value.correctOptions) == null ? void 0 : _a.length)) {
405
- if ((_b = componentProps.value.correctOptions) == null ? void 0 : _b.includes(value)) {
406
- componentProps.value.examinationStatus = examinationStatusEnum.Correct;
407
- componentProps.value.color = "#000000";
408
- displayAnswerDescription.value = false;
409
- } else {
410
- componentProps.value.examinationStatus = examinationStatusEnum.Error;
411
- componentProps.value.color = "#ff0000";
412
- displayAnswerDescription.value = true;
413
- }
414
- }
415
- componentProps.value.options.forEach((option) => {
416
- const inputKey = `${props.componentID}||${option.value}`;
417
- if (value !== option.value && datas.value[inputKey]) {
418
- delete datas.value[inputKey];
419
- }
420
- });
421
- };
422
- change(datas.value[props.componentID]);
423
- const clearCheck = (event, value) => {
424
- if (componentProps.value.clearable && oldValue === value) {
425
- delete datas.value[props.componentID];
426
- oldValue = void 0;
427
- const inputKey = `${props.componentID}||${value}`;
428
- datas.value[inputKey] && delete datas.value[inputKey];
429
- event.preventDefault();
430
- return;
431
- }
432
- oldValue = value;
433
- };
434
- return (_ctx, _cache) => {
435
- const _component_wd_radio = resolveComponent("wd-radio");
436
- const _component_wd_input = resolveComponent("wd-input");
437
- const _component_wd_radio_group = resolveComponent("wd-radio-group");
438
- return openBlock(), createElementBlock("div", { class: "zhy-form-component-radio" }, [
439
- createVNode(_component_wd_radio_group, {
440
- "custom-class": "zhy",
441
- modelValue: unref(datas)[__props.componentID],
442
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(datas)[__props.componentID] = $event),
443
- disabled: __props.disabled,
444
- inline: !unref(componentProps).newLine,
445
- "icon-placement": "left",
446
- shape: "dot",
447
- onChange: change
448
- }, {
449
- default: withCtx(() => [
450
- (openBlock(true), createElementBlock(
451
- Fragment,
452
- null,
453
- renderList(unref(componentProps).options, (item, index2) => {
454
- var _a;
455
- return openBlock(), createElementBlock(
456
- Fragment,
457
- { key: index2 },
458
- [
459
- createVNode(_component_wd_radio, {
460
- value: item.value,
461
- onClick: ($event) => clearCheck($event, item.value)
462
- }, {
463
- default: withCtx(() => [
464
- createTextVNode(
465
- toDisplayString(item.label),
466
- 1
467
- /* TEXT */
468
- )
469
- ]),
470
- _: 2
471
- /* DYNAMIC */
472
- }, 1032, ["value", "onClick"]),
473
- item.inputEnable && ((_a = unref(datas)[__props.componentID]) == null ? void 0 : _a.includes(item.value)) ? (openBlock(), createBlock(_component_wd_input, {
474
- key: 0,
475
- "custom-class": "zhy ml-20!",
476
- type: "text",
477
- placeholder: "",
478
- clearable: true,
479
- clearTrigger: "focus",
480
- modelValue: unref(datas)[`${__props.componentID}||${item.value}`],
481
- "onUpdate:modelValue": ($event) => unref(datas)[`${__props.componentID}||${item.value}`] = $event
482
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
483
- ],
484
- 64
485
- /* STABLE_FRAGMENT */
486
- );
487
- }),
488
- 128
489
- /* KEYED_FRAGMENT */
490
- ))
491
- ]),
492
- _: 1
493
- /* STABLE */
494
- }, 8, ["modelValue", "disabled", "inline"]),
495
- unref(displayAnswerDescription) || __props.showDescription && (unref(formType) === unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
496
- key: 0,
497
- class: "description"
498
- }, [
499
- createVNode(iconfont, {
500
- name: "icon-tip",
501
- size: "20px",
502
- onTap: _cache[1] || (_cache[1] = ($event) => displayAnswerDescription.value = false)
503
- }),
504
- createTextVNode(
505
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
506
- 1
507
- /* TEXT */
508
- )
509
- ])) : unref(everyItemDisplayAnalysisSwitch) ? (openBlock(), createBlock(iconfont, {
510
- key: 1,
511
- name: "icon-tip",
512
- size: "20px",
513
- onTap: _cache[2] || (_cache[2] = ($event) => displayAnswerDescription.value = true)
514
- })) : createCommentVNode("v-if", true)
515
- ]);
516
- };
517
- }
518
- });
519
- const radio = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/base/radio.vue"]]);
520
- const baseComponent = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
521
- __proto__: null,
522
- checkbox,
523
- input,
524
- label,
525
- radio
526
- }, Symbol.toStringTag, { value: "Module" }));
527
- function deepClone(obj, cache = /* @__PURE__ */ new Map()) {
528
- if (obj === null || typeof obj !== "object") {
529
- return obj;
530
- }
531
- if (isDate(obj)) {
532
- return new Date(obj.getTime());
533
- }
534
- if (obj instanceof RegExp) {
535
- return new RegExp(obj.source, obj.flags);
536
- }
537
- if (obj instanceof Error) {
538
- const errorCopy = new Error(obj.message);
539
- errorCopy.stack = obj.stack;
540
- return errorCopy;
541
- }
542
- if (cache.has(obj)) {
543
- return cache.get(obj);
544
- }
545
- const copy = Array.isArray(obj) ? [] : {};
546
- cache.set(obj, copy);
547
- for (const key in obj) {
548
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
549
- copy[key] = deepClone(obj[key], cache);
550
- }
551
- }
552
- return copy;
553
- }
554
- function deepMerge(target, source) {
555
- target = deepClone(target);
556
- if (typeof target !== "object" || typeof source !== "object") {
557
- throw new Error("Both target and source must be objects.");
558
- }
559
- for (const prop in source) {
560
- if (!source.hasOwnProperty(prop))
561
- continue;
562
- target[prop] = source[prop];
563
- }
564
- return target;
565
- }
566
- const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
567
- const toastDefaultOptionKey = "__TOAST_OPTION__";
568
- const defaultOptions$1 = {
569
- duration: 2e3,
570
- show: false
571
- };
572
- const None$1 = Symbol("None");
573
- function useToast$1(selector = "") {
574
- const toastOptionKey = getToastOptionKey(selector);
575
- const toastOption = inject(toastOptionKey, ref(None$1));
576
- if (toastOption.value === None$1) {
577
- toastOption.value = defaultOptions$1;
578
- provide(toastOptionKey, toastOption);
579
- }
580
- let timer = null;
581
- const createMethod = (toastOptions) => {
582
- return (options) => {
583
- return show(deepMerge(toastOptions, typeof options === "string" ? { msg: options } : options));
584
- };
585
- };
586
- const show = (option) => {
587
- const options = deepMerge(defaultOptions$1, typeof option === "string" ? { msg: option } : option);
588
- toastOption.value = deepMerge(options, {
589
- show: true
590
- });
591
- timer && clearTimeout(timer);
592
- if (toastOption.value.duration && toastOption.value.duration > 0) {
593
- timer = setTimeout(() => {
594
- timer && clearTimeout(timer);
595
- close();
596
- }, options.duration);
597
- }
598
- };
599
- const loading = createMethod({
600
- iconName: "loading",
601
- duration: 0,
602
- cover: true
603
- });
604
- const success = createMethod({
605
- iconName: "success",
606
- duration: 1500
607
- });
608
- const error = createMethod({ iconName: "error" });
609
- const warning = createMethod({ iconName: "warning" });
610
- const info = createMethod({ iconName: "info" });
611
- const close = () => {
612
- toastOption.value = { show: false };
613
- };
614
- return {
615
- show,
616
- loading,
617
- success,
618
- error,
619
- warning,
620
- info,
621
- close
622
- };
623
- }
624
- const getToastOptionKey = (selector) => {
625
- return selector ? `${toastDefaultOptionKey}${selector}` : toastDefaultOptionKey;
626
- };
627
- const messageDefaultOptionKey = "__MESSAGE_OPTION__";
628
- const None = Symbol("None");
629
- const defaultOptions = {
630
- title: "",
631
- showCancelButton: false,
632
- show: false,
633
- closeOnClickModal: true,
634
- msg: "",
635
- type: "alert",
636
- inputType: "text",
637
- inputValue: "",
638
- showErr: false,
639
- zIndex: 99,
640
- lazyRender: true,
641
- inputError: ""
642
- };
643
- function useMessage$1(selector = "") {
644
- const messageOptionKey = selector ? messageDefaultOptionKey + selector : messageDefaultOptionKey;
645
- const messageOption = inject(messageOptionKey, ref(None));
646
- if (messageOption.value === None) {
647
- messageOption.value = defaultOptions;
648
- provide(messageOptionKey, messageOption);
649
- }
650
- const createMethod = (type) => {
651
- return (options) => {
652
- const messageOptions = deepMerge({ type }, typeof options === "string" ? { title: options } : options);
653
- if (messageOptions.type === "confirm" || messageOptions.type === "prompt") {
654
- messageOptions.showCancelButton = true;
655
- } else {
656
- messageOptions.showCancelButton = false;
657
- }
658
- return show(messageOptions);
659
- };
660
- };
661
- const show = (option) => {
662
- return new Promise((resolve, reject) => {
663
- const options = deepMerge(defaultOptions, typeof option === "string" ? { title: option } : option);
664
- messageOption.value = deepMerge(options, {
665
- show: true,
666
- success: (res) => {
667
- close();
668
- resolve(res);
669
- },
670
- fail: (res) => {
671
- close();
672
- reject(res);
673
- }
674
- });
675
- });
676
- };
677
- const alert = createMethod("alert");
678
- const confirm = createMethod("confirm");
679
- const prompt = createMethod("prompt");
680
- const close = () => {
681
- if (messageOption.value !== None) {
682
- messageOption.value.show = false;
683
- }
684
- };
685
- return {
686
- show,
687
- alert,
688
- confirm,
689
- prompt,
690
- close
691
- };
692
- }
693
- const zhCN = {
694
- calendar: {
695
- placeholder: "请选择",
696
- title: "选择日期",
697
- day: "日",
698
- week: "周",
699
- month: "月",
700
- confirm: "确定",
701
- startTime: "开始时间",
702
- endTime: "结束时间",
703
- to: "至",
704
- timeFormat: "YY年MM月DD日 HH:mm:ss",
705
- dateFormat: "YYYY年MM月DD日",
706
- weekFormat: (year, week) => `${year} 第 ${week} 周`,
707
- startWeek: "开始周",
708
- endWeek: "结束周",
709
- startMonth: "开始月",
710
- endMonth: "结束月",
711
- monthFormat: "YYYY年MM月"
712
- },
713
- calendarView: {
714
- startTime: "开始",
715
- endTime: "结束",
716
- weeks: {
717
- sun: "日",
718
- mon: "一",
719
- tue: "二",
720
- wed: "三",
721
- thu: "四",
722
- fri: "五",
723
- sat: "六"
724
- },
725
- rangePrompt: (maxRange) => `选择天数不能超过${maxRange}天`,
726
- rangePromptWeek: (maxRange) => `选择周数不能超过${maxRange}周`,
727
- rangePromptMonth: (maxRange) => `选择月份不能超过${maxRange}个月`,
728
- monthTitle: "YYYY年M月",
729
- yearTitle: "YYYY年",
730
- month: "M月",
731
- hour: (value) => `${value}时`,
732
- minute: (value) => `${value}分`,
733
- second: (value) => `${value}秒`
734
- },
735
- collapse: {
736
- expand: "展开",
737
- retract: "收起"
738
- },
739
- colPicker: {
740
- title: "请选择",
741
- placeholder: "请选择",
742
- select: "请选择"
743
- },
744
- datetimePicker: {
745
- start: "开始时间",
746
- end: "结束时间",
747
- to: "至",
748
- placeholder: "请选择",
749
- confirm: "完成",
750
- cancel: "取消"
751
- },
752
- loadmore: {
753
- loading: "正在努力加载中...",
754
- finished: "已加载完毕",
755
- error: "加载失败",
756
- retry: "点击重试"
757
- },
758
- messageBox: {
759
- inputPlaceholder: "请输入",
760
- confirm: "确定",
761
- cancel: "取消",
762
- inputNoValidate: "输入的数据不合法"
763
- },
764
- numberKeyboard: {
765
- confirm: "完成"
766
- },
767
- pagination: {
768
- prev: "上一页",
769
- next: "下一页",
770
- page: (value) => `当前页:${value}`,
771
- total: (total) => `当前数据:${total}条`,
772
- size: (size) => `分页大小:${size}`
773
- },
774
- picker: {
775
- cancel: "取消",
776
- done: "完成",
777
- placeholder: "请选择"
778
- },
779
- imgCropper: {
780
- confirm: "完成",
781
- cancel: "取消"
782
- },
783
- search: {
784
- search: "搜索",
785
- cancel: "取消"
786
- },
787
- steps: {
788
- wait: "未开始",
789
- finished: "已完成",
790
- process: "进行中",
791
- failed: "失败"
792
- },
793
- tabs: {
794
- all: "全部"
795
- },
796
- upload: {
797
- error: "上传失败"
798
- },
799
- input: {
800
- placeholder: "请输入..."
801
- },
802
- selectPicker: {
803
- title: "请选择",
804
- placeholder: "请选择",
805
- select: "请选择",
806
- confirm: "确认",
807
- filterPlaceholder: "搜索"
808
- },
809
- tag: {
810
- placeholder: "请输入",
811
- add: "新增标签"
812
- },
813
- textarea: {
814
- placeholder: "请输入..."
815
- },
816
- tableCol: {
817
- indexLabel: "序号"
818
- },
819
- signature: {
820
- confirmText: "确认",
821
- clearText: "清空",
822
- revokeText: "撤销",
823
- restoreText: "恢复"
824
- }
825
- };
826
- ref("zh-CN");
827
- reactive({
828
- "zh-CN": zhCN
829
- });
830
- var SECONDS_A_MINUTE = 60;
831
- var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
832
- var SECONDS_A_DAY = SECONDS_A_HOUR * 24;
833
- var SECONDS_A_WEEK = SECONDS_A_DAY * 7;
834
- var MILLISECONDS_A_SECOND = 1e3;
835
- var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
836
- var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
837
- var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
838
- var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND;
839
- var MS = "millisecond";
840
- var S = "second";
841
- var MIN = "minute";
842
- var H = "hour";
843
- var D = "day";
844
- var W = "week";
845
- var M = "month";
846
- var Q = "quarter";
847
- var Y = "year";
848
- var DATE = "date";
849
- var FORMAT_DEFAULT = "YYYY-MM-DDTHH:mm:ssZ";
850
- var INVALID_DATE_STRING = "Invalid Date";
851
- var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
852
- var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
853
- const en = {
854
- name: "en",
855
- weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
856
- months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
857
- ordinal: function ordinal(n) {
858
- var s = ["th", "st", "nd", "rd"];
859
- var v = n % 100;
860
- return "[" + n + (s[(v - 20) % 10] || s[v] || s[0]) + "]";
861
- }
862
- };
863
- var padStart = function padStart2(string, length, pad) {
864
- var s = String(string);
865
- if (!s || s.length >= length)
866
- return string;
867
- return "" + Array(length + 1 - s.length).join(pad) + string;
868
- };
869
- var padZoneStr = function padZoneStr2(instance) {
870
- var negMinutes = -instance.utcOffset();
871
- var minutes = Math.abs(negMinutes);
872
- var hourOffset = Math.floor(minutes / 60);
873
- var minuteOffset = minutes % 60;
874
- return (negMinutes <= 0 ? "+" : "-") + padStart(hourOffset, 2, "0") + ":" + padStart(minuteOffset, 2, "0");
875
- };
876
- var monthDiff = function monthDiff2(a, b) {
877
- if (a.date() < b.date())
878
- return -monthDiff2(b, a);
879
- var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());
880
- var anchor = a.clone().add(wholeMonthDiff, M);
881
- var c = b - anchor < 0;
882
- var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), M);
883
- return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);
884
- };
885
- var absFloor = function absFloor2(n) {
886
- return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
887
- };
888
- var prettyUnit = function prettyUnit2(u) {
889
- var special = {
890
- M,
891
- y: Y,
892
- w: W,
893
- d: D,
894
- D: DATE,
895
- h: H,
896
- m: MIN,
897
- s: S,
898
- ms: MS,
899
- Q
900
- };
901
- return special[u] || String(u || "").toLowerCase().replace(/s$/, "");
902
- };
903
- var isUndefined = function isUndefined2(s) {
904
- return s === void 0;
905
- };
906
- const U = {
907
- s: padStart,
908
- z: padZoneStr,
909
- m: monthDiff,
910
- a: absFloor,
911
- p: prettyUnit,
912
- u: isUndefined
913
- };
914
- var L = "en";
915
- var Ls = {};
916
- Ls[L] = en;
917
- var IS_DAYJS = "$isDayjsObject";
918
- var isDayjs = function isDayjs2(d) {
919
- return d instanceof Dayjs || !!(d && d[IS_DAYJS]);
920
- };
921
- var parseLocale = function parseLocale2(preset, object, isLocal) {
922
- var l;
923
- if (!preset)
924
- return L;
925
- if (typeof preset === "string") {
926
- var presetLower = preset.toLowerCase();
927
- if (Ls[presetLower]) {
928
- l = presetLower;
929
- }
930
- if (object) {
931
- Ls[presetLower] = object;
932
- l = presetLower;
933
- }
934
- var presetSplit = preset.split("-");
935
- if (!l && presetSplit.length > 1) {
936
- return parseLocale2(presetSplit[0]);
937
- }
938
- } else {
939
- var name = preset.name;
940
- Ls[name] = preset;
941
- l = name;
942
- }
943
- if (!isLocal && l)
944
- L = l;
945
- return l || !isLocal && L;
946
- };
947
- var dayjs = function dayjs2(date, c) {
948
- if (isDayjs(date)) {
949
- return date.clone();
950
- }
951
- var cfg = typeof c === "object" ? c : {};
952
- cfg.date = date;
953
- cfg.args = arguments;
954
- return new Dayjs(cfg);
955
- };
956
- var wrapper = function wrapper2(date, instance) {
957
- return dayjs(date, {
958
- locale: instance.$L,
959
- utc: instance.$u,
960
- x: instance.$x,
961
- $offset: instance.$offset
962
- // todo: refactor; do not use this.$offset in you code
963
- });
964
- };
965
- var Utils = U;
966
- Utils.l = parseLocale;
967
- Utils.i = isDayjs;
968
- Utils.w = wrapper;
969
- var parseDate = function parseDate2(cfg) {
970
- var date = cfg.date, utc = cfg.utc;
971
- if (date === null)
972
- return /* @__PURE__ */ new Date(NaN);
973
- if (Utils.u(date))
974
- return /* @__PURE__ */ new Date();
975
- if (date instanceof Date)
976
- return new Date(date);
977
- if (typeof date === "string" && !/Z$/i.test(date)) {
978
- var d = date.match(REGEX_PARSE);
979
- if (d) {
980
- var m = d[2] - 1 || 0;
981
- var ms = (d[7] || "0").substring(0, 3);
982
- if (utc) {
983
- return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));
984
- }
985
- return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
986
- }
987
- }
988
- return new Date(date);
989
- };
990
- var Dayjs = /* @__PURE__ */ function() {
991
- function Dayjs2(cfg) {
992
- this.$L = parseLocale(cfg.locale, null, true);
993
- this.parse(cfg);
994
- this.$x = this.$x || cfg.x || {};
995
- this[IS_DAYJS] = true;
996
- }
997
- var _proto = Dayjs2.prototype;
998
- _proto.parse = function parse(cfg) {
999
- this.$d = parseDate(cfg);
1000
- this.init();
1001
- };
1002
- _proto.init = function init() {
1003
- var $d = this.$d;
1004
- this.$y = $d.getFullYear();
1005
- this.$M = $d.getMonth();
1006
- this.$D = $d.getDate();
1007
- this.$W = $d.getDay();
1008
- this.$H = $d.getHours();
1009
- this.$m = $d.getMinutes();
1010
- this.$s = $d.getSeconds();
1011
- this.$ms = $d.getMilliseconds();
1012
- };
1013
- _proto.$utils = function $utils() {
1014
- return Utils;
1015
- };
1016
- _proto.isValid = function isValid() {
1017
- return !(this.$d.toString() === INVALID_DATE_STRING);
1018
- };
1019
- _proto.isSame = function isSame(that, units) {
1020
- var other = dayjs(that);
1021
- return this.startOf(units) <= other && other <= this.endOf(units);
1022
- };
1023
- _proto.isAfter = function isAfter(that, units) {
1024
- return dayjs(that) < this.startOf(units);
1025
- };
1026
- _proto.isBefore = function isBefore(that, units) {
1027
- return this.endOf(units) < dayjs(that);
1028
- };
1029
- _proto.$g = function $g(input2, get, set) {
1030
- if (Utils.u(input2))
1031
- return this[get];
1032
- return this.set(set, input2);
1033
- };
1034
- _proto.unix = function unix() {
1035
- return Math.floor(this.valueOf() / 1e3);
1036
- };
1037
- _proto.valueOf = function valueOf() {
1038
- return this.$d.getTime();
1039
- };
1040
- _proto.startOf = function startOf(units, _startOf) {
1041
- var _this = this;
1042
- var isStartOf = !Utils.u(_startOf) ? _startOf : true;
1043
- var unit = Utils.p(units);
1044
- var instanceFactory = function instanceFactory2(d, m) {
1045
- var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this);
1046
- return isStartOf ? ins : ins.endOf(D);
1047
- };
1048
- var instanceFactorySet = function instanceFactorySet2(method, slice) {
1049
- var argumentStart = [0, 0, 0, 0];
1050
- var argumentEnd = [23, 59, 59, 999];
1051
- return Utils.w(_this.toDate()[method].apply(
1052
- // eslint-disable-line prefer-spread
1053
- _this.toDate("s"),
1054
- (isStartOf ? argumentStart : argumentEnd).slice(slice)
1055
- ), _this);
1056
- };
1057
- var $W = this.$W, $M = this.$M, $D = this.$D;
1058
- var utcPad = "set" + (this.$u ? "UTC" : "");
1059
- switch (unit) {
1060
- case Y:
1061
- return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);
1062
- case M:
1063
- return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);
1064
- case W: {
1065
- var weekStart = this.$locale().weekStart || 0;
1066
- var gap = ($W < weekStart ? $W + 7 : $W) - weekStart;
1067
- return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);
1068
- }
1069
- case D:
1070
- case DATE:
1071
- return instanceFactorySet(utcPad + "Hours", 0);
1072
- case H:
1073
- return instanceFactorySet(utcPad + "Minutes", 1);
1074
- case MIN:
1075
- return instanceFactorySet(utcPad + "Seconds", 2);
1076
- case S:
1077
- return instanceFactorySet(utcPad + "Milliseconds", 3);
1078
- default:
1079
- return this.clone();
1080
- }
1081
- };
1082
- _proto.endOf = function endOf(arg) {
1083
- return this.startOf(arg, false);
1084
- };
1085
- _proto.$set = function $set(units, _int) {
1086
- var _C$D$C$DATE$C$M$C$Y$C;
1087
- var unit = Utils.p(units);
1088
- var utcPad = "set" + (this.$u ? "UTC" : "");
1089
- var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[D] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[DATE] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[M] = utcPad + "Month", _C$D$C$DATE$C$M$C$Y$C[Y] = utcPad + "FullYear", _C$D$C$DATE$C$M$C$Y$C[H] = utcPad + "Hours", _C$D$C$DATE$C$M$C$Y$C[MIN] = utcPad + "Minutes", _C$D$C$DATE$C$M$C$Y$C[S] = utcPad + "Seconds", _C$D$C$DATE$C$M$C$Y$C[MS] = utcPad + "Milliseconds", _C$D$C$DATE$C$M$C$Y$C)[unit];
1090
- var arg = unit === D ? this.$D + (_int - this.$W) : _int;
1091
- if (unit === M || unit === Y) {
1092
- var date = this.clone().set(DATE, 1);
1093
- date.$d[name](arg);
1094
- date.init();
1095
- this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d;
1096
- } else if (name)
1097
- this.$d[name](arg);
1098
- this.init();
1099
- return this;
1100
- };
1101
- _proto.set = function set(string, _int2) {
1102
- return this.clone().$set(string, _int2);
1103
- };
1104
- _proto.get = function get(unit) {
1105
- return this[Utils.p(unit)]();
1106
- };
1107
- _proto.add = function add(number, units) {
1108
- var _this2 = this, _C$MIN$C$H$C$S$unit;
1109
- number = Number(number);
1110
- var unit = Utils.p(units);
1111
- var instanceFactorySet = function instanceFactorySet2(n) {
1112
- var d = dayjs(_this2);
1113
- return Utils.w(d.date(d.date() + Math.round(n * number)), _this2);
1114
- };
1115
- if (unit === M) {
1116
- return this.set(M, this.$M + number);
1117
- }
1118
- if (unit === Y) {
1119
- return this.set(Y, this.$y + number);
1120
- }
1121
- if (unit === D) {
1122
- return instanceFactorySet(1);
1123
- }
1124
- if (unit === W) {
1125
- return instanceFactorySet(7);
1126
- }
1127
- var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[MIN] = MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[H] = MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[S] = MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1;
1128
- var nextTimeStamp = this.$d.getTime() + number * step;
1129
- return Utils.w(nextTimeStamp, this);
1130
- };
1131
- _proto.subtract = function subtract(number, string) {
1132
- return this.add(number * -1, string);
1133
- };
1134
- _proto.format = function format(formatStr) {
1135
- var _this3 = this;
1136
- var locale = this.$locale();
1137
- if (!this.isValid())
1138
- return locale.invalidDate || INVALID_DATE_STRING;
1139
- var str = formatStr || FORMAT_DEFAULT;
1140
- var zoneStr = Utils.z(this);
1141
- var $H = this.$H, $m = this.$m, $M = this.$M;
1142
- var weekdays = locale.weekdays, months = locale.months, meridiem = locale.meridiem;
1143
- var getShort = function getShort2(arr, index2, full, length) {
1144
- return arr && (arr[index2] || arr(_this3, str)) || full[index2].slice(0, length);
1145
- };
1146
- var get$H = function get$H2(num) {
1147
- return Utils.s($H % 12 || 12, num, "0");
1148
- };
1149
- var meridiemFunc = meridiem || function(hour, minute, isLowercase) {
1150
- var m = hour < 12 ? "AM" : "PM";
1151
- return isLowercase ? m.toLowerCase() : m;
1152
- };
1153
- var matches = function matches2(match) {
1154
- switch (match) {
1155
- case "YY":
1156
- return String(_this3.$y).slice(-2);
1157
- case "YYYY":
1158
- return Utils.s(_this3.$y, 4, "0");
1159
- case "M":
1160
- return $M + 1;
1161
- case "MM":
1162
- return Utils.s($M + 1, 2, "0");
1163
- case "MMM":
1164
- return getShort(locale.monthsShort, $M, months, 3);
1165
- case "MMMM":
1166
- return getShort(months, $M);
1167
- case "D":
1168
- return _this3.$D;
1169
- case "DD":
1170
- return Utils.s(_this3.$D, 2, "0");
1171
- case "d":
1172
- return String(_this3.$W);
1173
- case "dd":
1174
- return getShort(locale.weekdaysMin, _this3.$W, weekdays, 2);
1175
- case "ddd":
1176
- return getShort(locale.weekdaysShort, _this3.$W, weekdays, 3);
1177
- case "dddd":
1178
- return weekdays[_this3.$W];
1179
- case "H":
1180
- return String($H);
1181
- case "HH":
1182
- return Utils.s($H, 2, "0");
1183
- case "h":
1184
- return get$H(1);
1185
- case "hh":
1186
- return get$H(2);
1187
- case "a":
1188
- return meridiemFunc($H, $m, true);
1189
- case "A":
1190
- return meridiemFunc($H, $m, false);
1191
- case "m":
1192
- return String($m);
1193
- case "mm":
1194
- return Utils.s($m, 2, "0");
1195
- case "s":
1196
- return String(_this3.$s);
1197
- case "ss":
1198
- return Utils.s(_this3.$s, 2, "0");
1199
- case "SSS":
1200
- return Utils.s(_this3.$ms, 3, "0");
1201
- case "Z":
1202
- return zoneStr;
1203
- }
1204
- return null;
1205
- };
1206
- return str.replace(REGEX_FORMAT, function(match, $1) {
1207
- return $1 || matches(match) || zoneStr.replace(":", "");
1208
- });
1209
- };
1210
- _proto.utcOffset = function utcOffset() {
1211
- return -Math.round(this.$d.getTimezoneOffset() / 15) * 15;
1212
- };
1213
- _proto.diff = function diff(input2, units, _float) {
1214
- var _this4 = this;
1215
- var unit = Utils.p(units);
1216
- var that = dayjs(input2);
1217
- var zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE;
1218
- var diff2 = this - that;
1219
- var getMonth = function getMonth2() {
1220
- return Utils.m(_this4, that);
1221
- };
1222
- var result;
1223
- switch (unit) {
1224
- case Y:
1225
- result = getMonth() / 12;
1226
- break;
1227
- case M:
1228
- result = getMonth();
1229
- break;
1230
- case Q:
1231
- result = getMonth() / 3;
1232
- break;
1233
- case W:
1234
- result = (diff2 - zoneDelta) / MILLISECONDS_A_WEEK;
1235
- break;
1236
- case D:
1237
- result = (diff2 - zoneDelta) / MILLISECONDS_A_DAY;
1238
- break;
1239
- case H:
1240
- result = diff2 / MILLISECONDS_A_HOUR;
1241
- break;
1242
- case MIN:
1243
- result = diff2 / MILLISECONDS_A_MINUTE;
1244
- break;
1245
- case S:
1246
- result = diff2 / MILLISECONDS_A_SECOND;
1247
- break;
1248
- default:
1249
- result = diff2;
1250
- break;
1251
- }
1252
- return _float ? result : Utils.a(result);
1253
- };
1254
- _proto.daysInMonth = function daysInMonth() {
1255
- return this.endOf(M).$D;
1256
- };
1257
- _proto.$locale = function $locale() {
1258
- return Ls[this.$L];
1259
- };
1260
- _proto.locale = function locale(preset, object) {
1261
- if (!preset)
1262
- return this.$L;
1263
- var that = this.clone();
1264
- var nextLocaleName = parseLocale(preset, object, true);
1265
- if (nextLocaleName)
1266
- that.$L = nextLocaleName;
1267
- return that;
1268
- };
1269
- _proto.clone = function clone() {
1270
- return Utils.w(this.$d, this);
1271
- };
1272
- _proto.toDate = function toDate() {
1273
- return new Date(this.valueOf());
1274
- };
1275
- _proto.toJSON = function toJSON() {
1276
- return this.isValid() ? this.toISOString() : null;
1277
- };
1278
- _proto.toISOString = function toISOString() {
1279
- return this.$d.toISOString();
1280
- };
1281
- _proto.toString = function toString() {
1282
- return this.$d.toUTCString();
1283
- };
1284
- return Dayjs2;
1285
- }();
1286
- var proto = Dayjs.prototype;
1287
- dayjs.prototype = proto;
1288
- [["$ms", MS], ["$s", S], ["$m", MIN], ["$H", H], ["$W", D], ["$M", M], ["$y", Y], ["$D", DATE]].forEach(function(g) {
1289
- proto[g[1]] = function(input2) {
1290
- return this.$g(input2, g[0], g[1]);
1291
- };
1292
- });
1293
- dayjs.extend = function(plugin, option) {
1294
- if (!plugin.$i) {
1295
- plugin(option, Dayjs, dayjs);
1296
- plugin.$i = true;
1297
- }
1298
- return dayjs;
1299
- };
1300
- dayjs.locale = parseLocale;
1301
- dayjs.isDayjs = isDayjs;
1302
- dayjs.unix = function(timestamp) {
1303
- return dayjs(timestamp * 1e3);
1304
- };
1305
- dayjs.en = Ls[L];
1306
- dayjs.Ls = Ls;
1307
- dayjs.p = {};
1308
- function useToast() {
1309
- const toast = useToast$1();
1310
- return {
1311
- /**
1312
- * @description: 显示提示信息
1313
- * @param type 信息类型,可选值:success、error、warning、info
1314
- * @param messageContent 消息内容
1315
- * @param position 位置
1316
- * @return
1317
- */
1318
- showToast(type, messageContent, position = "bottom") {
1319
- toast[type]({
1320
- msg: messageContent,
1321
- position
1322
- });
1323
- }
1324
- };
1325
- }
1326
- function useUtils() {
1327
- const { showToast } = useToast();
1328
- const isEmpty = (param) => {
1329
- if (param instanceof Array) {
1330
- return !param || param.length === 0;
1331
- }
1332
- if (param instanceof Object) {
1333
- return !param || Object.keys(param).length === 0;
1334
- }
1335
- if (typeof param === "boolean" || param instanceof Boolean) {
1336
- return false;
1337
- }
1338
- return !param && param !== 0;
1339
- };
1340
- const computedExpression = (expression) => {
1341
- let fun = Function;
1342
- return new fun("return " + expression)();
1343
- };
1344
- const isPrimitive = (obj) => {
1345
- return typeof obj !== "object" && typeof obj !== "function" || obj === null;
1346
- };
1347
- const convertObjectToFormData = (objectToConvert, rootName, existingFormData) => {
1348
- let formData = existingFormData || new FormData();
1349
- if (rootName && isPrimitive(objectToConvert)) {
1350
- objectToConvert && formData.append(rootName, objectToConvert);
1351
- return formData;
1352
- }
1353
- for (let property in objectToConvert) {
1354
- if (!Object.prototype.hasOwnProperty.call(objectToConvert, property)) {
1355
- continue;
1356
- }
1357
- let formKey = rootName ? `${rootName}[${property}]` : property;
1358
- if (objectToConvert[property] instanceof File) {
1359
- formData.append(`${rootName}.${property}`, objectToConvert[property]);
1360
- continue;
1361
- }
1362
- if (Array.isArray(objectToConvert[property])) {
1363
- if (objectToConvert[property].every((item) => item instanceof File)) {
1364
- objectToConvert[property].forEach((item) => {
1365
- formData.append(`${rootName}.${property}`, item);
1366
- });
1367
- continue;
1368
- }
1369
- objectToConvert[property].forEach((item, index2) => {
1370
- let arrayFormKey = `${formKey}[${index2}]`;
1371
- convertObjectToFormData(item, arrayFormKey, formData);
1372
- });
1373
- continue;
1374
- }
1375
- if (typeof objectToConvert[property] === "object") {
1376
- convertObjectToFormData(objectToConvert[property], formKey, formData);
1377
- continue;
1378
- }
1379
- objectToConvert[property] && formData.append(formKey, objectToConvert[property]);
1380
- }
1381
- return formData;
1382
- };
1383
- const maxSizeOptions = {
1384
- kb: (size) => 1024 * size,
1385
- mb: (size) => 1024 * 1024 * size,
1386
- gb: (size) => 1024 * 1024 * 1024 * size
1387
- };
1388
- return {
1389
- /**
1390
- * @description: 判断是否是微信浏览器打开
1391
- * @return
1392
- */
1393
- isWechatBrowser() {
1394
- if (!(navigator == null ? void 0 : navigator.userAgent)) {
1395
- return false;
1396
- }
1397
- const userAgent = navigator.userAgent.toLowerCase();
1398
- return userAgent.indexOf("micromessenger") !== -1;
1399
- },
1400
- /**
1401
- * @description: 计算表达式,实现eval函数功能,解决使用eval时编译报错
1402
- * @param expression
1403
- * @return
1404
- */
1405
- computedExpression,
1406
- /**
1407
- * @description: 判断参数是否为空
1408
- * @param T param
1409
- * @return
1410
- */
1411
- isEmpty,
1412
- /**
1413
- * @description: 判断参数是否为空
1414
- * @param T obj
1415
- * @param reserveEmptyArray 是否保留空数组,默认不保留
1416
- * @return
1417
- */
1418
- removeEmptyAttribute(obj, reserveEmptyArray) {
1419
- return Object.entries(obj).reduce((acc, [key, value]) => {
1420
- const empty = isEmpty(value);
1421
- if (!empty || empty && reserveEmptyArray && value instanceof Array) {
1422
- acc[key] = value;
1423
- }
1424
- return acc;
1425
- }, {});
1426
- },
1427
- /**
1428
- * 将JavaScript对象转换为FormData对象,以便可以通过HTTP请求发送。
1429
- * @param {Object} objectToConvert - 要转换的JavaScript对象。
1430
- * @param {string} [rootName] - 在生成的FormData对象中,objectToConvert对象的属性的基础名称。
1431
- * @param {FormData} [existingFormData] - 可选的FormData对象,如果提供,将在此对象上添加新的字段。
1432
- * @returns {FormData} - 包含objectToConvert对象属性的FormData对象。
1433
- */
1434
- convertObjectToFormData,
1435
- /**
1436
- * @description: 检查上传的文件是否合法
1437
- * @param file 要上传的文件
1438
- * @param files 已上传的文件
1439
- * @param size 文件限制大小
1440
- * @param unit 文件限制大小的单位
1441
- * @param isImage 是否为图片
1442
- * @return
1443
- */
1444
- checkFile(file, files, size, unit, isImage) {
1445
- const fileSize = file.size;
1446
- const fileType = isImage ? "图片" : "文件";
1447
- if (!fileSize) {
1448
- showToast("error", `无效${fileType},请重新选择!`);
1449
- return false;
1450
- }
1451
- if (isImage && file.type.indexOf("image") === -1) {
1452
- showToast("error", "不是有效的图片文件或图片格式不支持,请重新选择!");
1453
- return false;
1454
- }
1455
- const maxSize = maxSizeOptions[unit.toLowerCase()](size);
1456
- if (fileSize > maxSize) {
1457
- showToast("error", `最大可以上传${size}${unit}的${fileType},请重新选择!`);
1458
- return false;
1459
- }
1460
- const index2 = files.findIndex((tempFile) => tempFile.name === file.name);
1461
- if (index2 !== -1) {
1462
- showToast("error", `${fileType}重复,请重新选择!`);
1463
- return false;
1464
- }
1465
- return true;
1466
- },
1467
- /**
1468
- * @description: 将对象格式化为页面跳转参数字符串
1469
- * @param params
1470
- * @param any
1471
- * @return
1472
- */
1473
- toQueryParams(params) {
1474
- return Object.keys(params).map((key) => `${key}=${params[key] ?? ""}`).join("&");
1475
- }
1476
- };
1477
- }
1478
- function useMessage() {
1479
- const message = useMessage$1();
1480
- return {
1481
- /**
1482
- * @description: 显示提示信息
1483
- * @param messageContent 消息内容
1484
- * @return
1485
- */
1486
- alert(messageContent) {
1487
- message.alert(messageContent);
1488
- },
1489
- /**
1490
- * @description: 显示确认信息
1491
- * @param messageContent 消息内容
1492
- * @param title 标题
1493
- * @param callback 回调方法
1494
- * @return
1495
- */
1496
- confirm(messageContent, title, callback) {
1497
- message.confirm({
1498
- msg: messageContent,
1499
- title
1500
- }).then(() => {
1501
- return callback == null ? void 0 : callback(true);
1502
- }).catch(() => {
1503
- return callback == null ? void 0 : callback(false);
1504
- });
1505
- }
1506
- };
1507
- }
1508
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1509
- __name: "upload",
1510
- props: {
1511
- /**
1512
- * 组件ID
1513
- */
1514
- componentID: {
1515
- type: [String, Number],
1516
- required: true
1517
- },
1518
- /**
1519
- * 表单数据
1520
- */
1521
- datas: {
1522
- type: Object,
1523
- required: true
1524
- },
1525
- /**
1526
- * 组件属性
1527
- */
1528
- componentProps: {
1529
- type: Object,
1530
- required: true
1531
- },
1532
- /**
1533
- * 是否项目说明/答案解析
1534
- */
1535
- showDescription: {
1536
- type: Boolean,
1537
- default: false
1538
- }
1539
- },
1540
- setup(__props) {
1541
- const props = __props;
1542
- const formType = inject("formType");
1543
- const { checkFile } = useUtils();
1544
- const upload2 = ref();
1545
- const uploadOptions = inject("uploadOptions");
1546
- const { datas, componentProps } = toRefs(props);
1547
- const fileList = ref(datas.value[props.componentID] ?? []);
1548
- const { confirm } = useMessage();
1549
- const beforeRemove = ({ file, fileList: fileList2, resolve }) => {
1550
- confirm("确定删除该文件吗?", "提示", (flag) => {
1551
- if (flag) {
1552
- datas.value[props.componentID] = datas.value[props.componentID].filter((item) => item.name !== file.name);
1553
- }
1554
- resolve(flag);
1555
- });
1556
- };
1557
- const beforeUpload = ({ files, fileList: fileList2, resolve }) => {
1558
- let errorNumber = 0;
1559
- files.forEach((file) => {
1560
- const checkPass = checkFile(file, fileList2, componentProps.value.fileSize, componentProps.value.fileSizeUnit, false);
1561
- if (!checkPass) {
1562
- errorNumber++;
1563
- }
1564
- });
1565
- if (errorNumber === 0) {
1566
- if (!datas.value[props.componentID]) {
1567
- datas.value[props.componentID] = [];
1568
- }
1569
- datas.value[props.componentID] = [...datas.value[props.componentID], ...files];
1570
- resolve(true);
1571
- }
1572
- resolve(false);
1573
- };
1574
- return (_ctx, _cache) => {
1575
- var _a, _b;
1576
- const _component_wd_button = resolveComponent("wd-button");
1577
- const _component_wd_upload = resolveComponent("wd-upload");
1578
- const _component_wd_message_box = resolveComponent("wd-message-box");
1579
- return openBlock(), createElementBlock("div", { class: "zhy-form-component-upload" }, [
1580
- createVNode(_component_wd_upload, {
1581
- ref_key: "upload",
1582
- ref: upload2,
1583
- "file-list": unref(fileList),
1584
- action: unref(uploadOptions).serverApi,
1585
- multiple: unref(componentProps).multiple,
1586
- limit: unref(componentProps).fileLimit,
1587
- "auto-upload": (_a = unref(uploadOptions)) == null ? void 0 : _a.autoUpload,
1588
- extension: (_b = unref(componentProps).fileType) == null ? void 0 : _b.split(","),
1589
- accept: "all",
1590
- "before-upload": beforeUpload,
1591
- "before-remove": beforeRemove
1592
- }, {
1593
- default: withCtx(() => [
1594
- createVNode(_component_wd_button, null, {
1595
- default: withCtx(() => [
1596
- createTextVNode("上传文件")
1597
- ]),
1598
- _: 1
1599
- /* STABLE */
1600
- })
1601
- ]),
1602
- _: 1
1603
- /* STABLE */
1604
- }, 8, ["file-list", "action", "multiple", "limit", "auto-upload", "extension"]),
1605
- __props.showDescription && (unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
1606
- key: 0,
1607
- class: "description"
1608
- }, [
1609
- createVNode(iconfont, {
1610
- name: "icon-tip",
1611
- size: "20px"
1612
- }),
1613
- createTextVNode(
1614
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
1615
- 1
1616
- /* TEXT */
1617
- )
1618
- ])) : createCommentVNode("v-if", true),
1619
- createCommentVNode(" message消息的挂载点。 "),
1620
- createVNode(_component_wd_message_box)
1621
- ]);
1622
- };
1623
- }
1624
- });
1625
- const upload = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/advanced/upload.vue"]]);
1626
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1627
- __name: "uploadImage",
1628
- props: {
1629
- /**
1630
- * 组件ID
1631
- */
1632
- componentID: {
1633
- type: [String, Number],
1634
- required: true
1635
- },
1636
- /**
1637
- * 表单数据
1638
- */
1639
- datas: {
1640
- type: Object,
1641
- required: true
1642
- },
1643
- /**
1644
- * 组件属性
1645
- */
1646
- componentProps: {
1647
- type: Object,
1648
- required: true
1649
- },
1650
- /**
1651
- * 是否项目说明/答案解析
1652
- */
1653
- showDescription: {
1654
- type: Boolean,
1655
- default: false
1656
- }
1657
- },
1658
- setup(__props) {
1659
- const props = __props;
1660
- const formType = inject("formType");
1661
- const { checkFile } = useUtils();
1662
- const upload2 = ref();
1663
- const uploadOptions = inject("uploadOptions");
1664
- const { datas, componentProps } = toRefs(props);
1665
- const fileList = ref(datas.value[props.componentID] ?? []);
1666
- const { confirm } = useMessage();
1667
- const beforeRemove = ({ file, resolve }) => {
1668
- confirm("确定删除该文件吗?", "提示", (flag) => {
1669
- if (flag) {
1670
- datas.value[props.componentID] = datas.value[props.componentID].filter((item) => item.name !== file.name);
1671
- }
1672
- resolve(flag);
1673
- });
1674
- };
1675
- const beforeUpload = ({ files, fileList: fileList2, resolve }) => {
1676
- let errorNumber = 0;
1677
- files.forEach((file) => {
1678
- const checkPass = checkFile(file, fileList2, componentProps.value.fileSize, componentProps.value.fileSizeUnit, false);
1679
- if (!checkPass) {
1680
- errorNumber++;
1681
- }
1682
- });
1683
- if (errorNumber === 0) {
1684
- if (!datas.value[props.componentID]) {
1685
- datas.value[props.componentID] = [];
1686
- }
1687
- datas.value[props.componentID] = [...datas.value[props.componentID], ...files];
1688
- resolve(true);
1689
- }
1690
- resolve(false);
1691
- };
1692
- return (_ctx, _cache) => {
1693
- var _a, _b;
1694
- const _component_wd_upload = resolveComponent("wd-upload");
1695
- const _component_wd_message_box = resolveComponent("wd-message-box");
1696
- return openBlock(), createElementBlock("div", { class: "zhy-form-component-upload-image" }, [
1697
- createVNode(_component_wd_upload, {
1698
- ref_key: "upload",
1699
- ref: upload2,
1700
- "file-list": unref(fileList),
1701
- action: unref(uploadOptions).serverApi,
1702
- multiple: unref(componentProps).multiple,
1703
- limit: unref(componentProps).fileLimit,
1704
- "auto-upload": (_a = unref(uploadOptions)) == null ? void 0 : _a.autoUpload,
1705
- extension: (_b = unref(componentProps).fileType) == null ? void 0 : _b.split(","),
1706
- accept: "media",
1707
- "before-upload": beforeUpload,
1708
- "before-remove": beforeRemove
1709
- }, null, 8, ["file-list", "action", "multiple", "limit", "auto-upload", "extension"]),
1710
- __props.showDescription && (unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
1711
- key: 0,
1712
- class: "description"
1713
- }, [
1714
- createVNode(iconfont, {
1715
- name: "icon-tip",
1716
- size: "20px"
1717
- }),
1718
- createTextVNode(
1719
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
1720
- 1
1721
- /* TEXT */
1722
- )
1723
- ])) : createCommentVNode("v-if", true),
1724
- createCommentVNode(" message消息的挂载点。 "),
1725
- createVNode(_component_wd_message_box)
1726
- ]);
1727
- };
1728
- }
1729
- });
1730
- const uploadImage = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/advanced/uploadImage.vue"]]);
1731
- const advancedComponent = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1732
- __proto__: null,
1733
- upload,
1734
- uploadImage
1735
- }, Symbol.toStringTag, { value: "Module" }));
1736
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1737
- __name: "employee",
1738
- props: {
1739
- /**
1740
- * 是否禁用
1741
- */
1742
- disabled: {
1743
- type: Boolean,
1744
- default: false
1745
- },
1746
- /**
1747
- * 组件ID
1748
- */
1749
- componentID: {
1750
- type: [String, Number],
1751
- required: true
1752
- },
1753
- /**
1754
- * 表单数据
1755
- */
1756
- datas: {
1757
- type: Object,
1758
- required: true
1759
- },
1760
- /**
1761
- * 组件属性
1762
- */
1763
- componentProps: {
1764
- type: Object,
1765
- required: true
1766
- },
1767
- /**
1768
- * 是否项目说明/答案解析
1769
- */
1770
- showDescription: {
1771
- type: Boolean,
1772
- default: false
1773
- }
1774
- },
1775
- emits: ["update:datas"],
1776
- setup(__props, { emit: __emit }) {
1777
- const props = __props;
1778
- const formType = inject("formType");
1779
- const { datas, componentProps } = toRefs(props);
1780
- const emits = __emit;
1781
- watch(datas, (newValue) => emits("update:datas", newValue));
1782
- const employee2 = ref({});
1783
- onMounted(async () => {
1784
- confirm(datas.value[props.componentID]);
1785
- });
1786
- const confirm = (data) => {
1787
- employee2.value = (data == null ? void 0 : data.selectedItems) ?? {};
1788
- datas.value[props.componentID] = employee2.value.value;
1789
- };
1790
- let oldValue = datas.value[props.componentID];
1791
- const clearCheck = (event, value) => {
1792
- if (componentProps.value.clearable && oldValue === value) {
1793
- delete datas.value[props.componentID];
1794
- oldValue = void 0;
1795
- event.preventDefault();
1796
- return;
1797
- }
1798
- oldValue = value;
1799
- };
1800
- return (_ctx, _cache) => {
1801
- const _component_wd_radio = resolveComponent("wd-radio");
1802
- const _component_wd_radio_group = resolveComponent("wd-radio-group");
1803
- const _component_wd_checkbox = resolveComponent("wd-checkbox");
1804
- const _component_wd_checkbox_group = resolveComponent("wd-checkbox-group");
1805
- const _component_wd_input = resolveComponent("wd-input");
1806
- const _component_wd_picker = resolveComponent("wd-picker");
1807
- return openBlock(), createElementBlock("view", { class: "zhy-form-component-employee" }, [
1808
- unref(componentProps).type === "radio" ? (openBlock(), createBlock(_component_wd_radio_group, {
1809
- key: 0,
1810
- "custom-class": "zhy",
1811
- modelValue: unref(datas)[__props.componentID],
1812
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(datas)[__props.componentID] = $event),
1813
- disabled: __props.disabled,
1814
- inline: !unref(componentProps).newLine,
1815
- "icon-placement": "left",
1816
- shape: "dot"
1817
- }, {
1818
- default: withCtx(() => [
1819
- (openBlock(true), createElementBlock(
1820
- Fragment,
1821
- null,
1822
- renderList(unref(componentProps).options, (employee22, index2) => {
1823
- return openBlock(), createBlock(_component_wd_radio, {
1824
- key: index2,
1825
- value: employee22.value,
1826
- onClick: ($event) => clearCheck($event, employee22.value)
1827
- }, {
1828
- default: withCtx(() => [
1829
- createTextVNode(
1830
- toDisplayString(employee22.label),
1831
- 1
1832
- /* TEXT */
1833
- )
1834
- ]),
1835
- _: 2
1836
- /* DYNAMIC */
1837
- }, 1032, ["value", "onClick"]);
1838
- }),
1839
- 128
1840
- /* KEYED_FRAGMENT */
1841
- ))
1842
- ]),
1843
- _: 1
1844
- /* STABLE */
1845
- }, 8, ["modelValue", "disabled", "inline"])) : createCommentVNode("v-if", true),
1846
- unref(componentProps).type === "checkbox" ? (openBlock(), createBlock(_component_wd_checkbox_group, {
1847
- key: 1,
1848
- "custom-class": "zhy",
1849
- modelValue: unref(datas)[__props.componentID],
1850
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(datas)[__props.componentID] = $event),
1851
- disabled: __props.disabled,
1852
- min: unref(componentProps).min,
1853
- max: unref(componentProps).max,
1854
- inline: !unref(componentProps).newLine
1855
- }, {
1856
- default: withCtx(() => [
1857
- (openBlock(true), createElementBlock(
1858
- Fragment,
1859
- null,
1860
- renderList(unref(componentProps).options, (employee22, index2) => {
1861
- return openBlock(), createBlock(_component_wd_checkbox, {
1862
- key: index2,
1863
- modelValue: employee22.value,
1864
- shape: "square"
1865
- }, {
1866
- default: withCtx(() => [
1867
- createTextVNode(
1868
- toDisplayString(employee22.label),
1869
- 1
1870
- /* TEXT */
1871
- )
1872
- ]),
1873
- _: 2
1874
- /* DYNAMIC */
1875
- }, 1032, ["modelValue"]);
1876
- }),
1877
- 128
1878
- /* KEYED_FRAGMENT */
1879
- ))
1880
- ]),
1881
- _: 1
1882
- /* STABLE */
1883
- }, 8, ["modelValue", "disabled", "min", "max", "inline"])) : createCommentVNode("v-if", true),
1884
- unref(componentProps).type === "selector" ? (openBlock(), createBlock(_component_wd_picker, {
1885
- key: 2,
1886
- "custom-class": "zhy",
1887
- modelValue: unref(employee2).value,
1888
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(employee2).value = $event),
1889
- columns: unref(componentProps).options,
1890
- disabled: __props.disabled,
1891
- "use-default-slot": "",
1892
- onConfirm: confirm
1893
- }, {
1894
- default: withCtx(() => [
1895
- createVNode(_component_wd_input, {
1896
- "custom-class": "zhy",
1897
- type: "text",
1898
- modelValue: unref(employee2).label,
1899
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(employee2).label = $event),
1900
- placeholder: `请选择${unref(componentProps).label}`,
1901
- readonly: ""
1902
- }, null, 8, ["modelValue", "placeholder"])
1903
- ]),
1904
- _: 1
1905
- /* STABLE */
1906
- }, 8, ["modelValue", "columns", "disabled"])) : createCommentVNode("v-if", true),
1907
- __props.showDescription && (unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
1908
- key: 3,
1909
- class: "description"
1910
- }, [
1911
- createVNode(iconfont, {
1912
- name: "icon-tip",
1913
- size: "20px"
1914
- }),
1915
- createTextVNode(
1916
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
1917
- 1
1918
- /* TEXT */
1919
- )
1920
- ])) : createCommentVNode("v-if", true)
1921
- ]);
1922
- };
1923
- }
1924
- });
1925
- const employee = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/application/employee.vue"]]);
1926
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1927
- __name: "grade",
1928
- props: {
1929
- /**
1930
- * 是否禁用
1931
- */
1932
- disabled: {
1933
- type: Boolean,
1934
- default: false
1935
- },
1936
- /**
1937
- * 组件ID
1938
- */
1939
- componentID: {
1940
- type: [String, Number],
1941
- required: true
1942
- },
1943
- /**
1944
- * 表单数据
1945
- */
1946
- datas: {
1947
- type: Object,
1948
- required: true
1949
- },
1950
- /**
1951
- * 组件属性
1952
- */
1953
- componentProps: {
1954
- type: Object,
1955
- required: true
1956
- },
1957
- /**
1958
- * 是否项目说明/答案解析
1959
- */
1960
- showDescription: {
1961
- type: Boolean,
1962
- default: false
1963
- }
1964
- },
1965
- emits: ["update:datas"],
1966
- setup(__props, { emit: __emit }) {
1967
- const props = __props;
1968
- const formType = inject("formType");
1969
- const { datas, componentProps } = toRefs(props);
1970
- const emits = __emit;
1971
- watch(datas, (newValue) => emits("update:datas", newValue));
1972
- const data = ref(datas.value[props.componentID] || {});
1973
- const { isEmpty } = useUtils();
1974
- watch(
1975
- data,
1976
- (newValue) => {
1977
- let hasValue = false;
1978
- datas.value[props.componentID] = {};
1979
- Object.keys(newValue ?? {}).forEach((key) => {
1980
- if (!isEmpty(newValue[key])) {
1981
- datas.value[props.componentID][key] = newValue[key];
1982
- hasValue = true;
1983
- }
1984
- });
1985
- if (hasValue) {
1986
- datas.value[props.componentID].maxScore = componentProps.value.maxScore;
1987
- }
1988
- },
1989
- { deep: true }
1990
- );
1991
- const gradeItems = ref([]);
1992
- onMounted(() => getGradeItems());
1993
- const getGradeItems = () => {
1994
- if (!componentProps.value.maxScore) {
1995
- return gradeItems;
1996
- }
1997
- if (componentProps.value.showVeto) {
1998
- gradeItems.value.push({ value: "-2", label: "单项否决" });
1999
- }
2000
- if (componentProps.value.showNotGrade) {
2001
- gradeItems.value.push({ value: "-1", label: "不考评" });
2002
- }
2003
- if (componentProps.value.showZero) {
2004
- gradeItems.value.push({ value: "0", label: "0分" });
2005
- }
2006
- let gradeScore = Number(componentProps.value.maxScore);
2007
- for (let i = 1; i <= gradeScore; i++) {
2008
- gradeItems.value.push({ value: String(i), label: `${String(i)}分` });
2009
- }
2010
- if (componentProps.value.scoreReverseFlag) {
2011
- gradeItems.value.reverse();
2012
- }
2013
- };
2014
- let oldValue = (datas.value[props.componentID] || {}).score;
2015
- const clearCheck = (event, value) => {
2016
- if (componentProps.value.clearable && oldValue === value) {
2017
- delete datas.value[props.componentID].score;
2018
- oldValue = void 0;
2019
- event.preventDefault();
2020
- return;
2021
- }
2022
- oldValue = value;
2023
- };
2024
- return (_ctx, _cache) => {
2025
- const _component_wd_radio = resolveComponent("wd-radio");
2026
- const _component_wd_radio_group = resolveComponent("wd-radio-group");
2027
- const _component_wd_input = resolveComponent("wd-input");
2028
- return openBlock(), createElementBlock("view", { class: "zhy-form-component-grade" }, [
2029
- createVNode(_component_wd_radio_group, {
2030
- "custom-class": "zhy",
2031
- modelValue: unref(data).score,
2032
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(data).score = $event),
2033
- disabled: __props.disabled,
2034
- inline: !unref(componentProps).newLine,
2035
- "icon-placement": "left",
2036
- shape: "dot"
2037
- }, {
2038
- default: withCtx(() => [
2039
- (openBlock(true), createElementBlock(
2040
- Fragment,
2041
- null,
2042
- renderList(unref(gradeItems), (gradeItem, index2) => {
2043
- return openBlock(), createBlock(_component_wd_radio, {
2044
- key: index2,
2045
- value: gradeItem.value,
2046
- onClick: ($event) => clearCheck($event, gradeItem.value)
2047
- }, {
2048
- default: withCtx(() => [
2049
- createTextVNode(
2050
- toDisplayString(gradeItem.label),
2051
- 1
2052
- /* TEXT */
2053
- )
2054
- ]),
2055
- _: 2
2056
- /* DYNAMIC */
2057
- }, 1032, ["value", "onClick"]);
2058
- }),
2059
- 128
2060
- /* KEYED_FRAGMENT */
2061
- ))
2062
- ]),
2063
- _: 1
2064
- /* STABLE */
2065
- }, 8, ["modelValue", "disabled", "inline"]),
2066
- unref(componentProps).showProblem ? (openBlock(), createElementBlock("view", {
2067
- key: 0,
2068
- class: "aline-left"
2069
- }, [
2070
- createElementVNode("text", { class: "break-keep" }, "问题:"),
2071
- createVNode(_component_wd_input, {
2072
- "custom-class": "zhy flex-auto",
2073
- type: "text",
2074
- modelValue: unref(data).problem,
2075
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(data).problem = $event),
2076
- disabled: __props.disabled,
2077
- placeholder: "",
2078
- clearable: true,
2079
- clearTrigger: "focus"
2080
- }, null, 8, ["modelValue", "disabled"])
2081
- ])) : createCommentVNode("v-if", true),
2082
- unref(componentProps).showProblem ? (openBlock(), createElementBlock("view", {
2083
- key: 1,
2084
- class: "aline-left"
2085
- }, [
2086
- createElementVNode("text", { class: "break-keep" }, "亮点:"),
2087
- createVNode(_component_wd_input, {
2088
- "custom-class": "zhy flex-auto",
2089
- type: "text",
2090
- modelValue: unref(data).brightSpot,
2091
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(data).brightSpot = $event),
2092
- disabled: __props.disabled,
2093
- placeholder: "",
2094
- clearable: true,
2095
- clearTrigger: "focus"
2096
- }, null, 8, ["modelValue", "disabled"])
2097
- ])) : createCommentVNode("v-if", true),
2098
- unref(componentProps).showRemark ? (openBlock(), createElementBlock("view", {
2099
- key: 2,
2100
- class: "aline-left"
2101
- }, [
2102
- createElementVNode("text", { class: "break-keep" }, "备注:"),
2103
- createVNode(_component_wd_input, {
2104
- "custom-class": "zhy flex-auto",
2105
- type: "text",
2106
- modelValue: unref(data).remark,
2107
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(data).remark = $event),
2108
- disabled: __props.disabled,
2109
- placeholder: "",
2110
- clearable: true,
2111
- clearTrigger: "focus"
2112
- }, null, 8, ["modelValue", "disabled"])
2113
- ])) : createCommentVNode("v-if", true),
2114
- __props.showDescription && (unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
2115
- key: 3,
2116
- class: "description"
2117
- }, [
2118
- createVNode(iconfont, {
2119
- name: "icon-tip",
2120
- size: "20px"
2121
- }),
2122
- createTextVNode(
2123
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
2124
- 1
2125
- /* TEXT */
2126
- )
2127
- ])) : createCommentVNode("v-if", true)
2128
- ]);
2129
- };
2130
- }
2131
- });
2132
- const grade = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/application/grade.vue"]]);
2133
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2134
- __name: "post",
2135
- props: {
2136
- /**
2137
- * 是否禁用
2138
- */
2139
- disabled: {
2140
- type: Boolean,
2141
- default: false
2142
- },
2143
- /**
2144
- * 组件ID
2145
- */
2146
- componentID: {
2147
- type: [String, Number],
2148
- required: true
2149
- },
2150
- /**
2151
- * 表单数据
2152
- */
2153
- datas: {
2154
- type: Object,
2155
- required: true
2156
- },
2157
- /**
2158
- * 组件属性
2159
- */
2160
- componentProps: {
2161
- type: Object,
2162
- required: true
2163
- },
2164
- /**
2165
- * 是否项目说明/答案解析
2166
- */
2167
- showDescription: {
2168
- type: Boolean,
2169
- default: false
2170
- }
2171
- },
2172
- emits: ["update:datas"],
2173
- setup(__props, { emit: __emit }) {
2174
- const props = __props;
2175
- const formType = inject("formType");
2176
- const { datas, componentProps } = toRefs(props);
2177
- const emits = __emit;
2178
- watch(datas, (newValue) => emits("update:datas", newValue));
2179
- const post2 = ref({});
2180
- onMounted(async () => {
2181
- confirm(datas.value[props.componentID]);
2182
- });
2183
- const confirm = (data) => {
2184
- post2.value = (data == null ? void 0 : data.selectedItems) ?? {};
2185
- datas.value[props.componentID] = post2.value.value;
2186
- };
2187
- let oldValue = datas.value[props.componentID];
2188
- const clearCheck = (event, value) => {
2189
- if (componentProps.value.clearable && oldValue === value) {
2190
- delete datas.value[props.componentID];
2191
- oldValue = void 0;
2192
- event.preventDefault();
2193
- return;
2194
- }
2195
- oldValue = value;
2196
- };
2197
- return (_ctx, _cache) => {
2198
- const _component_wd_radio = resolveComponent("wd-radio");
2199
- const _component_wd_radio_group = resolveComponent("wd-radio-group");
2200
- const _component_wd_checkbox = resolveComponent("wd-checkbox");
2201
- const _component_wd_checkbox_group = resolveComponent("wd-checkbox-group");
2202
- const _component_wd_input = resolveComponent("wd-input");
2203
- const _component_wd_picker = resolveComponent("wd-picker");
2204
- return openBlock(), createElementBlock("view", { class: "zhy-form-component-post" }, [
2205
- unref(componentProps).type === "radio" ? (openBlock(), createBlock(_component_wd_radio_group, {
2206
- key: 0,
2207
- "custom-class": "zhy",
2208
- modelValue: unref(datas)[__props.componentID],
2209
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(datas)[__props.componentID] = $event),
2210
- disabled: __props.disabled,
2211
- inline: !unref(componentProps).newLine,
2212
- "icon-placement": "left",
2213
- shape: "dot"
2214
- }, {
2215
- default: withCtx(() => [
2216
- (openBlock(true), createElementBlock(
2217
- Fragment,
2218
- null,
2219
- renderList(unref(componentProps).options, (post22, index2) => {
2220
- return openBlock(), createBlock(_component_wd_radio, {
2221
- key: index2,
2222
- value: post22.value,
2223
- onClick: ($event) => clearCheck($event, post22.value)
2224
- }, {
2225
- default: withCtx(() => [
2226
- createTextVNode(
2227
- toDisplayString(post22.label),
2228
- 1
2229
- /* TEXT */
2230
- )
2231
- ]),
2232
- _: 2
2233
- /* DYNAMIC */
2234
- }, 1032, ["value", "onClick"]);
2235
- }),
2236
- 128
2237
- /* KEYED_FRAGMENT */
2238
- ))
2239
- ]),
2240
- _: 1
2241
- /* STABLE */
2242
- }, 8, ["modelValue", "disabled", "inline"])) : createCommentVNode("v-if", true),
2243
- unref(componentProps).type === "checkbox" ? (openBlock(), createBlock(_component_wd_checkbox_group, {
2244
- key: 1,
2245
- "custom-class": "zhy",
2246
- modelValue: unref(datas)[__props.componentID],
2247
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(datas)[__props.componentID] = $event),
2248
- disabled: __props.disabled,
2249
- min: unref(componentProps).min,
2250
- max: unref(componentProps).max,
2251
- inline: !unref(componentProps).newLine
2252
- }, {
2253
- default: withCtx(() => [
2254
- (openBlock(true), createElementBlock(
2255
- Fragment,
2256
- null,
2257
- renderList(unref(componentProps).options, (post22, index2) => {
2258
- return openBlock(), createBlock(_component_wd_checkbox, {
2259
- key: index2,
2260
- modelValue: post22.value,
2261
- shape: "square"
2262
- }, {
2263
- default: withCtx(() => [
2264
- createTextVNode(
2265
- toDisplayString(post22.label),
2266
- 1
2267
- /* TEXT */
2268
- )
2269
- ]),
2270
- _: 2
2271
- /* DYNAMIC */
2272
- }, 1032, ["modelValue"]);
2273
- }),
2274
- 128
2275
- /* KEYED_FRAGMENT */
2276
- ))
2277
- ]),
2278
- _: 1
2279
- /* STABLE */
2280
- }, 8, ["modelValue", "disabled", "min", "max", "inline"])) : createCommentVNode("v-if", true),
2281
- unref(componentProps).type === "selector" ? (openBlock(), createBlock(_component_wd_picker, {
2282
- key: 2,
2283
- "custom-class": "zhy",
2284
- modelValue: unref(post2).value,
2285
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(post2).value = $event),
2286
- columns: unref(componentProps).options,
2287
- disabled: __props.disabled,
2288
- "use-default-slot": "",
2289
- onConfirm: confirm
2290
- }, {
2291
- default: withCtx(() => [
2292
- createVNode(_component_wd_input, {
2293
- "custom-class": "zhy",
2294
- type: "text",
2295
- modelValue: unref(post2).label,
2296
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(post2).label = $event),
2297
- placeholder: `请选择${unref(componentProps).label}`,
2298
- readonly: ""
2299
- }, null, 8, ["modelValue", "placeholder"])
2300
- ]),
2301
- _: 1
2302
- /* STABLE */
2303
- }, 8, ["modelValue", "columns", "disabled"])) : createCommentVNode("v-if", true),
2304
- __props.showDescription && (unref(formTypeEnum).Examination || unref(componentProps).description) ? (openBlock(), createElementBlock("div", {
2305
- key: 3,
2306
- class: "description"
2307
- }, [
2308
- createVNode(iconfont, {
2309
- name: "icon-tip",
2310
- size: "20px"
2311
- }),
2312
- createTextVNode(
2313
- " " + toDisplayString(`${unref(formType) === unref(formTypeEnum).Form ? "项目说明" : "答案解析"}:${unref(componentProps).description || "无"}`),
2314
- 1
2315
- /* TEXT */
2316
- )
2317
- ])) : createCommentVNode("v-if", true)
2318
- ]);
2319
- };
2320
- }
2321
- });
2322
- const post = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/application/post.vue"]]);
2323
- const applicationComponent = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2324
- __proto__: null,
2325
- employee,
2326
- grade,
2327
- post
2328
- }, Symbol.toStringTag, { value: "Module" }));
2329
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2330
- __name: "groupLayout",
2331
- props: {
2332
- /**
2333
- * 组件ID
2334
- */
2335
- componentID: {
2336
- type: [String, Number],
2337
- required: true
2338
- },
2339
- /**
2340
- * 组件
2341
- */
2342
- component: {
2343
- type: Object,
2344
- required: true
2345
- },
2346
- /**
2347
- * 是否禁用
2348
- */
2349
- disabled: {
2350
- type: Boolean,
2351
- default: false
2352
- },
2353
- /**
2354
- * 标题位置
2355
- */
2356
- labelPosition: {
2357
- type: String,
2358
- default: "top"
2359
- },
2360
- /**
2361
- * 是否项目说明/答案解析
2362
- */
2363
- showDescription: {
2364
- type: Boolean,
2365
- default: false
2366
- },
2367
- /**
2368
- * 一页一项标记
2369
- */
2370
- onePageItemFlag: {
2371
- type: Boolean,
2372
- default: false
2373
- },
2374
- /**
2375
- * 一页一项时的当前显示项目ID集合
2376
- */
2377
- currentShowIDArray: {
2378
- type: Array,
2379
- default: []
2380
- }
2381
- },
2382
- emits: ["validate"],
2383
- setup(__props, { emit: __emit }) {
2384
- const emits = __emit;
2385
- const props = __props;
2386
- const { component, showDescription, onePageItemFlag, currentShowIDArray } = toRefs(props);
2387
- !component.value.children && (component.value.children = []);
2388
- const style = computed(() => {
2389
- let styles = {
2390
- "background-color": component.value.props.backgroundColor || ""
2391
- };
2392
- if (component.value.props.showBorder) {
2393
- styles["border"] = `${component.value.props.borderWidth}px ${component.value.props.borderStyle} ${component.value.props.borderColor}`;
2394
- }
2395
- if (component.value.props.borderRadius) {
2396
- styles["border-radius"] = `${component.value.props.borderRadius}px`;
2397
- }
2398
- return styles;
2399
- });
2400
- return (_ctx, _cache) => {
2401
- return openBlock(), createElementBlock(
2402
- "view",
2403
- {
2404
- class: "group-layout-component px-10 box-border",
2405
- style: normalizeStyle(unref(style))
2406
- },
2407
- [
2408
- unref(component).props.showLabel ? (openBlock(), createElementBlock(
2409
- "view",
2410
- {
2411
- key: 0,
2412
- class: "py-5",
2413
- style: normalizeStyle({
2414
- color: unref(component).props.color,
2415
- "font-size": unref(component).props.fontSize + "px",
2416
- "font-weight": unref(component).props.isBold ? "bold" : "normal"
2417
- })
2418
- },
2419
- toDisplayString(unref(component).props.label),
2420
- 5
2421
- /* TEXT, STYLE */
2422
- )) : createCommentVNode("v-if", true),
2423
- createVNode(componentRenderer, {
2424
- components: unref(component).children,
2425
- disabled: __props.disabled,
2426
- labelPosition: __props.labelPosition,
2427
- showDescription: unref(showDescription),
2428
- onePageItemFlag: unref(onePageItemFlag),
2429
- currentShowIDArray: unref(currentShowIDArray),
2430
- onValidate: _cache[0] || (_cache[0] = (prop) => emits("validate", prop))
2431
- }, null, 8, ["components", "disabled", "labelPosition", "showDescription", "onePageItemFlag", "currentShowIDArray"])
2432
- ],
2433
- 4
2434
- /* STYLE */
2435
- );
2436
- };
2437
- }
2438
- });
2439
- const groupLayout = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/layout/groupLayout.vue"]]);
2440
- const layoutComponent = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2441
- __proto__: null,
2442
- groupLayout
2443
- }, Symbol.toStringTag, { value: "Module" }));
2444
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2445
- __name: "componentRenderer",
2446
- props: {
2447
- /**
2448
- * 组件
2449
- */
2450
- components: {
2451
- type: Array,
2452
- required: true
2453
- },
2454
- /**
2455
- * 标题位置
2456
- */
2457
- labelPosition: {
2458
- type: String,
2459
- default: "top"
2460
- },
2461
- /**
2462
- * 是否禁用
2463
- */
2464
- disabled: {
2465
- type: Boolean,
2466
- default: false
2467
- },
2468
- /**
2469
- * 是否显示组件说明
2470
- */
2471
- showDescription: {
2472
- type: Boolean,
2473
- default: false
2474
- },
2475
- /**
2476
- * 一页一项标记
2477
- */
2478
- onePageItemFlag: {
2479
- type: Boolean,
2480
- default: false
2481
- },
2482
- /**
2483
- * 一页一项时的当前显示项目ID集合
2484
- */
2485
- currentShowIDArray: {
2486
- type: Array,
2487
- default: []
2488
- }
2489
- },
2490
- emits: ["validate"],
2491
- setup(__props, { emit: __emit }) {
2492
- const componentTypes = { ...baseComponent, ...advancedComponent, ...applicationComponent, ...layoutComponent };
2493
- const { computedExpression } = useUtils();
2494
- const props = __props;
2495
- const { components: components2, showDescription, onePageItemFlag, currentShowIDArray } = toRefs(props);
2496
- let formData = inject("formData");
2497
- const dynamicConditionType = {
2498
- // 显示动态条件
2499
- show: (componentProp) => {
2500
- if (componentProp.showFlag === void 0) {
2501
- return String(true);
2502
- }
2503
- let condition = "";
2504
- if (componentProp.showFlag) {
2505
- condition = componentProp.hiddenConditionExpression ? `!(${componentProp.hiddenConditionExpression})` : String(componentProp.showFlag);
2506
- } else {
2507
- condition = componentProp.showConditionExpression || String(componentProp.showFlag);
2508
- }
2509
- return condition;
2510
- },
2511
- // 禁用动态条件
2512
- disabled: (componentProp) => {
2513
- return componentProp.disabledConditionExpression || String(componentProp.disabled === void 0 ? false : componentProp.disabled);
2514
- },
2515
- // 只读动态条件
2516
- readonly: (componentProp) => {
2517
- return componentProp.readonlyConditionExpression || String(componentProp.readonly === void 0 ? false : componentProp.readonly);
2518
- }
2519
- };
2520
- const getByDynamicCondition = (component, propType) => {
2521
- var _a;
2522
- let condition = dynamicConditionType[propType](component.props);
2523
- if (!condition) {
2524
- return void 0;
2525
- }
2526
- if (!["true", "false"].includes(condition)) {
2527
- const idTemplates = condition.match(/{(.*?)}/g);
2528
- idTemplates.forEach((idTemplate) => {
2529
- var _a2;
2530
- const id = idTemplate.replace(/\{|}/g, "");
2531
- let value = formData.value.datas[id];
2532
- const paramComponent = components2.value.find((paramComponent2) => paramComponent2.id === id);
2533
- if ((paramComponent == null ? void 0 : paramComponent.type) === "grade") {
2534
- value = (_a2 = formData.value.datas[id]) == null ? void 0 : _a2.score;
2535
- }
2536
- condition = condition.replace(idTemplate, value || "");
2537
- });
2538
- }
2539
- const result = computedExpression(condition);
2540
- if (propType === "show" && !result) {
2541
- let components22 = [];
2542
- if (component.isLayout && ((_a = component.children) == null ? void 0 : _a.length)) {
2543
- components22 = component.children;
2544
- } else {
2545
- components22 = [component];
2546
- }
2547
- components22.forEach((tempComponent) => {
2548
- if (!formData.value.datas[tempComponent.id]) {
2549
- return;
2550
- }
2551
- if (tempComponent.type === "grade") {
2552
- delete formData.value.datas[tempComponent.id].score;
2553
- } else {
2554
- delete formData.value.datas[tempComponent.id];
2555
- }
2556
- });
2557
- }
2558
- return result;
2559
- };
2560
- const watchID = ref();
2561
- const watchData = ref();
2562
- const setValidateWatch = (id, data) => {
2563
- watchID.value = id;
2564
- watchData.value = data;
2565
- return id;
2566
- };
2567
- const emits = __emit;
2568
- watch(watchData, () => {
2569
- emits("validate", watchID.value);
2570
- });
2571
- return (_ctx, _cache) => {
2572
- const _component_wd_text = resolveComponent("wd-text");
2573
- const _component_wd_cell = resolveComponent("wd-cell");
2574
- return openBlock(true), createElementBlock(
2575
- Fragment,
2576
- null,
2577
- renderList(unref(components2), (component, index2) => {
2578
- return openBlock(), createElementBlock(
2579
- Fragment,
2580
- { key: index2 },
2581
- [
2582
- createCommentVNode(" 非隐藏项 "),
2583
- getByDynamicCondition(component, "show") && !unref(onePageItemFlag) || unref(onePageItemFlag) && unref(currentShowIDArray).includes(component.id) ? (openBlock(), createElementBlock("view", {
2584
- key: 0,
2585
- class: "p-5"
2586
- }, [
2587
- createCommentVNode(" 容器组件直接显示 且(非一项一页 或 一项一页的当前项)"),
2588
- component.isLayout ? (openBlock(), createBlock(resolveDynamicComponent(componentTypes[component.type]), {
2589
- key: 0,
2590
- component: unref(components2)[index2],
2591
- "onUpdate:component": ($event) => unref(components2)[index2] = $event,
2592
- componentID: component.id,
2593
- disabled: __props.disabled,
2594
- labelPosition: __props.labelPosition,
2595
- showDescription: unref(showDescription),
2596
- onePageItemFlag: unref(onePageItemFlag),
2597
- currentShowIDArray: unref(currentShowIDArray),
2598
- onValidate: _cache[0] || (_cache[0] = (prop) => emits("validate", prop))
2599
- }, null, 40, ["component", "onUpdate:component", "componentID", "disabled", "labelPosition", "showDescription", "onePageItemFlag", "currentShowIDArray"])) : (openBlock(), createBlock(_component_wd_cell, {
2600
- key: 1,
2601
- "custom-class": `zhy form-item form-prop-${component.id}`,
2602
- vertical: __props.labelPosition === "top" || component.props.labelNewLine,
2603
- "title-width": `${component.props.showLabel && !(__props.labelPosition === "top" || component.props.labelNewLine) ? component.props.labelWidth : ""}px`,
2604
- prop: component.id,
2605
- rules: component.rules
2606
- }, {
2607
- label: withCtx(() => [
2608
- createVNode(_component_wd_text, {
2609
- "custom-class": "zhy",
2610
- text: component.props.showLabel ? component.props.label + ":" : "",
2611
- size: `${component.props.fontSize > 14 ? component.props.fontSize : 14}px`,
2612
- bold: component.props.isBold,
2613
- color: component.props.color || "#000000"
2614
- }, null, 8, ["text", "size", "bold", "color"])
2615
- ]),
2616
- default: withCtx(() => [
2617
- (openBlock(), createBlock(resolveDynamicComponent(componentTypes[component.type]), {
2618
- componentProps: component.props,
2619
- "onUpdate:componentProps": ($event) => component.props = $event,
2620
- datas: unref(formData).datas,
2621
- "onUpdate:datas": _cache[1] || (_cache[1] = ($event) => unref(formData).datas = $event),
2622
- componentID: component.id,
2623
- disabled: __props.disabled || getByDynamicCondition(component, "disabled"),
2624
- readonly: getByDynamicCondition(component, "readonly"),
2625
- showDescription: unref(showDescription),
2626
- key: setValidateWatch(component.id, unref(formData).datas[component.id])
2627
- }, null, 40, ["componentProps", "onUpdate:componentProps", "datas", "componentID", "disabled", "readonly", "showDescription"]))
2628
- ]),
2629
- _: 2
2630
- /* DYNAMIC */
2631
- }, 1032, ["custom-class", "vertical", "title-width", "prop", "rules"]))
2632
- ])) : createCommentVNode("v-if", true)
2633
- ],
2634
- 64
2635
- /* STABLE_FRAGMENT */
2636
- );
2637
- }),
2638
- 128
2639
- /* KEYED_FRAGMENT */
2640
- );
2641
- };
2642
- }
2643
- });
2644
- const componentRenderer = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/componentRenderer.vue"]]);
2645
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2646
- __name: "answerSheetItem",
2647
- props: {
2648
- /**
2649
- * 组件
2650
- */
2651
- answerSheetData: {
2652
- type: Array,
2653
- required: true
2654
- },
2655
- tagType: {
2656
- type: Object,
2657
- required: true
2658
- }
2659
- },
2660
- emits: ["showItem"],
2661
- setup(__props, { emit: __emit }) {
2662
- const emits = __emit;
2663
- const showItem = (id) => {
2664
- emits("showItem", id);
2665
- };
2666
- return (_ctx, _cache) => {
2667
- const _component_answer_sheet_item = resolveComponent("answer-sheet-item", true);
2668
- const _component_wd_tag = resolveComponent("wd-tag");
2669
- return openBlock(), createElementBlock("view", { class: "answer-sheet-item" }, [
2670
- (openBlock(true), createElementBlock(
2671
- Fragment,
2672
- null,
2673
- renderList(__props.answerSheetData, (answerSheet, index2) => {
2674
- var _a;
2675
- return openBlock(), createElementBlock(
2676
- Fragment,
2677
- { key: index2 },
2678
- [
2679
- ((_a = answerSheet.children) == null ? void 0 : _a.length) ? (openBlock(), createElementBlock("view", {
2680
- key: 0,
2681
- class: "answer-group"
2682
- }, [
2683
- createElementVNode(
2684
- "view",
2685
- { class: "answer-group-name" },
2686
- toDisplayString(answerSheet.name),
2687
- 1
2688
- /* TEXT */
2689
- ),
2690
- (openBlock(true), createElementBlock(
2691
- Fragment,
2692
- null,
2693
- renderList(answerSheet.children, (item, index22) => {
2694
- var _a2, _b, _c;
2695
- return openBlock(), createElementBlock(
2696
- Fragment,
2697
- { key: index22 },
2698
- [
2699
- ((_a2 = item.children) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_answer_sheet_item, {
2700
- key: 0,
2701
- answerSheetData: item.children,
2702
- tagType: __props.tagType,
2703
- onShowItem: showItem
2704
- }, null, 8, ["answerSheetData", "tagType"])) : (openBlock(), createElementBlock(
2705
- Fragment,
2706
- { key: 1 },
2707
- [
2708
- ((_b = __props.tagType[item.status]) == null ? void 0 : _b.value) ? (openBlock(), createBlock(_component_wd_tag, {
2709
- key: 0,
2710
- "custom-class": "answer-item",
2711
- type: (_c = __props.tagType[item.status]) == null ? void 0 : _c.value,
2712
- onClick: ($event) => showItem(item.id)
2713
- }, {
2714
- default: withCtx(() => [
2715
- createTextVNode(
2716
- toDisplayString(item.name),
2717
- 1
2718
- /* TEXT */
2719
- )
2720
- ]),
2721
- _: 2
2722
- /* DYNAMIC */
2723
- }, 1032, ["type", "onClick"])) : (openBlock(), createBlock(_component_wd_tag, {
2724
- key: 1,
2725
- "custom-class": "answer-item",
2726
- onClick: ($event) => showItem(item.id)
2727
- }, {
2728
- default: withCtx(() => [
2729
- createTextVNode(
2730
- toDisplayString(item.name),
2731
- 1
2732
- /* TEXT */
2733
- )
2734
- ]),
2735
- _: 2
2736
- /* DYNAMIC */
2737
- }, 1032, ["onClick"]))
2738
- ],
2739
- 64
2740
- /* STABLE_FRAGMENT */
2741
- ))
2742
- ],
2743
- 64
2744
- /* STABLE_FRAGMENT */
2745
- );
2746
- }),
2747
- 128
2748
- /* KEYED_FRAGMENT */
2749
- ))
2750
- ])) : createCommentVNode("v-if", true)
2751
- ],
2752
- 64
2753
- /* STABLE_FRAGMENT */
2754
- );
2755
- }),
2756
- 128
2757
- /* KEYED_FRAGMENT */
2758
- ))
2759
- ]);
2760
- };
2761
- }
2762
- });
2763
- const answerSheetItem_vue_vue_type_style_index_0_lang = "";
2764
- const answerSheetItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/answerSheetPopup/answerSheetItem.vue"]]);
2765
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2766
- __name: "index",
2767
- props: {
2768
- /**
2769
- * @description: 表单数据,包含表单属性,组件集合、初始数据
2770
- */
2771
- formData: {
2772
- type: Object,
2773
- required: true
2774
- },
2775
- /**
2776
- * @description: 是否显示正确与否
2777
- */
2778
- showCorrectOrNot: {
2779
- type: Boolean,
2780
- default: true
2781
- },
2782
- /**
2783
- * @description: 弹出框高度
2784
- */
2785
- height: {
2786
- type: String,
2787
- default: "360px"
2788
- }
2789
- },
2790
- emits: ["showItem"],
2791
- setup(__props, { emit: __emit }) {
2792
- useCssVars((_ctx) => ({
2793
- "66686455-height": __props.height
2794
- }));
2795
- const props = __props;
2796
- const show = ref(true);
2797
- const answerSheetData = ref([]);
2798
- const tagType = ref({});
2799
- onMounted(() => {
2800
- tagType.value = {
2801
- 1: { value: "", label: "未作答" },
2802
- 2: { value: "success", label: "已作答" }
2803
- };
2804
- if (props.showCorrectOrNot) {
2805
- tagType.value[2].label = "正确";
2806
- tagType.value[3] = { value: "danger", label: "错误" };
2807
- }
2808
- answerSheetData.value = getAnswerSheetData(props.formData.components);
2809
- });
2810
- const getAnswerSheetData = (components2) => {
2811
- let result = [];
2812
- let index2 = 1;
2813
- components2.forEach((component) => {
2814
- var _a;
2815
- if (component.type === componentTypeEnum.LABEL) {
2816
- return;
2817
- }
2818
- let status = 0;
2819
- if (props.showCorrectOrNot) {
2820
- status = !props.formData.datas[component.id] ? 1 : component.props.examinationStatus;
2821
- } else {
2822
- status = !props.formData.datas[component.id] ? 1 : 2;
2823
- }
2824
- const data = {
2825
- id: component.id,
2826
- name: index2,
2827
- status
2828
- };
2829
- if (component.isLayout && ((_a = component.children) == null ? void 0 : _a.length)) {
2830
- data.name = component.props.label.replace(/([^)]*)/g, "");
2831
- data.children = getAnswerSheetData(component.children);
2832
- }
2833
- result.push(data);
2834
- index2++;
2835
- });
2836
- return result;
2837
- };
2838
- const emits = __emit;
2839
- const showItem = (id) => {
2840
- show.value = false;
2841
- emits("showItem", id);
2842
- };
2843
- return (_ctx, _cache) => {
2844
- const _component_wd_tag = resolveComponent("wd-tag");
2845
- const _component_wd_action_sheet = resolveComponent("wd-action-sheet");
2846
- return openBlock(), createBlock(_component_wd_action_sheet, {
2847
- "custom-class": "zhy answer-sheet-popup",
2848
- modelValue: unref(show),
2849
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(show) ? show.value = $event : null),
2850
- title: "答题卡"
2851
- }, {
2852
- default: withCtx(() => [
2853
- createElementVNode("view", { class: "answer-sheet-wrap" }, [
2854
- createElementVNode("view", { class: "answer-type-explain" }, [
2855
- createElementVNode("text", null, "说明:"),
2856
- (openBlock(true), createElementBlock(
2857
- Fragment,
2858
- null,
2859
- renderList(Object.values(unref(tagType)), (type, index2) => {
2860
- return openBlock(), createElementBlock(
2861
- Fragment,
2862
- { key: index2 },
2863
- [
2864
- type.value ? (openBlock(), createBlock(_component_wd_tag, {
2865
- key: 0,
2866
- "custom-class": "zhy type-item",
2867
- type: type.value
2868
- }, {
2869
- default: withCtx(() => [
2870
- createTextVNode(
2871
- toDisplayString(type.label),
2872
- 1
2873
- /* TEXT */
2874
- )
2875
- ]),
2876
- _: 2
2877
- /* DYNAMIC */
2878
- }, 1032, ["type"])) : (openBlock(), createBlock(
2879
- _component_wd_tag,
2880
- {
2881
- key: 1,
2882
- "custom-class": "zhy type-item"
2883
- },
2884
- {
2885
- default: withCtx(() => [
2886
- createTextVNode(
2887
- toDisplayString(type.label),
2888
- 1
2889
- /* TEXT */
2890
- )
2891
- ]),
2892
- _: 2
2893
- /* DYNAMIC */
2894
- },
2895
- 1024
2896
- /* DYNAMIC_SLOTS */
2897
- ))
2898
- ],
2899
- 64
2900
- /* STABLE_FRAGMENT */
2901
- );
2902
- }),
2903
- 128
2904
- /* KEYED_FRAGMENT */
2905
- ))
2906
- ]),
2907
- createElementVNode("view", { class: "answer-sheet-list" }, [
2908
- createVNode(answerSheetItem, {
2909
- answerSheetData: unref(answerSheetData),
2910
- tagType: unref(tagType),
2911
- onShowItem: showItem
2912
- }, null, 8, ["answerSheetData", "tagType"])
2913
- ])
2914
- ])
2915
- ]),
2916
- _: 1
2917
- /* STABLE */
2918
- }, 8, ["modelValue"]);
2919
- };
2920
- }
2921
- });
2922
- const index_vue_vue_type_style_index_0_lang = "";
2923
- const answerSheetPopup = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/components/answerSheetPopup/index.vue"]]);
2924
- const __default__ = {
2925
- name: "zhy-form-renderer"
2926
- };
2927
- const _sfc_main = /* @__PURE__ */ defineComponent({
2928
- ...__default__,
2929
- props: {
2930
- /**
2931
- * @description: 表单数据,包含表单属性,组件集合、初始数据
2932
- */
2933
- formData: {
2934
- type: Object,
2935
- default: () => {
2936
- return {
2937
- components: [],
2938
- props: {
2939
- labelPosition: "top",
2940
- labelWidth: 90,
2941
- formType: "1"
2942
- },
2943
- datas: {}
2944
- };
2945
- },
2946
- required: true
2947
- },
2948
- /**
2949
- * @description: 文件上传配置参数
2950
- */
2951
- uploadOptions: {
2952
- type: Object,
2953
- default: () => {
2954
- return {
2955
- serverApi: "",
2956
- headers: void 0,
2957
- autoUpload: false,
2958
- params: void 0
2959
- };
2960
- }
2961
- },
2962
- /**
2963
- * @description: 监视标记
2964
- */
2965
- watching: {
2966
- type: Boolean,
2967
- default: false
2968
- },
2969
- /**
2970
- * 是否禁用
2971
- */
2972
- disabled: {
2973
- type: Boolean,
2974
- default: false
2975
- },
2976
- /**
2977
- * 标题
2978
- */
2979
- title: {
2980
- type: String,
2981
- default: void 0
2982
- },
2983
- /**
2984
- * 是否隐藏标题
2985
- */
2986
- hiddenTitle: {
2987
- type: Boolean,
2988
- default: false
2989
- },
2990
- /**
2991
- * 一页一项标记
2992
- */
2993
- onePageItemFlag: {
2994
- type: Boolean,
2995
- default: false
2996
- },
2997
- /**
2998
- * 一页一项时显示切题导航
2999
- */
3000
- showOnePageNavButton: {
3001
- type: Boolean,
3002
- default: false
3003
- },
3004
- /**
3005
- * 实时显示答案模式
3006
- */
3007
- realTimeDisplayAnswerMode: {
3008
- type: Boolean,
3009
- default: false
3010
- },
3011
- /**
3012
- * 每个项目都显示解析开关
3013
- */
3014
- everyItemDisplayAnalysisSwitch: {
3015
- type: Boolean,
3016
- default: false
3017
- }
3018
- },
3019
- emits: ["change", "switchPage"],
3020
- setup(__props, { expose: __expose, emit: __emit }) {
3021
- const { removeEmptyAttribute } = useUtils();
3022
- const formRenderer = ref();
3023
- const showDescription = ref(false);
3024
- const props = __props;
3025
- const emits = __emit;
3026
- const { formData, onePageItemFlag } = toRefs(props);
3027
- provide("realTimeDisplayAnswerMode", props.realTimeDisplayAnswerMode);
3028
- provide("everyItemDisplayAnalysisSwitch", props.everyItemDisplayAnalysisSwitch);
3029
- provide("uploadOptions", props.uploadOptions);
3030
- provide("formData", formData);
3031
- provide(
3032
- "formType",
3033
- computed(() => formData.value.props.formType)
3034
- );
3035
- watch(formData, () => {
3036
- initComponents(formData.value.components);
3037
- });
3038
- const themeVars = ref({
3039
- // 主题色
3040
- colorTheme: "#4d80f0",
3041
- // 成功色
3042
- colorSuccess: "#34d19d",
3043
- // 警告色
3044
- colorWarning: "#f0883a",
3045
- // 危险出错色
3046
- colorDanger: "#fa4350"
3047
- });
3048
- onMounted(() => initComponents(formData.value.components));
3049
- const initComponents = (components2) => {
3050
- if (components2 == null ? void 0 : components2.length) {
3051
- components2.forEach((component) => {
3052
- var _a;
3053
- if (component.isLayout && ((_a = component.children) == null ? void 0 : _a.length)) {
3054
- component.children.forEach((child) => {
3055
- child.rules = getFormRules(child);
3056
- });
3057
- } else {
3058
- component.rules = getFormRules(component);
3059
- }
3060
- });
3061
- allComponentIdArray.value = getComponentIDArray(formData.value.components);
3062
- currentShowIDArray.value = allComponentIdArray.value[0];
3063
- }
3064
- };
3065
- const { isEmpty } = useUtils();
3066
- const getFormRules = (component) => {
3067
- const componentProps = component.props;
3068
- let formRules = [];
3069
- if (componentProps.required) {
3070
- let formRule = {
3071
- required: componentProps.required,
3072
- message: componentProps.requiredMessage || "必填项"
3073
- };
3074
- formRule.validator = (value, rule) => {
3075
- if (isEmpty(value)) {
3076
- return Promise.reject(rule.message);
3077
- }
3078
- return Promise.resolve();
3079
- };
3080
- formRules.push(formRule);
3081
- }
3082
- if (componentProps.pattern) {
3083
- formRules.push({
3084
- pattern: componentProps.pattern,
3085
- message: componentProps.patternMessage
3086
- });
3087
- }
3088
- return formRules;
3089
- };
3090
- const getDatas = () => {
3091
- let data = removeEmptyAttribute(formData.value.datas);
3092
- let resultData = [];
3093
- let fileList = [];
3094
- const componentIDs = Object.keys(data);
3095
- const result = setLayoutChildrenResultData(formData.value.components, resultData, fileList, componentIDs, data);
3096
- return result;
3097
- };
3098
- const setLayoutChildrenResultData = (components2, resultData, fileList, componentIDs, data, groupID, pageID) => {
3099
- var _a;
3100
- let newResultData = resultData;
3101
- let newFileList = fileList;
3102
- for (let i = 0; i < components2.length; i++) {
3103
- const component = components2[i];
3104
- if (componentIDs.includes(component.id)) {
3105
- const newPageID = component.props.pageID || pageID;
3106
- const result = setDataByComponentType(newResultData, newFileList, component.id, data, component, groupID, newPageID);
3107
- newResultData = result.resultData;
3108
- newFileList = result.fileList;
3109
- continue;
3110
- }
3111
- if (component.isLayout && ((_a = component == null ? void 0 : component.children) == null ? void 0 : _a.length)) {
3112
- const childGroupID = component.id;
3113
- const result = setLayoutChildrenResultData(component.children, newResultData, newFileList, componentIDs, data, childGroupID, pageID);
3114
- newResultData = result.resultData;
3115
- newFileList = result.fileList;
3116
- }
3117
- }
3118
- return { resultData: newResultData, fileList: newFileList };
3119
- };
3120
- const setDataByComponentType = (resultData, fileList, componentID, data, component, groupID, pageID) => {
3121
- var _a, _b, _c;
3122
- switch (component.type) {
3123
- case "radio":
3124
- resultData.push({
3125
- sourceType: component.itemSourceType,
3126
- pageID,
3127
- groupID,
3128
- parentID: componentID,
3129
- id: data[componentID],
3130
- // 可能包含手动录入的备注,通过拼接获取到录入的备注
3131
- value: data[`${componentID}||${data[componentID]}`] ?? ""
3132
- });
3133
- break;
3134
- case "checkbox":
3135
- (_a = data[componentID]) == null ? void 0 : _a.forEach((value) => {
3136
- resultData.push({
3137
- sourceType: component.itemSourceType,
3138
- pageID,
3139
- groupID,
3140
- parentID: componentID,
3141
- id: value,
3142
- // 可能包含手动录入的备注,通过拼接获取到录入的备注
3143
- value: data[`${componentID}||${value}`] ?? ""
3144
- });
3145
- });
3146
- break;
3147
- case "upload":
3148
- case "uploadImage":
3149
- if (!((_b = props.uploadOptions) == null ? void 0 : _b.autoUpload) && ((_c = data[componentID]) == null ? void 0 : _c.length)) {
3150
- let addFileList = [];
3151
- let fileIDs = [];
3152
- data[componentID].forEach((file) => {
3153
- file.id = componentID;
3154
- addFileList.push(file);
3155
- if (file.fileID) {
3156
- fileIDs.push(file.fileID);
3157
- }
3158
- });
3159
- fileList.push({
3160
- sourceType: component.itemSourceType,
3161
- id: componentID,
3162
- pageID: component.props.pageID,
3163
- groupID,
3164
- fileIDs,
3165
- files: addFileList
3166
- });
3167
- }
3168
- break;
3169
- default:
3170
- resultData.push({
3171
- sourceType: component.itemSourceType,
3172
- pageID,
3173
- groupID,
3174
- parentID: componentID,
3175
- id: componentID,
3176
- value: data[componentID]
3177
- });
3178
- break;
3179
- }
3180
- return { resultData, fileList };
3181
- };
3182
- if (props.watching) {
3183
- watch(
3184
- () => formData.value.datas,
3185
- () => {
3186
- const resultData = getDatas();
3187
- emits("change", resultData.resultData, resultData.fileList);
3188
- },
3189
- { immediate: true, deep: true }
3190
- );
3191
- }
3192
- const allComponentIdArray = ref([]);
3193
- const currentShowIDArray = ref([]);
3194
- const getComponentIDArray = (components2, parentPath = []) => {
3195
- let result = [];
3196
- components2.forEach((component) => {
3197
- var _a, _b;
3198
- const currentPath = [...parentPath, component.id];
3199
- if (!component.isLayout || !((_a = component.children) == null ? void 0 : _a.length)) {
3200
- result.push(currentPath);
3201
- }
3202
- if (component.isLayout && ((_b = component.children) == null ? void 0 : _b.length)) {
3203
- const childPaths = getComponentIDArray(component.children, currentPath);
3204
- result = result.concat(childPaths);
3205
- }
3206
- });
3207
- return result;
3208
- };
3209
- const currentIndex = computed(() => allComponentIdArray.value.indexOf(currentShowIDArray.value));
3210
- const switchPageItem = (type, id) => {
3211
- if (!onePageItemFlag.value || !currentShowIDArray.value.length) {
3212
- return;
3213
- }
3214
- if (type === "prev") {
3215
- if (currentIndex.value > 0) {
3216
- currentShowIDArray.value = allComponentIdArray.value[currentIndex.value - 1];
3217
- }
3218
- }
3219
- if (type === "next") {
3220
- if (currentIndex.value < allComponentIdArray.value.length - 1) {
3221
- currentShowIDArray.value = allComponentIdArray.value[currentIndex.value + 1];
3222
- }
3223
- }
3224
- if (id) {
3225
- const targetIDArray = allComponentIdArray.value.find((idArray) => idArray.includes(id));
3226
- if (targetIDArray) {
3227
- currentShowIDArray.value = targetIDArray;
3228
- }
3229
- }
3230
- emits("switchPage", currentIndex.value + 1, allComponentIdArray.value.length);
3231
- return {
3232
- currentIndex: currentIndex.value + 1,
3233
- count: allComponentIdArray.value.length
3234
- };
3235
- };
3236
- const showAnswerSheetFlag = ref(false);
3237
- const showCorrectOrNot = ref(false);
3238
- const showAnswerSheet = (showCorrectOrNotFlag) => {
3239
- showCorrectOrNot.value = showCorrectOrNotFlag ?? false;
3240
- showAnswerSheetFlag.value = false;
3241
- nextTick(() => {
3242
- showAnswerSheetFlag.value = true;
3243
- });
3244
- };
3245
- let highlightStyle = null;
3246
- const scrollToFormProp = (prop) => {
3247
- const element = document.querySelector(`.form-prop-${prop}`);
3248
- if (element) {
3249
- element.scrollIntoView({ behavior: "smooth", block: "center" });
3250
- element.classList.add("highlight");
3251
- if (!highlightStyle || !document.head.contains(highlightStyle)) {
3252
- highlightStyle = document.createElement("style");
3253
- highlightStyle.innerHTML = `
3254
- .form-prop-${prop}.highlight {
3255
- border-color: red;
3256
- background-color: #ffe6e6;
3257
- }
3258
- .form-prop-${prop}.highlight * {
3259
- background-color: #ffe6e6;
3260
- }
3261
- `;
3262
- document.head.appendChild(highlightStyle);
3263
- }
3264
- setTimeout(() => {
3265
- if (highlightStyle && document.head.contains(highlightStyle)) {
3266
- document.head.removeChild(highlightStyle);
3267
- highlightStyle = null;
3268
- }
3269
- element.classList.remove("highlight");
3270
- }, 2e3);
3271
- }
3272
- };
3273
- const scrollToField = (prop) => {
3274
- if (onePageItemFlag.value) {
3275
- switchPageItem("", prop);
3276
- return;
3277
- }
3278
- scrollToFormProp(prop);
3279
- if (showAnswerSheetFlag.value) {
3280
- showAnswerSheetFlag.value = false;
3281
- }
3282
- };
3283
- const validate = async (prop) => {
3284
- var _a, _b;
3285
- let result = await ((_a = formRenderer.value) == null ? void 0 : _a.validate(prop));
3286
- if (!result) {
3287
- return true;
3288
- }
3289
- if (!result.valid) {
3290
- if (prop) {
3291
- scrollToField(prop);
3292
- return;
3293
- }
3294
- const firstErrorProp = (_b = result.errors.reduce((prev, curr) => {
3295
- const prevIndex = allComponentIdArray.value.findIndex((idArray) => idArray.includes(prev.prop));
3296
- const currIndex = allComponentIdArray.value.findIndex((idArray) => idArray.includes(curr.prop));
3297
- return currIndex < prevIndex ? curr : prev;
3298
- }, result.errors[0])) == null ? void 0 : _b.prop;
3299
- scrollToField(firstErrorProp);
3300
- }
3301
- return result.valid;
3302
- };
3303
- __expose({
3304
- /**
3305
- * @description: 获取表单数据
3306
- * @param callback
3307
- * @return
3308
- */
3309
- getDatas,
3310
- /**
3311
- * @description: 对整个表单的内容进行验证
3312
- * @param callback
3313
- * @return
3314
- */
3315
- validate,
3316
- /**
3317
- * @description: 对该表单项进行重置,将其值重置为初始值并移除校验结果
3318
- * @param
3319
- * @return
3320
- */
3321
- resetFields() {
3322
- nextTick(() => formRenderer.value.reset());
3323
- },
3324
- /**
3325
- * @description: 滚动到指定的字段
3326
- * @param prop
3327
- * @return
3328
- */
3329
- scrollToField,
3330
- /**
3331
- * @description:显示/隐藏 项目说明/答案解析
3332
- */
3333
- toggleDescription() {
3334
- showDescription.value = !showDescription.value;
3335
- },
3336
- /**
3337
- * @description: 一页一项模式下切换项目
3338
- * @param type
3339
- * @return
3340
- */
3341
- switchPageItem,
3342
- /**
3343
- * @description: 显示答题卡
3344
- */
3345
- showAnswerSheet
3346
- });
3347
- return (_ctx, _cache) => {
3348
- const _component_wd_form = resolveComponent("wd-form");
3349
- const _component_wd_button = resolveComponent("wd-button");
3350
- const _component_wd_toast = resolveComponent("wd-toast");
3351
- const _component_wd_config_provider = resolveComponent("wd-config-provider");
3352
- return openBlock(), createBlock(_component_wd_config_provider, { "theme-vars": unref(themeVars) }, {
3353
- default: withCtx(() => [
3354
- createElementVNode("view", { class: "form-renderer" }, [
3355
- !__props.hiddenTitle && (__props.title || unref(formData).props.formName) ? (openBlock(), createElementBlock(
3356
- "h3",
3357
- {
3358
- key: 0,
3359
- class: "title"
3360
- },
3361
- toDisplayString(__props.title ?? unref(formData).props.formName),
3362
- 1
3363
- /* TEXT */
3364
- )) : createCommentVNode("v-if", true),
3365
- createVNode(_component_wd_form, {
3366
- ref_key: "formRenderer",
3367
- ref: formRenderer,
3368
- "custom-class": "zhy",
3369
- class: normalizeClass(["renderer-form", { "hidden-title": __props.hiddenTitle }, { "one-page-question-mode": unref(onePageItemFlag) }]),
3370
- model: unref(formData).datas,
3371
- resetOnChange: false
3372
- }, {
3373
- default: withCtx(() => [
3374
- createVNode(componentRenderer, {
3375
- disabled: __props.disabled,
3376
- labelPosition: unref(formData).props.labelPosition ?? "top",
3377
- components: unref(formData).components,
3378
- showDescription: unref(showDescription),
3379
- onePageItemFlag: unref(onePageItemFlag),
3380
- currentShowIDArray: unref(currentShowIDArray),
3381
- onValidate: validate
3382
- }, null, 8, ["disabled", "labelPosition", "components", "showDescription", "onePageItemFlag", "currentShowIDArray"])
3383
- ]),
3384
- _: 1
3385
- /* STABLE */
3386
- }, 8, ["class", "model"]),
3387
- unref(onePageItemFlag) && __props.showOnePageNavButton ? (openBlock(), createElementBlock("view", {
3388
- key: 1,
3389
- class: "one-page-nav-button"
3390
- }, [
3391
- createVNode(_component_wd_button, {
3392
- type: "primary",
3393
- onClick: _cache[0] || (_cache[0] = ($event) => switchPageItem("prev"))
3394
- }, {
3395
- default: withCtx(() => [
3396
- createTextVNode(" 上一题 ")
3397
- ]),
3398
- _: 1
3399
- /* STABLE */
3400
- }),
3401
- createVNode(_component_wd_button, {
3402
- type: "success",
3403
- onClick: _cache[1] || (_cache[1] = ($event) => switchPageItem("next"))
3404
- }, {
3405
- default: withCtx(() => [
3406
- createTextVNode(" 下一题 ")
3407
- ]),
3408
- _: 1
3409
- /* STABLE */
3410
- })
3411
- ])) : createCommentVNode("v-if", true)
3412
- ]),
3413
- unref(showAnswerSheetFlag) ? (openBlock(), createBlock(answerSheetPopup, {
3414
- key: 0,
3415
- showCorrectOrNot: unref(showCorrectOrNot),
3416
- formData: unref(formData),
3417
- onShowItem: scrollToField
3418
- }, null, 8, ["showCorrectOrNot", "formData"])) : createCommentVNode("v-if", true),
3419
- createCommentVNode(" toast消息的挂载点。 "),
3420
- createVNode(_component_wd_toast)
3421
- ]),
3422
- _: 1
3423
- /* STABLE */
3424
- }, 8, ["theme-vars"]);
3425
- };
3426
- }
3427
- });
3428
- const formRenderer_vue_vue_type_style_index_0_lang = "";
3429
- const zhyFormRenderer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/work/zhytech/zhytech-ui-mobile/src/components/dynamicForm/formRenderer.vue"]]);
3430
- const components = [zhyFormRenderer];
3431
- const install = function(app, options) {
3432
- components.forEach((component) => {
3433
- app.component(component.name, component);
3434
- });
3435
- };
3436
- const index = { install };
3437
- export {
3438
- index as default,
3439
- zhyFormRenderer
3440
- };