@xuekl/cli-components 1.0.7 → 1.0.9
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/XklForm.vue +11 -0
- package/XklSelect.vue +15 -1
- package/package.json +1 -1
package/XklForm.vue
CHANGED
|
@@ -68,6 +68,7 @@ import XklSelect from './XklSelect.vue'
|
|
|
68
68
|
import XklTreeSelect from './XklTreeSelect.vue'
|
|
69
69
|
import XklDict from './XklDict.vue'
|
|
70
70
|
import XklDatePicker from './XklDatePicker.vue'
|
|
71
|
+
import { componentGlobal } from '@xuekl/cli-base/global'
|
|
71
72
|
|
|
72
73
|
const props = defineProps(['form'])
|
|
73
74
|
const XklFormRef = ref(null)
|
|
@@ -158,9 +159,19 @@ searchSpan.value = 24 - toalSpan % 24
|
|
|
158
159
|
const regProto = () => {
|
|
159
160
|
if (XklFormRef.value) {
|
|
160
161
|
let enableSubmit = true;
|
|
162
|
+
let submitTimer: NodeJS.Timeout
|
|
161
163
|
form.setSubmit((callback: (call: () => void, feils: any) => void) => {
|
|
164
|
+
if (componentGlobal.enableFormSubmit) {
|
|
165
|
+
enableSubmit = true
|
|
166
|
+
}
|
|
167
|
+
componentGlobal.enableFormSubmit = false
|
|
162
168
|
if (enableSubmit) {
|
|
163
169
|
enableSubmit = false;
|
|
170
|
+
clearTimeout(submitTimer)
|
|
171
|
+
submitTimer = setTimeout(() => {
|
|
172
|
+
componentGlobal.enableFormSubmit = true
|
|
173
|
+
enableSubmit = true
|
|
174
|
+
}, 3000)
|
|
164
175
|
formList.forEach(field => {
|
|
165
176
|
modeFields[field.prop] = (form as any)[field.prop]
|
|
166
177
|
});
|
package/XklSelect.vue
CHANGED
|
@@ -26,9 +26,23 @@ const changeHandle = (val: string) => {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const handleData = (data) => {
|
|
29
|
+
const split = config?.split
|
|
30
|
+
const labelTarget = config?.labelTarget
|
|
31
|
+
let labels = []
|
|
32
|
+
if (split) {
|
|
33
|
+
if (labelTarget) {
|
|
34
|
+
labels = labelTarget.split(split)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
data.forEach(inner => {
|
|
30
39
|
inner.value = inner[config?.valueTarget || 'value']
|
|
31
|
-
|
|
40
|
+
if (!split) {
|
|
41
|
+
inner.label = inner[labelTarget || 'label']
|
|
42
|
+
} else {
|
|
43
|
+
inner.label = labels.map(label => inner[label]).join(split)
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
})
|
|
33
47
|
return data
|
|
34
48
|
}
|