@ddwl/ddwl-ui 1.2.3-beta.2 → 1.2.3-beta.3
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/dist/app.common.js +3881 -3878
- package/dist/app.css +17 -18
- package/dist/app.umd.js +17141 -17138
- package/dist/app.umd.min.js +4 -4
- package/package.json +6 -3
- package/src/lib/install/index.js +1 -2
- package/src/lib/slots/buttonGroup.vue +21 -12
- package/src/lib/slots/dict.vue +4 -6
- package/src/lib/slots/file.vue +4 -6
- package/src/lib/slots/icon.vue +7 -6
- package/src/lib/slots/index.js +1 -1
- package/src/main.js +1 -4
- package/src/packages/button/index.vue +5 -10
- package/src/packages/checkbox-group/index.vue +8 -18
- package/src/packages/descriptions/index.vue +9 -18
- package/src/packages/dialog/index.vue +17 -22
- package/src/packages/dialog-confirm/index.vue +15 -13
- package/src/packages/drawer/index.vue +10 -15
- package/src/packages/file-preview/index.vue +34 -66
- package/src/packages/filter-tree/index.vue +44 -42
- package/src/packages/form/index.vue +40 -41
- package/src/packages/form-item/index.vue +28 -31
- package/src/packages/import-file/index.vue +18 -30
- package/src/packages/menu/index.vue +11 -9
- package/src/packages/menu/menuItem.vue +28 -45
- package/src/packages/popconfirm/index.vue +3 -8
- package/src/packages/radio-group/index.vue +8 -18
- package/src/packages/search-form/index.vue +50 -50
- package/src/packages/search-input/index.vue +12 -8
- package/src/packages/search-table/index.vue +30 -17
- package/src/packages/select/index.vue +10 -16
- package/src/packages/svg-icon/index.vue +10 -10
- package/src/packages/table/index.vue +67 -80
- package/src/packages/upload/index.vue +92 -112
- package/src/utils/constant.js +1 -1
- package/src/utils/index.js +1 -1
- package/src/utils/treeLib.js +3 -13
- package/dist/static/fonts/element-icons.f1a45d74.ttf +0 -0
- package/dist/static/fonts/element-icons.ff18efd1.woff +0 -0
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<div
|
|
7
|
-
ref="leftRef"
|
|
8
|
-
class="d-file-preview_left"
|
|
9
|
-
>
|
|
10
|
-
<el-tabs
|
|
11
|
-
v-model="activeTab"
|
|
12
|
-
@tab-click="handleTabClick"
|
|
13
|
-
>
|
|
14
|
-
<el-tab-pane
|
|
15
|
-
v-for="(v, i) in fileList"
|
|
16
|
-
:key="i"
|
|
17
|
-
:label="v.name"
|
|
18
|
-
:name="v.type"
|
|
19
|
-
/>
|
|
2
|
+
<div v-if="visible && list.length" class="d-file-preview">
|
|
3
|
+
<div ref="leftRef" class="d-file-preview_left">
|
|
4
|
+
<el-tabs v-model="activeTab" @tab-click="handleTabClick">
|
|
5
|
+
<el-tab-pane v-for="(v, i) in fileList" :key="i" :label="v.name" :name="v.type" />
|
|
20
6
|
</el-tabs>
|
|
21
7
|
<ul class="d-file-preview_list">
|
|
22
8
|
<li
|
|
@@ -25,11 +11,7 @@
|
|
|
25
11
|
:class="currentFileIndex === i ? 'active_left' : ''"
|
|
26
12
|
@click="handleClickLeft(url, i)"
|
|
27
13
|
>
|
|
28
|
-
<el-image
|
|
29
|
-
style="width: 140px; height: 140px"
|
|
30
|
-
:src="getUrl(url)"
|
|
31
|
-
fit="cover"
|
|
32
|
-
/>
|
|
14
|
+
<el-image style="width: 140px; height: 140px" :src="getUrl(url)" fit="cover" />
|
|
33
15
|
</li>
|
|
34
16
|
</ul>
|
|
35
17
|
</div>
|
|
@@ -41,30 +23,16 @@
|
|
|
41
23
|
:url-list="[activeTab === 'image' ? currentFileList[currentFileIndex] : '']"
|
|
42
24
|
:on-close="close"
|
|
43
25
|
/>
|
|
44
|
-
<div
|
|
45
|
-
|
|
46
|
-
class="d-file-preview_box"
|
|
47
|
-
>
|
|
48
|
-
<span
|
|
49
|
-
class="el-image-viewer__btn el-image-viewer__close"
|
|
50
|
-
@click="close"
|
|
51
|
-
>
|
|
26
|
+
<div v-show="activeTab !== 'image'" class="d-file-preview_box">
|
|
27
|
+
<span class="el-image-viewer__btn el-image-viewer__close" @click="close">
|
|
52
28
|
<i class="el-icon-close" />
|
|
53
29
|
</span>
|
|
54
|
-
<audio
|
|
55
|
-
|
|
56
|
-
controls
|
|
57
|
-
style="width: 60%"
|
|
58
|
-
>
|
|
59
|
-
<source :src="currentFileList[currentFileIndex]">
|
|
30
|
+
<audio v-show="activeTab === 'audio'" controls style="width: 60%">
|
|
31
|
+
<source :src="currentFileList[currentFileIndex]" />
|
|
60
32
|
您的浏览器不支持 audio 元素。
|
|
61
33
|
</audio>
|
|
62
|
-
<video
|
|
63
|
-
|
|
64
|
-
controls
|
|
65
|
-
style="min-width: 80%;max-height: 90%"
|
|
66
|
-
>
|
|
67
|
-
<source :src="currentFileList[currentFileIndex]">
|
|
34
|
+
<video v-show="activeTab === 'video'" controls style="min-width: 80%; max-height: 90%">
|
|
35
|
+
<source :src="currentFileList[currentFileIndex]" />
|
|
68
36
|
您的浏览器不支持 HTML5 video 标签。
|
|
69
37
|
</video>
|
|
70
38
|
</div>
|
|
@@ -73,7 +41,7 @@
|
|
|
73
41
|
|
|
74
42
|
<script>
|
|
75
43
|
import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
|
|
76
|
-
import {imgExts, videoExts, audioExts} from '../../utils/constant'
|
|
44
|
+
import { imgExts, videoExts, audioExts } from '../../utils/constant'
|
|
77
45
|
export default {
|
|
78
46
|
name: 'DFilePreview',
|
|
79
47
|
components: { ElImageViewer },
|
|
@@ -95,9 +63,9 @@ export default {
|
|
|
95
63
|
defaultIndex: {
|
|
96
64
|
type: Number,
|
|
97
65
|
default: 0
|
|
98
|
-
}
|
|
66
|
+
}
|
|
99
67
|
},
|
|
100
|
-
data
|
|
68
|
+
data() {
|
|
101
69
|
return {
|
|
102
70
|
fileList: [],
|
|
103
71
|
currentFileIndex: 0,
|
|
@@ -106,14 +74,14 @@ export default {
|
|
|
106
74
|
}
|
|
107
75
|
},
|
|
108
76
|
computed: {
|
|
109
|
-
currentFileList
|
|
110
|
-
return this.fileList.find(item => item.type === this.activeTab)?.urls || []
|
|
77
|
+
currentFileList() {
|
|
78
|
+
return this.fileList.find((item) => item.type === this.activeTab)?.urls || []
|
|
111
79
|
}
|
|
112
80
|
},
|
|
113
81
|
watch: {
|
|
114
82
|
list: {
|
|
115
|
-
handler
|
|
116
|
-
if (val.length && typeof
|
|
83
|
+
handler(val) {
|
|
84
|
+
if (val.length && typeof val[0] === 'string') {
|
|
117
85
|
let arr = [
|
|
118
86
|
{ name: '图片', type: 'image', urls: [] },
|
|
119
87
|
{ name: '视频', type: 'video', urls: [] },
|
|
@@ -132,7 +100,7 @@ export default {
|
|
|
132
100
|
}
|
|
133
101
|
})
|
|
134
102
|
})
|
|
135
|
-
this.fileList = arr.filter(item => item.urls.length)
|
|
103
|
+
this.fileList = arr.filter((item) => item.urls.length)
|
|
136
104
|
} else {
|
|
137
105
|
this.fileList = val
|
|
138
106
|
}
|
|
@@ -141,7 +109,7 @@ export default {
|
|
|
141
109
|
deep: true
|
|
142
110
|
},
|
|
143
111
|
visible: {
|
|
144
|
-
handler
|
|
112
|
+
handler(val) {
|
|
145
113
|
if (val) {
|
|
146
114
|
this.addEventEventFun()
|
|
147
115
|
} else {
|
|
@@ -151,27 +119,27 @@ export default {
|
|
|
151
119
|
}
|
|
152
120
|
},
|
|
153
121
|
methods: {
|
|
154
|
-
deviceSupportUninstall
|
|
122
|
+
deviceSupportUninstall() {
|
|
155
123
|
this.$refs.viewer.deviceSupportUninstall()
|
|
156
124
|
},
|
|
157
|
-
deviceSupportInstall
|
|
125
|
+
deviceSupportInstall() {
|
|
158
126
|
this.$refs.viewer.deviceSupportInstall()
|
|
159
127
|
},
|
|
160
|
-
addEventEventFun
|
|
128
|
+
addEventEventFun() {
|
|
161
129
|
const elRef = this.$refs.leftRef
|
|
162
130
|
elRef.addEventListener('mouseenter', this.deviceSupportUninstall)
|
|
163
131
|
elRef.addEventListener('mouseleave', this.deviceSupportInstall)
|
|
164
132
|
},
|
|
165
|
-
removeEventFun
|
|
133
|
+
removeEventFun() {
|
|
166
134
|
const elRef = this.$refs.leftRef
|
|
167
135
|
elRef.removeEventListener('mouseenter', this.deviceSupportUninstall)
|
|
168
136
|
elRef.removeEventListener('mouseleave', this.deviceSupportInstall)
|
|
169
137
|
},
|
|
170
|
-
close
|
|
138
|
+
close() {
|
|
171
139
|
this.visible = false
|
|
172
140
|
this.$emit('close')
|
|
173
141
|
},
|
|
174
|
-
getUrl
|
|
142
|
+
getUrl(val) {
|
|
175
143
|
switch (this.activeTab) {
|
|
176
144
|
case 'video':
|
|
177
145
|
return require('./static/video.png')
|
|
@@ -183,17 +151,17 @@ export default {
|
|
|
183
151
|
break
|
|
184
152
|
}
|
|
185
153
|
},
|
|
186
|
-
handleClickLeft
|
|
154
|
+
handleClickLeft(url, index) {
|
|
187
155
|
this.currentFileIndex = index
|
|
188
156
|
},
|
|
189
|
-
handleTabClick
|
|
157
|
+
handleTabClick() {
|
|
190
158
|
this.currentFileIndex = 0
|
|
191
159
|
}
|
|
192
160
|
}
|
|
193
161
|
}
|
|
194
162
|
</script>
|
|
195
163
|
|
|
196
|
-
<style lang="scss"
|
|
164
|
+
<style lang="scss">
|
|
197
165
|
.d-file-preview {
|
|
198
166
|
width: 100vw;
|
|
199
167
|
height: 100vh;
|
|
@@ -230,15 +198,15 @@ export default {
|
|
|
230
198
|
flex-direction: column;
|
|
231
199
|
background: #606266;
|
|
232
200
|
|
|
233
|
-
|
|
201
|
+
.el-tabs__nav-wrap::after {
|
|
234
202
|
background-color: transparent;
|
|
235
203
|
}
|
|
236
204
|
|
|
237
|
-
|
|
205
|
+
.el-tabs__item {
|
|
238
206
|
color: #fff;
|
|
239
207
|
}
|
|
240
208
|
|
|
241
|
-
|
|
209
|
+
.el-tabs__item.is-active {
|
|
242
210
|
color: #5f9efd;
|
|
243
211
|
}
|
|
244
212
|
|
|
@@ -264,11 +232,11 @@ export default {
|
|
|
264
232
|
}
|
|
265
233
|
}
|
|
266
234
|
|
|
267
|
-
|
|
235
|
+
.el-image-viewer__wrapper {
|
|
268
236
|
left: calc(220px);
|
|
269
237
|
}
|
|
270
238
|
|
|
271
|
-
|
|
239
|
+
.el-icon-close {
|
|
272
240
|
color: #fff;
|
|
273
241
|
}
|
|
274
242
|
}
|
|
@@ -22,19 +22,13 @@
|
|
|
22
22
|
:default-expanded-keys="defaultExpandIds"
|
|
23
23
|
v-bind="$attrs"
|
|
24
24
|
@node-click="nodeClick"
|
|
25
|
-
@node-expand="(data)=>handleNodeToggle(data,true)"
|
|
26
|
-
@node-collapse="(data)=>handleNodeToggle(data,false)"
|
|
25
|
+
@node-expand="(data) => handleNodeToggle(data, true)"
|
|
26
|
+
@node-collapse="(data) => handleNodeToggle(data, false)"
|
|
27
27
|
v-on="$listeners"
|
|
28
28
|
>
|
|
29
|
-
<span
|
|
30
|
-
slot-scope="{ node, data }"
|
|
31
|
-
class="d-filter-tree-node"
|
|
32
|
-
>
|
|
29
|
+
<span slot-scope="{ node, data }" class="d-filter-tree-node">
|
|
33
30
|
<span class="node-label ellipsis">
|
|
34
|
-
<slot
|
|
35
|
-
name="label"
|
|
36
|
-
:data="data"
|
|
37
|
-
>{{ node.label }}</slot>
|
|
31
|
+
<slot name="label" :data="data">{{ node.label }}</slot>
|
|
38
32
|
</span>
|
|
39
33
|
<span class="mr8">
|
|
40
34
|
<slot name="button" :node="node"></slot>
|
|
@@ -117,7 +111,7 @@ export default {
|
|
|
117
111
|
default: 'search'
|
|
118
112
|
}
|
|
119
113
|
},
|
|
120
|
-
data
|
|
114
|
+
data() {
|
|
121
115
|
return {
|
|
122
116
|
searchContent: '',
|
|
123
117
|
defaultExpandIds: [],
|
|
@@ -125,7 +119,7 @@ export default {
|
|
|
125
119
|
}
|
|
126
120
|
},
|
|
127
121
|
computed: {
|
|
128
|
-
showNodeButton
|
|
122
|
+
showNodeButton() {
|
|
129
123
|
return (type, data) => {
|
|
130
124
|
if (this.buttonProps[type]) {
|
|
131
125
|
if (typeof this.buttonProps[type] === 'function') {
|
|
@@ -141,11 +135,13 @@ export default {
|
|
|
141
135
|
},
|
|
142
136
|
watch: {
|
|
143
137
|
data: {
|
|
144
|
-
handler
|
|
138
|
+
handler() {
|
|
145
139
|
if (this.data && this.data.length) {
|
|
146
140
|
let node
|
|
147
141
|
if (this.currentKey) {
|
|
148
|
-
node = getNodeByKey(this.data, this.currentKey, {
|
|
142
|
+
node = getNodeByKey(this.data, this.currentKey, {
|
|
143
|
+
key: this.nodeKey
|
|
144
|
+
})
|
|
149
145
|
} else if (this.currentDefault) {
|
|
150
146
|
// 获取需要默认选中的节点
|
|
151
147
|
const props = {
|
|
@@ -167,32 +163,36 @@ export default {
|
|
|
167
163
|
},
|
|
168
164
|
immediate: true
|
|
169
165
|
},
|
|
170
|
-
searchContent
|
|
166
|
+
searchContent(val) {
|
|
171
167
|
this.$refs.tree.filter(val)
|
|
172
168
|
}
|
|
173
169
|
},
|
|
174
|
-
created
|
|
170
|
+
created() {},
|
|
175
171
|
methods: {
|
|
176
172
|
// 树的过滤methods
|
|
177
|
-
filterNode
|
|
173
|
+
filterNode(value, data) {
|
|
178
174
|
if (!value) return true
|
|
179
|
-
return (
|
|
175
|
+
return (
|
|
176
|
+
(data[this.searchKey] || data[(this.props && this.props.label) || 'label']).indexOf(
|
|
177
|
+
value
|
|
178
|
+
) !== -1
|
|
179
|
+
)
|
|
180
180
|
},
|
|
181
181
|
// 树节点触发点击
|
|
182
|
-
nodeClick
|
|
182
|
+
nodeClick(node) {
|
|
183
183
|
this.$emit('node-change', node)
|
|
184
184
|
},
|
|
185
|
-
append
|
|
185
|
+
append(node) {
|
|
186
186
|
this.$emit('node-append', node)
|
|
187
187
|
},
|
|
188
|
-
edit
|
|
188
|
+
edit(node) {
|
|
189
189
|
this.$emit('node-edit', node)
|
|
190
190
|
},
|
|
191
|
-
remove
|
|
191
|
+
remove(node) {
|
|
192
192
|
this.$emit('node-remove', node)
|
|
193
193
|
},
|
|
194
194
|
// 树节点展开/关闭
|
|
195
|
-
handleNodeToggle
|
|
195
|
+
handleNodeToggle(data, isExpanded) {
|
|
196
196
|
if (isExpanded) {
|
|
197
197
|
// 展开节点
|
|
198
198
|
if (!this.defaultExpandIds.includes(data[this.nodeKey])) {
|
|
@@ -207,59 +207,61 @@ export default {
|
|
|
207
207
|
}
|
|
208
208
|
this.removeExpandChildIds(data)
|
|
209
209
|
},
|
|
210
|
-
removeExpandChildIds
|
|
211
|
-
const ids = (flatTree(data.children || [], { key: this.nodeKey }) || []).map(
|
|
212
|
-
|
|
210
|
+
removeExpandChildIds(data) {
|
|
211
|
+
const ids = (flatTree(data.children || [], { key: this.nodeKey }) || []).map(
|
|
212
|
+
(node) => node[this.nodeKey]
|
|
213
|
+
)
|
|
214
|
+
this.defaultExpandIds = this.defaultExpandIds.filter((id) => !ids.includes(id))
|
|
213
215
|
},
|
|
214
|
-
expandNode
|
|
216
|
+
expandNode(id) {
|
|
215
217
|
const node = getNodeByKey(this.data, id, { key: this.nodeKey })
|
|
216
218
|
if (node) this.handleNodeToggle(node, true)
|
|
217
219
|
},
|
|
218
220
|
// el-tree methods
|
|
219
|
-
updateKeyChildren
|
|
221
|
+
updateKeyChildren(...args) {
|
|
220
222
|
this.$refs.tree.updateKeyChildren(...args)
|
|
221
223
|
},
|
|
222
|
-
getCheckedNodes
|
|
224
|
+
getCheckedNodes(...args) {
|
|
223
225
|
return this.$refs.tree.getCheckedNodes(...args)
|
|
224
226
|
},
|
|
225
|
-
setCheckedNodes
|
|
227
|
+
setCheckedNodes(...args) {
|
|
226
228
|
this.$refs.tree.setCheckedNodes(...args)
|
|
227
229
|
},
|
|
228
|
-
getCheckedKeys
|
|
230
|
+
getCheckedKeys(...args) {
|
|
229
231
|
return this.$refs.tree.getCheckedKeys(...args)
|
|
230
232
|
},
|
|
231
|
-
setCheckedKeys
|
|
233
|
+
setCheckedKeys(...args) {
|
|
232
234
|
this.$refs.tree.setCheckedKeys(...args)
|
|
233
235
|
},
|
|
234
|
-
setChecked
|
|
236
|
+
setChecked(...args) {
|
|
235
237
|
this.$refs.tree.setChecked(...args)
|
|
236
238
|
},
|
|
237
|
-
getHalfCheckedNodes
|
|
239
|
+
getHalfCheckedNodes(...args) {
|
|
238
240
|
return this.$refs.tree.getHalfCheckedNodes(...args)
|
|
239
241
|
},
|
|
240
|
-
getHalfCheckedKeys
|
|
242
|
+
getHalfCheckedKeys(...args) {
|
|
241
243
|
return this.$refs.tree.getHalfCheckedKeys(...args)
|
|
242
244
|
},
|
|
243
|
-
getCurrentKey
|
|
245
|
+
getCurrentKey(...args) {
|
|
244
246
|
return this.$refs.tree.getCurrentKey(...args)
|
|
245
247
|
},
|
|
246
|
-
getCurrentNode
|
|
248
|
+
getCurrentNode(...args) {
|
|
247
249
|
return this.$refs.tree.getCurrentNode(...args)
|
|
248
250
|
},
|
|
249
|
-
setCurrentKey
|
|
251
|
+
setCurrentKey(...args) {
|
|
250
252
|
this.$refs.tree.setCurrentKey(...args)
|
|
251
253
|
},
|
|
252
|
-
setCurrentNode
|
|
254
|
+
setCurrentNode(...args) {
|
|
253
255
|
this.$refs.tree.setCurrentNode(...args)
|
|
254
256
|
},
|
|
255
|
-
getNode
|
|
257
|
+
getNode(...args) {
|
|
256
258
|
return this.$refs.tree.getNode(...args)
|
|
257
259
|
}
|
|
258
260
|
}
|
|
259
261
|
}
|
|
260
262
|
</script>
|
|
261
263
|
|
|
262
|
-
<style lang=
|
|
264
|
+
<style lang="scss">
|
|
263
265
|
.d-filter-tree {
|
|
264
266
|
display: flex;
|
|
265
267
|
flex-direction: column;
|
|
@@ -270,7 +272,7 @@ export default {
|
|
|
270
272
|
justify-content: space-between;
|
|
271
273
|
& > div {
|
|
272
274
|
cursor: pointer;
|
|
273
|
-
color: #
|
|
275
|
+
color: #3786fd;
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
.d-filter-tree-node {
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
<!-- 表单 -->
|
|
2
2
|
<template>
|
|
3
|
-
<el-form
|
|
4
|
-
|
|
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
|
-
>
|
|
3
|
+
<el-form ref="form" class="d-form" v-bind="$attrs" :model="source">
|
|
4
|
+
<el-row style="display: flex; flex-wrap: wrap" :gutter="16" :class="!grid && 'flex'">
|
|
13
5
|
<template v-for="item in config">
|
|
14
6
|
<component
|
|
15
7
|
:is="grid ? 'el-col' : 'div'"
|
|
@@ -20,11 +12,20 @@
|
|
|
20
12
|
>
|
|
21
13
|
<el-form-item
|
|
22
14
|
class="d-form-item"
|
|
23
|
-
:class="{
|
|
15
|
+
:class="{
|
|
16
|
+
'custom-form-item-top': item.direction === 'vertical' || direction === 'vertical'
|
|
17
|
+
}"
|
|
24
18
|
:label="item.label"
|
|
25
19
|
:prop="item.prop"
|
|
26
|
-
:label-width="
|
|
27
|
-
|
|
20
|
+
:label-width="
|
|
21
|
+
item.direction === 'line' || direction === 'line'
|
|
22
|
+
? item.labelWidth || labelWidth
|
|
23
|
+
: '100%'
|
|
24
|
+
"
|
|
25
|
+
:rules="
|
|
26
|
+
item.rules ||
|
|
27
|
+
(item.required ? [{ required: true, message: placeholder(item) }] : null)
|
|
28
|
+
"
|
|
28
29
|
v-bind="item.itemProps"
|
|
29
30
|
>
|
|
30
31
|
<span slot="label">
|
|
@@ -33,11 +34,7 @@
|
|
|
33
34
|
</span>
|
|
34
35
|
<span v-if="item.preText" class="mr8">{{ item.preText }}</span>
|
|
35
36
|
<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
|
-
>
|
|
37
|
+
<div v-else-if="item.component === 'text'" :class="item.innerClass" :style="item.style">
|
|
41
38
|
{{ item.text || source[item.prop] }}
|
|
42
39
|
</div>
|
|
43
40
|
<template v-else>
|
|
@@ -87,19 +84,19 @@ export default {
|
|
|
87
84
|
default: 'vertical'
|
|
88
85
|
}
|
|
89
86
|
},
|
|
90
|
-
data
|
|
87
|
+
data() {
|
|
91
88
|
return {}
|
|
92
89
|
},
|
|
93
90
|
computed: {
|
|
94
91
|
source: {
|
|
95
|
-
get
|
|
92
|
+
get() {
|
|
96
93
|
return this.modelValue
|
|
97
94
|
},
|
|
98
|
-
set
|
|
95
|
+
set(value) {
|
|
99
96
|
this.$emit('change', value)
|
|
100
97
|
}
|
|
101
98
|
},
|
|
102
|
-
placeholder
|
|
99
|
+
placeholder() {
|
|
103
100
|
return ({ component, label }) => {
|
|
104
101
|
// 默认给组件添加placeholder,可自定义
|
|
105
102
|
if (component === 'el-input' || component === 'el-input-number') {
|
|
@@ -111,13 +108,13 @@ export default {
|
|
|
111
108
|
}
|
|
112
109
|
},
|
|
113
110
|
methods: {
|
|
114
|
-
resetFields
|
|
111
|
+
resetFields() {
|
|
115
112
|
this.$refs.form.resetFields()
|
|
116
113
|
},
|
|
117
|
-
clearValidate
|
|
114
|
+
clearValidate() {
|
|
118
115
|
this.$refs.form.clearValidate()
|
|
119
116
|
},
|
|
120
|
-
async validate
|
|
117
|
+
async validate() {
|
|
121
118
|
const valid = await this.$refs.form.validate()
|
|
122
119
|
return valid
|
|
123
120
|
}
|
|
@@ -125,25 +122,27 @@ export default {
|
|
|
125
122
|
}
|
|
126
123
|
</script>
|
|
127
124
|
|
|
128
|
-
<style lang="scss"
|
|
129
|
-
.d-form
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
<style lang="scss">
|
|
126
|
+
.d-form {
|
|
127
|
+
.d-form-item {
|
|
128
|
+
.el-form-item__content {
|
|
129
|
+
display: flex;
|
|
130
|
+
.search-item {
|
|
131
|
+
flex: 1;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
}
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
flex-direction: column;
|
|
136
|
+
.custom-form-item-top {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
141
139
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
.el-form-item__label {
|
|
141
|
+
text-align: left;
|
|
142
|
+
}
|
|
143
|
+
.el-form-item__content {
|
|
144
|
+
margin-left: 0 !important;
|
|
145
|
+
}
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
</style>
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
<template>
|
|
3
3
|
<div class="search-item">
|
|
4
4
|
<div>
|
|
5
|
-
<span
|
|
6
|
-
v-if="config.prefix"
|
|
7
|
-
class="mr6"
|
|
8
|
-
>{{ config.prefix }}</span>
|
|
5
|
+
<span v-if="config.prefix" class="mr6">{{ config.prefix }}</span>
|
|
9
6
|
<el-radio-group
|
|
10
7
|
v-if="config.component === 'el-radio-group'"
|
|
11
8
|
v-model="value"
|
|
@@ -39,14 +36,8 @@
|
|
|
39
36
|
v-on="config.listeners"
|
|
40
37
|
@change="change"
|
|
41
38
|
>
|
|
42
|
-
<template
|
|
43
|
-
|
|
44
|
-
:slot="s.slotName"
|
|
45
|
-
>
|
|
46
|
-
<form-item-render
|
|
47
|
-
:scope="config"
|
|
48
|
-
:render="s.render"
|
|
49
|
-
/>
|
|
39
|
+
<template v-for="s in slots" :slot="s.slotName">
|
|
40
|
+
<form-item-render :scope="config" :render="s.render" />
|
|
50
41
|
</template>
|
|
51
42
|
<template v-if="config.component === 'el-checkbox-group'">
|
|
52
43
|
<el-checkbox
|
|
@@ -67,10 +58,7 @@
|
|
|
67
58
|
:disabled="!!option.disabled"
|
|
68
59
|
/>
|
|
69
60
|
</template>
|
|
70
|
-
<span
|
|
71
|
-
v-if="config.suffix"
|
|
72
|
-
class="ml6"
|
|
73
|
-
>{{ config.suffix }}</span>
|
|
61
|
+
<span v-if="config.suffix" class="ml6">{{ config.suffix }}</span>
|
|
74
62
|
</component>
|
|
75
63
|
</div>
|
|
76
64
|
</div>
|
|
@@ -97,25 +85,25 @@ export default {
|
|
|
97
85
|
default: ''
|
|
98
86
|
}
|
|
99
87
|
},
|
|
100
|
-
data
|
|
88
|
+
data() {
|
|
101
89
|
return {}
|
|
102
90
|
},
|
|
103
91
|
computed: {
|
|
104
92
|
value: {
|
|
105
|
-
get
|
|
93
|
+
get() {
|
|
106
94
|
return this.modelValue
|
|
107
95
|
},
|
|
108
|
-
set
|
|
96
|
+
set(value) {
|
|
109
97
|
this.$emit('change', value)
|
|
110
98
|
}
|
|
111
99
|
},
|
|
112
|
-
slots
|
|
100
|
+
slots() {
|
|
113
101
|
return Object.entries(this.config.slots || []).map(([key, value]) => ({
|
|
114
102
|
slotName: key,
|
|
115
103
|
render: value
|
|
116
104
|
}))
|
|
117
105
|
},
|
|
118
|
-
clearable
|
|
106
|
+
clearable() {
|
|
119
107
|
return (config) => {
|
|
120
108
|
// 优先取配置项clearable
|
|
121
109
|
if (config.clearable !== undefined) {
|
|
@@ -125,7 +113,7 @@ export default {
|
|
|
125
113
|
}
|
|
126
114
|
}
|
|
127
115
|
},
|
|
128
|
-
maxlength
|
|
116
|
+
maxlength() {
|
|
129
117
|
return (config) => {
|
|
130
118
|
if (config.component === 'el-input') {
|
|
131
119
|
if (config.props && config.props.type === 'textarea') {
|
|
@@ -138,7 +126,7 @@ export default {
|
|
|
138
126
|
}
|
|
139
127
|
}
|
|
140
128
|
},
|
|
141
|
-
placeholder
|
|
129
|
+
placeholder() {
|
|
142
130
|
return ({ component, label }) => {
|
|
143
131
|
// 默认给组件添加placeholder,可自定义
|
|
144
132
|
if (component === 'el-input' || component === 'el-input-number') {
|
|
@@ -155,7 +143,7 @@ export default {
|
|
|
155
143
|
* @param {*} value
|
|
156
144
|
* @return {*} data: 输出结构和value数据结构一致,对应value中的节点data
|
|
157
145
|
*/
|
|
158
|
-
change
|
|
146
|
+
change(value) {
|
|
159
147
|
if (this.config.onChange) {
|
|
160
148
|
let data = null
|
|
161
149
|
|
|
@@ -164,29 +152,38 @@ export default {
|
|
|
164
152
|
this.$nextTick(() => {
|
|
165
153
|
// el-cascader搜索勾选bug,需要nextTick后才能正常使用getCheckedNodes
|
|
166
154
|
data = this.$refs[this.config.prop].getCheckedNodes()
|
|
167
|
-
const emitPath =
|
|
168
|
-
|
|
155
|
+
const emitPath =
|
|
156
|
+
this.config.props &&
|
|
157
|
+
this.config.props.props &&
|
|
158
|
+
this.config.props.props.emitPath !== undefined
|
|
159
|
+
? this.config.props.props.emitPath
|
|
160
|
+
: true
|
|
161
|
+
const multiple =
|
|
162
|
+
this.config.props && this.config.props.props && this.config.props.props.multiple
|
|
169
163
|
if (emitPath) {
|
|
170
164
|
if (multiple) {
|
|
171
|
-
data = value.map(
|
|
165
|
+
data = value.map(
|
|
166
|
+
(arr) => data.find((node) => arr[arr.length - 1] === node.value).pathNodes
|
|
167
|
+
)
|
|
172
168
|
} else {
|
|
173
169
|
data = data[data.length - 1].pathNodes
|
|
174
170
|
}
|
|
175
171
|
} else {
|
|
176
172
|
if (multiple) {
|
|
177
|
-
data = value.map(item => data.find(node => item === node.value))
|
|
173
|
+
data = value.map((item) => data.find((node) => item === node.value))
|
|
178
174
|
} else {
|
|
179
175
|
data = data[data.length - 1]
|
|
180
176
|
}
|
|
181
177
|
}
|
|
182
178
|
this.config.onChange(value, data)
|
|
183
179
|
})
|
|
184
|
-
} else if (this.config.component === 'el-select') {
|
|
180
|
+
} else if (this.config.component === 'el-select') {
|
|
181
|
+
// 处理下拉选择器
|
|
185
182
|
data = this.config.options
|
|
186
183
|
if (Array.isArray(value)) {
|
|
187
|
-
data = data.filter(i => value.includes(i.value)) || []
|
|
184
|
+
data = data.filter((i) => value.includes(i.value)) || []
|
|
188
185
|
} else {
|
|
189
|
-
data = data.find(i => value === i.value) || {}
|
|
186
|
+
data = data.find((i) => value === i.value) || {}
|
|
190
187
|
}
|
|
191
188
|
this.config.onChange(value, data)
|
|
192
189
|
} else {
|