@xuekl/cli-components 1.3.6 → 1.3.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/XklDatePicker.vue +9 -3
- package/XklForm.vue +2 -2
- package/XklFormInfo.vue +2 -1
- package/XklUpload.vue +19 -7
- package/package.json +1 -1
package/XklDatePicker.vue
CHANGED
|
@@ -13,8 +13,6 @@ import { ref } from 'vue';
|
|
|
13
13
|
const props = defineProps(['type'])
|
|
14
14
|
const { type } = props
|
|
15
15
|
|
|
16
|
-
console.log('type', type);
|
|
17
|
-
|
|
18
16
|
|
|
19
17
|
const startPlaceholder = ref('')
|
|
20
18
|
const endPlaceholder = ref('')
|
|
@@ -22,11 +20,19 @@ const valueFormat = ref('YYYY-MM-DD')
|
|
|
22
20
|
if (type === 'daterange') {
|
|
23
21
|
startPlaceholder.value = '开始日期'
|
|
24
22
|
endPlaceholder.value = '结束日期'
|
|
25
|
-
valueFormat.value = 'YYYY-MM-DD'
|
|
26
23
|
} else if (type === 'datetimerange') {
|
|
27
24
|
startPlaceholder.value = '开始时间'
|
|
28
25
|
endPlaceholder.value = '结束时间'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (['date', 'dates', 'daterange'].includes(type)) {
|
|
29
|
+
valueFormat.value = 'YYYY-MM-DD'
|
|
30
|
+
} else if (['datetime', 'datetimerange'].includes(type)) {
|
|
29
31
|
valueFormat.value = 'YYYY-MM-DD HH:mm:ss'
|
|
32
|
+
} else if (['month', 'monthrange'].includes(type)) {
|
|
33
|
+
valueFormat.value = 'YYYY-MM'
|
|
34
|
+
} else {
|
|
35
|
+
valueFormat.value = ''
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
</script>
|
package/XklForm.vue
CHANGED
|
@@ -71,7 +71,7 @@ export default {
|
|
|
71
71
|
<script setup lang="ts">
|
|
72
72
|
import { setUpperFirst } from '@xuekl/cli-utils'
|
|
73
73
|
import { FormItem } from '@xuekl/cli-base/type.d'
|
|
74
|
-
import { ref, watch, onMounted } from 'vue'
|
|
74
|
+
import { ref, watch, onMounted, Ref } from 'vue'
|
|
75
75
|
import XklSelect from './XklSelect.vue'
|
|
76
76
|
import XklTreeSelect from './XklTreeSelect.vue'
|
|
77
77
|
import XklDict from './XklDict.vue'
|
|
@@ -82,7 +82,7 @@ const props = defineProps(['form'])
|
|
|
82
82
|
const XklFormRef = ref(null)
|
|
83
83
|
const { form } = props
|
|
84
84
|
const sourceFormList: FormItem[] = []
|
|
85
|
-
const formList: FormItem[] = ref([])
|
|
85
|
+
const formList: Ref<FormItem[]> = ref([])
|
|
86
86
|
const opts = form._opts || {}
|
|
87
87
|
const isCollapse = ref(true)
|
|
88
88
|
if (typeof opts.defaultCollapse !== 'undefined') {
|
package/XklFormInfo.vue
CHANGED
|
@@ -43,7 +43,8 @@ Object.keys(form).forEach(prop => {
|
|
|
43
43
|
labelWidth: field.labelWidth || opts.labelWidth,
|
|
44
44
|
show: field.show,
|
|
45
45
|
key: field.key,
|
|
46
|
-
reflect: field.reflect
|
|
46
|
+
reflect: field.reflect,
|
|
47
|
+
config: field.config || {}
|
|
47
48
|
}
|
|
48
49
|
if (opts.mode) {
|
|
49
50
|
if (field.mode && field.mode.includes(opts.mode)) {
|
package/XklUpload.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-upload v-model:file-list="fileList" class="upload
|
|
3
|
-
:on-change="handleChange" :before-upload="beforeUpload">
|
|
2
|
+
<el-upload v-model:file-list="fileList" class="xkl-upload" :headers="headers" :data="config.params()"
|
|
3
|
+
:action="actionUrl" :on-change="handleChange" :before-upload="beforeUpload">
|
|
4
4
|
<el-button type="primary">点击上传</el-button>
|
|
5
5
|
<template #tip>
|
|
6
6
|
<div v-if="config.maxSize" class="el-upload__tip">
|
|
@@ -23,8 +23,10 @@ const props = defineProps(['config', 'modelValue'])
|
|
|
23
23
|
const emit = defineEmits(['update:modelValue'])
|
|
24
24
|
const { config, modelValue } = props
|
|
25
25
|
|
|
26
|
+
config.params = config.params || (() => { })
|
|
27
|
+
|
|
26
28
|
const headers = {
|
|
27
|
-
Authorization: getToken()
|
|
29
|
+
[config.authorization || 'Authorization']: getToken()
|
|
28
30
|
}
|
|
29
31
|
const actionUrl = http.adornUrl(config.url || '/common/upload')
|
|
30
32
|
|
|
@@ -43,15 +45,20 @@ const handleChange = (_file, _files) => {
|
|
|
43
45
|
const upFiles = fileList.value.map((res: any) => {
|
|
44
46
|
const j = {
|
|
45
47
|
name: res.name,
|
|
46
|
-
url: res.url
|
|
48
|
+
url: res.url,
|
|
49
|
+
fileName: res.name,
|
|
50
|
+
filePath: res.url
|
|
47
51
|
}
|
|
48
52
|
if (res.response) {
|
|
49
|
-
j.name = res.response.
|
|
50
|
-
j.url = res.response.
|
|
53
|
+
j.name = res.response.data.fileName
|
|
54
|
+
j.url = res.response.data.filePath
|
|
55
|
+
j.fileName = res.response.data.fileName
|
|
56
|
+
j.filePath = res.response.data.filePath
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
return j
|
|
54
60
|
})
|
|
61
|
+
|
|
55
62
|
emit('update:modelValue', upFiles)
|
|
56
63
|
}
|
|
57
64
|
|
|
@@ -59,4 +66,9 @@ const handleChange = (_file, _files) => {
|
|
|
59
66
|
onMounted(() => {
|
|
60
67
|
fileList.value = modelValue
|
|
61
68
|
})
|
|
62
|
-
</script>
|
|
69
|
+
</script>
|
|
70
|
+
<style lang="scss">
|
|
71
|
+
.xkl-upload {
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
</style>
|