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