leisure-core 0.5.60 → 0.5.61
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/le-list-form/src/main.vue +145 -54
- package/package.json +1 -1
|
@@ -6,49 +6,62 @@
|
|
|
6
6
|
:label-width="labelWidth"
|
|
7
7
|
class="le-form-container"
|
|
8
8
|
>
|
|
9
|
-
<div class="form-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
:class="{ 'radio-container': item.type === 'radio' }"
|
|
20
|
-
>
|
|
21
|
-
<component
|
|
22
|
-
:is="componentType(item.type)"
|
|
23
|
-
v-model="formPop[item.prop]"
|
|
24
|
-
v-bind="mergeProps(getComponentProps(item), item.attr || {})"
|
|
25
|
-
v-on="item.event"
|
|
26
|
-
class="compontClass"
|
|
27
|
-
:class="{ 'radio-group-class': item.type === 'radio' }"
|
|
28
|
-
:key="`component-${index}-${item.prop}-${item.type}`"
|
|
9
|
+
<div class="form-layout" :class="{ 'has-right-content': hasRightContent }">
|
|
10
|
+
<!-- 主窗体区域 - 保持原有结构 -->
|
|
11
|
+
<div class="form-main">
|
|
12
|
+
<div class="form-grid" :style="gridStyle">
|
|
13
|
+
<el-form-item
|
|
14
|
+
v-for="(item, index) in filteredFormColumns"
|
|
15
|
+
:label="item.label"
|
|
16
|
+
:prop="item.prop"
|
|
17
|
+
:key="`form-item-${index}-${item.prop}`"
|
|
18
|
+
class="leisure-form-item-class"
|
|
29
19
|
>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
<div
|
|
21
|
+
class="comContainerClass"
|
|
22
|
+
:class="{ 'radio-container': item.type === 'radio' }"
|
|
23
|
+
>
|
|
24
|
+
<component
|
|
25
|
+
:is="componentType(item.type)"
|
|
26
|
+
v-model="formPop[item.prop]"
|
|
27
|
+
v-bind="mergeProps(getComponentProps(item), item.attr || {})"
|
|
28
|
+
v-on="item.event"
|
|
29
|
+
class="compontClass"
|
|
30
|
+
:class="{ 'radio-group-class': item.type === 'radio' }"
|
|
31
|
+
:key="`component-${index}-${item.prop}-${item.type}`"
|
|
36
32
|
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
<template v-if="item.type === 'radio'">
|
|
34
|
+
<el-radio
|
|
35
|
+
v-for="(option, radioIndex) in item.options"
|
|
36
|
+
:label="option.id"
|
|
37
|
+
:key="`radio-${index}-${radioIndex}`"
|
|
38
|
+
>{{ option.lable }}</el-radio
|
|
39
|
+
>
|
|
40
|
+
</template>
|
|
41
|
+
<template v-else-if="item.type === 'select'">
|
|
42
|
+
<le-select-option
|
|
43
|
+
:options="fieldOptions[item.prop]"
|
|
44
|
+
:label="item.kv.label"
|
|
45
|
+
:value="item.kv.key"
|
|
46
|
+
:keyNum="item.keyNum"
|
|
47
|
+
:key="`select-${index}-${item.prop}`"
|
|
48
|
+
/>
|
|
49
|
+
</template>
|
|
50
|
+
</component>
|
|
51
|
+
<slot :name="item.prop"></slot>
|
|
52
|
+
</div>
|
|
53
|
+
</el-form-item>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<!-- 右侧附件区域 - 新增 -->
|
|
58
|
+
<div class="form-sidebar" v-if="hasRightContent">
|
|
59
|
+
<div class="sidebar-content">
|
|
60
|
+
<slot name="sidebar"></slot>
|
|
49
61
|
</div>
|
|
50
|
-
</
|
|
62
|
+
</div>
|
|
51
63
|
</div>
|
|
64
|
+
|
|
52
65
|
<div class="form-body-footer">
|
|
53
66
|
<slot></slot>
|
|
54
67
|
</div>
|
|
@@ -64,6 +77,7 @@
|
|
|
64
77
|
</el-form-item>
|
|
65
78
|
</el-form>
|
|
66
79
|
</template>
|
|
80
|
+
|
|
67
81
|
<script>
|
|
68
82
|
import { EventBus } from "../../le-libs/js/event.js";
|
|
69
83
|
export default {
|
|
@@ -85,7 +99,6 @@ export default {
|
|
|
85
99
|
type: String,
|
|
86
100
|
default: "100px",
|
|
87
101
|
},
|
|
88
|
-
|
|
89
102
|
fieldOptions: {
|
|
90
103
|
type: Object,
|
|
91
104
|
default: () => {},
|
|
@@ -97,14 +110,12 @@ export default {
|
|
|
97
110
|
columnsPerRow: {
|
|
98
111
|
type: Number,
|
|
99
112
|
default: 1,
|
|
100
|
-
validator: (value) => value > 0 && value <= 4,
|
|
113
|
+
validator: (value) => value > 0 && value <= 4,
|
|
101
114
|
},
|
|
102
|
-
// 新增属性:列间距
|
|
103
115
|
columnGap: {
|
|
104
116
|
type: String,
|
|
105
117
|
default: "20px",
|
|
106
118
|
},
|
|
107
|
-
// 新增属性:行间距
|
|
108
119
|
rowGap: {
|
|
109
120
|
type: String,
|
|
110
121
|
default: "16px",
|
|
@@ -113,6 +124,11 @@ export default {
|
|
|
113
124
|
type: Object,
|
|
114
125
|
default: () => ({}),
|
|
115
126
|
},
|
|
127
|
+
// 新增属性:是否显示右侧边栏
|
|
128
|
+
showSidebar: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: false,
|
|
131
|
+
},
|
|
116
132
|
},
|
|
117
133
|
watch: {
|
|
118
134
|
formData: {
|
|
@@ -136,13 +152,19 @@ export default {
|
|
|
136
152
|
data() {
|
|
137
153
|
return {
|
|
138
154
|
formPop: {},
|
|
139
|
-
options: {},
|
|
155
|
+
options: {},
|
|
140
156
|
};
|
|
141
157
|
},
|
|
142
158
|
computed: {
|
|
143
159
|
filteredFormColumns() {
|
|
144
160
|
return this.formColumns.filter((item) => !item.hidden);
|
|
145
161
|
},
|
|
162
|
+
|
|
163
|
+
// 判断是否有右侧内容
|
|
164
|
+
hasRightContent() {
|
|
165
|
+
return this.showSidebar || this.$slots["sidebar"];
|
|
166
|
+
},
|
|
167
|
+
|
|
146
168
|
dynamicComponentMap() {
|
|
147
169
|
const baseMap = {
|
|
148
170
|
input: {
|
|
@@ -176,6 +198,7 @@ export default {
|
|
|
176
198
|
};
|
|
177
199
|
return { ...baseMap, ...this.externalComponentMap };
|
|
178
200
|
},
|
|
201
|
+
|
|
179
202
|
gridStyle() {
|
|
180
203
|
return {
|
|
181
204
|
"grid-template-columns": `repeat(${this.columnsPerRow}, 1fr)`,
|
|
@@ -203,7 +226,6 @@ export default {
|
|
|
203
226
|
getComponentProps(item) {
|
|
204
227
|
let type = item.type;
|
|
205
228
|
|
|
206
|
-
// 如果组件类型未定义,返回空对象
|
|
207
229
|
if (!this.dynamicComponentMap[type]) {
|
|
208
230
|
return {};
|
|
209
231
|
}
|
|
@@ -251,25 +273,70 @@ export default {
|
|
|
251
273
|
},
|
|
252
274
|
};
|
|
253
275
|
</script>
|
|
276
|
+
|
|
254
277
|
<style lang="scss" scoped>
|
|
255
|
-
le-form-container {
|
|
278
|
+
.le-form-container {
|
|
256
279
|
width: 100%;
|
|
257
280
|
}
|
|
258
281
|
|
|
282
|
+
.form-layout {
|
|
283
|
+
display: flex;
|
|
284
|
+
gap: 20px;
|
|
285
|
+
transition: all 0.3s ease;
|
|
286
|
+
|
|
287
|
+
// 有右侧内容时的布局
|
|
288
|
+
&.has-right-content {
|
|
289
|
+
.form-main {
|
|
290
|
+
width: 80%;
|
|
291
|
+
}
|
|
292
|
+
.form-sidebar {
|
|
293
|
+
width: 20%;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// 无右侧内容时的布局
|
|
298
|
+
&:not(.has-right-content) {
|
|
299
|
+
.form-main {
|
|
300
|
+
width: 100%;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.form-main {
|
|
306
|
+
transition: width 0.3s ease;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.form-sidebar {
|
|
310
|
+
transition: width 0.3s ease;
|
|
311
|
+
|
|
312
|
+
.sidebar-content {
|
|
313
|
+
background: #f8f9fa;
|
|
314
|
+
border-radius: 6px;
|
|
315
|
+
padding: 16px;
|
|
316
|
+
border: 1px solid #e9ecef;
|
|
317
|
+
min-height: 200px;
|
|
318
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
|
319
|
+
|
|
320
|
+
// 可以在这里添加右侧内容的统一样式
|
|
321
|
+
h4 {
|
|
322
|
+
margin: 0 0 12px 0;
|
|
323
|
+
color: #2c3e50;
|
|
324
|
+
font-size: 14px;
|
|
325
|
+
font-weight: 600;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
259
330
|
.form-grid {
|
|
260
331
|
display: grid;
|
|
261
332
|
|
|
262
|
-
// 响应式处理:在小屏幕上自动调整为1列
|
|
263
333
|
@media (max-width: 768px) {
|
|
264
334
|
grid-template-columns: 1fr !important;
|
|
265
335
|
}
|
|
266
336
|
}
|
|
267
337
|
|
|
268
338
|
.leisure-form-item-class {
|
|
269
|
-
margin-bottom: 0;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.leisure-form-item-class {
|
|
339
|
+
margin-bottom: 0;
|
|
273
340
|
}
|
|
274
341
|
|
|
275
342
|
.form-body-footer {
|
|
@@ -280,11 +347,11 @@ le-form-container {
|
|
|
280
347
|
display: flex;
|
|
281
348
|
display: -webkit-flex;
|
|
282
349
|
line-height: inherit;
|
|
283
|
-
justify-content: center;
|
|
350
|
+
justify-content: center;
|
|
284
351
|
|
|
285
352
|
&.radio-container {
|
|
286
353
|
align-items: center;
|
|
287
|
-
min-height: 40px;
|
|
354
|
+
min-height: 40px;
|
|
288
355
|
}
|
|
289
356
|
|
|
290
357
|
.compontClass {
|
|
@@ -295,7 +362,6 @@ le-form-container {
|
|
|
295
362
|
align-items: center;
|
|
296
363
|
flex-wrap: wrap;
|
|
297
364
|
line-height: normal;
|
|
298
|
-
// background-color: rebeccapurple;
|
|
299
365
|
}
|
|
300
366
|
}
|
|
301
367
|
}
|
|
@@ -304,4 +370,29 @@ le-form-container {
|
|
|
304
370
|
margin-top: 20px;
|
|
305
371
|
text-align: right;
|
|
306
372
|
}
|
|
373
|
+
|
|
374
|
+
// 响应式处理
|
|
375
|
+
@media (max-width: 1200px) {
|
|
376
|
+
.form-layout.has-right-content {
|
|
377
|
+
flex-direction: column;
|
|
378
|
+
|
|
379
|
+
.form-main,
|
|
380
|
+
.form-sidebar {
|
|
381
|
+
width: 100%;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.form-sidebar {
|
|
385
|
+
margin-top: 20px;
|
|
386
|
+
order: 2; // 在移动端让侧边栏显示在下方
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// 小屏幕优化
|
|
392
|
+
@media (max-width: 768px) {
|
|
393
|
+
.form-sidebar .sidebar-content {
|
|
394
|
+
padding: 12px;
|
|
395
|
+
min-height: 150px;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
307
398
|
</style>
|