resolver-egretimp-plus 0.0.236 → 0.0.237
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/package.json
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
<script setup>
|
|
5
5
|
import { ElDatePicker } from 'element-plus'
|
|
6
|
-
import { useAttrs, computed } from 'vue'
|
|
6
|
+
import { useAttrs, computed, watch, nextTick } from 'vue'
|
|
7
7
|
import { commonPropsType, formatDate, isDate } from '../../utils/index.js'
|
|
8
|
+
import { useFormItem } from 'element-plus'
|
|
8
9
|
|
|
10
|
+
const { formItem: elFormItem } = useFormItem()
|
|
9
11
|
const props = defineProps({
|
|
10
12
|
...ElDatePicker.props,
|
|
11
13
|
...commonPropsType,
|
|
@@ -47,6 +49,11 @@ const value = computed({
|
|
|
47
49
|
modeValue.value = val
|
|
48
50
|
}
|
|
49
51
|
})
|
|
52
|
+
watch(value, () => {
|
|
53
|
+
nextTick(() => {
|
|
54
|
+
elFormItem?.validate?.('blur').catch()
|
|
55
|
+
})
|
|
56
|
+
})
|
|
50
57
|
|
|
51
58
|
const disabledDate = (date) => {
|
|
52
59
|
let dateTime = formatDate(date, 'yyyy-MM-dd')
|
|
@@ -13,6 +13,11 @@ import { ElSelect, ElOption } from 'element-plus'
|
|
|
13
13
|
import { computed, defineProps, inject, useAttrs } from 'vue'
|
|
14
14
|
import { commonPropsType } from '../../utils/index.js'
|
|
15
15
|
|
|
16
|
+
const VALUE_TYPES = {
|
|
17
|
+
LIST: 'list',
|
|
18
|
+
OBJECT: 'object',
|
|
19
|
+
STRING: 'string',
|
|
20
|
+
}
|
|
16
21
|
const modelValue = defineModel()
|
|
17
22
|
const props = defineProps({
|
|
18
23
|
...ElSelect.props,
|
|
@@ -31,11 +36,18 @@ const attrs = useAttrs()
|
|
|
31
36
|
const separator = computed(() => {
|
|
32
37
|
return props.separator
|
|
33
38
|
})
|
|
39
|
+
const valueTypes = computed(() => {
|
|
40
|
+
return props.config?.valueType
|
|
41
|
+
})
|
|
34
42
|
// 值是list 还是,连起来的string
|
|
35
43
|
const isStrVal = computed(() => {
|
|
36
44
|
// valueType 值为 list 或者 string
|
|
37
|
-
return
|
|
45
|
+
return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
|
|
38
46
|
})
|
|
47
|
+
const isObject = computed(() => {
|
|
48
|
+
return valueTypes.value === VALUE_TYPES.OBJECT
|
|
49
|
+
})
|
|
50
|
+
|
|
39
51
|
// 是否为多选
|
|
40
52
|
const isMutiple = computed(() => {
|
|
41
53
|
return props.multiple == '1'
|
|
@@ -52,7 +64,17 @@ const value = computed({
|
|
|
52
64
|
get() {
|
|
53
65
|
if (isMutiple.value) {
|
|
54
66
|
const val = modelValue.value || ''
|
|
55
|
-
return val ?
|
|
67
|
+
return val ?
|
|
68
|
+
(
|
|
69
|
+
isStrVal.value ?
|
|
70
|
+
val.split(separator.value) :
|
|
71
|
+
(
|
|
72
|
+
isObject.value ?
|
|
73
|
+
Object.values(val || {}) :
|
|
74
|
+
val
|
|
75
|
+
)
|
|
76
|
+
) :
|
|
77
|
+
[]
|
|
56
78
|
} else {
|
|
57
79
|
if (modelValue.value !== null && modelValue.value !== undefined) {
|
|
58
80
|
if (options.value?.some(item => item.columnValue == modelValue.value)) {
|
|
@@ -69,7 +91,13 @@ const value = computed({
|
|
|
69
91
|
},
|
|
70
92
|
set(val) {
|
|
71
93
|
if (isMutiple.value) {
|
|
72
|
-
modelValue.value = isStrVal.value ?
|
|
94
|
+
modelValue.value = isStrVal.value ?
|
|
95
|
+
val.join(separator.value) :
|
|
96
|
+
(
|
|
97
|
+
isObject.value ?
|
|
98
|
+
val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
|
|
99
|
+
val
|
|
100
|
+
)
|
|
73
101
|
} else {
|
|
74
102
|
modelValue.value = val
|
|
75
103
|
}
|