leisure-core 0.5.21 → 0.5.22

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.
@@ -1,24 +1,27 @@
1
1
  <template>
2
- <el-form :model="formPop" :rules="rules" ref="ruleForm" :label-width="labelWidth">
3
- <el-form-item v-for="(item, index) in formColumns" :key="index" :label="item.label" :prop="item.prop"
4
- class="leisure-form-item-class">
5
- <div class="comContainerClass">
6
- <component :is="componentType(item.type)" v-model="formPop[item.prop]"
7
- v-bind="mergeProps(getComponentProps(item), item.attr || {})" v-on="item.event" class="compontClass">
8
- <template v-if="item.type === 'radio'">
9
- <el-radio v-for="(option, index) in item.options" :label="option.id" :key="index + '_radio'">{{ option.lable
10
- }}</el-radio>
11
- </template>
12
- <template v-else-if="item.type === 'select'">
13
- <le-select-option :options="fieldOptions[item.prop]" :label="item.kv.label" :value="item.kv.key"
14
- :keyNum="item.keyNum" />
15
- </template>
16
- </component>
17
- <slot :name="item.prop"></slot>
18
- </div>
19
- </el-form-item>
2
+ <el-form :model="formPop" :rules="rules" ref="ruleForm" :label-width="labelWidth" class="le-form-container">
3
+ <div class="form-grid" :style="gridStyle">
4
+ <el-form-item v-for="(item, index) in formColumns" :key="index" :label="item.label" :prop="item.prop"
5
+ class="leisure-form-item-class">
6
+ <div class="comContainerClass">
7
+ <component :is="componentType(item.type)" v-model="formPop[item.prop]"
8
+ v-bind="mergeProps(getComponentProps(item), item.attr || {})" v-on="item.event" class="compontClass">
9
+ <template v-if="item.type === 'radio'">
10
+ <el-radio v-for="(option, index) in item.options" :label="option.id" :key="index + '_radio'">{{
11
+ option.lable
12
+ }}</el-radio>
13
+ </template>
14
+ <template v-else-if="item.type === 'select'">
15
+ <le-select-option :options="fieldOptions[item.prop]" :label="item.kv.label" :value="item.kv.key"
16
+ :keyNum="item.keyNum" />
17
+ </template>
18
+ </component>
19
+ <slot :name="item.prop"></slot>
20
+ </div>
21
+ </el-form-item>
22
+ </div>
20
23
  <slot></slot>
21
- <el-form-item v-rfooter>
24
+ <el-form-item v-rfooter class="form-footer">
22
25
  <slot name="footerBtn"></slot>
23
26
  <le-button type="primary" @click="saveData" v-if="handleStatus == 1 || handleStatus == 2">保存</le-button>
24
27
  <le-button type="info" @click="close()">关闭</le-button>
@@ -46,6 +49,7 @@ export default {
46
49
  type: String,
47
50
  default: "100px",
48
51
  },
52
+
49
53
  fieldOptions: {
50
54
  type: Object,
51
55
  default: () => { },
@@ -54,6 +58,21 @@ export default {
54
58
  type: Number,
55
59
  default: 0, //0:详情 1:新增 2:编辑
56
60
  },
61
+ columnsPerRow: {
62
+ type: Number,
63
+ default: 1,
64
+ validator: (value) => value > 0 && value <= 4 // 限制最大4列,避免太拥挤
65
+ },
66
+ // 新增属性:列间距
67
+ columnGap: {
68
+ type: String,
69
+ default: "20px"
70
+ },
71
+ // 新增属性:行间距
72
+ rowGap: {
73
+ type: String,
74
+ default: "16px"
75
+ }
57
76
  },
58
77
  watch: {
59
78
  formData: {
@@ -105,7 +124,15 @@ export default {
105
124
  options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
106
125
  };
107
126
  },
108
- computed: {},
127
+ computed: {
128
+ gridStyle() {
129
+ return {
130
+ 'grid-template-columns': `repeat(${this.columnsPerRow}, 1fr)`,
131
+ 'column-gap': this.columnGap,
132
+ 'row-gap': this.rowGap
133
+ };
134
+ }
135
+ },
109
136
  mounted() { },
110
137
  methods: {
111
138
  componentType(type) {
@@ -143,6 +170,23 @@ export default {
143
170
  };
144
171
  </script>
145
172
  <style lang="scss" scoped>
173
+ le-form-container {
174
+ width: 100%;
175
+ }
176
+
177
+ .form-grid {
178
+ display: grid;
179
+
180
+ // 响应式处理:在小屏幕上自动调整为1列
181
+ @media (max-width: 768px) {
182
+ grid-template-columns: 1fr !important;
183
+ }
184
+ }
185
+
186
+ .leisure-form-item-class {
187
+ margin-bottom: 0; // 使用grid的gap控制间距,不需要margin-bottom
188
+ }
189
+
146
190
  .leisure-form-item-class {}
147
191
 
148
192
  .comContainerClass {
@@ -154,4 +198,9 @@ export default {
154
198
  flex: 1
155
199
  }
156
200
  }
201
+
202
+ .form-footer {
203
+ margin-top: 20px;
204
+ text-align: right;
205
+ }
157
206
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.5.21",
3
+ "version": "0.5.22",
4
4
  "description": "leisure-core是京心数据基于vue2.x开发的一套后台管理系统桌面端组件库,封装了大量实用的UI控件模板,非常方便开发者快速搭建前端应用",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",