@ddwl/ddwl-ui 1.1.4 → 1.1.5-beta.1
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/README.md +92 -92
- package/package.json +68 -68
- package/src/lib/install/index.js +13 -13
- package/src/lib/slots/buttonGroup.vue +113 -113
- package/src/lib/slots/dict.vue +46 -46
- package/src/lib/slots/file.vue +36 -36
- package/src/lib/slots/icon.vue +74 -74
- package/src/lib/slots/index.js +11 -11
- package/src/main.js +62 -62
- package/src/packages/button/index.vue +36 -36
- package/src/packages/descriptions/index.vue +124 -124
- package/src/packages/dialog/index.vue +172 -172
- package/src/packages/dialog-confirm/index.vue +99 -99
- package/src/packages/drawer/index.vue +136 -136
- package/src/packages/file-preview/index.vue +277 -277
- package/src/packages/filter-tree/index.vue +295 -295
- package/src/packages/form/index.vue +149 -149
- package/src/packages/form-item/index.vue +199 -199
- package/src/packages/import-file/index.vue +173 -173
- package/src/packages/menu/index.vue +66 -66
- package/src/packages/menu/menuItem.vue +90 -90
- package/src/packages/popconfirm/index.vue +39 -39
- package/src/packages/render/index.vue +14 -14
- package/src/packages/search-form/index.vue +257 -257
- package/src/packages/search-input/index.vue +68 -68
- package/src/packages/search-table/index.vue +93 -93
- package/src/packages/svg-icon/index.vue +43 -43
- package/src/packages/table/index.vue +458 -458
- package/src/packages/upload/index.vue +356 -356
- package/src/utils/index.js +77 -77
- package/src/utils/treeLib.js +190 -190
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
<!-- 表单 -->
|
|
2
|
-
<template>
|
|
3
|
-
<el-form
|
|
4
|
-
ref="form"
|
|
5
|
-
v-bind="$attrs"
|
|
6
|
-
:model="source"
|
|
7
|
-
>
|
|
8
|
-
<el-row
|
|
9
|
-
style="display: flex;flex-wrap: wrap;"
|
|
10
|
-
:gutter="16"
|
|
11
|
-
:class="!grid && 'flex'"
|
|
12
|
-
>
|
|
13
|
-
<template v-for="item in config">
|
|
14
|
-
<component
|
|
15
|
-
:is="grid ? 'el-col' : 'div'"
|
|
16
|
-
v-if="!item.hide"
|
|
17
|
-
:key="item.prop"
|
|
18
|
-
:class="item.className"
|
|
19
|
-
:span="item.span || 24"
|
|
20
|
-
>
|
|
21
|
-
<el-form-item
|
|
22
|
-
class="d-form-item"
|
|
23
|
-
:class="{ 'custom-form-item-top': item.direction === 'vertical' || direction === 'vertical' }"
|
|
24
|
-
:label="item.label"
|
|
25
|
-
:prop="item.prop"
|
|
26
|
-
:label-width="(item.direction === 'line' || direction === 'line') ? (item.labelWidth || labelWidth) : '100%'"
|
|
27
|
-
:rules="item.rules || (item.required ? [{ required: true, message: placeholder(item) }] : null)"
|
|
28
|
-
v-bind="item.itemProps"
|
|
29
|
-
>
|
|
30
|
-
<span slot="label">
|
|
31
|
-
<span v-if="!item.labelRender">{{ item.label }}</span>
|
|
32
|
-
<form-label-render v-else :scope="item" :render="item.labelRender" />
|
|
33
|
-
</span>
|
|
34
|
-
<span v-if="item.preText" class="mr8">{{ item.preText }}</span>
|
|
35
|
-
<slot v-if="item.component === 'slot'" :name="item.slotName" />
|
|
36
|
-
<div
|
|
37
|
-
v-else-if="item.component === 'text'"
|
|
38
|
-
:class="item.innerClass"
|
|
39
|
-
:style="item.style"
|
|
40
|
-
>
|
|
41
|
-
{{ item.text || source[item.prop] }}
|
|
42
|
-
</div>
|
|
43
|
-
<template v-else>
|
|
44
|
-
<form-item :ref="item.prop" v-model="source[item.prop]" :config="item" />
|
|
45
|
-
</template>
|
|
46
|
-
<span v-if="item.sufText" class="ml8">{{ item.sufText }}</span>
|
|
47
|
-
</el-form-item>
|
|
48
|
-
</component>
|
|
49
|
-
</template>
|
|
50
|
-
</el-row>
|
|
51
|
-
</el-form>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script>
|
|
55
|
-
import FormItem from '../form-item/index'
|
|
56
|
-
import FormLabelRender from '../render'
|
|
57
|
-
|
|
58
|
-
export default {
|
|
59
|
-
name: 'DForm',
|
|
60
|
-
components: {
|
|
61
|
-
FormItem,
|
|
62
|
-
FormLabelRender
|
|
63
|
-
},
|
|
64
|
-
model: {
|
|
65
|
-
prop: 'modelValue',
|
|
66
|
-
event: 'change'
|
|
67
|
-
},
|
|
68
|
-
props: {
|
|
69
|
-
config: {
|
|
70
|
-
type: Array,
|
|
71
|
-
default: () => []
|
|
72
|
-
},
|
|
73
|
-
labelWidth: {
|
|
74
|
-
default: '120px',
|
|
75
|
-
type: String
|
|
76
|
-
},
|
|
77
|
-
modelValue: {
|
|
78
|
-
type: Object,
|
|
79
|
-
default: () => ({})
|
|
80
|
-
},
|
|
81
|
-
grid: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
default: true
|
|
84
|
-
},
|
|
85
|
-
direction: {
|
|
86
|
-
type: String,
|
|
87
|
-
default: 'vertical'
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
data () {
|
|
91
|
-
return {}
|
|
92
|
-
},
|
|
93
|
-
computed: {
|
|
94
|
-
source: {
|
|
95
|
-
get () {
|
|
96
|
-
return this.modelValue
|
|
97
|
-
},
|
|
98
|
-
set (value) {
|
|
99
|
-
this.$emit('change', value)
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
placeholder () {
|
|
103
|
-
return ({ component, label }) => {
|
|
104
|
-
// 默认给组件添加placeholder,可自定义
|
|
105
|
-
if (component === 'el-input' || component === 'el-input-number') {
|
|
106
|
-
return `请输入${label}`
|
|
107
|
-
} else {
|
|
108
|
-
return `请选择${label}`
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
methods: {
|
|
114
|
-
resetFields () {
|
|
115
|
-
this.$refs.form.resetFields()
|
|
116
|
-
},
|
|
117
|
-
clearValidate () {
|
|
118
|
-
this.$refs.form.clearValidate()
|
|
119
|
-
},
|
|
120
|
-
async validate () {
|
|
121
|
-
const valid = await this.$refs.form.validate()
|
|
122
|
-
return valid
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<style lang="scss" scoped>
|
|
129
|
-
.d-form-item {
|
|
130
|
-
:deep(.el-form-item__content) {
|
|
131
|
-
display: flex;
|
|
132
|
-
.search-item {
|
|
133
|
-
flex: 1;
|
|
134
|
-
overflow: hidden;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
.custom-form-item-top {
|
|
139
|
-
display: flex;
|
|
140
|
-
flex-direction: column;
|
|
141
|
-
|
|
142
|
-
:deep(.el-form-item__label) {
|
|
143
|
-
text-align: left;
|
|
144
|
-
}
|
|
145
|
-
:deep(.el-form-item__content) {
|
|
146
|
-
margin-left: 0 !important;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
</style>
|
|
1
|
+
<!-- 表单 -->
|
|
2
|
+
<template>
|
|
3
|
+
<el-form
|
|
4
|
+
ref="form"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
:model="source"
|
|
7
|
+
>
|
|
8
|
+
<el-row
|
|
9
|
+
style="display: flex;flex-wrap: wrap;"
|
|
10
|
+
:gutter="16"
|
|
11
|
+
:class="!grid && 'flex'"
|
|
12
|
+
>
|
|
13
|
+
<template v-for="item in config">
|
|
14
|
+
<component
|
|
15
|
+
:is="grid ? 'el-col' : 'div'"
|
|
16
|
+
v-if="!item.hide"
|
|
17
|
+
:key="item.prop"
|
|
18
|
+
:class="item.className"
|
|
19
|
+
:span="item.span || 24"
|
|
20
|
+
>
|
|
21
|
+
<el-form-item
|
|
22
|
+
class="d-form-item"
|
|
23
|
+
:class="{ 'custom-form-item-top': item.direction === 'vertical' || direction === 'vertical' }"
|
|
24
|
+
:label="item.label"
|
|
25
|
+
:prop="item.prop"
|
|
26
|
+
:label-width="(item.direction === 'line' || direction === 'line') ? (item.labelWidth || labelWidth) : '100%'"
|
|
27
|
+
:rules="item.rules || (item.required ? [{ required: true, message: placeholder(item) }] : null)"
|
|
28
|
+
v-bind="item.itemProps"
|
|
29
|
+
>
|
|
30
|
+
<span slot="label">
|
|
31
|
+
<span v-if="!item.labelRender">{{ item.label }}</span>
|
|
32
|
+
<form-label-render v-else :scope="item" :render="item.labelRender" />
|
|
33
|
+
</span>
|
|
34
|
+
<span v-if="item.preText" class="mr8">{{ item.preText }}</span>
|
|
35
|
+
<slot v-if="item.component === 'slot'" :name="item.slotName" />
|
|
36
|
+
<div
|
|
37
|
+
v-else-if="item.component === 'text'"
|
|
38
|
+
:class="item.innerClass"
|
|
39
|
+
:style="item.style"
|
|
40
|
+
>
|
|
41
|
+
{{ item.text || source[item.prop] }}
|
|
42
|
+
</div>
|
|
43
|
+
<template v-else>
|
|
44
|
+
<form-item :ref="item.prop" v-model="source[item.prop]" :config="item" />
|
|
45
|
+
</template>
|
|
46
|
+
<span v-if="item.sufText" class="ml8">{{ item.sufText }}</span>
|
|
47
|
+
</el-form-item>
|
|
48
|
+
</component>
|
|
49
|
+
</template>
|
|
50
|
+
</el-row>
|
|
51
|
+
</el-form>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
import FormItem from '../form-item/index'
|
|
56
|
+
import FormLabelRender from '../render'
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
name: 'DForm',
|
|
60
|
+
components: {
|
|
61
|
+
FormItem,
|
|
62
|
+
FormLabelRender
|
|
63
|
+
},
|
|
64
|
+
model: {
|
|
65
|
+
prop: 'modelValue',
|
|
66
|
+
event: 'change'
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
config: {
|
|
70
|
+
type: Array,
|
|
71
|
+
default: () => []
|
|
72
|
+
},
|
|
73
|
+
labelWidth: {
|
|
74
|
+
default: '120px',
|
|
75
|
+
type: String
|
|
76
|
+
},
|
|
77
|
+
modelValue: {
|
|
78
|
+
type: Object,
|
|
79
|
+
default: () => ({})
|
|
80
|
+
},
|
|
81
|
+
grid: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: true
|
|
84
|
+
},
|
|
85
|
+
direction: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: 'vertical'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
data () {
|
|
91
|
+
return {}
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
source: {
|
|
95
|
+
get () {
|
|
96
|
+
return this.modelValue
|
|
97
|
+
},
|
|
98
|
+
set (value) {
|
|
99
|
+
this.$emit('change', value)
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
placeholder () {
|
|
103
|
+
return ({ component, label }) => {
|
|
104
|
+
// 默认给组件添加placeholder,可自定义
|
|
105
|
+
if (component === 'el-input' || component === 'el-input-number') {
|
|
106
|
+
return `请输入${label}`
|
|
107
|
+
} else {
|
|
108
|
+
return `请选择${label}`
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
resetFields () {
|
|
115
|
+
this.$refs.form.resetFields()
|
|
116
|
+
},
|
|
117
|
+
clearValidate () {
|
|
118
|
+
this.$refs.form.clearValidate()
|
|
119
|
+
},
|
|
120
|
+
async validate () {
|
|
121
|
+
const valid = await this.$refs.form.validate()
|
|
122
|
+
return valid
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<style lang="scss" scoped>
|
|
129
|
+
.d-form-item {
|
|
130
|
+
:deep(.el-form-item__content) {
|
|
131
|
+
display: flex;
|
|
132
|
+
.search-item {
|
|
133
|
+
flex: 1;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
.custom-form-item-top {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
|
|
142
|
+
:deep(.el-form-item__label) {
|
|
143
|
+
text-align: left;
|
|
144
|
+
}
|
|
145
|
+
:deep(.el-form-item__content) {
|
|
146
|
+
margin-left: 0 !important;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</style>
|