el-plus-crud 0.0.12 → 0.0.13
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/CHANGELOG.md +2 -0
- package/README.md +115 -3
- package/dist/el-plus-crud.mjs +6968 -6968
- package/dist/el-plus-crud.umd.js +27 -27
- package/dist/style.css +1 -1
- package/lib/components/el-plus-form/ElPlusFormDialog.vue +107 -107
- package/lib/components/el-plus-form/components/ElPlusFormAutocomplete.vue +49 -49
- package/lib/components/el-plus-form/components/ElPlusFormBtns.vue +133 -133
- package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +51 -51
- package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +42 -42
- package/lib/components/el-plus-form/components/ElPlusFormCheckboxButton.vue +42 -42
- package/lib/components/el-plus-form/components/ElPlusFormColor.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormDaterange.vue +44 -44
- package/lib/components/el-plus-form/components/ElPlusFormDatetime.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormImage.vue +113 -113
- package/lib/components/el-plus-form/components/ElPlusFormNbinput.vue +51 -51
- package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +42 -42
- package/lib/components/el-plus-form/components/ElPlusFormRate.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormSlider.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormStatus.vue +67 -67
- package/lib/components/el-plus-form/components/ElPlusFormSwitch.vue +38 -38
- package/lib/components/el-plus-form/components/ElPlusFormTag.vue +78 -78
- package/lib/components/el-plus-form/components/ElPlusFormTransfer.vue +44 -44
- package/lib/components/el-plus-form/components/ElPlusFormTree.vue +53 -53
- package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +36 -36
- package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +2 -0
- package/lib/components/el-plus-form/components/index.ts +17 -17
- package/lib/components/el-plus-form/data/file.ts +74 -74
- package/lib/components/el-plus-form/mixins/index.ts +113 -113
- package/lib/components/el-plus-form/util/validate.ts +310 -310
- package/lib/components-list.ts +66 -66
- package/package.json +1 -1
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ElPlusFormStatus-panel">
|
|
3
|
-
<i v-if="currentValue === 0" class="status-danger" />
|
|
4
|
-
<i v-else-if="currentValue === 1" class="status-success" />
|
|
5
|
-
<i v-else-if="currentValue === 2" class="status-warning" />
|
|
6
|
-
<i v-else-if="currentValue === 3" class="status-info" />
|
|
7
|
-
<div :class="desc.class" :style="desc.style" v-bind="attrs" v-on="onEvents">
|
|
8
|
-
{{ attrs.formatedValue || currentValue }}
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
export default {
|
|
14
|
-
name: 'ElPlusFormStatus',
|
|
15
|
-
inheritAttrs: false,
|
|
16
|
-
typeName: 'status',
|
|
17
|
-
customOptions: {}
|
|
18
|
-
}
|
|
19
|
-
</script>
|
|
20
|
-
<script lang="ts" setup>
|
|
21
|
-
import { ref, useAttrs, onBeforeMount } from 'vue'
|
|
22
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
23
|
-
|
|
24
|
-
const props = defineProps<{
|
|
25
|
-
modelValue?: string | number | '' | null
|
|
26
|
-
field: string
|
|
27
|
-
desc: { [key: string]: any }
|
|
28
|
-
formData: { [key: string]: any }
|
|
29
|
-
}>()
|
|
30
|
-
|
|
31
|
-
const emits = defineEmits(['update:modelValue'])
|
|
32
|
-
const currentValue = ref(props.modelValue)
|
|
33
|
-
emits('update:modelValue', currentValue)
|
|
34
|
-
|
|
35
|
-
const attrs = ref({} as any)
|
|
36
|
-
const onEvents = ref(getEvents(props))
|
|
37
|
-
|
|
38
|
-
onBeforeMount(async () => {
|
|
39
|
-
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
40
|
-
})
|
|
41
|
-
</script>
|
|
42
|
-
<style lang="scss" scoped>
|
|
43
|
-
.ElPlusFormStatus-panel {
|
|
44
|
-
display: flex;
|
|
45
|
-
line-height: 25px;
|
|
46
|
-
align-items: center;
|
|
47
|
-
i {
|
|
48
|
-
display: inline-block;
|
|
49
|
-
min-width: 10px;
|
|
50
|
-
min-height: 10px;
|
|
51
|
-
border-radius: 50%;
|
|
52
|
-
margin-right: 5px;
|
|
53
|
-
}
|
|
54
|
-
.status-danger {
|
|
55
|
-
background: #f56c6c;
|
|
56
|
-
}
|
|
57
|
-
.status-success {
|
|
58
|
-
background: #67c23a;
|
|
59
|
-
}
|
|
60
|
-
.status-warning {
|
|
61
|
-
background: #e6a23c;
|
|
62
|
-
}
|
|
63
|
-
.status-info {
|
|
64
|
-
background: #909399;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ElPlusFormStatus-panel">
|
|
3
|
+
<i v-if="currentValue === 0" class="status-danger" />
|
|
4
|
+
<i v-else-if="currentValue === 1" class="status-success" />
|
|
5
|
+
<i v-else-if="currentValue === 2" class="status-warning" />
|
|
6
|
+
<i v-else-if="currentValue === 3" class="status-info" />
|
|
7
|
+
<div :class="desc.class" :style="desc.style" v-bind="attrs" v-on="onEvents">
|
|
8
|
+
{{ attrs.formatedValue || currentValue }}
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
export default {
|
|
14
|
+
name: 'ElPlusFormStatus',
|
|
15
|
+
inheritAttrs: false,
|
|
16
|
+
typeName: 'status',
|
|
17
|
+
customOptions: {}
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import { ref, useAttrs, onBeforeMount } from 'vue'
|
|
22
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
23
|
+
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
modelValue?: string | number | '' | null
|
|
26
|
+
field: string
|
|
27
|
+
desc: { [key: string]: any }
|
|
28
|
+
formData: { [key: string]: any }
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const emits = defineEmits(['update:modelValue'])
|
|
32
|
+
const currentValue = ref(props.modelValue)
|
|
33
|
+
emits('update:modelValue', currentValue)
|
|
34
|
+
|
|
35
|
+
const attrs = ref({} as any)
|
|
36
|
+
const onEvents = ref(getEvents(props))
|
|
37
|
+
|
|
38
|
+
onBeforeMount(async () => {
|
|
39
|
+
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
<style lang="scss" scoped>
|
|
43
|
+
.ElPlusFormStatus-panel {
|
|
44
|
+
display: flex;
|
|
45
|
+
line-height: 25px;
|
|
46
|
+
align-items: center;
|
|
47
|
+
i {
|
|
48
|
+
display: inline-block;
|
|
49
|
+
min-width: 10px;
|
|
50
|
+
min-height: 10px;
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
margin-right: 5px;
|
|
53
|
+
}
|
|
54
|
+
.status-danger {
|
|
55
|
+
background: #f56c6c;
|
|
56
|
+
}
|
|
57
|
+
.status-success {
|
|
58
|
+
background: #67c23a;
|
|
59
|
+
}
|
|
60
|
+
.status-warning {
|
|
61
|
+
background: #e6a23c;
|
|
62
|
+
}
|
|
63
|
+
.status-info {
|
|
64
|
+
background: #909399;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="el-plus-form-switch">
|
|
3
|
-
<el-switch v-if="isInit" v-bind="attrs" v-on="onEvents" v-model="currentValue" />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
<script lang="ts">
|
|
7
|
-
export default {
|
|
8
|
-
name: 'ElPlusFormSwitch',
|
|
9
|
-
inheritAttrs: false,
|
|
10
|
-
typeName: 'switch',
|
|
11
|
-
customOptions: {}
|
|
12
|
-
}
|
|
13
|
-
</script>
|
|
14
|
-
<script lang="ts" setup>
|
|
15
|
-
import { ref, useAttrs, onBeforeMount } from 'vue'
|
|
16
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
17
|
-
|
|
18
|
-
const props = defineProps<{
|
|
19
|
-
modelValue?: number | null
|
|
20
|
-
field: string
|
|
21
|
-
loading?: boolean
|
|
22
|
-
desc: { [key: string]: any }
|
|
23
|
-
formData: { [key: string]: any }
|
|
24
|
-
}>()
|
|
25
|
-
const emits = defineEmits(['update:modelValue'])
|
|
26
|
-
|
|
27
|
-
const currentValue = ref(props.modelValue)
|
|
28
|
-
emits('update:modelValue', currentValue)
|
|
29
|
-
|
|
30
|
-
const isInit = ref(false)
|
|
31
|
-
const attrs = ref({} as any)
|
|
32
|
-
const onEvents = ref(getEvents(props))
|
|
33
|
-
|
|
34
|
-
onBeforeMount(async () => {
|
|
35
|
-
attrs.value = await getAttrs(props, { activeValue: 1, inactiveValue: 0, clearable: true, ...useAttrs() })
|
|
36
|
-
isInit.value = true
|
|
37
|
-
})
|
|
38
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="el-plus-form-switch">
|
|
3
|
+
<el-switch v-if="isInit" v-bind="attrs" v-on="onEvents" v-model="currentValue" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
export default {
|
|
8
|
+
name: 'ElPlusFormSwitch',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
typeName: 'switch',
|
|
11
|
+
customOptions: {}
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
import { ref, useAttrs, onBeforeMount } from 'vue'
|
|
16
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
17
|
+
|
|
18
|
+
const props = defineProps<{
|
|
19
|
+
modelValue?: number | null
|
|
20
|
+
field: string
|
|
21
|
+
loading?: boolean
|
|
22
|
+
desc: { [key: string]: any }
|
|
23
|
+
formData: { [key: string]: any }
|
|
24
|
+
}>()
|
|
25
|
+
const emits = defineEmits(['update:modelValue'])
|
|
26
|
+
|
|
27
|
+
const currentValue = ref(props.modelValue)
|
|
28
|
+
emits('update:modelValue', currentValue)
|
|
29
|
+
|
|
30
|
+
const isInit = ref(false)
|
|
31
|
+
const attrs = ref({} as any)
|
|
32
|
+
const onEvents = ref(getEvents(props))
|
|
33
|
+
|
|
34
|
+
onBeforeMount(async () => {
|
|
35
|
+
attrs.value = await getAttrs(props, { activeValue: 1, inactiveValue: 0, clearable: true, ...useAttrs() })
|
|
36
|
+
isInit.value = true
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<el-tag v-bind="attrs" :size="attrs.size || 'small'" :type="tagType !== '--' ? tagType : ''" v-on="onEvents">
|
|
4
|
-
{{ formatValue || modelValue }}
|
|
5
|
-
</el-tag>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
<script lang="ts">
|
|
9
|
-
export default {
|
|
10
|
-
name: 'ElPlusFormTag',
|
|
11
|
-
inheritAttrs: false,
|
|
12
|
-
typeName: 'tag',
|
|
13
|
-
customOptions: {}
|
|
14
|
-
}
|
|
15
|
-
</script>
|
|
16
|
-
<script lang="ts" setup>
|
|
17
|
-
import { ref, watch, useAttrs, onBeforeMount, inject } from 'vue'
|
|
18
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
19
|
-
|
|
20
|
-
const format = inject('format') as any
|
|
21
|
-
|
|
22
|
-
const props = defineProps<{
|
|
23
|
-
modelValue?: string | number | '' | null
|
|
24
|
-
field: string
|
|
25
|
-
loading?: boolean
|
|
26
|
-
desc: { [key: string]: any }
|
|
27
|
-
formData: { [key: string]: any }
|
|
28
|
-
}>()
|
|
29
|
-
|
|
30
|
-
const attrs = ref({} as any)
|
|
31
|
-
const onEvents = ref(getEvents(props))
|
|
32
|
-
|
|
33
|
-
const formatValue = ref('' as any)
|
|
34
|
-
// 格式化Type类型
|
|
35
|
-
const tagType = ref('' as any)
|
|
36
|
-
|
|
37
|
-
onBeforeMount(async () => {
|
|
38
|
-
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
watch(
|
|
42
|
-
() => props.modelValue,
|
|
43
|
-
async () => {
|
|
44
|
-
if (!props.desc.tagType) {
|
|
45
|
-
tagType.value = ''
|
|
46
|
-
} else {
|
|
47
|
-
if (typeof props.desc.tagType === 'function') {
|
|
48
|
-
// 如果有方法类型的判断,则需要启用动态监测
|
|
49
|
-
tagType.value = await props.desc.tagType(props.modelValue, props.formData, props.field)
|
|
50
|
-
} else if (typeof props.desc.tagType === 'string') {
|
|
51
|
-
tagType.value = (await format)[props.desc.tagType](props.modelValue, props.formData, props.field)
|
|
52
|
-
} else {
|
|
53
|
-
tagType.value = ''
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{ immediate: true }
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
watch(
|
|
61
|
-
() => props.modelValue,
|
|
62
|
-
async () => {
|
|
63
|
-
if (!props.desc.format) {
|
|
64
|
-
formatValue.value = props.modelValue === '' ? '—' : props.modelValue ?? '—'
|
|
65
|
-
} else {
|
|
66
|
-
if (typeof props.desc.format === 'function') {
|
|
67
|
-
// 如果有方法类型的判断,则需要启用动态监测
|
|
68
|
-
formatValue.value = await props.desc.format(props.modelValue, props.formData, props.field)
|
|
69
|
-
} else if (typeof props.desc.format === 'string') {
|
|
70
|
-
formatValue.value = (await format)[props.desc.format](props.modelValue, props.formData, props.field)
|
|
71
|
-
} else {
|
|
72
|
-
formatValue.value = props.modelValue || '—'
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{ immediate: true }
|
|
77
|
-
)
|
|
78
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-tag v-bind="attrs" :size="attrs.size || 'small'" :type="tagType !== '--' ? tagType : ''" v-on="onEvents">
|
|
4
|
+
{{ formatValue || modelValue }}
|
|
5
|
+
</el-tag>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export default {
|
|
10
|
+
name: 'ElPlusFormTag',
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
typeName: 'tag',
|
|
13
|
+
customOptions: {}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import { ref, watch, useAttrs, onBeforeMount, inject } from 'vue'
|
|
18
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
19
|
+
|
|
20
|
+
const format = inject('format') as any
|
|
21
|
+
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
modelValue?: string | number | '' | null
|
|
24
|
+
field: string
|
|
25
|
+
loading?: boolean
|
|
26
|
+
desc: { [key: string]: any }
|
|
27
|
+
formData: { [key: string]: any }
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
const attrs = ref({} as any)
|
|
31
|
+
const onEvents = ref(getEvents(props))
|
|
32
|
+
|
|
33
|
+
const formatValue = ref('' as any)
|
|
34
|
+
// 格式化Type类型
|
|
35
|
+
const tagType = ref('' as any)
|
|
36
|
+
|
|
37
|
+
onBeforeMount(async () => {
|
|
38
|
+
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
watch(
|
|
42
|
+
() => props.modelValue,
|
|
43
|
+
async () => {
|
|
44
|
+
if (!props.desc.tagType) {
|
|
45
|
+
tagType.value = ''
|
|
46
|
+
} else {
|
|
47
|
+
if (typeof props.desc.tagType === 'function') {
|
|
48
|
+
// 如果有方法类型的判断,则需要启用动态监测
|
|
49
|
+
tagType.value = await props.desc.tagType(props.modelValue, props.formData, props.field)
|
|
50
|
+
} else if (typeof props.desc.tagType === 'string') {
|
|
51
|
+
tagType.value = (await format)[props.desc.tagType](props.modelValue, props.formData, props.field)
|
|
52
|
+
} else {
|
|
53
|
+
tagType.value = ''
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{ immediate: true }
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
watch(
|
|
61
|
+
() => props.modelValue,
|
|
62
|
+
async () => {
|
|
63
|
+
if (!props.desc.format) {
|
|
64
|
+
formatValue.value = props.modelValue === '' ? '—' : props.modelValue ?? '—'
|
|
65
|
+
} else {
|
|
66
|
+
if (typeof props.desc.format === 'function') {
|
|
67
|
+
// 如果有方法类型的判断,则需要启用动态监测
|
|
68
|
+
formatValue.value = await props.desc.format(props.modelValue, props.formData, props.field)
|
|
69
|
+
} else if (typeof props.desc.format === 'string') {
|
|
70
|
+
formatValue.value = (await format)[props.desc.format](props.modelValue, props.formData, props.field)
|
|
71
|
+
} else {
|
|
72
|
+
formatValue.value = props.modelValue || '—'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{ immediate: true }
|
|
77
|
+
)
|
|
78
|
+
</script>
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-transfer :class="desc.class" :data="desc.options" :style="desc.style" class="ele-form-transfer" v-bind="attrs" v-model="currentValue" v-on="onEvents">
|
|
3
|
-
<!-- 非作用域插槽 -->
|
|
4
|
-
<template v-for="(item, key, index) in slots" #[key]="data" :key="index">
|
|
5
|
-
<slot :name="key" :data="data" />
|
|
6
|
-
</template>
|
|
7
|
-
</el-transfer>
|
|
8
|
-
</template>
|
|
9
|
-
<script lang="ts">
|
|
10
|
-
export default {
|
|
11
|
-
name: 'ElPlusFormTransfer',
|
|
12
|
-
inheritAttrs: false,
|
|
13
|
-
typeName: 'transfer',
|
|
14
|
-
customOptions: {}
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
<script lang="ts" setup>
|
|
18
|
-
import { ref, useAttrs, useSlots, onBeforeMount } from 'vue'
|
|
19
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
20
|
-
|
|
21
|
-
const props = defineProps<{
|
|
22
|
-
modelValue?: string | number | '' | null
|
|
23
|
-
field: string
|
|
24
|
-
loading?: boolean
|
|
25
|
-
desc: { [key: string]: any }
|
|
26
|
-
formData: { [key: string]: any }
|
|
27
|
-
}>()
|
|
28
|
-
const emits = defineEmits(['update:modelValue'])
|
|
29
|
-
const currentValue = ref(props.modelValue)
|
|
30
|
-
emits('update:modelValue', currentValue)
|
|
31
|
-
|
|
32
|
-
const slots = ref(Object.assign({}, useSlots(), props.desc.slots))
|
|
33
|
-
const attrs = ref({} as any)
|
|
34
|
-
const onEvents = ref(getEvents(props))
|
|
35
|
-
|
|
36
|
-
onBeforeMount(async () => {
|
|
37
|
-
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
38
|
-
})
|
|
39
|
-
</script>
|
|
40
|
-
<style lang="scss" scoped>
|
|
41
|
-
.ele-form-transfer {
|
|
42
|
-
line-height: 1;
|
|
43
|
-
}
|
|
44
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-transfer :class="desc.class" :data="desc.options" :style="desc.style" class="ele-form-transfer" v-bind="attrs" v-model="currentValue" v-on="onEvents">
|
|
3
|
+
<!-- 非作用域插槽 -->
|
|
4
|
+
<template v-for="(item, key, index) in slots" #[key]="data" :key="index">
|
|
5
|
+
<slot :name="key" :data="data" />
|
|
6
|
+
</template>
|
|
7
|
+
</el-transfer>
|
|
8
|
+
</template>
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
export default {
|
|
11
|
+
name: 'ElPlusFormTransfer',
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
typeName: 'transfer',
|
|
14
|
+
customOptions: {}
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { ref, useAttrs, useSlots, onBeforeMount } from 'vue'
|
|
19
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
20
|
+
|
|
21
|
+
const props = defineProps<{
|
|
22
|
+
modelValue?: string | number | '' | null
|
|
23
|
+
field: string
|
|
24
|
+
loading?: boolean
|
|
25
|
+
desc: { [key: string]: any }
|
|
26
|
+
formData: { [key: string]: any }
|
|
27
|
+
}>()
|
|
28
|
+
const emits = defineEmits(['update:modelValue'])
|
|
29
|
+
const currentValue = ref(props.modelValue)
|
|
30
|
+
emits('update:modelValue', currentValue)
|
|
31
|
+
|
|
32
|
+
const slots = ref(Object.assign({}, useSlots(), props.desc.slots))
|
|
33
|
+
const attrs = ref({} as any)
|
|
34
|
+
const onEvents = ref(getEvents(props))
|
|
35
|
+
|
|
36
|
+
onBeforeMount(async () => {
|
|
37
|
+
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
40
|
+
<style lang="scss" scoped>
|
|
41
|
+
.ele-form-transfer {
|
|
42
|
+
line-height: 1;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tree ref="treeRef" v-if="isInit" :class="props.desc.class" :style="props.desc.style" v-bind="attrs" :default-checked-keys="currentValue" :loading="props.loading" node-key="id" :data="props.desc.options" v-on="onEvents" class="el-plus-form-tree" @check-change="handelCheckChange" />
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
export default {
|
|
6
|
-
name: 'ElPlusFormTree',
|
|
7
|
-
inheritAttrs: false,
|
|
8
|
-
typeName: 'tree',
|
|
9
|
-
customOptions: {}
|
|
10
|
-
}
|
|
11
|
-
</script>
|
|
12
|
-
<script lang="ts" setup>
|
|
13
|
-
import { ref, useAttrs, onBeforeMount, watch } from 'vue'
|
|
14
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
-
|
|
16
|
-
const props = defineProps<{
|
|
17
|
-
modelValue?: string
|
|
18
|
-
field: string
|
|
19
|
-
loading?: boolean
|
|
20
|
-
desc: { [key: string]: any }
|
|
21
|
-
formData: { [key: string]: any }
|
|
22
|
-
}>()
|
|
23
|
-
const emits = defineEmits(['update:modelValue'])
|
|
24
|
-
const currentValue = ref(props.modelValue?.split(',') || [])
|
|
25
|
-
|
|
26
|
-
const isInit = ref(false)
|
|
27
|
-
const attrs = ref({} as any)
|
|
28
|
-
const onEvents = ref(getEvents(props))
|
|
29
|
-
|
|
30
|
-
const treeRef = ref()
|
|
31
|
-
|
|
32
|
-
onBeforeMount(async () => {
|
|
33
|
-
attrs.value = await getAttrs(props, { checkStrictly: true, showCheckbox: true, accordion: true, props: { label: 'label', children: 'children' }, ...useAttrs() })
|
|
34
|
-
isInit.value = true
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
function handelCheckChange() {
|
|
38
|
-
emits('update:modelValue', [...treeRef.value!.getCheckedKeys(!(props.desc.isPId ?? true))].join(','))
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
watch(
|
|
42
|
-
() => props.modelValue,
|
|
43
|
-
(val) => {
|
|
44
|
-
currentValue.value = val?.split(',') || []
|
|
45
|
-
treeRef.value!.setCheckedKeys(currentValue.value)
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
</script>
|
|
49
|
-
<style lang="scss" scoped>
|
|
50
|
-
.el-plus-form-tree {
|
|
51
|
-
width: 100%;
|
|
52
|
-
}
|
|
53
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-tree ref="treeRef" v-if="isInit" :class="props.desc.class" :style="props.desc.style" v-bind="attrs" :default-checked-keys="currentValue" :loading="props.loading" node-key="id" :data="props.desc.options" v-on="onEvents" class="el-plus-form-tree" @check-change="handelCheckChange" />
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts">
|
|
5
|
+
export default {
|
|
6
|
+
name: 'ElPlusFormTree',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
typeName: 'tree',
|
|
9
|
+
customOptions: {}
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { ref, useAttrs, onBeforeMount, watch } from 'vue'
|
|
14
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
modelValue?: string
|
|
18
|
+
field: string
|
|
19
|
+
loading?: boolean
|
|
20
|
+
desc: { [key: string]: any }
|
|
21
|
+
formData: { [key: string]: any }
|
|
22
|
+
}>()
|
|
23
|
+
const emits = defineEmits(['update:modelValue'])
|
|
24
|
+
const currentValue = ref(props.modelValue?.split(',') || [])
|
|
25
|
+
|
|
26
|
+
const isInit = ref(false)
|
|
27
|
+
const attrs = ref({} as any)
|
|
28
|
+
const onEvents = ref(getEvents(props))
|
|
29
|
+
|
|
30
|
+
const treeRef = ref()
|
|
31
|
+
|
|
32
|
+
onBeforeMount(async () => {
|
|
33
|
+
attrs.value = await getAttrs(props, { checkStrictly: true, showCheckbox: true, accordion: true, props: { label: 'label', children: 'children' }, ...useAttrs() })
|
|
34
|
+
isInit.value = true
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
function handelCheckChange() {
|
|
38
|
+
emits('update:modelValue', [...treeRef.value!.getCheckedKeys(!(props.desc.isPId ?? true))].join(','))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
watch(
|
|
42
|
+
() => props.modelValue,
|
|
43
|
+
(val) => {
|
|
44
|
+
currentValue.value = val?.split(',') || []
|
|
45
|
+
treeRef.value!.setCheckedKeys(currentValue.value)
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
</script>
|
|
49
|
+
<style lang="scss" scoped>
|
|
50
|
+
.el-plus-form-tree {
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tree-select v-if="isInit" :class="desc.class" :style="desc.style" v-bind="attrs" v-model="currentValue" :data="desc.options" :loading="loading" v-on="onEvents" :render-after-expand="false" />
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
export default {
|
|
6
|
-
name: 'ElPlusFormTselect',
|
|
7
|
-
inheritAttrs: false,
|
|
8
|
-
typeName: 'tselect',
|
|
9
|
-
customOptions: {}
|
|
10
|
-
}
|
|
11
|
-
</script>
|
|
12
|
-
<script lang="ts" setup>
|
|
13
|
-
import { ref, useAttrs, onBeforeMount } from 'vue'
|
|
14
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
-
|
|
16
|
-
const props = defineProps<{
|
|
17
|
-
modelValue?: any
|
|
18
|
-
field: string
|
|
19
|
-
loading?: boolean
|
|
20
|
-
desc: { [key: string]: any }
|
|
21
|
-
formData: { [key: string]: any }
|
|
22
|
-
}>()
|
|
23
|
-
const emits = defineEmits(['update:modelValue'])
|
|
24
|
-
|
|
25
|
-
const currentValue = ref(props.modelValue)
|
|
26
|
-
emits('update:modelValue', currentValue)
|
|
27
|
-
|
|
28
|
-
const isInit = ref(false)
|
|
29
|
-
const attrs = ref({} as any)
|
|
30
|
-
const onEvents = ref(getEvents(props))
|
|
31
|
-
|
|
32
|
-
onBeforeMount(async () => {
|
|
33
|
-
attrs.value = await getAttrs(props, { filterable: true, clearable: true, props: { label: 'name', value: 'id', children: 'children' }, ...useAttrs() })
|
|
34
|
-
isInit.value = true
|
|
35
|
-
})
|
|
36
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<el-tree-select v-if="isInit" :class="desc.class" :style="desc.style" v-bind="attrs" v-model="currentValue" :data="desc.options" :loading="loading" v-on="onEvents" :render-after-expand="false" />
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts">
|
|
5
|
+
export default {
|
|
6
|
+
name: 'ElPlusFormTselect',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
typeName: 'tselect',
|
|
9
|
+
customOptions: {}
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { ref, useAttrs, onBeforeMount } from 'vue'
|
|
14
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
modelValue?: any
|
|
18
|
+
field: string
|
|
19
|
+
loading?: boolean
|
|
20
|
+
desc: { [key: string]: any }
|
|
21
|
+
formData: { [key: string]: any }
|
|
22
|
+
}>()
|
|
23
|
+
const emits = defineEmits(['update:modelValue'])
|
|
24
|
+
|
|
25
|
+
const currentValue = ref(props.modelValue)
|
|
26
|
+
emits('update:modelValue', currentValue)
|
|
27
|
+
|
|
28
|
+
const isInit = ref(false)
|
|
29
|
+
const attrs = ref({} as any)
|
|
30
|
+
const onEvents = ref(getEvents(props))
|
|
31
|
+
|
|
32
|
+
onBeforeMount(async () => {
|
|
33
|
+
attrs.value = await getAttrs(props, { filterable: true, clearable: true, props: { label: 'name', value: 'id', children: 'children' }, ...useAttrs() })
|
|
34
|
+
isInit.value = true
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
@@ -80,6 +80,8 @@ const previewList = computed(() =>
|
|
|
80
80
|
)
|
|
81
81
|
|
|
82
82
|
onBeforeMount(async () => {
|
|
83
|
+
// // 如果没有配置,则抛出一个警告
|
|
84
|
+
// if (defaultConf.upload?.action)
|
|
83
85
|
attrs.value = await getAttrs(props, {
|
|
84
86
|
drag: true,
|
|
85
87
|
listType: props.desc.upType === 'file' ? 'text' : 'picture-card',
|