@xuekl/cli-components 1.3.5 → 1.3.8
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/XklDict.vue +10 -1
- 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/XklDict.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-select style="width: 100%;">
|
|
2
|
+
<el-select style="width: 100%;" @change="changeHandle">
|
|
3
3
|
<el-option v-for="item in dataList" :key="item.dictValue" :label="item.dictLabel"
|
|
4
4
|
:value="item.dictValue"></el-option>
|
|
5
5
|
</el-select>
|
|
@@ -14,9 +14,17 @@ import { ref, onBeforeMount, Ref } from 'vue'
|
|
|
14
14
|
import http from "@/utils/httpRequest"
|
|
15
15
|
import { baseConfig } from "@xuekl/cli-base/config"
|
|
16
16
|
const props = defineProps(['config'])
|
|
17
|
+
const emit = defineEmits(['update:label', 'loaded'])
|
|
18
|
+
|
|
17
19
|
const { config } = props
|
|
18
20
|
const dataList: Ref<{ dictCode: string, dictLabel: string, dictValue: string | number }[]> = ref([])
|
|
19
21
|
|
|
22
|
+
const changeHandle = (val: string) => {
|
|
23
|
+
const item = dataList.value.find(res => res.dictValue === val)
|
|
24
|
+
if (item) {
|
|
25
|
+
emit('update:label', item.dictLabel)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
20
28
|
|
|
21
29
|
onBeforeMount(() => {
|
|
22
30
|
http({
|
|
@@ -25,6 +33,7 @@ onBeforeMount(() => {
|
|
|
25
33
|
params: http.adornParams({})
|
|
26
34
|
}).then(({ data }) => {
|
|
27
35
|
dataList.value = data.data
|
|
36
|
+
emit('loaded', dataList.value)
|
|
28
37
|
})
|
|
29
38
|
})
|
|
30
39
|
</script>
|
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>
|